public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Michael Frysinger <vapier@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] sim: don't hardcode -ldl for SDL support
Date: Fri,  4 Nov 2022 06:58:31 +0000 (GMT)	[thread overview]
Message-ID: <20221104065831.95D663858413@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c55c1f6e9d7bcc400bc23a0e29ac9e2681ed4c31

commit c55c1f6e9d7bcc400bc23a0e29ac9e2681ed4c31
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Thu Nov 3 17:38:46 2022 +0700

    sim: don't hardcode -ldl for SDL support
    
    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 = @CCDEPMODE@
 DEPDIR = @DEPDIR@
 
 SDL_CFLAGS = @SDL_CFLAGS@
-SDL_LIBS = @SDL_LIBS@
 TERMCAP_LIB = @TERMCAP_LIB@
 READLINE_LIB = @READLINE_LIB@
 READLINE_CFLAGS = @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 = \
 	eth_phy
 
 SIM_EXTRA_CFLAGS = $(SDL_CFLAGS)
-SIM_EXTRA_LIBS = $(SDL_LIBS)
 
 ## COMMON_POST_CONFIG_FRAG
 
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="${SDL_CFLAGS} -DHAVE_SDL=1"
-      SDL_LIBS="-ldl"
 
 fi
 
@@ -13332,7 +13331,6 @@ else
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 	      SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL=1"
-      SDL_LIBS="-ldl"
 
 fi
 
@@ -13342,14 +13340,20 @@ else
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 	    SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL=2"
-    SDL_LIBS="-ldl"
+
+fi
+    if test -n "$SDL_CFLAGS"; then :
+      if test "$ac_cv_search_dlopen" = no; then :
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SDL support requires dlopen support" >&5
+$as_echo "$as_me: WARNING: SDL support requires dlopen support" >&2;}
+
+fi
 
 fi
 else
   SDL_CFLAGS=
-  SDL_LIBS=
 fi
-
+SDL_LIBS=
 
 
 { $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}" = "yes"; then
   PKG_CHECK_MODULES(SDL, sdl2, [dnl
     SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL=2"
-    SDL_LIBS="-ldl"
   ], [
     PKG_CHECK_MODULES(SDL, sdl, [dnl
       SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL=1"
-      SDL_LIBS="-ldl"
     ], [:])
   ])
+  dnl If we use SDL, we need dlopen support.
+  AS_IF([test -n "$SDL_CFLAGS"], [dnl
+    AS_IF([test "$ac_cv_search_dlopen" = no], [dnl
+      AC_MSG_WARN([SDL support requires dlopen support])
+    ])
+  ])
 else
   SDL_CFLAGS=
-  SDL_LIBS=
 fi
+dnl We dlopen the libs at runtime, so never pass down SDL_LIBS.
+SDL_LIBS=
 AC_SUBST(SDL_CFLAGS)
-AC_SUBST(SDL_LIBS)
 
 dnl In the Cygwin environment, we need some additional flags.
 AC_CACHE_CHECK([for cygwin], sim_cv_os_cygwin,

                 reply	other threads:[~2022-11-04  6:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221104065831.95D663858413@sourceware.org \
    --to=vapier@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).