summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-05-13 15:48:24 +0000
committerNicholas Clark <nick@ccl4.org>2006-05-13 15:48:24 +0000
commit9802685f01199cb057aa21dd571a78932fb81070 (patch)
tree97b27073562777d68d3bc888d7510329bf246022 /Configure
parentfd655d330c4a545eb836be2bf58736622e036e45 (diff)
downloadperl-9802685f01199cb057aa21dd571a78932fb81070.tar.gz
A Configure probe for C99 variadic macros, based on code from Jarkko.
p4raw-id: //depot/perl@28189
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure42
1 files changed, 42 insertions, 0 deletions
diff --git a/Configure b/Configure
index 6ddb054323..a4b4887fc7 100755
--- a/Configure
+++ b/Configure
@@ -383,6 +383,7 @@ d_ctermid_r=''
ctime_r_proto=''
d_ctime_r=''
d_cuserid=''
+d_c99_variadic_macros=''
d_dbl_dig=''
d_dbminitproto=''
d_difftime=''
@@ -19164,6 +19165,46 @@ EOCP
;;
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
@@ -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_c99_variadic_macros='$d_c99_variadic_macros'
d_dbl_dig='$d_dbl_dig'
d_dbminitproto='$d_dbminitproto'
d_difftime='$d_difftime'