gh-115765: Don't use deprecated AC_EGREP_* macros in configure.ac (#116016)

Rewrite using AX_CHECK_DEFINE and AC_CHECK_TYPES.
This commit is contained in:
Erlend E. Aasland 2024-02-28 14:35:41 +01:00 committed by GitHub
parent a71e32ce8e
commit 449c6da2bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 375 additions and 183 deletions

74
aclocal.m4 generated vendored
View File

@ -150,6 +150,80 @@ AS_VAR_IF(CACHEVAR,yes,
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_define.html
# ===========================================================================
#
# SYNOPSIS
#
# AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
# AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
#
# DESCRIPTION
#
# Complements AC_CHECK_FUNC but it does not check for a function but for a
# define to exist. Consider a usage like:
#
# AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500")
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 11
AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
AC_DEFUN([AC_CHECK_DEFINE],[
AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl
AC_CACHE_CHECK([for $1 defined], ac_var,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifdef $1
int ok;
(void)ok;
#else
choke me
#endif
]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl
AS_VAR_POPDEF([ac_var])dnl
])
AU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE])
AC_DEFUN([AX_CHECK_DEFINE],[
AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl
AC_CACHE_CHECK([for $2 defined in $1], ac_var,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
#ifdef $2
int ok;
(void)ok;
#else
choke me
#endif
]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl
AS_VAR_POPDEF([ac_var])dnl
])
AC_DEFUN([AX_CHECK_FUNC],
[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl
AC_CACHE_CHECK([for $2], ac_var,
dnl AC_LANG_FUNC_LINK_TRY
[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1
#undef $2
char $2 ();],[
char (*f) () = $2;
return f != $2; ])],
[AS_VAR_SET(ac_var, yes)],
[AS_VAR_SET(ac_var, no)])])
AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
AS_VAR_POPDEF([ac_var])dnl
])# AC_CHECK_FUNC
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
# ===========================================================================

310
configure generated vendored
View File

