From 92ff7f21ad0b167f8d742a9d7b5f93704a57619c Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 24 Apr 2008 02:02:49 +0000 Subject: Major coding style cleanup. Updated all shared code from my other projects. The configure option requesting AFS kaserver support (and thus building kasetkey) is now --with-kaserver instead of --with-afs. If KRB5_CONFIG was explicitly set in the environment, don't use a different krb5-config based on --with-krb4 or --with-krb5. If krb5-config isn't executable, don't use it. This allows one to force library probing by setting KRB5_CONFIG to point to a nonexistent file. Sanity-check the results of krb5-config before proceeding and error out in configure if they don't work. Stop setting Stanford-specific compile-time defaults for the wallet server and port. --- m4/afs.m4 | 94 ------------------------------------------------------ m4/gssapi.m4 | 11 ++++++- m4/kaserver.m4 | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/krb4.m4 | 15 +++++++-- m4/krb5.m4 | 20 ++++++++++-- m4/lib-depends.m4 | 1 + m4/remctl.m4 | 21 ++++++------ m4/snprintf.m4 | 12 +++---- m4/vamacros.m4 | 27 ++++++++-------- 9 files changed, 165 insertions(+), 131 deletions(-) delete mode 100644 m4/afs.m4 create mode 100644 m4/kaserver.m4 (limited to 'm4') diff --git a/m4/afs.m4 b/m4/afs.m4 deleted file mode 100644 index 66a3f08..0000000 --- a/m4/afs.m4 +++ /dev/null @@ -1,94 +0,0 @@ -dnl afs.m4 -- Find the compiler and linker flags for OpenAFS. -dnl $Id$ -dnl -dnl If --with-afs is given, finds the compiler and linker flags for building -dnl with OpenAFS libraries; sets AFS_CPPFLAGS, AFS_LDFLAGS, and AFS_LIBS as -dnl appropriate; and defines HAVE_AFS. Provides the macro RRA_LIB_AFS, which -dnl takes no arguments. -dnl -dnl This function also sets rra_afs to true if AFS was requested, which can be -dnl checked to determine if further checks should be done. -dnl -dnl Also provides RRA_LIB_AFS_SET to set CPPFLAGS, LDFLAGS, and LIBS to -dnl include the AFS libraries; RRA_LIB_AFS_SWITCH to do the same but save the -dnl current values first; and RRA_LIB_AFS_RESTORE to restore those settings to -dnl before the last RRA_LIB_AFS_SWITCH. -dnl -dnl Written by Russ Allbery -dnl Based on code developed by Derrick Brashear and Ken Hornstein of Sine -dnl Nomine Associates, on behalf of Stanford University. -dnl Copyright 2006, 2007, 2008 -dnl Board of Trustees, Leland Stanford Jr. University -dnl See LICENSE for licensing terms. - -dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the AFS settings. -AC_DEFUN([RRA_LIB_AFS_SET], -[CPPFLAGS="$AFS_CPPFLAGS $CPPFLAGS" - LDFLAGS="$AFS_LDFLAGS $LDFLAGS" - LIBS="$AFS_LIBS $LIBS"]) - -dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to -dnl versions that include the AFS flags. Used as a wrapper, with -dnl RRA_LIB_AFS_RESTORE, around tests. -AC_DEFUN([RRA_LIB_AFS_SWITCH], -[rra_afs_save_CPPFLAGS="$CPPFLAGS" - rra_afs_save_LDFLAGS="$LDFLAGS" - rra_afs_save_LIBS="$LIBS" - RRA_LIB_AFS_SET]) - -dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before -dnl RRA_LIB_AFS_SWITCH was called). -AC_DEFUN([RRA_LIB_AFS_RESTORE], -[CPPFLAGS="$rra_afs_save_CPPFLAGS" - LDFLAGS="$rra_afs_save_LDFLAGS" - LIBS="$rra_afs_save_LIBS"]) - -dnl The function that does the work checking for the AFS libraries. -AC_DEFUN([_RRA_LIB_AFS_CHECK], -[RRA_LIB_AFS_SET - LIBS= - AC_SEARCH_LIBS([pthread_getspecific], [pthread]) - AC_SEARCH_LIBS([res_search], [resolv], , - [AC_SEARCH_LIBS([__res_search], [resolv])]) - AC_SEARCH_LIBS([gethostbyname], [nsl]) - AC_SEARCH_LIBS([socket], [socket], , - [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], , - [-lsocket])]) - AFS_LIBS="$AFS_LIBS $LIBS" - LIBS="$AFS_LIBS" - AC_CACHE_CHECK([whether linking with AFS libraries work], [rra_cv_lib_afs], - [AC_TRY_LINK( -[#include -#include ], -[char cell[256] = "EXAMPLE.COM"; -char realm[256]; -int local; - -ka_CellToRealm(cell, realm, &local);], - [rra_cv_lib_afs=yes], - [rra_cv_lib_afs=no])]) - AS_IF([test "$rra_cv_lib_afs" = no], - [AC_MSG_ERROR([unable to link test AFS program])]) - RRA_LIB_AFS_RESTORE]) - -dnl The public entry point. Sets up the --with option and only does the -dnl library check if AFS linkage was requested. -AC_DEFUN([RRA_LIB_AFS], -[rra_afs=false - AFS_CPPFLAGS= - AFS_LDFLAGS= - AFS_LIBS="-lafsauthent -lafsrpc" - AC_SUBST([AFS_CPPFLAGS]) - AC_SUBST([AFS_LDFLAGS]) - AC_SUBST([AFS_LIBS]) - AC_ARG_WITH([afs], - [AC_HELP_STRING([--with-afs@<:@=DIR@:>@], - [Compile with AFS kaserver sync support])], - [AS_IF([test x"$withval" != xno], - [rra_afs=true - AS_IF([test x"$withval" != xyes], - [AFS_CPPFLAGS="-I${withval}/include" - AFS_LDFLAGS="-L${withval}/lib"]) - _RRA_LIB_AFS_CHECK - AC_DEFINE([HAVE_AFS], 1, - [Define to enable AFS kaserver support.])])])]) diff --git a/m4/gssapi.m4 b/m4/gssapi.m4 index 2d36e43..5c0d9e7 100644 --- a/m4/gssapi.m4 +++ b/m4/gssapi.m4 @@ -97,6 +97,14 @@ AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL], [-lkrb5 -lasn1 -lroken -lcrypto -lcom_err $rra_gssapi_extra]) RRA_LIB_GSSAPI_RESTORE]) +dnl Sanity-check the results of krb5-config and be sure we can really link a +dnl GSS-API program. +AC_DEFUN([_RRA_LIB_GSSAPI_CHECK], +[RRA_LIB_GSSAPI_SWITCH + AC_CHECK_FUNC([gss_import_name], , + [AC_MSG_FAILURE([krb5-config results fail for GSS-API])]) + RRA_LIB_GSSAPI_RESTORE]) + dnl The main macro. AC_DEFUN([RRA_LIB_GSSAPI], [AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS]) @@ -132,6 +140,7 @@ AC_DEFUN([RRA_LIB_GSSAPI], [GSSAPI_CPPFLAGS=`"$KRB5_CONFIG" --cflags` GSSAPI_LIBS=`"$KRB5_CONFIG" --libs`]) GSSAPI_CPPFLAGS=`echo "$GSSAPI_CPPFLAGS" \ - | sed 's%-I/usr/include ?%%'`], + | sed 's%-I/usr/include ?%%'` + _RRA_LIB_GSSAPI_CHECK], [_RRA_LIB_GSSAPI_PATHS _RRA_LIB_GSSAPI_MANUAL])])]) diff --git a/m4/kaserver.m4 b/m4/kaserver.m4 new file mode 100644 index 0000000..6a41bd4 --- /dev/null +++ b/m4/kaserver.m4 @@ -0,0 +1,95 @@ +dnl kaserver.m4 -- Find the compiler and linker flags for OpenAFS kaserver. +dnl $Id$ +dnl +dnl If --with-kaserver is given, finds the compiler and linker flags for +dnl building with OpenAFS libraries; sets AFS_CPPFLAGS, AFS_LDFLAGS, and +dnl AFS_LIBS as appropriate; and defines HAVE_AFS. Provides the macro +dnl RRA_LIB_AFS, which takes no arguments. +dnl +dnl This function also sets rra_kaserver to true if AFS was requested, which +dnl can be checked to determine if further checks should be done. +dnl +dnl Also provides RRA_LIB_AFS_SET to set CPPFLAGS, LDFLAGS, and LIBS to +dnl include the AFS libraries; RRA_LIB_AFS_SWITCH to do the same but save the +dnl current values first; and RRA_LIB_AFS_RESTORE to restore those settings to +dnl before the last RRA_LIB_AFS_SWITCH. +dnl +dnl Written by Russ Allbery +dnl Based on code developed by Derrick Brashear and Ken Hornstein of Sine +dnl Nomine Associates, on behalf of Stanford University. +dnl Copyright 2006, 2007, 2008 +dnl Board of Trustees, Leland Stanford Jr. University +dnl +dnl See LICENSE for licensing terms. + +dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the AFS settings. +AC_DEFUN([RRA_LIB_AFS_SET], +[CPPFLAGS="$AFS_CPPFLAGS $CPPFLAGS" + LDFLAGS="$AFS_LDFLAGS $LDFLAGS" + LIBS="$AFS_LIBS $LIBS"]) + +dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to +dnl versions that include the AFS flags. Used as a wrapper, with +dnl RRA_LIB_AFS_RESTORE, around tests. +AC_DEFUN([RRA_LIB_AFS_SWITCH], +[rra_afs_save_CPPFLAGS="$CPPFLAGS" + rra_afs_save_LDFLAGS="$LDFLAGS" + rra_afs_save_LIBS="$LIBS" + RRA_LIB_AFS_SET]) + +dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before +dnl RRA_LIB_AFS_SWITCH was called). +AC_DEFUN([RRA_LIB_AFS_RESTORE], +[CPPFLAGS="$rra_afs_save_CPPFLAGS" + LDFLAGS="$rra_afs_save_LDFLAGS" + LIBS="$rra_afs_save_LIBS"]) + +dnl The function that does the work checking for the AFS libraries. +AC_DEFUN([_RRA_LIB_AFS_CHECK], +[RRA_LIB_AFS_SET + LIBS= + AC_SEARCH_LIBS([pthread_getspecific], [pthread]) + AC_SEARCH_LIBS([res_search], [resolv], , + [AC_SEARCH_LIBS([__res_search], [resolv])]) + AC_SEARCH_LIBS([gethostbyname], [nsl]) + AC_SEARCH_LIBS([socket], [socket], , + [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], , + [-lsocket])]) + AFS_LIBS="$AFS_LIBS $LIBS" + LIBS="$AFS_LIBS" + AC_CACHE_CHECK([whether linking with AFS libraries work], [rra_cv_lib_afs], + [AC_TRY_LINK( +[#include +#include ], +[char cell[256] = "EXAMPLE.COM"; +char realm[256]; +int local; + +ka_CellToRealm(cell, realm, &local);], + [rra_cv_lib_afs=yes], + [rra_cv_lib_afs=no])]) + AS_IF([test "$rra_cv_lib_afs" = no], + [AC_MSG_ERROR([unable to link test AFS program])]) + RRA_LIB_AFS_RESTORE]) + +dnl The public entry point. Sets up the --with option and only does the +dnl library check if AFS linkage was requested. +AC_DEFUN([RRA_LIB_AFS], +[rra_afs=false + AFS_CPPFLAGS= + AFS_LDFLAGS= + AFS_LIBS="-lafsauthent -lafsrpc" + AC_SUBST([AFS_CPPFLAGS]) + AC_SUBST([AFS_LDFLAGS]) + AC_SUBST([AFS_LIBS]) + AC_ARG_WITH([kaserver], + [AC_HELP_STRING([--with-kaserver@<:@=DIR@:>@], + [Compile with AFS kaserver sync support])], + [AS_IF([test x"$withval" != xno], + [rra_afs=true + AS_IF([test x"$withval" != xyes], + [AFS_CPPFLAGS="-I${withval}/include" + AFS_LDFLAGS="-L${withval}/lib"]) + _RRA_LIB_AFS_CHECK + AC_DEFINE([HAVE_AFS], 1, + [Define to enable AFS kaserver support.])])])]) diff --git a/m4/krb4.m4 b/m4/krb4.m4 index 12b6efe..321b0bf 100644 --- a/m4/krb4.m4 +++ b/m4/krb4.m4 @@ -104,6 +104,14 @@ AC_DEFUN([_RRA_LIB_KRB4_EXTRA], AC_CHECK_HEADERS([kerberosIV/krb.h]) RRA_LIB_KRB4_RESTORE]) +dnl Sanity-check the results of krb5-config and be sure we can really link a +dnl Kerberos program. +AC_DEFUN([_RRA_LIB_KRB4_CHECK], +[RRA_LIB_KRB4_SWITCH + AC_CHECK_FUNC([krb_get_svc_in_tkt], , + [AC_MSG_FAILURE([krb5-config results fail for Kerberos v4])]) + RRA_LIB_KRB4_RESTORE]) + dnl The main macro. AC_DEFUN([RRA_LIB_KRB4], [AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS]) @@ -123,11 +131,11 @@ AS_IF([test x"$rra_reduced_depends" = xtrue], [_RRA_LIB_KRB4_PATHS _RRA_LIB_KRB4_REDUCED], [AC_ARG_VAR([KRB5_CONFIG], [Path to krb5-config]) - AS_IF([test x"$rra_krb4_root" != x], + AS_IF([test x"$rra_krb4_root" != x && test -z "$KRB5_CONFIG"], [AS_IF([test -x "${rra_krb4_root}/bin/krb5-config"], [KRB5_CONFIG="${rra_krb4_root}/bin/krb5-config"])], [AC_PATH_PROG([KRB5_CONFIG], [krb5-config])]) - AS_IF([test x"$KRB5_CONFIG" != x], + AS_IF([test x"$KRB5_CONFIG" != x && test -x "$KRB5_CONFIG"], [AC_CACHE_CHECK([for krb4 support in krb5-config], [rra_cv_lib_krb4_config], [AS_IF(["$KRB5_CONFIG" | grep krb4 > /dev/null 2>&1], @@ -138,7 +146,8 @@ AS_IF([test x"$rra_reduced_depends" = xtrue], KRB4_LIBS=`"$KRB5_CONFIG" --libs krb4`], [_RRA_LIB_KRB4_PATHS _RRA_LIB_KRB4_MANUAL]) - KRB4_CPPFLAGS=`echo "$KRB5_CPPFLAGS" | sed 's%-I/usr/include ?%%'`], + KRB4_CPPFLAGS=`echo "$KRB5_CPPFLAGS" | sed 's%-I/usr/include ?%%'` + _RRA_LIB_KRB4_CHECK], [_RRA_LIB_KRB4_PATHS _RRA_LIB_KRB4_MANUAL])]) _RRA_LIB_KRB4_EXTRA]) diff --git a/m4/krb5.m4 b/m4/krb5.m4 index c7aa5bf..934be0c 100644 --- a/m4/krb5.m4 +++ b/m4/krb5.m4 @@ -132,6 +132,19 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [AC_CHECK_HEADERS([et/com_err.h])])])]) RRA_LIB_KRB5_RESTORE]) +dnl Sanity-check the results of krb5-config and be sure we can really link a +dnl Kerberos program. The first option says whether to fail if Kerberos was +dnl not found. If we shouldn't fail, clear KRB5_CPPFLAGS and KRB5_LIBS so +dnl that we know we don't have usable flags. +AC_DEFUN([_RRA_LIB_KRB5_CHECK], +[RRA_LIB_KRB5_SWITCH + AC_CHECK_FUNC([krb5_init_context], , + [AS_IF([test x"$1" = xtrue], + [AC_MSG_FAILURE([krb5-config results fail for Kerberos v5])]) + KRB5_CPPFLAGS= + KRB5_LIBS=]) + RRA_LIB_KRB5_RESTORE]) + dnl The core of the library checking, shared between RRA_LIB_KRB5 and dnl RRA_LIB_KRB5_OPTIONAL. The single argument, if "true", says to fail if dnl Kerberos could not be found. @@ -141,11 +154,11 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL], [_RRA_LIB_KRB5_PATHS _RRA_LIB_KRB5_REDUCED([$1])], [AC_ARG_VAR([KRB5_CONFIG], [Path to krb5-config]) - AS_IF([test x"$rra_krb5_root" != x], + AS_IF([test x"$rra_krb5_root" != x && test -z "$KRB5_CONFIG"], [AS_IF([test -x "${rra_krb5_root}/bin/krb5-config"], [KRB5_CONFIG="${rra_krb5_root}/bin/krb5-config"])], [AC_PATH_PROG([KRB5_CONFIG], [krb5-config])]) - AS_IF([test x"$KRB5_CONFIG" != x], + AS_IF([test x"$KRB5_CONFIG" != x && test -x "$KRB5_CONFIG"], [AC_CACHE_CHECK([for krb5 support in krb5-config], [rra_cv_lib_krb5_config], [AS_IF(["$KRB5_CONFIG" | grep krb5 > /dev/null 2>&1], @@ -157,6 +170,7 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL], [KRB5_CPPFLAGS=`"$KRB5_CONFIG" --cflags` KRB5_LIBS=`"$KRB5_CONFIG" --libs`]) KRB5_CPPFLAGS=`echo "$KRB5_CPPFLAGS" | sed 's%-I/usr/include ?%%'` + _RRA_LIB_KRB5_CHECK([$1]) RRA_LIB_KRB5_SWITCH AC_CHECK_FUNCS([krb5_get_error_message], [AC_CHECK_FUNCS([krb5_free_error_message])], @@ -189,7 +203,7 @@ AC_DEFUN([RRA_LIB_KRB5], [Location of Kerberos v5 headers and libraries])], [AS_IF([test x"$withval" != xyes && test x"$withval" != xno], [rra_krb5_root="$withval"])]) - _RRA_LIB_KRB5_INTERNAL]) + _RRA_LIB_KRB5_INTERNAL([true])]) dnl The main macro for packages with optional Kerberos support. AC_DEFUN([RRA_LIB_KRB5_OPTIONAL], diff --git a/m4/lib-depends.m4 b/m4/lib-depends.m4 index 54a8f43..5f4c284 100644 --- a/m4/lib-depends.m4 +++ b/m4/lib-depends.m4 @@ -13,6 +13,7 @@ dnl dnl Written by Russ Allbery dnl Copyright 2005, 2006, 2007 dnl Board of Trustees, Leland Stanford Jr. University +dnl dnl See LICENSE for licensing terms. AC_DEFUN([RRA_ENABLE_REDUCED_DEPENDS], diff --git a/m4/remctl.m4 b/m4/remctl.m4 index 2941f19..5cebc68 100644 --- a/m4/remctl.m4 +++ b/m4/remctl.m4 @@ -13,6 +13,7 @@ dnl This macro depends on RRA_ENABLE_REDUCED_DEPENDS and RRA_LIB_GSSAPI. dnl dnl Written by Russ Allbery dnl Copyright 2008 Board of Trustees, Leland Stanford Jr. University +dnl dnl See LICENSE for licensing terms. dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the Kerberos v5 @@ -48,20 +49,20 @@ AC_DEFUN([_RRA_LIB_REMCTL_PATHS], dnl The main macro. AC_DEFUN([RRA_LIB_REMCTL], [AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS]) -rra_remctl_root= -REMCTL_CPPFLAGS= -REMCTL_LDFLAGS= -REMCTL_LIBS= -AC_SUBST([REMCTL_CPPFLAGS]) -AC_SUBST([REMCTL_LDFLAGS]) -AC_SUBST([REMCTL_LIBS]) -AC_ARG_WITH([remctl], + rra_remctl_root= + REMCTL_CPPFLAGS= + REMCTL_LDFLAGS= + REMCTL_LIBS= + AC_SUBST([REMCTL_CPPFLAGS]) + AC_SUBST([REMCTL_LDFLAGS]) + AC_SUBST([REMCTL_LIBS]) + AC_ARG_WITH([remctl], [AC_HELP_STRING([--with-remctl=DIR], [Location of remctl headers and libraries])], [AS_IF([test x"$withval" != xyes && test x"$withval" != xno], [rra_remctl_root="$withval"])]) -_RRA_LIB_REMCTL_PATHS -AS_IF([test x"$rra_reduced_depends" = xtrue], + _RRA_LIB_REMCTL_PATHS + AS_IF([test x"$rra_reduced_depends" = xtrue], [REMCTL_LIBS="-lremctl"], [RRA_LIB_GSSAPI REMCTL_CPPFLAGS="$REMCTL_CPPFLAGS $GSSAPI_CPPFLAGS" diff --git a/m4/snprintf.m4 b/m4/snprintf.m4 index 335a937..8ab3689 100644 --- a/m4/snprintf.m4 +++ b/m4/snprintf.m4 @@ -11,7 +11,7 @@ dnl Provides RRA_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a dnl fully working snprintf is found. dnl dnl Written by Russ Allbery -dnl Copyright 2006 Board of Trustees, Leland Stanford Jr. University +dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University dnl See LICENSE for licensing terms. dnl Source used by RRA_FUNC_SNPRINTF. @@ -47,9 +47,7 @@ AC_DEFUN([RRA_FUNC_SNPRINTF], [rra_cv_func_snprintf_works=yes], [rra_cv_func_snprintf_works=no], [rra_cv_func_snprintf_works=no])]) -if test "$rra_cv_func_snprintf_works" = yes ; then - AC_DEFINE([HAVE_SNPRINTF], 1, - [Define if your system has a working snprintf function.]) -else - AC_LIBOBJ([snprintf]) -fi]) +AS_IF([test "$rra_cv_func_snprintf_works" = yes], + [AC_DEFINE([HAVE_SNPRINTF], 1, + [Define if your system has a working snprintf function.])], + [AC_LIBOBJ([snprintf])])]) diff --git a/m4/vamacros.m4 b/m4/vamacros.m4 index c343d9f..8946d8b 100644 --- a/m4/vamacros.m4 +++ b/m4/vamacros.m4 @@ -15,7 +15,8 @@ dnl dnl They set HAVE_C99_VAMACROS or HAVE_GNU_VAMACROS as appropriate. dnl dnl Written by Russ Allbery -dnl Copyright 2006 Board of Trustees, Leland Stanford Jr. University +dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University +dnl dnl See LICENSE for licensing terms. AC_DEFUN([RRA_C_C99_VAMACROS], @@ -23,21 +24,21 @@ AC_DEFUN([RRA_C_C99_VAMACROS], [AC_TRY_COMPILE( [#include #define error(...) fprintf(stderr, __VA_ARGS__)], -[error("foo"); error("foo %d", 0); return 0;], -[rra_cv_c_c99_vamacros=yes], [rra_cv_c_c99_vamacros=no])]) -if test $rra_cv_c_c99_vamacros = yes ; then - AC_DEFINE([HAVE_C99_VAMACROS], 1, - [Define if the compiler supports C99 variadic macros.]) -fi]) + [error("foo"); error("foo %d", 0); return 0;], + [rra_cv_c_c99_vamacros=yes], + [rra_cv_c_c99_vamacros=no])]) +AS_IF([test $rra_cv_c_c99_vamacros = yes], + [AC_DEFINE([HAVE_C99_VAMACROS], 1, + [Define if the compiler supports C99 variadic macros.])])]) AC_DEFUN([RRA_C_GNU_VAMACROS], [AC_CACHE_CHECK([for GNU-style variadic macros], [rra_cv_c_gnu_vamacros], [AC_TRY_COMPILE( [#include #define error(args...) fprintf(stderr, args)], -[error("foo"); error("foo %d", 0); return 0;], -[rra_cv_c_gnu_vamacros=yes], [rra_cv_c_gnu_vamacros=no])]) -if test $rra_cv_c_gnu_vamacros = yes ; then - AC_DEFINE([HAVE_GNU_VAMACROS], 1, - [Define if the compiler supports GNU-style variadic macros.]) -fi]) + [error("foo"); error("foo %d", 0); return 0;], + [rra_cv_c_gnu_vamacros=yes], + [rra_cv_c_gnu_vamacros=no])]) +AS_IF([test $rra_cv_c_gnu_vamacros = yes], + [AC_DEFINE([HAVE_GNU_VAMACROS], 1, + [Define if the compiler supports GNU-style variadic macros.])])]) -- cgit v1.2.3