Skip to content

Commit

Permalink
rust: avoid clobbering LIBS
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Thomas Schwinge <[email protected]>
Tested-by: Thomas Schwinge <[email protected]>
  • Loading branch information
dkm committed Aug 6, 2024
1 parent 177660e commit 47c16d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 8 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -8829,9 +8829,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 :
Expand Down Expand Up @@ -8944,16 +8947,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_crate = no; then
if test "$ac_cv_search_pthread_create" = no; then
missing_rust_dynlibs="$missing_rust_dynlibs, libpthread"
fi

Expand Down
15 changes: 8 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2038,21 +2038,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_crate = no; then
if test "$ac_cv_search_pthread_create" = no; then
missing_rust_dynlibs="$missing_rust_dynlibs, libpthread"
fi

Expand Down

0 comments on commit 47c16d7

Please sign in to comment.