From: Peter Johnson Date: Thu, 20 Sep 2001 07:02:05 +0000 (-0000) Subject: Check for snprintf (used in Check suite). Also define _GNU_SOURCE for Check X-Git-Tag: v0.1.0~310 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a002baa1df07ec4bfad35f5338825b45515ef7db;p=yasm Check for snprintf (used in Check suite). Also define _GNU_SOURCE for Check to stop warnings on Linux. svn path=/trunk/yasm/; revision=208 --- diff --git a/check/check_msg.c b/check/check_msg.c index cba6b83f..d88d7820 100644 --- a/check/check_msg.c +++ b/check/check_msg.c @@ -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; } diff --git a/check/check_run.c b/check/check_run.c index 8ff0aaa0..90673fc9 100644 --- a/check/check_run.c +++ b/check/check_run.c @@ -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; } diff --git a/configure.ac b/configure.ac index ab07d5de..3586b37f 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/configure.in b/configure.in index ab07d5de..3586b37f 100644 --- a/configure.in +++ b/configure.in @@ -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