From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 99AF83858C56 for ; Fri, 4 Nov 2022 00:44:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99AF83858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 3743C3407AF; Fri, 4 Nov 2022 00:44:55 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: don't hardcode -ldl for SDL support Date: Fri, 4 Nov 2022 07:44:51 +0700 Message-Id: <20221104004451.22534-1-vapier@gentoo.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 | 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 bd047c97687c..616e06ec453f 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 62f7b71ded1a..5a36be78c3f1 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/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index 74ac7fe14d45..467987e11e7e 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, -- 2.38.1