Replace obsolete AC_TRY_XXX macros with AC_XXX_IFELSE

No real changes, just avoid warnings from autoconf 2.71 when
regenerating configure.

Note that double brackets must be used around any code using brackets to
preserve them during the expansion.
This commit is contained in:
Vadim Zeitlin 2023-07-23 23:14:12 +02:00
parent 04f7e0664b
commit 00960b40b9
10 changed files with 199 additions and 200 deletions

View file

@ -26,7 +26,7 @@ AC_CACHE_CHECK(how many arguments getservbyname_r() takes,
dnl we need to use C++ to detect missing prototypes
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <netdb.h>],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>], [
[
char *name;
char *proto;
@ -34,10 +34,10 @@ AC_CACHE_CHECK(how many arguments getservbyname_r() takes,
char buffer[2048];
int buflen = 2048;
(void) getservbyname_r(name, proto, se, buffer, buflen, &res)
],
]])],
ac_cv_func_which_getservbyname_r=six,
[
AC_TRY_COMPILE([#include <netdb.h>],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>], [
[
char *name;
char *proto;
@ -45,17 +45,17 @@ AC_CACHE_CHECK(how many arguments getservbyname_r() takes,
char buffer[2048];
int buflen = 2048;
(void) getservbyname_r(name, proto, se, buffer, buflen)
],
]])],
ac_cv_func_which_getservbyname_r=five,
[
AC_TRY_COMPILE([#include <netdb.h>],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>],
[
char *name;
char *proto;
struct servent *se;
struct servent_data data;
(void) getservbyname_r(name, proto, se, &data);
],
])],
ac_cv_func_which_getservbyname_r=four,
ac_cv_func_which_getservbyname_r=no
)

View file

@ -8,13 +8,13 @@ AC_DEFUN([WX_ATOMIC_BUILTINS],
if test -n "$GCC"; then
AC_MSG_CHECKING([for __sync_xxx_and_fetch builtins])
AC_CACHE_VAL(wx_cv_cc_gcc_atomic_builtins, [
AC_TRY_LINK(
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[],
[
unsigned int value=0;
volatile unsigned int r1 = __sync_add_and_fetch(&value, 2);
volatile unsigned int r2 = __sync_sub_and_fetch(&value, 1);
],
])],
wx_cv_cc_gcc_atomic_builtins=yes,
wx_cv_cc_gcc_atomic_builtins=no)
])

View file

@ -81,19 +81,18 @@ AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_C
AC_LANG_PUSH(C)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_RESTORE
AC_LANG_POP()
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;
@ -117,19 +116,18 @@ AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_LANG_PUSH(C++)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_RESTORE
AC_LANG_POP()
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;
@ -152,19 +150,18 @@ AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_C
AC_LANG_PUSH(C)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_RESTORE
AC_LANG_POP()
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;
@ -188,19 +185,18 @@ AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_LANG_PUSH(C++)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_RESTORE
AC_LANG_POP()
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;

View file

@ -37,13 +37,13 @@ AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER],
AC_CACHE_CHECK(
[whether we are using the $1 $2 compiler],
[bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3],
[AC_TRY_COMPILE(
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[],
[
#ifndef $3
choke me
#endif
],
])],
[bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=yes],
[bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=no]
)
@ -67,13 +67,13 @@ AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_LATER_THAN],
AC_CACHE_CHECK(
[whether we are using $1 $2 compiler v$5 or later],
[bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4],
[AC_TRY_COMPILE(
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[],
[
#ifndef $3 || $3 < $4
choke me
#endif
],
])],
[bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4=yes],
[bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4=no]
)

View file

@ -600,7 +600,7 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
if test "x$GCC" = "xyes"; then
dnl test if we have gcc-3.4:
AC_MSG_CHECKING([if the compiler supports precompiled headers])
AC_TRY_COMPILE([],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[
#if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
There is no PCH support
@ -614,7 +614,7 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS],
( defined(__INTEL_COMPILER) )
There is no PCH support
#endif
],
])],
[
AC_MSG_RESULT([yes])
GCC_PCH=1

View file

@ -63,7 +63,7 @@ dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
dnl
rm -f conf.sdltest
AC_TRY_RUN([
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -120,7 +120,7 @@ int main (int argc, char *argv[])
}
}
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
]])],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
@ -144,7 +144,7 @@ int main (int argc, char *argv[])
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AC_TRY_LINK([
AC_LINK_IFELSE([AC_LANG_PROGRAM[[
#include <stdio.h>
#include "SDL.h"
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
], [ return 0; ],
]], [ return 0; ])],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding SDL or finding the wrong"
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"

View file

@ -36,7 +36,7 @@ AC_DEFUN([WX_VISIBILITY],
wx_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
/* we need gcc >= 4.0, older versions with visibility support
didn't have class visibility: */
@ -75,7 +75,7 @@ AC_DEFUN([WX_VISIBILITY],
Foo() {}
};
],
[],
[])],
wx_cv_cc_visibility=yes,
wx_cv_cc_visibility=no)
AC_LANG_POP()
@ -93,14 +93,14 @@ AC_DEFUN([WX_VISIBILITY],
CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
LDFLAGS="$LDFLAGS -shared -fPIC"
AC_LANG_PUSH(C++)
AC_TRY_LINK(
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <string>
],
[
std::string s("hello");
return s.length();
],
])],
wx_cv_cc_broken_libstdcxx_visibility=no,
wx_cv_cc_broken_libstdcxx_visibility=yes)
AC_LANG_POP()
@ -112,7 +112,7 @@ AC_DEFUN([WX_VISIBILITY],
AC_MSG_CHECKING([whether we can work around it])
AC_CACHE_VAL(wx_cv_cc_visibility_workaround, [
AC_LANG_PUSH(C++)
AC_TRY_LINK(
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#pragma GCC visibility push(default)
#include <string>
@ -121,7 +121,7 @@ AC_DEFUN([WX_VISIBILITY],
[
std::string s("hello");
return s.length();
],
])],
wx_cv_cc_visibility_workaround=no,
wx_cv_cc_visibility_workaround=yes)
AC_LANG_POP()