From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id 95D663858413; Fri, 4 Nov 2022 06:58:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95D663858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667545111; bh=Kaj5JIWIMND7TABk4rQX2ecwTjuil9ZhhfmTds0EdbY=; h=From:To:Subject:Date:From; b=C0WDKG/zPu5rK983LhaorKMX65E4ADiPTRZBl5/1Auvt8IDQjW2x3lWiS2qRqt1iy ffsShWaA8wqx1i6Vpxxnpe1FderP85tJbN9MtcLwZI6sXNZsZkX35aw3wGmliqkkov 6HYDhNU+VSwLT69gwEXlwnG3MIkKmRnJzIKwfI5k= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] sim: don't hardcode -ldl for SDL support X-Act-Checkin: binutils-gdb X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: 01d8ce742c257b697eed52de5520d0a4489e4e5b X-Git-Newrev: c55c1f6e9d7bcc400bc23a0e29ac9e2681ed4c31 Message-Id: <20221104065831.95D663858413@sourceware.org> Date: Fri, 4 Nov 2022 06:58:31 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc55c1f6e9d7b= cc400bc23a0e29ac9e2681ed4c31 commit c55c1f6e9d7bcc400bc23a0e29ac9e2681ed4c31 Author: Mike Frysinger Date: Thu Nov 3 17:38:46 2022 +0700 sim: don't hardcode -ldl for SDL support =20 Since we use AC_SEARCH_LIBS to find dlopen, we don't need to hardcode -ldl when using SDL ourselves. Diff: --- sim/arch-subdir.mk.in | 1 - sim/bfin/Makefile.in | 1 - sim/configure | 14 +++++++++----- sim/m4/sim_ac_platform.m4 | 12 ++++++++---- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in index bd047c97687..616e06ec453 100644 --- a/sim/arch-subdir.mk.in +++ b/sim/arch-subdir.mk.in @@ -54,7 +54,6 @@ DEPMODE =3D @CCDEPMODE@ DEPDIR =3D @DEPDIR@ =20 SDL_CFLAGS =3D @SDL_CFLAGS@ -SDL_LIBS =3D @SDL_LIBS@ TERMCAP_LIB =3D @TERMCAP_LIB@ READLINE_LIB =3D @READLINE_LIB@ READLINE_CFLAGS =3D @READLINE_CFLAGS@ diff --git a/sim/bfin/Makefile.in b/sim/bfin/Makefile.in index 62f7b71ded1..5a36be78c3f 100644 --- a/sim/bfin/Makefile.in +++ b/sim/bfin/Makefile.in @@ -60,7 +60,6 @@ SIM_EXTRA_HW_DEVICES =3D \ eth_phy =20 SIM_EXTRA_CFLAGS =3D $(SDL_CFLAGS) -SIM_EXTRA_LIBS =3D $(SDL_LIBS) =20 ## COMMON_POST_CONFIG_FRAG =20 diff --git a/sim/configure b/sim/configure index fdb72656466..06c3012bb04 100755 --- a/sim/configure +++ b/sim/configure @@ -13230,7 +13230,6 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SDL_CFLAGS=3D"${SDL_CFLAGS} -DHAVE_SDL=3D1" - SDL_LIBS=3D"-ldl" =20 fi =20 @@ -13332,7 +13331,6 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SDL_CFLAGS=3D"${SDL_CFLAGS} -DHAVE_SDL=3D1" - SDL_LIBS=3D"-ldl" =20 fi =20 @@ -13342,14 +13340,20 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SDL_CFLAGS=3D"${SDL_CFLAGS} -DHAVE_SDL=3D2" - SDL_LIBS=3D"-ldl" + +fi + if test -n "$SDL_CFLAGS"; then : + if test "$ac_cv_search_dlopen" =3D no; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SDL support requ= ires dlopen support" >&5 +$as_echo "$as_me: WARNING: SDL support requires dlopen support" >&2;} + +fi =20 fi else SDL_CFLAGS=3D - SDL_LIBS=3D fi - +SDL_LIBS=3D =20 =20 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cygwin" >&5 diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index 74ac7fe14d4..467987e11e7 100644 --- a/sim/m4/sim_ac_platform.m4 +++ b/sim/m4/sim_ac_platform.m4 @@ -154,19 +154,23 @@ AC_SEARCH_LIBS([dlopen], [dl]) if test "${ac_cv_lib_dl_dlopen}" =3D "yes"; then PKG_CHECK_MODULES(SDL, sdl2, [dnl SDL_CFLAGS=3D"${SDL_CFLAGS} -DHAVE_SDL=3D2" - SDL_LIBS=3D"-ldl" ], [ PKG_CHECK_MODULES(SDL, sdl, [dnl SDL_CFLAGS=3D"${SDL_CFLAGS} -DHAVE_SDL=3D1" - SDL_LIBS=3D"-ldl" ], [:]) ]) + dnl If we use SDL, we need dlopen support. + AS_IF([test -n "$SDL_CFLAGS"], [dnl + AS_IF([test "$ac_cv_search_dlopen" =3D no], [dnl + AC_MSG_WARN([SDL support requires dlopen support]) + ]) + ]) else SDL_CFLAGS=3D - SDL_LIBS=3D fi +dnl We dlopen the libs at runtime, so never pass down SDL_LIBS. +SDL_LIBS=3D AC_SUBST(SDL_CFLAGS) -AC_SUBST(SDL_LIBS) =20 dnl In the Cygwin environment, we need some additional flags. AC_CACHE_CHECK([for cygwin], sim_cv_os_cygwin,