Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] (PR#6360) configure check for variable arrays
Home

[Freeciv-Dev] (PR#6360) configure check for variable arrays

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6360) configure check for variable arrays
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 1 Oct 2003 13:59:22 -0700
Reply-to: rt@xxxxxxxxxxxxxx

This configure check will fail unless C99-style variable arrays are 
supported.

Since there are no users, it's not needed yet...

jason

Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.51
diff -u -r1.51 configure.ac
--- configure.ac        2003/10/01 20:48:44     1.51
+++ configure.ac        2003/10/01 20:58:22
@@ -264,6 +264,7 @@
 
 FC_DEBUG
 FC_VARIADIC_MACROS
+FC_VARIABLE_ARRAYS
 
 if test "$CVS_DEPS" = "maybe"; then
    dnl Should also check for gmake?
Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.227
diff -u -r1.227 configure.in
--- configure.in        2003/10/01 20:48:44     1.227
+++ configure.in        2003/10/01 20:58:22
@@ -263,6 +263,7 @@
 
 FC_DEBUG
 FC_VARIADIC_MACROS
+FC_VARIABLE_ARRAYS
 
 if test "$CVS_DEPS" = "maybe"; then
    dnl Should also check for gmake?
Index: m4/c99.m4
===================================================================
RCS file: /home/freeciv/CVS/freeciv/m4/c99.m4,v
retrieving revision 1.1
diff -u -r1.1 c99.m4
--- m4/c99.m4   2003/10/01 20:48:45     1.1
+++ m4/c99.m4   2003/10/01 20:58:22
@@ -18,8 +18,28 @@
            MSG("%s%d", "foo", 1);],
           ac_cv_c99_variadic_macros=yes,
           ac_cv_c99_variadic_macros=no)])
-  echo "${CFLAGS_save}"
   if test "x${ac_cv_c99_variadic_macros}" != "xyes"; then
     AC_MSG_ERROR([A compiler supporting C99 variadic macros is required])
+  fi
+])
+
+# Check C99-style variable-sized arrays (required):
+#
+#   char concat_str[strlen(s1) + strlen(s2) + 1];
+#
+AC_DEFUN(FC_VARIABLE_ARRAYS,
+[
+  dnl Check for variable arrays
+  AC_CACHE_CHECK([for C99 variable arrays],
+    [ac_cv_c99_variable_arrays],
+    [AC_TRY_COMPILE(
+        [],
+        [char *s1 = "foo", *s2 = "bar";
+         char s3[strlen(s1) + strlen(s2) + 1];
+         sprintf(s3, "%s%s", s1, s2);],
+        ac_cv_c99_variable_arrays=yes,
+        ac_cv_c99_variable_arrays=no)])
+  if test "x${ac_cv_c99_variable_arrays}" != "xyes"; then
+    AC_MSG_ERROR([A compiler supporting C99 variable arrays is required])
   fi
 ])

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#6360) configure check for variable arrays, Jason Short <=