Eradicate AC_TRY_COMPILE.

* aclang.m4 (AC_PROG_CC_STDC, AC_C_BIGENDIAN, AC_C_INLINE,
AC_C_CONST, AC_C_VOLATILE, AC_F77_NAME_MANGLING): Use
`AC_COMPILE_IFELSE'.
* acspecific.m4 (AC_DECL_SYS_SIGLIST, _AC_CHECK_HEADER_DIRENT,
AC_HEADER_SYS_WAIT, AC_HEADER_TIME, AC_TYPE_SIGNAL,
AC_FUNC_GETLOADAVG, AC_FUNC_SELECT_ARGTYPES, AC_STRUCT_TM,
AC_CYGWIN, AC_MINGW32, AC_EMXOS2): Likewise.
* tests/semantics.m4 (C keywords): Check that AC_C_CONST,
AC_C_VOLATILE, and AC_C_INLINE function properly with GCC.
This commit is contained in:
Akim Demaille 2000-05-11 13:09:05 +00:00
parent 347ad8e733
commit c706f3273a
10 changed files with 230 additions and 146 deletions

View File

@ -1,3 +1,17 @@
2000-05-11 Akim Demaille <akim@epita.fr>
Eradicate AC_TRY_COMPILE.
* aclang.m4 (AC_PROG_CC_STDC, AC_C_BIGENDIAN, AC_C_INLINE,
AC_C_CONST, AC_C_VOLATILE, AC_F77_NAME_MANGLING): Use
`AC_COMPILE_IFELSE'.
* acspecific.m4 (AC_DECL_SYS_SIGLIST, _AC_CHECK_HEADER_DIRENT,
AC_HEADER_SYS_WAIT, AC_HEADER_TIME, AC_TYPE_SIGNAL,
AC_FUNC_GETLOADAVG, AC_FUNC_SELECT_ARGTYPES, AC_STRUCT_TM,
AC_CYGWIN, AC_MINGW32, AC_EMXOS2): Likewise.
* tests/semantics.m4 (C keywords): Check that AC_C_CONST,
AC_C_VOLATILE, and AC_C_INLINE function properly with GCC.
2000-05-11 Akim Demaille <akim@epita.fr>
Replace AC_LANG_SAVE/AC_LANG_RESTORE with AC_LANG_PUSH/AC_LANG_POP.

View File

@ -2865,9 +2865,8 @@ rm -f conftest*[]dnl
# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# --------------------------------------------------------
# FIXME: Should INCLUDES be defaulted here?
AC_DEFUN([AC_TRY_COMPILE],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])

View File

