]> granicus.if.org Git - yasm/commitdiff
Check for snprintf (used in Check suite). Also define _GNU_SOURCE for Check
authorPeter Johnson <peter@tortall.net>
Thu, 20 Sep 2001 07:02:05 +0000 (07:02 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 20 Sep 2001 07:02:05 +0000 (07:02 -0000)
to stop warnings on Linux.

svn path=/trunk/yasm/; revision=208

check/check_msg.c
check/check_run.c
configure.ac
configure.in

index cba6b83f98638f9cd804d920f61778c0a20729db..d88d7820ff873f8af4f410772b44d03cc6c5809d 100644 (file)
@@ -71,7 +71,11 @@ static LastLocMsg *create_last_loc_msg (char *file, int line)
 {
   LastLocMsg *m = emalloc (sizeof(LastLocMsg));
   m->message_type = (long int) LASTLOCMSG;
+#ifdef HAVE_SNPRINTF
   snprintf(m->msg, CMAXMSG, "%s\n%d", file, line);
+#else
+  sprintf(m->msg, "%s\n%d", file, line);
+#endif
 
   return m;
 }
index 8ff0aaa0311f40b1173c09b0a44d91a641f575b7..90673fc9b8a8944028be609616d7f8bbfad8df2a 100644 (file)
@@ -379,7 +379,11 @@ char *tr_tcname (TestResult *tr)
 static char *signal_msg (int signal)
 {
   char *msg = emalloc (CMAXMSG); /* free'd by caller */
+#ifdef HAVE_SNPRINTF
   snprintf(msg, CMAXMSG, "Received signal %d", signal);
+#else
+  sprintf(msg, "Received signal %d", signal);
+#endif
   return msg;
 }
 #endif
@@ -387,8 +391,12 @@ static char *signal_msg (int signal)
 static char *exit_msg (int exitval)
 {
   char *msg = emalloc(CMAXMSG); /* free'd by caller */
+#ifdef HAVE_SNPRINTF
   snprintf(msg, CMAXMSG,
           "Early exit with return value %d", exitval);
+#else
+  sprintf(msg, "Early exit with return value %d", exitval);
+#endif
   return msg;
 }
 
index ab07d5de256dec64602b4d5bb4c294cb8643f9ee..3586b37f59381d701d79c3cb8ddb931f66d8ab0d 100644 (file)
@@ -104,7 +104,7 @@ fi
 # Check for stuff wanted by the test suite.  None of this is required.
 CHECK_CFLAGS=
 if ${check}; then
-       AC_CHECK_FUNCS(fork wait msgctl msgget msgrcv msgsnd strerror)
+       AC_CHECK_FUNCS(fork wait msgctl msgget msgrcv msgsnd strerror snprintf)
        if test "$ac_cv_func_fork" = yes &&
           test "$ac_cv_func_wait" = yes &&
           test "$ac_cv_func_msgctl" = yes &&
@@ -112,7 +112,7 @@ if ${check}; then
           test "$ac_cv_func_msgrcv" = yes &&
           test "$ac_cv_func_msgsnd" = yes; then
                AC_DEFINE(USE_FORKWAITMSG)
-               CHECK_CFLAGS="-D_SVID_SOURCE"
+               CHECK_CFLAGS="-D_SVID_SOURCE -D_GNU_SOURCE"
        fi
        AC_TYPE_PID_T
        AC_HEADER_SYS_WAIT
index ab07d5de256dec64602b4d5bb4c294cb8643f9ee..3586b37f59381d701d79c3cb8ddb931f66d8ab0d 100644 (file)
@@ -104,7 +104,7 @@ fi
 # Check for stuff wanted by the test suite.  None of this is required.
 CHECK_CFLAGS=
 if ${check}; then
-       AC_CHECK_FUNCS(fork wait msgctl msgget msgrcv msgsnd strerror)
+       AC_CHECK_FUNCS(fork wait msgctl msgget msgrcv msgsnd strerror snprintf)
        if test "$ac_cv_func_fork" = yes &&
           test "$ac_cv_func_wait" = yes &&
           test "$ac_cv_func_msgctl" = yes &&
@@ -112,7 +112,7 @@ if ${check}; then
           test "$ac_cv_func_msgrcv" = yes &&
           test "$ac_cv_func_msgsnd" = yes; then
                AC_DEFINE(USE_FORKWAITMSG)
-               CHECK_CFLAGS="-D_SVID_SOURCE"
+               CHECK_CFLAGS="-D_SVID_SOURCE -D_GNU_SOURCE"
        fi
        AC_TYPE_PID_T
        AC_HEADER_SYS_WAIT