@ -11297,42 +11297,22 @@ then :
fi
# checks for typedefs
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_t in time.h" >&5
printf %s "checking for clock_t in time.h... " >&6; }
if test ${ac_cv_clock_t_time_h+y}
# Check for clock_t in time.h.
ac_fn_c_check_type "$LINENO" "clock_t" "ac_cv_type_clock_t" "#include <time.h>
"
if test "x$ac_cv_type_clock_t" = xyes
then :
printf %s "(cached) " >&6
printf "%s\n" "#define HAVE_CLOCK_T 1" >>confdefs.h
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "clock_t" >/dev/null 2>&1
then :
ac_cv_clock_t_time_h=yes
else $as_nop
ac_cv_clock_t_time_h=no
fi
rm -rf conftest*
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_clock_t_time_h" >&5
printf "%s\n" "$ac_cv_clock_t_time_h" >&6; }
if test "x$ac_cv_clock_t_time_h" = xno
then :
printf "%s\n" "#define clock_t long" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for makedev" >&5
printf %s "checking for makedev... " >&6; }
if test ${ac_cv_func_makedev+y}
@ -11534,6 +11514,7 @@ printf "%s\n" "#define size_t unsigned int" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
printf %s "checking for uid_t in sys/types.h... " >&6; }
if test ${ac_cv_type_uid_t+y}
@ -16184,24 +16165,47 @@ else
# (e.g. gnu pth with pthread emulation)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _POSIX_THREADS in unistd.h" >&5
printf %s "checking for _POSIX_THREADS in unistd.h... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _POSIX_THREADS defined in unistd.h" >&5
printf %s "checking for _POSIX_THREADS defined in unistd.h... " >&6; }
if test ${ac_cv_defined__POSIX_THREADS_unistd_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main (void)
{
#ifdef _POSIX_THREADS
yes
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_defined__POSIX_THREADS_unistd_h=yes
else $as_nop
ac_cv_defined__POSIX_THREADS_unistd_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined__POSIX_THREADS_unistd_h" >&5
printf "%s\n" "$ac_cv_defined__POSIX_THREADS_unistd_h" >&6; }
if test $ac_cv_defined__POSIX_THREADS_unistd_h != "no"
then :
unistd_defines_pthreads=yes
else $as_nop
unistd_defines_pthreads=no
fi
rm -rf conftest*
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $unistd_defines_pthreads" >&5
printf "%s\n" "$unistd_defines_pthreads" >&6; }
@ -16708,59 +16712,131 @@ printf %s "checking ipv6 stack type... " >&6; }
do
case $i in
inria)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IPV6_INRIA_VERSION defined in netinet/in.h" >&5
printf %s "checking for IPV6_INRIA_VERSION defined in netinet/in.h... " >&6; }
if test ${ac_cv_defined_IPV6_INRIA_VERSION_netinet_in_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <netinet/in.h>
int
main (void)
{
#ifdef IPV6_INRIA_VERSION
yes
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_defined_IPV6_INRIA_VERSION_netinet_in_h=yes
else $as_nop
ac_cv_defined_IPV6_INRIA_VERSION_netinet_in_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined_IPV6_INRIA_VERSION_netinet_in_h" >&5
printf "%s\n" "$ac_cv_defined_IPV6_INRIA_VERSION_netinet_in_h" >&6; }
if test $ac_cv_defined_IPV6_INRIA_VERSION_netinet_in_h != "no"
then :
ipv6type=$i
fi
rm -rf conftest*
;;
kame)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __KAME__ defined in netinet/in.h" >&5
printf %s "checking for __KAME__ defined in netinet/in.h... " >&6; }
if test ${ac_cv_defined___KAME___netinet_in_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <netinet/in.h>
int
main (void)
{
#ifdef __KAME__
yes
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ipv6type=$i;
ac_cv_defined___KAME___netinet_in_h=yes
else $as_nop
ac_cv_defined___KAME___netinet_in_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined___KAME___netinet_in_h" >&5
printf "%s\n" "$ac_cv_defined___KAME___netinet_in_h" >&6; }
if test $ac_cv_defined___KAME___netinet_in_h != "no"
then :
ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/local/v6/lib
ipv6trylibc=yes
fi
rm -rf conftest*
;;
linux-glibc)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __GLIBC__ defined in features.h" >&5
printf %s "checking for __GLIBC__ defined in features.h... " >&6; }
if test ${ac_cv_defined___GLIBC___features_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <features.h>
#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
yes
int
main (void)
{
#ifdef __GLIBC__
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ipv6type=$i;
ac_cv_defined___GLIBC___features_h=yes
else $as_nop
ac_cv_defined___GLIBC___features_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined___GLIBC___features_h" >&5
printf "%s\n" "$ac_cv_defined___GLIBC___features_h" >&6; }
if test $ac_cv_defined___GLIBC___features_h != "no"
then :
ipv6type=$i
ipv6trylibc=yes
fi
rm -rf conftest*
;;
linux-inet6)
if test -d /usr/inet6; then
@ -16779,62 +16855,134 @@ rm -rf conftest*
fi
;;
toshiba)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _TOSHIBA_INET6 defined in sys/param.h" >&5
printf %s "checking for _TOSHIBA_INET6 defined in sys/param.h... " >&6; }
if test ${ac_cv_defined__TOSHIBA_INET6_sys_param_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/param.h>
int
main (void)
{
#ifdef _TOSHIBA_INET6
yes
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ipv6type=$i;
ipv6lib=inet6;
ac_cv_defined__TOSHIBA_INET6_sys_param_h=yes
else $as_nop
ac_cv_defined__TOSHIBA_INET6_sys_param_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined__TOSHIBA_INET6_sys_param_h" >&5
printf "%s\n" "$ac_cv_defined__TOSHIBA_INET6_sys_param_h" >&6; }
if test $ac_cv_defined__TOSHIBA_INET6_sys_param_h != "no"
then :
ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/local/v6/lib
fi
rm -rf conftest*
;;
v6d)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __V6D__ defined in /usr/local/v6/include/sys/v6config.h" >&5
printf %s "checking for __V6D__ defined in /usr/local/v6/include/sys/v6config.h... " >&6; }
if test ${ac_cv_defined___V6D____usr_local_v6_include_sys_v6config_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include </usr/local/v6/include/sys/v6config.h>
int
main (void)
{
#ifdef __V6D__
yes
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ipv6type=$i;
ipv6lib=v6;
ipv6libdir=/usr/local/v6/lib;
ac_cv_defined___V6D____usr_local_v6_include_sys_v6config_h=yes
else $as_nop
ac_cv_defined___V6D____usr_local_v6_include_sys_v6config_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined___V6D____usr_local_v6_include_sys_v6config_h" >&5
printf "%s\n" "$ac_cv_defined___V6D____usr_local_v6_include_sys_v6config_h" >&6; }
if test $ac_cv_defined___V6D____usr_local_v6_include_sys_v6config_h != "no"
then :
ipv6type=$i
ipv6lib=v6
ipv6libdir=/usr/local/v6/lib
BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"
fi
rm -rf conftest*
;;
zeta)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _ZETA_MINAMI_INET6 defined in sys/param.h" >&5
printf %s "checking for _ZETA_MINAMI_INET6 defined in sys/param.h... " >&6; }
if test ${ac_cv_defined__ZETA_MINAMI_INET6_sys_param_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/param.h>
int
main (void)
{
#ifdef _ZETA_MINAMI_INET6
yes
int ok;
(void)ok;
#else
choke me
#endif
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1
if ac_fn_c_try_compile "$LINENO"
then :
ipv6type=$i;
ipv6lib=inet6;
ac_cv_defined__ZETA_MINAMI_INET6_sys_param_h=yes
else $as_nop
ac_cv_defined__ZETA_MINAMI_INET6_sys_param_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined__ZETA_MINAMI_INET6_sys_param_h" >&5
printf "%s\n" "$ac_cv_defined__ZETA_MINAMI_INET6_sys_param_h" >&6; }
if test $ac_cv_defined__ZETA_MINAMI_INET6_sys_param_h != "no"
then :
ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/local/v6/lib
fi
rm -rf conftest*
;;
esac
if test "$ipv6type" != "unknown"; then

View File

@ -2895,15 +2895,11 @@ AC_CHECK_HEADERS(
#endif
])
# checks for typedefs
AC_CACHE_CHECK([for clock_t in time.h], [ac_cv_clock_t_time_h], [
AC_EGREP_HEADER([clock_t], [time.h], [ac_cv_clock_t_time_h=yes], [ac_cv_clock_t_time_h=no])
])
dnl checks for "no"
AS_VAR_IF([ac_cv_clock_t_time_h], [no], [
AC_DEFINE([clock_t], [long],
[Define to 'long' if <time.h> doesn't define.])
])
# Check for clock_t in time.h.
AC_CHECK_TYPES([clock_t], [],
[AC_DEFINE([clock_t], [long],
[Define to 'long' if <time.h> does not define clock_t.])],
[@%:@include <time.h>])
AC_CACHE_CHECK([for makedev], [ac_cv_func_makedev], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
@ -4331,13 +4327,9 @@ else
# define _POSIX_THREADS in unistd.h. Some apparently don't
# (e.g. gnu pth with pthread emulation)
AC_MSG_CHECKING([for _POSIX_THREADS in unistd.h])
AC_EGREP_CPP([yes],
[
#include <unistd.h>
#ifdef _POSIX_THREADS
yes
#endif
], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
AX_CHECK_DEFINE([unistd.h], [_POSIX_THREADS],
[unistd_defines_pthreads=yes],
[unistd_defines_pthreads=no])
AC_MSG_RESULT([$unistd_defines_pthreads])
AC_DEFINE([_REENTRANT])
@ -4517,33 +4509,20 @@ if test "$ipv6" = yes -a "$cross_compiling" = no; then
case $i in
inria)
dnl http://www.kame.net/
AC_EGREP_CPP([yes], [
#include <netinet/in.h>
#ifdef IPV6_INRIA_VERSION
yes
@%:@endif],
[ipv6type=$i])
AX_CHECK_DEFINE([netinet/in.h], [IPV6_INRIA_VERSION], [ipv6type=$i])
;;
kame)
dnl http://www.kame.net/
AC_EGREP_CPP([yes], [
#include <netinet/in.h>
#ifdef __KAME__
yes
@%:@endif],
[ipv6type=$i;
AX_CHECK_DEFINE([netinet/in.h], [__KAME__],
[ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/local/v6/lib
ipv6trylibc=yes])
;;
linux-glibc)
dnl http://www.v6.linux.or.jp/
AC_EGREP_CPP([yes], [
#include <features.h>
#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
yes
@%:@endif],
[ipv6type=$i;
dnl Advanced IPv6 support was added to glibc 2.1 in 1999.
AX_CHECK_DEFINE([features.h], [__GLIBC__],
[ipv6type=$i
ipv6trylibc=yes])
;;
linux-inet6)
@ -4564,34 +4543,22 @@ yes
fi
;;
toshiba)
AC_EGREP_CPP([yes], [
#include <sys/param.h>
#ifdef _TOSHIBA_INET6
yes
@%:@endif],
[ipv6type=$i;
ipv6lib=inet6;
AX_CHECK_DEFINE([sys/param.h], [_TOSHIBA_INET6],
[ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/local/v6/lib])
;;
v6d)
AC_EGREP_CPP([yes], [
#include </usr/local/v6/include/sys/v6config.h>
#ifdef __V6D__
yes
@%:@endif],
[ipv6type=$i;
ipv6lib=v6;
ipv6libdir=/usr/local/v6/lib;
AX_CHECK_DEFINE([/usr/local/v6/include/sys/v6config.h], [__V6D__],
[ipv6type=$i
ipv6lib=v6
ipv6libdir=/usr/local/v6/lib
BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
;;
zeta)
AC_EGREP_CPP([yes], [
#include <sys/param.h>
#ifdef _ZETA_MINAMI_INET6
yes
@%:@endif],
[ipv6type=$i;
ipv6lib=inet6;
AX_CHECK_DEFINE([sys/param.h], [_ZETA_MINAMI_INET6],
[ipv6type=$i
ipv6lib=inet6
ipv6libdir=/usr/local/v6/lib])
;;
esac

View File

@ -157,6 +157,9 @@
/* Define to 1 if you have the `clock_settime' function. */
#undef HAVE_CLOCK_SETTIME
/* Define to 1 if the system has the type `clock_t'. */
#undef HAVE_CLOCK_T
/* Define to 1 if you have the `closefrom' function. */
#undef HAVE_CLOSEFROM
@ -1941,7 +1944,7 @@
/* Define on FreeBSD to activate all library features */
#undef __BSD_VISIBLE
/* Define to 'long' if <time.h> doesn't define. */
/* Define to 'long' if <time.h> does not define clock_t. */
#undef clock_t
/* Define to empty if `const' does not conform to ANSI C. */