apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r230416 - /apr/apr/trunk/build/apr_common.m4
Date Fri, 05 Aug 2005 08:49:33 GMT
Author: jorton
Date: Fri Aug  5 01:49:30 2005
New Revision: 230416

URL: http://svn.apache.org/viewcvs?rev=230416&view=rev
Log:
* build/apr_common.m4 (APR_TRY_COMPILE_NO_WARNING): Rewrite to use
AC_COMPILE_IFELSE; fix quoting to avoid always triggering a warning in
the main() definition.

PR: 36032

Modified:
    apr/apr/trunk/build/apr_common.m4

Modified: apr/apr/trunk/build/apr_common.m4
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/build/apr_common.m4?rev=230416&r1=230415&r2=230416&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_common.m4 (original)
+++ apr/apr/trunk/build/apr_common.m4 Fri Aug  5 01:49:30 2005
@@ -471,40 +471,29 @@
 
 dnl
 dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
-dnl             [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl             [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
 dnl
 dnl Tries a compile test with warnings activated so that the result
-dnl is false if the code doesn't compile cleanly.
+dnl is false if the code doesn't compile cleanly.  For compilers
+dnl where it is not known how to activate a "fail-on-error" mode,
+dnl it is undefined which of the sets of actions will be run.
 dnl
-AC_DEFUN(APR_TRY_COMPILE_NO_WARNING,
-[if test "x$CFLAGS_WARN" = "x"; then
-  apr_tcnw_flags=""
-else
-  apr_tcnw_flags=$CFLAGS_WARN
-fi
-if test "$ac_cv_prog_gcc" = "yes"; then 
-  apr_tcnw_flags="$apr_tcnw_flags -Werror"
-fi
-changequote(', ')
-cat > conftest.$ac_ext <<EOTEST
-#include "confdefs.h"
-'$1'
-int main(int argc, const char * const argv[]) {
-'$2'
-; return 0; }
-EOTEST
-changequote([, ])
-if ${CC-cc} -c $CFLAGS $CPPFLAGS $apr_tcnw_flags conftest.$ac_ext 2>&AC_FD_CC ; then
-  ifelse([$3], , :, [rm -rf conftest*
-  $3])
-else
-  echo "configure: failed or warning program:" >&AC_FD_CC
-  cat conftest.$ac_ext >&AC_FD_CC
-  ifelse([$4], , , [rm -rf conftest*
-  $4])
-fi
-rm -f conftest*
-])dnl
+AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
+[apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_prog_gcc" = "yes"; then 
+   CFLAGS="$CFLAGS -Werror"
+ fi
+ AC_COMPILE_IFELSE(
+  [#include "confdefs.h"
+  ]
+  [[$1]]
+  [int main(int argc, const char *const *argv) {]
+  [[$2]]
+  [   return 0; }],
+  [$3], [$4])
+ CFLAGS=$apr_save_CFLAGS
+])
 
 dnl
 dnl APR_CHECK_STRERROR_R_RC



Mime
View raw message