From 502dd5500bea7056add8e94403ac92472c3c4a43 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 19 Sep 2015 07:24:40 -0500 Subject: [svn-r27832] Updates to configure.ac based on the results of autoscan. This removes all of the TRY_* macros and replaces them with *_IFELSE macros, which are better for cross-compiling. Tested on: h5committest (cmake fails due to --enable-fortran2003) --- configure.ac | 115 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 52 deletions(-) diff --git a/configure.ac b/configure.ac index a31b989..96b26c6 100644 --- a/configure.ac +++ b/configure.ac @@ -1061,17 +1061,22 @@ esac CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS" -AC_TRY_COMPILE([#include ], - [off64_t n = 0;], - [AC_CHECK_FUNCS([lseek64 fseeko64 ftello64 ftruncate64])], - [AC_MSG_RESULT([skipping test for lseek64(), fseeko64 , ftello64, ftruncate64() because off64_t is not defined])]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +]], + [[off64_t n = 0;]])], + [AC_CHECK_FUNCS([lseek64 fseeko64 ftello64 ftruncate64])], + [AC_MSG_RESULT([skipping test for lseek64, fseeko64 , ftello64, ftruncate64 because off64_t is not defined])]) + AC_CHECK_FUNCS([fseeko ftello]) -AC_TRY_COMPILE([ + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include -#include ], -[struct stat64 sb;], +#include +]], +[[struct stat64 sb;]])], [AC_CHECK_FUNCS([stat64 fstat64])], -[AC_MSG_RESULT([skipping test for stat64() and fstat64()])]) +[AC_MSG_RESULT([skipping test for stat64 and fstat64])]) ## Checkpoint the cache AC_CACHE_SAVE @@ -1132,17 +1137,16 @@ AC_CACHE_SAVE ## Check if the dev_t type is a scalar type (must come after the check for ## sys/types.h) AC_MSG_CHECKING([if dev_t is scalar]) -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif - ], - [dev_t d1, d2; if(d1==d2) return 0;], - AC_DEFINE([DEV_T_IS_SCALAR], [1], - [Define if `dev_t' is a scalar]) - AC_MSG_RESULT([yes]), - AC_MSG_RESULT([no]) -) + ]], + [[dev_t d1, d2; if(d1==d2) return 0;]])], + [AC_DEFINE([DEV_T_IS_SCALAR], [1], + [Define if dev_t is a scalar]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) ## ---------------------------------------------------------------------- ## Fake --with-xxx option to allow us to create a help message for the @@ -1636,11 +1640,12 @@ AC_CHECK_DECL([CLOCK_MONOTONIC],[have_clock_monotonic="yes"],[have_clock_monoton ## First check if `struct tm' has a `tm_gmtoff' member. AC_MSG_CHECKING([for tm_gmtoff in struct tm]) -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include - #include ], [struct tm tm; tm.tm_gmtoff=0;], + #include +]], [[struct tm tm; tm.tm_gmtoff=0;]])], [AC_DEFINE([HAVE_TM_GMTOFF], [1], - [Define if `tm_gmtoff' is a member of `struct tm']) + [Define if tm_gmtoff is a member of struct tm]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) @@ -1652,11 +1657,11 @@ case "`uname`" in AC_MSG_RESULT([disabled in CYGWIN]) ;; *) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include - #include ], [timezone=0;], + #include ]], [[timezone=0;]])], [AC_DEFINE([HAVE_TIMEZONE], [1], - [Define if `timezone' is a global variable]) + [Define if timezone is a global variable]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) ;; @@ -1667,10 +1672,10 @@ esac ## Does the struct stat have the st_blocks field? This field is not Posix. ## AC_MSG_CHECKING([for st_blocks in struct stat]) -AC_TRY_COMPILE([ - #include ],[struct stat sb; sb.st_blocks=0;], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM[[ + #include ]],[[struct stat sb; sb.st_blocks=0;]])], [AC_DEFINE([HAVE_STAT_ST_BLOCKS], [1], - [Define if `struct stat' has the `st_blocks' field]) + [Define if struct stat has the st_blocks field]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) @@ -1688,28 +1693,32 @@ esac AC_CHECK_FUNCS([_scrsize ioctl]) AC_MSG_CHECKING([for struct videoconfig]) -AC_TRY_COMPILE(,[struct videoconfig w; w.numtextcols=0;], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[struct videoconfig w; w.numtextcols=0;]])], [AC_DEFINE([HAVE_STRUCT_VIDEOCONFIG], [1], - [Define if `struct videoconfig' is defined]) + [Define if struct videoconfig is defined]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for struct text_info]) -AC_TRY_COMPILE(, [struct text_info w; w.screenwidth=0;], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[struct text_info w; w.screenwidth=0;]])], [AC_DEFINE([HAVE_STRUCT_TEXT_INFO], [1], - [Define if `struct text_info' is defined]) + [Define if struct text_info is defined]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for TIOCGWINSZ]) -AC_TRY_COMPILE([#include ],[int w=TIOCGWINSZ;], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +]],[[int w=TIOCGWINSZ;]])], [AC_DEFINE([HAVE_TIOCGWINSZ], [1], [Define if the ioctl TIOGWINSZ is defined]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for TIOCGETD]) -AC_TRY_COMPILE([#include ],[int w=TIOCGETD;], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +]],[[int w=TIOCGETD;]])], [AC_DEFINE([HAVE_TIOCGETD], [1], [Define if the ioctl TIOCGETD is defined]) AC_MSG_RESULT([yes])], @@ -1756,26 +1765,26 @@ AC_COMPILE_IFELSE( ) AC_MSG_CHECKING([for __attribute__ extension]) -AC_TRY_COMPILE(,[int __attribute__((unused)) x], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])], [AC_DEFINE([HAVE_ATTRIBUTE], [1], [Define if the __attribute__(()) extension is present]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for __func__ extension]) -AC_TRY_COMPILE(,[ const char *fname = __func__; ], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[ const char *fname = __func__; ]])], [AC_DEFINE([HAVE_C99_FUNC], [1], [Define if the compiler understands the __func__ keyword]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for __FUNCTION__ extension]) -AC_TRY_COMPILE(,[ const char *fname = __FUNCTION__; ], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],,[[ const char *fname = __FUNCTION__; ]])], [AC_DEFINE([HAVE_FUNCTION], [1], [Define if the compiler understands the __FUNCTION__ keyword]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for C99 designated initialization support]) -AC_TRY_COMPILE(,[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ typedef struct { int x; union { @@ -1783,7 +1792,7 @@ AC_TRY_COMPILE(,[ double d; } u; } di_struct_t; - di_struct_t x = {0, { .d = 0.0}}; ], + di_struct_t x = {0, { .d = 0.0}}; ]])], [AC_DEFINE([HAVE_C99_DESIGNATED_INITIALIZER], [1], [Define if the compiler understands C99 designated initialization of structs and unions]) AC_MSG_RESULT([yes])], @@ -2145,21 +2154,23 @@ if test -n "$PARALLEL"; then ADD_PARALLEL_FILES="yes" AC_MSG_CHECKING([for MPI_Comm_c2f and MPI_Comm_f2c functions]) - AC_TRY_LINK([#include ], - [MPI_Comm c_comm; MPI_Comm_c2f(c_comm)], - AC_DEFINE([HAVE_MPI_MULTI_LANG_Comm], [1], - [Define if `MPI_Comm_c2f' and `MPI_Comm_f2c' exists]) - AC_MSG_RESULT([yes]), - AC_MSG_RESULT([no]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], + [[MPI_Comm c_comm; MPI_Comm_c2f(c_comm)]])], + [AC_DEFINE([HAVE_MPI_MULTI_LANG_Comm], [1], + [Define if MPI_Comm_c2f and MPI_Comm_f2c exist]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] ) AC_MSG_CHECKING([for MPI_Info_c2f and MPI_Info_f2c functions]) - AC_TRY_LINK([#include ], - [MPI_Info c_info; MPI_Info_c2f(c_info)], - AC_DEFINE([HAVE_MPI_MULTI_LANG_Info], [1], - [Define if `MPI_Info_c2f' and `MPI_Info_f2c' exists]) - AC_MSG_RESULT([yes]), - AC_MSG_RESULT([no]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[MPI_Info c_info; MPI_Info_c2f(c_info)]])], + [AC_DEFINE([HAVE_MPI_MULTI_LANG_Info], [1], + [Define if MPI_Info_c2f and MPI_Info_f2c exist]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] ) fi @@ -2526,7 +2537,7 @@ if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no} else AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate], - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(void) { long double ld = 20041683600089727.779961L; @@ -2563,7 +2574,7 @@ else done: exit(ret); } - ], [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],)]) + ]])], [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],[])]) fi if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then @@ -2589,7 +2600,7 @@ if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no} else AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct], - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(void) { long double ld; @@ -2630,7 +2641,7 @@ else done: exit(ret); } - ], [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],)]) + ]])],[hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])]) fi if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then -- cgit v0.12