summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Angeletti <florian.angeletti@inria.fr>2020-02-14 10:15:51 +0100
committerGitHub <noreply@github.com>2020-02-14 10:15:51 +0100
commit9b36ee9cda66b6cd91d98e14437c24f1b2b0d065 (patch)
treeeb88433a95bd0ab7aeb584d13de252a9284f3877
parentf09fae8551b3418963dc8af341f92ba12f825b7c (diff)
parent41994062439f7cec9008895d05a2b9a940abdcc9 (diff)
downloadocaml-9b36ee9cda66b6cd91d98e14437c24f1b2b0d065.tar.gz
Merge pull request #9302 from shindere/bfd-ld
Fix support for the bfd library
-rw-r--r--Changes4
-rwxr-xr-xconfigure55
-rw-r--r--configure.ac12
3 files changed, 59 insertions, 12 deletions
diff --git a/Changes b/Changes
index 46e73f2eb4..03e3758ffe 100644
--- a/Changes
+++ b/Changes
@@ -551,8 +551,8 @@ OCaml 4.10.0
- #8843, #8841: fix use of off_t on 32-bit systems.
(Stephen Dolan, report by Richard Jones, review by Xavier Leroy)
-- #8947, #9134: fix/improve support for the BFD library
- (Sébastien Hinderer, review by Damien Doligez)
+- #8947, #9134, #9302: fix/improve support for the BFD library
+ (Sébastien Hinderer, review by Damien Doligez and David Allsopp)
- #8951: let make's default target build the compiler
(Sébastien Hinderer, review by David Allsopp)
diff --git a/configure b/configure
index 634c13b6ba..0988fef4ed 100755
--- a/configure
+++ b/configure
@@ -16125,7 +16125,7 @@ if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbfd -liberty $LIBS"
+LIBS="-lbfd -ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16156,7 +16156,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
- bfd_ldlibs="-lbfd -liberty"
+ bfd_ldlibs="-lbfd -ldl"
fi
fi
@@ -16168,7 +16168,7 @@ if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbfd -liberty -lz $LIBS"
+LIBS="-lbfd -ldl -liberty $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16199,7 +16199,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
- bfd_ldlibs="-lbfd -liberty -lz"
+ bfd_ldlibs="-lbfd -ldl -liberty"
fi
fi
@@ -16211,7 +16211,7 @@ if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbfd -liberty -lz -lintl $LIBS"
+LIBS="-lbfd -ldl -liberty -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16242,7 +16242,50 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
- bfd_ldlibs="-lbfd -liberty -lz -lintl"
+ bfd_ldlibs="-lbfd -ldl -liberty -lz"
+fi
+
+fi
+ if test -z "$bfd_ldlibs"; then :
+ unset ac_cv_lib_bfd_bfd_openr
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
+$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbfd -ldl -liberty -lz -lintl $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 bfd_openr ();
+int
+main ()
+{
+return bfd_openr ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_bfd_bfd_openr=yes
+else
+ ac_cv_lib_bfd_bfd_openr=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_bfd_bfd_openr" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
+ bfd_ldlibs="-lbfd -ldl -liberty -lz -lintl"
fi
fi
diff --git a/configure.ac b/configure.ac
index ff1b007496..1fc9aec509 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1521,16 +1521,20 @@ AS_IF([test x"$with_bfd" != "xno"],
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
- [bfd_ldlibs="-lbfd -liberty"], [], [-liberty])])
+ [bfd_ldlibs="-lbfd -ldl"], [], [-ldl])])
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
- [bfd_ldlibs="-lbfd -liberty -lz"], [], [-liberty -lz])])
+ [bfd_ldlibs="-lbfd -ldl -liberty"], [], [-ldl -liberty])])
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
- [bfd_ldlibs="-lbfd -liberty -lz -lintl"], [],
- [-liberty -lz -lintl])])
+ [bfd_ldlibs="-lbfd -ldl -liberty -lz"], [], [-ldl -liberty -lz])])
+ AS_IF([test -z "$bfd_ldlibs"],
+ [unset ac_cv_lib_bfd_bfd_openr
+ AC_CHECK_LIB([bfd], [bfd_openr],
+ [bfd_ldlibs="-lbfd -ldl -liberty -lz -lintl"], [],
+ [-ldl -liberty -lz -lintl])])
AS_IF([test -n "$bfd_ldlibs"],
[bfd_available=true
AC_DEFINE([HAS_LIBBFD])])])