This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A Configure probe for C99 variadic macros, based on code from Jarkko.
authorNicholas Clark <nick@ccl4.org>
Sat, 13 May 2006 15:48:24 +0000 (15:48 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 13 May 2006 15:48:24 +0000 (15:48 +0000)
p4raw-id: //depot/perl@28189

14 files changed:
Configure
Cross/config.sh-arm-linux
NetWare/config.wc
Porting/Glossary
config_h.SH
configure.com
epoc/config.sh
plan9/config_sh.sample
symbian/config.sh
uconfig.sh
win32/config.bc
win32/config.gc
win32/config.vc
win32/config.vc64

index 6ddb054..a4b4887 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -383,6 +383,7 @@ d_ctermid_r=''
 ctime_r_proto=''
 d_ctime_r=''
 d_cuserid=''
 ctime_r_proto=''
 d_ctime_r=''
 d_cuserid=''
+d_c99_variadic_macros=''
 d_dbl_dig=''
 d_dbminitproto=''
 d_difftime=''
 d_dbl_dig=''
 d_dbminitproto=''
 d_difftime=''
@@ -19164,6 +19165,46 @@ EOCP
        ;;
 esac
 
        ;;
 esac
 
+: see if the Compiler supports C99 variadic macros 
+case "$i_stdarg$i_stdlib" in
+    "$define$define")
+    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
+    $cat >try.c <<EOCP
+#include <stdio.h>
+#include <stdarg.h>
+
+#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
+
+int main() {
+  char buf[20];
+  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
+  puts(buf);
+  return 0;
+}
+EOCP
+    set try
+    if eval $compile && $run ./try 2>&1 >/dev/null; then
+       case "`$run ./try`" in
+           "123 456 789")
+           echo "You have C99 variadic macros." >&4
+           d_c99_variadic_macros="$define"
+           ;;
+           *)
+           echo "You don't have functional C99 variadic macros." >&4
+           d_c99_variadic_macros="$undef"
+           ;;
+       esac
+    else
+       echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
+       d_c99_variadic_macros="$undef"
+    fi
+    ;;
+    *)
+    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
+    d_c99_variadic_macros="$undef"
+    ;;
+esac
+
 : see what type is used for size_t
 rp="What is the type used for the length parameter for string functions?"
 set size_t sizetype 'unsigned int' stdio.h sys/types.h
 : see what type is used for size_t
 rp="What is the type used for the length parameter for string functions?"
 set size_t sizetype 'unsigned int' stdio.h sys/types.h
@@ -21276,6 +21317,7 @@ d_csh='$d_csh'
 d_ctermid_r='$d_ctermid_r'
 d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
 d_ctermid_r='$d_ctermid_r'
 d_ctime_r='$d_ctime_r'
 d_cuserid='$d_cuserid'
+d_c99_variadic_macros='$d_c99_variadic_macros'
 d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
 d_difftime='$d_difftime'
 d_dbl_dig='$d_dbl_dig'
 d_dbminitproto='$d_dbminitproto'
 d_difftime='$d_difftime'
index de83224..863c44a 100644 (file)
@@ -141,6 +141,7 @@ d_crypt_r='undef'
 d_csh='define'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='define'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='define'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='define'
 d_dbl_dig='define'
 d_dbminitproto='undef'
index 005a1d2..511ebf3 100644 (file)
@@ -129,6 +129,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
index 35e0e8b..767db1c 100644 (file)
@@ -558,6 +558,11 @@ d_ctime_r (d_ctime_r.U):
        which indicates to the C program that the ctime_r()
        routine is available.
 
        which indicates to the C program that the ctime_r()
        routine is available.
 
+d_c99_variadic_macros (d_c99_variadic_macros.U):
+       This variable conditionally defines the HAS_C99_VARIADIC_MACROS
+       symbol, which indicates to the C program that C99 variadic macros
+       are available.
+
 d_cuserid (d_cuserid.U):
        This variable conditionally defines the HAS_CUSERID symbol, which
        indicates to the C program that the cuserid() routine is available
 d_cuserid (d_cuserid.U):
        This variable conditionally defines the HAS_CUSERID symbol, which
        indicates to the C program that the cuserid() routine is available
index 4639102..ee4c292 100644 (file)
@@ -4421,4 +4421,10 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
 #endif
 
 #endif
 #endif
 
 #endif
+
+/* HAS_C99_VARIADIC_MACROS:
+ *     If defined, the compiler supports C99 variadic macros.
+ */
+#$d_c99_variadic_macros        HAS_C99_VARIADIC_MACROS /**/
+
 !GROK!THIS!
 !GROK!THIS!
index 62e4192..b8d6da7 100644 (file)
@@ -5703,6 +5703,7 @@ $ WC "d_copysignl='define'"
 $ WC "d_crypt='define'"
 $ WC "d_csh='undef'"
 $ WC "d_cuserid='define'"
 $ WC "d_crypt='define'"
 $ WC "d_csh='undef'"
 $ WC "d_cuserid='define'"
+$ WC "d_c99_variadic_macros='undef'"
 $ WC "d_dbl_dig='define'"
 $ WC "d_dbminitproto='undef'"
 $ WC "d_difftime='define'"
 $ WC "d_dbl_dig='define'"
 $ WC "d_dbminitproto='undef'"
 $ WC "d_difftime='define'"
index d7e9469..217b6c8 100644 (file)
@@ -134,6 +134,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='undef'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='undef'
 d_dbminitproto='undef'
index ddf15cc..8697741 100644 (file)
@@ -141,6 +141,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='define'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='define'
 d_dbl_dig='define'
 d_dbminitproto='undef'
index b1bb772..2e7327f 100644 (file)
@@ -83,6 +83,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='undef'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='undef'
 d_dbminitproto='undef'
index fe046a7..dc49402 100755 (executable)
@@ -72,6 +72,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='undef'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='undef'
 d_dbminitproto='undef'
index 60d615b..d460097 100644 (file)
@@ -131,6 +131,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
index 2f5bc67..da97c1a 100644 (file)
@@ -131,6 +131,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
index 89e3242..ec90484 100644 (file)
@@ -131,6 +131,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
index 6e5c748..bcda881 100644 (file)
@@ -131,6 +131,7 @@ d_crypt_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
 d_csh='undef'
 d_ctermid_r='undef'
 d_ctime_r='undef'
+d_c99_variadic_macros='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'
 d_cuserid='undef'
 d_dbl_dig='define'
 d_dbminitproto='undef'