C99 compatibility fixes for configure scripts

Define _GNU_SOURCE in the math tests so that exp10 can be found.
Include <stdio.h> for the puts function in the __progname check.
This commit is contained in:
Florian Weimer 2023-01-02 08:20:04 +01:00
parent 5a1095794e
commit 22bf34222e
2 changed files with 4 additions and 2 deletions

View file

@ -566,6 +566,7 @@ AC_DEFUN([GB_CHECK_MATH_FUNC],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _ISOC9X_SOURCE 1 #define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1 #define _ISOC99_SOURCE 1
#define _GNU_SOURCE 1
#define __USE_ISOC99 1 #define __USE_ISOC99 1
#define __USE_ISOC9X 1 #define __USE_ISOC9X 1
#include <math.h> #include <math.h>

View file

@ -28,7 +28,7 @@ dnl
AC_MSG_CHECKING(how to link static binaries) AC_MSG_CHECKING(how to link static binaries)
AC_CACHE_VAL(ac_cv_lbl_static_flag, AC_CACHE_VAL(ac_cv_lbl_static_flag,
ac_cv_lbl_static_flag=unknown ac_cv_lbl_static_flag=unknown
echo 'main() {}' > conftest.c echo 'int main() {}' > conftest.c
if test "$GCC" != yes ; then if test "$GCC" != yes ; then
trial_flag="-Bstatic" trial_flag="-Bstatic"
test=`$CC $trial_flag -o conftest conftest.c 2>&1` test=`$CC $trial_flag -o conftest conftest.c 2>&1`
@ -53,7 +53,8 @@ fi
AC_MSG_CHECKING(for __progname) AC_MSG_CHECKING(for __progname)
AC_CACHE_VAL(ac_cv_extern__progname, AC_CACHE_VAL(ac_cv_extern__progname,
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
[[extern char *__progname;
puts(__progname)]])],[ac_cv_extern__progname=yes],[ac_cv_extern__progname=no])) puts(__progname)]])],[ac_cv_extern__progname=yes],[ac_cv_extern__progname=no]))
if test $ac_cv_extern__progname = yes ; then if test $ac_cv_extern__progname = yes ; then
AC_DEFINE([HAVE__PROGNAME], [], [have __progname]) AC_DEFINE([HAVE__PROGNAME], [], [have __progname])