aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-03-18 16:26:05 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-03-18 16:26:05 +0100
commitecf953432d8605836ada71ee45e606cc693b93ba (patch)
tree02e1d6e3091f52e6b1590c56dffbf39fc1006329
parent7e312bdfddb8135df49e6da8e7759f26ebdf4fa3 (diff)
configure: use cpp -P when needed
Since gcc 5, the processor output can get split up on multiple lines that made the configure script fail to figure out values from definitions. The fix is to use cpp -P, and this fix now first checks if cpp -P is necessary and then if cpp -P works before it uses that to extract defined values. Fixes #719
-rw-r--r--acinclude.m451
1 files changed, 50 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 4f25ac636..2c2e51b90 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -20,7 +20,6 @@
#
#***************************************************************************
-
dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
dnl -------------------------------------------------
dnl Use the C preprocessor to find out if the given object-style symbol
@@ -31,6 +30,10 @@ dnl result in a set of double-quoted strings the returned expansion will
dnl actually be a single double-quoted string concatenating all them.
AC_DEFUN([CURL_CHECK_DEF], [
+ AC_REQUIRE([CURL_CPP_P])dnl
+ OLDCPPFLAGS=$CPPFLAGS
+ # CPPPFLAGS comes from CURL_CPP_P
+ CPPFLAGS="$CPPPFLAGS"
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
if test -z "$SED"; then
@@ -67,6 +70,7 @@ CURL_DEF_TOKEN $1
fi
AS_VAR_POPDEF([ac_Def])dnl
AS_VAR_POPDEF([ac_HaveDef])dnl
+ CPPFLAGS=$OLDCPPFLAGS
])
@@ -3147,3 +3151,48 @@ use vars qw(
1;
_EOF
])
+
+dnl CURL_CPP_P
+dnl
+dnl Check if $cpp -P should be used for extract define values due to gcc 5
+dnl splitting up strings and defines between line outputs. gcc by default
+dnl (without -P) will show TEST EINVAL TEST as
+dnl
+dnl # 13 "conftest.c"
+dnl TEST
+dnl # 13 "conftest.c" 3 4
+dnl 22
+dnl # 13 "conftest.c"
+dnl TEST
+
+AC_DEFUN([CURL_CPP_P], [
+ AC_MSG_CHECKING([if cpp -P is needed])
+ AC_EGREP_CPP([TEST.*TEST], [
+ #include <errno.h>
+TEST EINVAL TEST
+ ], [cpp=no], [cpp=yes])
+ AC_MSG_RESULT([$cpp])
+
+ dnl we need cpp -P so check if it works then
+ if test "x$cpp" = "xyes"; then
+ AC_MSG_CHECKING([if cpp -P works])
+ OLDCPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -P"
+ AC_EGREP_CPP([TEST.*TEST], [
+ #include <errno.h>
+TEST EINVAL TEST
+ ], [cpp_p=yes], [cpp_p=no])
+ AC_MSG_RESULT([$cpp_p])
+
+ if test "x$cpp_p" = "xno"; then
+ AC_MSG_WARN([failed to figure out cpp -P alternative])
+ # without -P
+ CPPPFLAGS=$OLDCPPFLAGS
+ else
+ # with -P
+ CPPPFLAGS=$CPPFLAGS
+ fi
+ dnl restore CPPFLAGS
+ CPPFLAGS=$OLDCPPFLAGS
+ fi
+])