* m4/macros/check_varargs_macros.m4: rewrite macro so it'll
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 7 Oct 2005 23:17:31 +0000 (23:17 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 7 Oct 2005 23:17:31 +0000 (23:17 +0000)
try and compile the varargs test, not just cpp it.  Some systems
pass the old cpp test, but not when you actually try to compile
the code (Tru64's cc).

ChangeLog
m4/macros/check_varargs_macros.m4

index b78e261cc1cbea93623c2211545cf0ad2d0a777b..3a3b31b6e04601e7faab4877b6e1357720b21131 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-10-07  Erez Zadok  <ezk@cs.sunysb.edu>
 
+       * m4/macros/check_varargs_macros.m4: rewrite macro so it'll
+       try and compile the varargs test, not just cpp it.  Some systems
+       pass the old cpp test, but not when you actually try to compile
+       the code (Tru64's cc).
+
        * conf/autofs/autofs_solaris_v1.h: redefine
        autofs_strdup_space_hack as a macro to str3cat(NULL,(s)," ","").
        This works everywhere and we avoid linking problems, inline
index dfec692b42c155ea16d3df720688e8dbb13a9fb7..44bd3edf198937c3ae380cb32adf7e9c3b6cbb9c 100644 (file)
@@ -1,19 +1,27 @@
 dnl ######################################################################
-dnl check if CPP can handle variable-length argument macros
+dnl check if compiler can handle variable-length argument macros
 AC_DEFUN([AMU_VARARGS_MACROS],
 [
-AC_CACHE_CHECK(if pre-processor can handle variable-length macros,
+AC_CACHE_CHECK(if compiler can handle variable-length macros,
 ac_cv_varargs_macros,
 [
 # try C99 style
-AC_PREPROC_IFELSE(
+AC_TRY_COMPILE(
 [
-#define foo(format, ...)    bar(format, __VA_ARGS__)
+#define foo(str,size,fmt,...)  bar(__FILE__,__LINE__,(str),(size),(fmt),__VA_ARGS__)
+],
+[
+char a[80];
+foo(a, sizeof(a), "%d,%d", 1, 2);
 ], ac_cv_varargs_macros=c99,
 # else try gcc style
-AC_PREPROC_IFELSE(
+AC_TRY_COMPILE(
+[
+#define foo(str,size,args...)  bar(__FILE__,__LINE__,(str),(size),(fmt),args)
+],
 [
-#define foo(format, args...)   bar(format, args)
+char a[80];
+foo(a, sizeof(a), "%d,%d", 1, 2);
 ], ac_cv_varargs_macros=gcc, ac_cv_varargs_macros=none))
 ])
 if test "$ac_cv_varargs_macros" = c99