2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Add custom version of AC_CHECK_LIB that uses the extra libs in the

cache value name.  With this we no longer need to rely on a modified
version of autoconf.
This commit is contained in:
Todd C. Miller
2012-01-20 10:28:56 -05:00
parent d337a532ac
commit e852bf4374
3 changed files with 122 additions and 68 deletions

22
aclocal.m4 vendored
View File

@@ -185,6 +185,28 @@ AC_DEFUN([SUDO_FUNC_ISBLANK],
fi
])
AC_DEFUN([SUDO_CHECK_LIB], [
_sudo_check_lib_extras=`echo "$5"|sed -e 's/[ ]*//g' -e 's/-l/_/g'`
AC_MSG_CHECKING([for $2 in -l$1${5+ }$5])
AC_CACHE_VAL([sudo_cv_lib_$1''_$2$_sudo_check_lib_extras], [
SUDO_CHECK_LIB_OLIBS="$LIBS"
LIBS="$LIBS -l$1${5+ }$5"
AC_LINK_IFELSE(
[AC_LANG_CALL([], [$2])],
[eval sudo_cv_lib_$1''_$2$_sudo_check_lib_extras=yes],
[eval sudo_cv_lib_$1''_$2$_sudo_check_lib_extras=no]
)
LIBS="$SUDO_CHECK_LIB_OLIBS"
])
if eval test \$sudo_cv_lib_$1''_$2$_sudo_check_lib_extras = "yes"; then
AC_MSG_RESULT([yes])
$3
else
AC_MSG_RESULT([no])
$4
fi
])
dnl
dnl check unsetenv() return value
dnl

160
configure vendored
View File

@@ -17156,15 +17156,17 @@ else
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`"
as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_socket$extralibs" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -l$lib" >&5
$as_echo_n "checking for socket in -l$lib... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
_sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -l$lib${5+ }$extralibs" >&5
$as_echo_n "checking for socket in -l$lib${5+ }$extralibs... " >&6; }
if { as_var=sudo_cv_lib_$lib''_socket$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-l$lib $extralibs $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
SUDO_CHECK_LIB_OLIBS="$LIBS"
LIBS="$LIBS -l$lib${5+ }$extralibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -17183,21 +17185,27 @@ return socket ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
eval sudo_cv_lib_$lib''_socket$_sudo_check_lib_extras=yes
else
eval "$as_ac_Lib=no"
eval sudo_cv_lib_$lib''_socket$_sudo_check_lib_extras=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break
LIBS="$SUDO_CHECK_LIB_OLIBS"
fi
if eval test \$sudo_cv_lib_$lib''_socket$_sudo_check_lib_extras = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
fi
@@ -17224,15 +17232,17 @@ else
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`"
as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_inet_addr$extralibs" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_addr in -l$lib" >&5
$as_echo_n "checking for inet_addr in -l$lib... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
_sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_addr in -l$lib${5+ }$extralibs" >&5
$as_echo_n "checking for inet_addr in -l$lib${5+ }$extralibs... " >&6; }
if { as_var=sudo_cv_lib_$lib''_inet_addr$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-l$lib $extralibs $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
SUDO_CHECK_LIB_OLIBS="$LIBS"
LIBS="$LIBS -l$lib${5+ }$extralibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -17251,21 +17261,27 @@ return inet_addr ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
eval sudo_cv_lib_$lib''_inet_addr$_sudo_check_lib_extras=yes
else
eval "$as_ac_Lib=no"
eval sudo_cv_lib_$lib''_inet_addr$_sudo_check_lib_extras=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break
LIBS="$SUDO_CHECK_LIB_OLIBS"
fi
if eval test \$sudo_cv_lib_$lib''_inet_addr$_sudo_check_lib_extras = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
fi
@@ -17290,15 +17306,17 @@ else
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`"
as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_syslog$extralibs" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for syslog in -l$lib" >&5
$as_echo_n "checking for syslog in -l$lib... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
_sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for syslog in -l$lib${5+ }$extralibs" >&5
$as_echo_n "checking for syslog in -l$lib${5+ }$extralibs... " >&6; }
if { as_var=sudo_cv_lib_$lib''_syslog$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-l$lib $extralibs $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
SUDO_CHECK_LIB_OLIBS="$LIBS"
LIBS="$LIBS -l$lib${5+ }$extralibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -17317,21 +17335,27 @@ return syslog ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
eval sudo_cv_lib_$lib''_syslog$_sudo_check_lib_extras=yes
else
eval "$as_ac_Lib=no"
eval sudo_cv_lib_$lib''_syslog$_sudo_check_lib_extras=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break
LIBS="$SUDO_CHECK_LIB_OLIBS"
fi
if eval test \$sudo_cv_lib_$lib''_syslog$_sudo_check_lib_extras = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
fi
@@ -17359,15 +17383,17 @@ else
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`"
as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_getaddrinfo$extralibs" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -l$lib" >&5
$as_echo_n "checking for getaddrinfo in -l$lib... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
_sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -l$lib${5+ }$extralibs" >&5
$as_echo_n "checking for getaddrinfo in -l$lib${5+ }$extralibs... " >&6; }
if { as_var=sudo_cv_lib_$lib''_getaddrinfo$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-l$lib $extralibs $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
SUDO_CHECK_LIB_OLIBS="$LIBS"
LIBS="$LIBS -l$lib${5+ }$extralibs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -17386,21 +17412,27 @@ return getaddrinfo ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
eval sudo_cv_lib_$lib''_getaddrinfo$_sudo_check_lib_extras=yes
else
eval "$as_ac_Lib=no"
eval sudo_cv_lib_$lib''_getaddrinfo$_sudo_check_lib_extras=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break
LIBS="$SUDO_CHECK_LIB_OLIBS"
fi
if eval test \$sudo_cv_lib_$lib''_getaddrinfo$_sudo_check_lib_extras = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
if test X"$found" != X"no"; then
$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h

View File

@@ -2214,7 +2214,7 @@ AC_CHECK_FUNC(socket, [], [
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
AC_CHECK_LIB($lib, socket, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
SUDO_CHECK_LIB($lib, socket, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
done
])
dnl
@@ -2235,7 +2235,7 @@ AC_CHECK_FUNC(inet_addr, [], [
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
AC_CHECK_LIB($lib, inet_addr, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
SUDO_CHECK_LIB($lib, inet_addr, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
done
])
])
@@ -2255,7 +2255,7 @@ AC_CHECK_FUNC(syslog, [], [
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
AC_CHECK_LIB($lib, syslog, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
SUDO_CHECK_LIB($lib, syslog, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
done
])
dnl
@@ -2276,7 +2276,7 @@ AC_CHECK_FUNCS(getaddrinfo, [], [
test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
AC_CHECK_LIB($lib, getaddrinfo, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break], [], [$extralibs])
SUDO_CHECK_LIB($lib, getaddrinfo, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break], [], [$extralibs])
done
if test X"$found" != X"no"; then
AC_DEFINE(HAVE_GETADDRINFO)