@ -859,8 +859,9 @@ ac_save_CC=$CC
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -887,9 +888,9 @@ struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;],
[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
[ac_cv_prog_cc_stdc=$ac_arg; break])
char **argv;]],
[[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]])],
[ac_cv_prog_cc_stdc=$ac_arg; break])
done
CC=$ac_save_CC
])
@ -986,20 +987,21 @@ AC_DEFUN(AC_C_BIGENDIAN,
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
[ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
],
[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
],
])],
[# It does; now see whether it defined to BIG_ENDIAN or not.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
], [#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
])], [ac_cv_c_bigendian=yes],
[ac_cv_c_bigendian=no])])
if test $ac_cv_c_bigendian = unknown; then
AC_TRY_RUN(
[int
@ -1033,12 +1035,12 @@ AC_DEFUN(AC_C_INLINE,
AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
AC_TRY_COMPILE(,
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[#ifndef __cplusplus
} $ac_kw int foo() {
$ac_kw int foo () {return 0; }
#endif
],
[ac_cv_c_inline=$ac_kw; break])
])],
[ac_cv_c_inline=$ac_kw; break])
done
])
case "$ac_cv_c_inline" in
@ -1056,8 +1058,8 @@ esac
AC_DEFUN(AC_C_CONST,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
[AC_TRY_COMPILE(,
[/* FIXME: Include the comments suggested by Paul. */
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
@ -1103,8 +1105,9 @@ AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
const int foo = 10;
}
#endif
],
ac_cv_c_const=yes, ac_cv_c_const=no)])
]])],
[ac_cv_c_const=yes],
[ac_cv_c_const=no])])
if test $ac_cv_c_const = no; then
AC_DEFINE(const,,
[Define to empty if `const' does not conform to ANSI C.])
@ -1123,10 +1126,11 @@ fi
AC_DEFUN(AC_C_VOLATILE,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_TRY_COMPILE(,[
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
volatile int x;
int * volatile y;],
ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
int * volatile y;])],
[ac_cv_c_volatile=yes],
[ac_cv_c_volatile=no])])
if test $ac_cv_c_volatile = no; then
AC_DEFINE(volatile,,
[Define to empty if the keyword `volatile' does not work.

View File

@ -319,14 +319,16 @@ AC_DEFUNCT(AC_RSH, [; replace it with equivalent code])
AC_DEFUN(AC_DECL_SYS_SIGLIST,
[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
ac_cv_decl_sys_siglist,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
/* NetBSD declares sys_siglist in unistd.h. */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
], [char *msg = *(sys_siglist + 1);],
ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
], [char *msg = *(sys_siglist + 1);])],
[ac_cv_decl_sys_siglist=yes],
[ac_cv_decl_sys_siglist=no])])
if test $ac_cv_decl_sys_siglist = yes; then
AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
[Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
@ -349,11 +351,12 @@ fi
define([_AC_CHECK_HEADER_DIRENT],
[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_dirent_$1])dnl
AC_CACHE_CHECK([for $1 that defines DIR], ac_Header,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <$1>
],
[DIR *dirp = 0;],
AC_VAR_SET(ac_Header, yes), AC_VAR_SET(ac_Header, no))])
[DIR *dirp = 0;])],
[AC_VAR_SET(ac_Header, yes)],
[AC_VAR_SET(ac_Header, no)])])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Header) = yes],
[$2], [$3])dnl
AC_VAR_POPDEF([ac_Header])dnl
@ -513,19 +516,21 @@ fi
AC_DEFUN(AC_HEADER_SYS_WAIT,
[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
ac_cv_header_sys_wait_h,
[AC_TRY_COMPILE(
[#include <sys/types.h>
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif],
#endif
],
[ int s;
wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],
ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;])],
[ac_cv_header_sys_wait_h=yes],
[ac_cv_header_sys_wait_h=no])])
if test $ac_cv_header_sys_wait_h = yes; then
AC_DEFINE(HAVE_SYS_WAIT_H, 1,
[Define if you have <sys/wait.h> that is POSIX.1 compatible.])
@ -538,11 +543,13 @@ fi
AC_DEFUN(AC_HEADER_TIME,
[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
ac_cv_header_time,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
],
[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
[struct tm *tp;])],
[ac_cv_header_time=yes],
[ac_cv_header_time=no])])
if test $ac_cv_header_time = yes; then
AC_DEFINE(TIME_WITH_SYS_TIME, 1,
[Define if you can safely include both <sys/time.h> and <time.h>.])
@ -659,7 +666,8 @@ AC_DEFUNCT(AC_LONG_64_BITS, [; instead use AC_CHECK_SIZEOF(long)])
# Note that identifiers starting with SIG are reserved by ANSI C.
AC_DEFUN(AC_TYPE_SIGNAL,
[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
#ifdef signal
# undef signal
@ -670,7 +678,9 @@ extern "C" void (*signal (int, void (*)(int)))(int);
void (*signal ()) ();
#endif
],
[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])
[int i;])],
[ac_cv_type_signal=void],
[ac_cv_type_signal=int])])
AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
[Define as the return type of signal handlers
(`int' or `void').])
@ -916,10 +926,11 @@ else
AC_CHECK_HEADER(nlist.h,
[AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
[AC_TRY_COMPILE([#include <nlist.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <nlist.h>
],
[struct nlist n; n.n_un.n_name = 0;],
ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
[struct nlist n; n.n_un.n_name = 0;])],
[ac_cv_struct_nlist_n_un=yes],
[ac_cv_struct_nlist_n_un=no])])
if test $ac_cv_struct_nlist_n_un = yes; then
AC_DEFINE(NLIST_NAME_UNION, 1,
[Define if your `struct nlist' has an `n_un' member.])
@ -1375,7 +1386,7 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
AC_TRY_COMPILE(
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#include <sys/types.h>
#if HAVE_SYS_TIME_H
# include <sys/time.h>
@ -1386,8 +1397,8 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);],,
[ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3])
extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);])],
[ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3])
done
done
done
@ -1717,11 +1728,12 @@ fi
AC_DEFUN(AC_STRUCT_TM,
[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h],
ac_cv_struct_tm,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <time.h>
],
[struct tm *tp; tp->tm_sec;],
ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])
[struct tm *tp; tp->tm_sec;])],
[ac_cv_struct_tm=time.h],
[ac_cv_struct_tm=sys/time.h])])
if test $ac_cv_struct_tm = sys/time.h; then
AC_DEFINE(TM_IN_SYS_TIME, 1,
[Define if your <sys/time.h> declares `struct tm'.])
@ -2345,12 +2357,13 @@ AU_DEFUN(AC_CYGWIN32,
# EXEEXT.
AC_DEFUN(AC_CYGWIN,
[AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin,
[AC_TRY_COMPILE(,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[#ifndef __CYGWIN__
# define __CYGWIN__ __CYGWIN32__
#endif
return __CYGWIN__;],
ac_cv_cygwin=yes, ac_cv_cygwin=no)])
return __CYGWIN__;])],
[ac_cv_cygwin=yes],
[ac_cv_cygwin=no])])
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes])
@ -2361,8 +2374,9 @@ test "$ac_cv_cygwin" = yes && CYGWIN=yes])
# EXEEXT.
AC_DEFUN(AC_MINGW32,
[AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32,
[AC_TRY_COMPILE(,[return __MINGW32__;],
ac_cv_mingw32=yes, ac_cv_mingw32=no)])
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __MINGW32__;])],
[ac_cv_mingw32=yes],
[ac_cv_mingw32=no])])
MINGW32=
test "$ac_cv_mingw32" = yes && MINGW32=yes])
@ -2373,8 +2387,9 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes])
# for EXEEXT.
AC_DEFUN(AC_EMXOS2,
[AC_CACHE_CHECK(for EMX OS/2 environment, ac_cv_emxos2,
[AC_TRY_COMPILE(,[return __EMX__;],
ac_cv_emxos2=yes, ac_cv_emxos2=no)])
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])],
[ac_cv_emxos2=yes],
[ac_cv_emxos2=no])])
EMXOS2=
test "$ac_cv_emxos2" = yes && EMXOS2=yes])

View File

@ -859,8 +859,9 @@ ac_save_CC=$CC
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -887,9 +888,9 @@ struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;],
[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
[ac_cv_prog_cc_stdc=$ac_arg; break])
char **argv;]],
[[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]])],
[ac_cv_prog_cc_stdc=$ac_arg; break])
done
CC=$ac_save_CC
])
@ -986,20 +987,21 @@ AC_DEFUN(AC_C_BIGENDIAN,
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
[ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
],
[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
],
])],
[# It does; now see whether it defined to BIG_ENDIAN or not.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
], [#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
])], [ac_cv_c_bigendian=yes],
[ac_cv_c_bigendian=no])])
if test $ac_cv_c_bigendian = unknown; then
AC_TRY_RUN(
[int
@ -1033,12 +1035,12 @@ AC_DEFUN(AC_C_INLINE,
AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
AC_TRY_COMPILE(,
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[#ifndef __cplusplus
} $ac_kw int foo() {
$ac_kw int foo () {return 0; }
#endif
],
[ac_cv_c_inline=$ac_kw; break])
])],
[ac_cv_c_inline=$ac_kw; break])
done
])
case "$ac_cv_c_inline" in
@ -1056,8 +1058,8 @@ esac
AC_DEFUN(AC_C_CONST,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
[AC_TRY_COMPILE(,
[/* FIXME: Include the comments suggested by Paul. */
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
@ -1103,8 +1105,9 @@ AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
const int foo = 10;
}
#endif
],
ac_cv_c_const=yes, ac_cv_c_const=no)])
]])],
[ac_cv_c_const=yes],
[ac_cv_c_const=no])])
if test $ac_cv_c_const = no; then
AC_DEFINE(const,,
[Define to empty if `const' does not conform to ANSI C.])
@ -1123,10 +1126,11 @@ fi
AC_DEFUN(AC_C_VOLATILE,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_TRY_COMPILE(,[
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
volatile int x;
int * volatile y;],
ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
int * volatile y;])],
[ac_cv_c_volatile=yes],
[ac_cv_c_volatile=no])])
if test $ac_cv_c_volatile = no; then
AC_DEFINE(volatile,,
[Define to empty if the keyword `volatile' does not work.

View File

@ -859,8 +859,9 @@ ac_save_CC=$CC
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -887,9 +888,9 @@ struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;],
[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
[ac_cv_prog_cc_stdc=$ac_arg; break])
char **argv;]],
[[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]])],
[ac_cv_prog_cc_stdc=$ac_arg; break])
done
CC=$ac_save_CC
])
@ -986,20 +987,21 @@ AC_DEFUN(AC_C_BIGENDIAN,
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
[ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
],
[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
],
])],
[# It does; now see whether it defined to BIG_ENDIAN or not.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
], [#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
])], [ac_cv_c_bigendian=yes],
[ac_cv_c_bigendian=no])])
if test $ac_cv_c_bigendian = unknown; then
AC_TRY_RUN(
[int
@ -1033,12 +1035,12 @@ AC_DEFUN(AC_C_INLINE,
AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
AC_TRY_COMPILE(,
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[#ifndef __cplusplus
} $ac_kw int foo() {
$ac_kw int foo () {return 0; }
#endif
],
[ac_cv_c_inline=$ac_kw; break])
])],
[ac_cv_c_inline=$ac_kw; break])
done
])
case "$ac_cv_c_inline" in
@ -1056,8 +1058,8 @@ esac
AC_DEFUN(AC_C_CONST,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
[AC_TRY_COMPILE(,
[/* FIXME: Include the comments suggested by Paul. */
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
@ -1103,8 +1105,9 @@ AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
const int foo = 10;
}
#endif
],
ac_cv_c_const=yes, ac_cv_c_const=no)])
]])],
[ac_cv_c_const=yes],
[ac_cv_c_const=no])])
if test $ac_cv_c_const = no; then
AC_DEFINE(const,,
[Define to empty if `const' does not conform to ANSI C.])
@ -1123,10 +1126,11 @@ fi
AC_DEFUN(AC_C_VOLATILE,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_TRY_COMPILE(,[
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
volatile int x;
int * volatile y;],
ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
int * volatile y;])],
[ac_cv_c_volatile=yes],
[ac_cv_c_volatile=no])])
if test $ac_cv_c_volatile = no; then
AC_DEFINE(volatile,,
[Define to empty if the keyword `volatile' does not work.

View File

@ -2865,9 +2865,8 @@ rm -f conftest*[]dnl
# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# --------------------------------------------------------
# FIXME: Should INCLUDES be defaulted here?
AC_DEFUN([AC_TRY_COMPILE],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])

View File

@ -859,8 +859,9 @@ ac_save_CC=$CC
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -887,9 +888,9 @@ struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;],
[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
[ac_cv_prog_cc_stdc=$ac_arg; break])
char **argv;]],
[[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]])],
[ac_cv_prog_cc_stdc=$ac_arg; break])
done
CC=$ac_save_CC
])
@ -986,20 +987,21 @@ AC_DEFUN(AC_C_BIGENDIAN,
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
[ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
],
[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
],
])],
[# It does; now see whether it defined to BIG_ENDIAN or not.
AC_TRY_COMPILE([#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/param.h>
], [#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
])], [ac_cv_c_bigendian=yes],
[ac_cv_c_bigendian=no])])
if test $ac_cv_c_bigendian = unknown; then
AC_TRY_RUN(
[int
@ -1033,12 +1035,12 @@ AC_DEFUN(AC_C_INLINE,
AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
AC_TRY_COMPILE(,
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[#ifndef __cplusplus
} $ac_kw int foo() {
$ac_kw int foo () {return 0; }
#endif
],
[ac_cv_c_inline=$ac_kw; break])
])],
[ac_cv_c_inline=$ac_kw; break])
done
])
case "$ac_cv_c_inline" in
@ -1056,8 +1058,8 @@ esac
AC_DEFUN(AC_C_CONST,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
[AC_TRY_COMPILE(,
[/* FIXME: Include the comments suggested by Paul. */
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
@ -1103,8 +1105,9 @@ AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
const int foo = 10;
}
#endif
],
ac_cv_c_const=yes, ac_cv_c_const=no)])
]])],
[ac_cv_c_const=yes],
[ac_cv_c_const=no])])
if test $ac_cv_c_const = no; then
AC_DEFINE(const,,
[Define to empty if `const' does not conform to ANSI C.])
@ -1123,10 +1126,11 @@ fi
AC_DEFUN(AC_C_VOLATILE,
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_TRY_COMPILE(,[
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
volatile int x;
int * volatile y;],
ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
int * volatile y;])],
[ac_cv_c_volatile=yes],
[ac_cv_c_volatile=no])])
if test $ac_cv_c_volatile = no; then
AC_DEFINE(volatile,,
[Define to empty if the keyword `volatile' does not work.

View File

@ -319,14 +319,16 @@ AC_DEFUNCT(AC_RSH, [; replace it with equivalent code])
AC_DEFUN(AC_DECL_SYS_SIGLIST,
[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
ac_cv_decl_sys_siglist,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
/* NetBSD declares sys_siglist in unistd.h. */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
], [char *msg = *(sys_siglist + 1);],
ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
], [char *msg = *(sys_siglist + 1);])],
[ac_cv_decl_sys_siglist=yes],
[ac_cv_decl_sys_siglist=no])])
if test $ac_cv_decl_sys_siglist = yes; then
AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
[Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
@ -349,11 +351,12 @@ fi
define([_AC_CHECK_HEADER_DIRENT],
[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_dirent_$1])dnl
AC_CACHE_CHECK([for $1 that defines DIR], ac_Header,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <$1>
],
[DIR *dirp = 0;],
AC_VAR_SET(ac_Header, yes), AC_VAR_SET(ac_Header, no))])
[DIR *dirp = 0;])],
[AC_VAR_SET(ac_Header, yes)],
[AC_VAR_SET(ac_Header, no)])])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Header) = yes],
[$2], [$3])dnl
AC_VAR_POPDEF([ac_Header])dnl
@ -513,19 +516,21 @@ fi
AC_DEFUN(AC_HEADER_SYS_WAIT,
[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
ac_cv_header_sys_wait_h,
[AC_TRY_COMPILE(
[#include <sys/types.h>
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif],
#endif
],
[ int s;
wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],
ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;])],
[ac_cv_header_sys_wait_h=yes],
[ac_cv_header_sys_wait_h=no])])
if test $ac_cv_header_sys_wait_h = yes; then
AC_DEFINE(HAVE_SYS_WAIT_H, 1,
[Define if you have <sys/wait.h> that is POSIX.1 compatible.])
@ -538,11 +543,13 @@ fi
AC_DEFUN(AC_HEADER_TIME,
[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
ac_cv_header_time,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
],
[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
[struct tm *tp;])],
[ac_cv_header_time=yes],
[ac_cv_header_time=no])])
if test $ac_cv_header_time = yes; then
AC_DEFINE(TIME_WITH_SYS_TIME, 1,
[Define if you can safely include both <sys/time.h> and <time.h>.])
@ -659,7 +666,8 @@ AC_DEFUNCT(AC_LONG_64_BITS, [; instead use AC_CHECK_SIZEOF(long)])
# Note that identifiers starting with SIG are reserved by ANSI C.
AC_DEFUN(AC_TYPE_SIGNAL,
[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
#ifdef signal
# undef signal
@ -670,7 +678,9 @@ extern "C" void (*signal (int, void (*)(int)))(int);
void (*signal ()) ();
#endif
],
[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])
[int i;])],
[ac_cv_type_signal=void],
[ac_cv_type_signal=int])])
AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
[Define as the return type of signal handlers
(`int' or `void').])
@ -916,10 +926,11 @@ else
AC_CHECK_HEADER(nlist.h,
[AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
[AC_TRY_COMPILE([#include <nlist.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <nlist.h>
],
[struct nlist n; n.n_un.n_name = 0;],
ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
[struct nlist n; n.n_un.n_name = 0;])],
[ac_cv_struct_nlist_n_un=yes],
[ac_cv_struct_nlist_n_un=no])])
if test $ac_cv_struct_nlist_n_un = yes; then
AC_DEFINE(NLIST_NAME_UNION, 1,
[Define if your `struct nlist' has an `n_un' member.])
@ -1375,7 +1386,7 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
AC_TRY_COMPILE(
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#include <sys/types.h>
#if HAVE_SYS_TIME_H
# include <sys/time.h>
@ -1386,8 +1397,8 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);],,
[ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3])
extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);])],
[ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3])
done
done
done
@ -1717,11 +1728,12 @@ fi
AC_DEFUN(AC_STRUCT_TM,
[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h],
ac_cv_struct_tm,
[AC_TRY_COMPILE([#include <sys/types.h>
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#include <time.h>
],
[struct tm *tp; tp->tm_sec;],
ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])
[struct tm *tp; tp->tm_sec;])],
[ac_cv_struct_tm=time.h],
[ac_cv_struct_tm=sys/time.h])])
if test $ac_cv_struct_tm = sys/time.h; then
AC_DEFINE(TM_IN_SYS_TIME, 1,
[Define if your <sys/time.h> declares `struct tm'.])
@ -2345,12 +2357,13 @@ AU_DEFUN(AC_CYGWIN32,
# EXEEXT.
AC_DEFUN(AC_CYGWIN,
[AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin,
[AC_TRY_COMPILE(,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[#ifndef __CYGWIN__
# define __CYGWIN__ __CYGWIN32__
#endif
return __CYGWIN__;],
ac_cv_cygwin=yes, ac_cv_cygwin=no)])
return __CYGWIN__;])],
[ac_cv_cygwin=yes],
[ac_cv_cygwin=no])])
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes])
@ -2361,8 +2374,9 @@ test "$ac_cv_cygwin" = yes && CYGWIN=yes])
# EXEEXT.
AC_DEFUN(AC_MINGW32,
[AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32,
[AC_TRY_COMPILE(,[return __MINGW32__;],
ac_cv_mingw32=yes, ac_cv_mingw32=no)])
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __MINGW32__;])],
[ac_cv_mingw32=yes],
[ac_cv_mingw32=no])])
MINGW32=
test "$ac_cv_mingw32" = yes && MINGW32=yes])
@ -2373,8 +2387,9 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes])
# for EXEEXT.
AC_DEFUN(AC_EMXOS2,
[AC_CACHE_CHECK(for EMX OS/2 environment, ac_cv_emxos2,
[AC_TRY_COMPILE(,[return __EMX__;],
ac_cv_emxos2=yes, ac_cv_emxos2=no)])
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])],
[ac_cv_emxos2=yes],
[ac_cv_emxos2=no])])
EMXOS2=
test "$ac_cv_emxos2" = yes && EMXOS2=yes])

View File

@ -15,6 +15,12 @@ AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
exit 1)])
## -------------------------------- ##
## Members of the AC_CHECK family. ##
## -------------------------------- ##
# AC_CHECK_LIB
# ------------
# Well, I can't imagine a system where `cos' is neither in libc, nor
@ -266,3 +272,23 @@ AT_CHECK([../autoconf -m .. -l $at_srcdir], 0,, ignore)
AT_CHECK([./configure], 0, ignore)
AT_CLEANUP(path config.log config.cache configure)
## ----------------- ##
## Specific macros. ##
## ----------------- ##
# AC_C_CONST
# ----------
# GCC supports `const', `volatile', and `inline'.
AT_TEST_MACRO(C keywords,
[[AC_PROG_CC
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
case "$GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile" in
yes,*no*) exit 1;;
esac]])