summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-11 01:08:30 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-11 01:21:14 -0500
commitc937e0d5c579863677e0fcb5508517f7714c332d (patch)
tree3d1988d1e17457297f5bedd7f95afcda72668372
parentff47c895c8c2132ef98ef4182213a0ba79eefb73 (diff)
build-sys: add -U_FORTIFY_SOURCE to $PYTHON_CFLAGS when necessary
This patch only adds one line, but moves python detection after cflags detection, so the result of the latter can be used in the former. $PYTHON_CFLAGS usually includes -D_FORTIFY_SOURCE, which will generate a warning when compiling without optimization. Avoid by undefining _FORTIFY_SOURCE.
-rw-r--r--configure.ac64
1 files changed, 34 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac
index d94af7b304..56694ff22a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,36 +93,6 @@ if test -z "$GPERF" ; then
AC_MSG_ERROR([*** gperf not found])
fi
-# we use python to build the man page index, and for systemd-python
-have_python=no
-have_python_devel=no
-
-AC_ARG_WITH([python],
- [AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
-
-AS_IF([test "x$with_python" != "xno"], [
- AM_PATH_PYTHON(,, [:])
- AS_IF([test "$PYTHON" != :], [have_python=yes])
-])
-AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
-AS_IF([test "x$PYTHON_BINARY" = "x"],
- [AS_IF([test "x$have_python" = "xyes"],
- [PYTHON_BINARY="`which "$PYTHON"`"],
- [PYTHON_BINARY=/usr/bin/python])])
-AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
-
-AS_IF([test "x$with_python" != "xno"], [
- AC_PATH_PROG(PYTHON_CONFIG, python${PYTHON_VERSION}-config)
- AS_IF([test -n "$PYTHON_CONFIG"], [
- have_python_devel=yes
- PYTHON_CFLAGS="`$PYTHON_CONFIG --cflags`"
- PYTHON_LIBS="`$PYTHON_CONFIG --ldflags`"
- AC_SUBST(PYTHON_CFLAGS)
- AC_SUBST(PYTHON_LIBS)
- ])
-])
-AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
-
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-pipe \
-Wall \
@@ -168,6 +138,7 @@ AC_SUBST([OUR_CFLAGS], $with_cflags)
AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-Wp,-D_FORTIFY_SOURCE=2])], [
+ python_extra_cflags=-Wp,-U_FORTIFY_SOURCE
AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
@@ -178,6 +149,39 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,-z,now])
AC_SUBST([OUR_LDFLAGS], $with_ldflags)
+# ------------------------------------------------------------------------------
+# we use python to build the man page index, and for systemd-python
+have_python=no
+have_python_devel=no
+
+AC_ARG_WITH([python],
+ [AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
+
+AS_IF([test "x$with_python" != "xno"], [
+ AM_PATH_PYTHON(,, [:])
+ AS_IF([test "$PYTHON" != :], [have_python=yes])
+])
+AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
+AS_IF([test "x$PYTHON_BINARY" = "x"],
+ [AS_IF([test "x$have_python" = "xyes"],
+ [PYTHON_BINARY="`which "$PYTHON"`"],
+ [PYTHON_BINARY=/usr/bin/python])])
+AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
+
+AS_IF([test "x$with_python" != "xno"], [
+ AC_PATH_PROG(PYTHON_CONFIG, python${PYTHON_VERSION}-config)
+ AS_IF([test -n "$PYTHON_CONFIG"], [
+ have_python_devel=yes
+ PYTHON_CFLAGS="`$PYTHON_CONFIG --cflags` $python_extra_cflags"
+ PYTHON_LIBS="`$PYTHON_CONFIG --ldflags`"
+ AC_SUBST(PYTHON_CFLAGS)
+ AC_SUBST(PYTHON_LIBS)
+ ])
+])
+AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
+
+# ------------------------------------------------------------------------------
+
AC_SEARCH_LIBS([mq_open], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])