This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
[PATCH 1/1] erc32 sim: Add libdl to build of sis
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: gdb at sourceware dot org
- Cc: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- Date: Thu, 14 Aug 2014 17:21:06 -0500
- Subject: [PATCH 1/1] erc32 sim: Add libdl to build of sis
- Authentication-results: sourceware.org; auth=none
sis failed to link on Fedora 20 because it was not linking against
libdl. There may be a better way but this does work.
2013-08-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.in, configure.ac: Probe for libdl and use if available.
* configure: Regenerated
---
sim/erc32/Makefile.in | 3 +-
sim/erc32/configure | 94 +++++++++++++++++++++++++++++++++++++++++++++-----
sim/erc32/configure.ac | 3 ++
3 files changed, 90 insertions(+), 10 deletions(-)
diff --git a/sim/erc32/Makefile.in b/sim/erc32/Makefile.in
index 0ce58a6..b5a6c4b 100644
--- a/sim/erc32/Makefile.in
+++ b/sim/erc32/Makefile.in
@@ -20,9 +20,10 @@
TERMCAP_LIB = @TERMCAP@
READLINE_LIB = @READLINE@
+DL_LIB = @DLLIB@
SIM_OBJS = exec.o erc32.o func.o help.o float.o interf.o
-SIM_EXTRA_LIBS = $(READLINE_LIB) $(TERMCAP_LIB) -lm
+SIM_EXTRA_LIBS = $(READLINE_LIB) $(TERMCAP_LIB) $(DL_LIB) -lm
SIM_EXTRA_ALL = sis
SIM_EXTRA_INSTALL = install-sis
SIM_EXTRA_CLEAN = clean-sis
diff --git a/sim/erc32/configure b/sim/erc32/configure
index b8fd852..dd9882e 100755
--- a/sim/erc32/configure
+++ b/sim/erc32/configure
@@ -601,6 +601,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
cgen_breaks
+DLLIB
READLINE
TERMCAP
REPORT_BUGS_TEXI
@@ -1389,7 +1390,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-plugins Enable support for plugins (defaults no)
+ --enable-plugins Enable support for plugins
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
@@ -8768,15 +8769,46 @@ fi
# BFD uses libdl when when plugins enabled.
-# Check whether --enable-plugins was given.
+ maybe_plugins=no
+ for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+ maybe_plugins=yes
+fi
+
+done
+
+ for ac_header in windows.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_windows_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_WINDOWS_H 1
+_ACEOF
+ maybe_plugins=yes
+fi
+
+done
+
+
+ # Check whether --enable-plugins was given.
if test "${enable_plugins+set}" = set; then :
enableval=$enable_plugins; case "${enableval}" in
- yes | "") plugins=yes ;;
- no) plugins=no ;;
- *) plugins=yes ;;
- esac
+ no) plugins=no ;;
+ *) plugins=yes
+ if test "$maybe_plugins" != "yes" ; then
+ as_fn_error "Building with plugin support requires a host that supports dlopen." "$LINENO" 5
+ fi ;;
+ esac
else
- plugins=no
+ plugins=$maybe_plugins
+
fi
@@ -12265,7 +12297,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12268 "configure"
+#line 12300 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12371,7 +12403,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12374 "configure"
+#line 12406 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13022,6 +13054,50 @@ fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dl in -ldl" >&5
+$as_echo_n "checking for dl in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dl+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dl ();
+int
+main ()
+{
+return dl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dl=yes
+else
+ ac_cv_lib_dl_dl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dl" >&5
+$as_echo "$ac_cv_lib_dl_dl" >&6; }
+if test "x$ac_cv_lib_dl_dl" = x""yes; then :
+ DLLIB=-ldl
+else
+ :
+fi
+
+
+
ac_sources="$sim_link_files"
ac_dests="$sim_link_links"
while test -n "$ac_sources"; do
diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac
index bc46091..21e5813 100644
--- a/sim/erc32/configure.ac
+++ b/sim/erc32/configure.ac
@@ -32,4 +32,7 @@ else
AC_ERROR([the required "readline" library is missing]), $TERMCAP)
fi
AC_SUBST(READLINE)
+
+AC_CHECK_LIB(dl, dl, DLLIB=-ldl, :, )
+AC_SUBST(DLLIB)
SIM_AC_OUTPUT
--
1.9.3