sim: don't hardcode -ldl for SDL support
authorMike Frysinger <vapier@gentoo.org>
Thu, 3 Nov 2022 10:38:46 +0000 (17:38 +0700)
committerMike Frysinger <vapier@gentoo.org>
Fri, 4 Nov 2022 06:50:37 +0000 (13:50 +0700)
Since we use AC_SEARCH_LIBS to find dlopen, we don't need to hardcode
-ldl when using SDL ourselves.

sim/arch-subdir.mk.in
sim/bfin/Makefile.in
sim/configure
sim/m4/sim_ac_platform.m4

index bd047c97687ce59e9281c2d7c495c414f2b724a9..616e06ec453f74bc64e2a31337ff23433b11d910 100644 (file)
@@ -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@
index 62f7b71ded1ab6f0a216f6b12881463878a9de13..5a36be78c3f153643abba7a1b290d18382142251 100644 (file)
@@ -60,7 +60,6 @@ SIM_EXTRA_HW_DEVICES = \
        eth_phy
 
 SIM_EXTRA_CFLAGS = $(SDL_CFLAGS)
-SIM_EXTRA_LIBS = $(SDL_LIBS)
 
 ## COMMON_POST_CONFIG_FRAG
 
index fdb726564668eb6534920e804447d7887ace00bd..06c3012bb0472c2c5542c14c4c1afc759b4fea62 100755 (executable)
@@ -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
index 74ac7fe14d45e111b25dc20bd1c078f2ee4c7c35..467987e11e7ee1953e30c7008500f2270c4d252f 100644 (file)
@@ -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,