aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2024-08-05 17:41:17 +0200
committerMarc Poulhiès <dkm@kataplop.net>2024-09-04 10:44:28 +0200
commitda3a2985fff39ee8ec1b9f48699e3b8197e439e6 (patch)
tree7174ac877db3f0a02437106d9a0687958e7989df
parent7164d982663738c255a1a71a5d4f38dc51c2a3cb (diff)
downloadgcc-da3a2985fff39ee8ec1b9f48699e3b8197e439e6.zip
gcc-da3a2985fff39ee8ec1b9f48699e3b8197e439e6.tar.gz
gcc-da3a2985fff39ee8ec1b9f48699e3b8197e439e6.tar.bz2
rust: avoid clobbering LIBS
Save LIBS around calls to AC_SEARCH_LIBS to avoid clobbering $LIBS. ChangeLog: * configure: Regenerate. * configure.ac: Save LIBS around calls to AC_SEARCH_LIBS. Signed-off-by: Marc Poulhiès <dkm@kataplop.net> Reviewed-by: Thomas Schwinge <tschwinge@baylibre.com> Tested-by: Thomas Schwinge <tschwinge@baylibre.com>
-rwxr-xr-xconfigure15
-rw-r--r--configure.ac15
2 files changed, 16 insertions, 14 deletions
diff --git a/configure b/configure
index 51bf1d1..e9583f2 100755
--- a/configure
+++ b/configure
@@ -8878,9 +8878,12 @@ fi
# Rust requires -ldl and -lpthread if you are using an old glibc that does not include them by
# default, so we check for them here
-
+# We are doing the test here and not in the gcc/configure to be able to nicely disable the
+# build of the Rust frontend in case a dep is missing.
missing_rust_dynlibs=none
+save_LIBS="$LIBS"
+LIBS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; }
if ${ac_cv_search_dlopen+:} false; then :
@@ -8993,16 +8996,14 @@ if test "$ac_res" != no; then :
fi
+CRAB1_LIBS="$LIBS"
+LIBS="$save_LIBS"
-if test "$ac_cv_search_dlopen" = -ldl; then
- CRAB1_LIBS="$CRAB1_LIBS -ldl"
-elif test "$ac_cv_search_dlopen" = no; then
+if test "$ac_cv_search_dlopen" = no; then
missing_rust_dynlibs="libdl"
fi
-if test "$ac_cv_search_pthread_create" = -lpthread; then
- CRAB1_LIBS="$CRAB1_LIBS -lpthread"
-elif test "$ac_cv_search_pthread_create" = no; then
+if test "$ac_cv_search_pthread_create" = no; then
missing_rust_dynlibs="$missing_rust_dynlibs, libpthread"
fi
diff --git a/configure.ac b/configure.ac
index 2045700..f61dbe6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2039,21 +2039,22 @@ AC_SUBST(PICFLAG)
# Rust requires -ldl and -lpthread if you are using an old glibc that does not include them by
# default, so we check for them here
-
+# We are doing the test here and not in the gcc/configure to be able to nicely disable the
+# build of the Rust frontend in case a dep is missing.
missing_rust_dynlibs=none
+save_LIBS="$LIBS"
+LIBS=
AC_SEARCH_LIBS([dlopen], [dl])
AC_SEARCH_LIBS([pthread_create], [pthread])
+CRAB1_LIBS="$LIBS"
+LIBS="$save_LIBS"
-if test "$ac_cv_search_dlopen" = -ldl; then
- CRAB1_LIBS="$CRAB1_LIBS -ldl"
-elif test "$ac_cv_search_dlopen" = no; then
+if test "$ac_cv_search_dlopen" = no; then
missing_rust_dynlibs="libdl"
fi
-if test "$ac_cv_search_pthread_create" = -lpthread; then
- CRAB1_LIBS="$CRAB1_LIBS -lpthread"
-elif test "$ac_cv_search_pthread_create" = no; then
+if test "$ac_cv_search_pthread_create" = no; then
missing_rust_dynlibs="$missing_rust_dynlibs, libpthread"
fi