summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-05-14 19:23:09 +0200
committerVijay Bellur <vbellur@redhat.com>2016-06-29 09:54:02 -0700
commitf9a6eba4e0b31247116256545b3c12e1df88c0de (patch)
treecc3f495c5231d877feb9a7afa3d25e5f17afa6bb /configure.ac
parent82a5e6cdacd9310f04830c47fd22e0aa9b7b7251 (diff)
build: Filter -D_FORTIFY_SOURCE from CFLAGS
We use python-config to get recommended CFLAGS. It provides -D_FORTIFY_SOURCE=2 by default that conflicts with our --enable-debug option or a developer provided no-optimization option. Hence, filter it out from default CFLAGS. Cherry picked from commit 5e65701f2660d1be101da81bffea7721d4f9ece0: > Change-Id: Id80196baeb55415b1ea334e7b17143e56dfbadb3 > BUG: 1283948 > Co-authored-by: Kaleb S KEITHLEY <kkeithle@redhat.com> > Signed-off-by: Raghavendra Talur <rtalur@redhat.com> > Reviewed-on: http://review.gluster.org/12707 > Smoke: Gluster Build System <jenkins@build.gluster.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Change-Id: Id80196baeb55415b1ea334e7b17143e56dfbadb3 BUG: 1336137 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/14339 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: Anoop C S <anoopcs@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac133
1 files changed, 58 insertions, 75 deletions
diff --git a/configure.ac b/configure.ac
index e50b46d05ef..2cb4a18a63c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1161,92 +1161,75 @@ if test "x$LIBAIO" != "x"; then
BUILD_LIBAIO=yes
fi
-# glupy section
+dnl glupy section
BUILD_GLUPY=no
have_python2=no
have_Python_h=no
-AM_PATH_PYTHON()
-if echo $PYTHON_VERSION | grep ^2; then
- have_python2=yes
-fi
+AC_ARG_ENABLE([glupy], AS_HELP_STRING([--enable-glupy], [build glupy]))
+if test "x$enable_glupy" != "xno"; then enable_glupy=yes; fi
-# Save flags before testing python
-saved_CFLAGS=$CFLAGS
-saved_CPPFLAGS=$CPPFLAGS
-saved_LDFLAGS=$LDFLAGS
-
-# Use pkg-config to get runtime search patch missing from ${PYTHON}-config
-# Just do "true" on failure so that configure does not bail out
-PKG_CHECK_MODULES([PYTHON], "python-$PYTHON_VERSION",,true)
-CFLAGS="`${PYTHON}-config --cflags`"
-CPPFLAGS=$CFLAGS
-LDFLAGS="${PYTHON_LIBS} -L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
-
-AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
-AC_ARG_ENABLE([glupy],
- AS_HELP_STRING([--enable-glupy],
- [build glupy]))
-case x$enable_glupy in
- xyes)
- if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
- BUILD_GLUPY=yes
- PYTHONDEV_CFLAGS="$CFLAGS"
- PYTHONDEV_CPPFLAGS="$CPPFLAGS"
- PYTHONDEV_LDFLAGS="$LDFLAGS"
- AC_SUBST(PYTHONDEV_CFLAGS)
- AC_SUBST(PYTHONDEV_CPPFLAGS)
- AC_SUBST(PYTHONDEV_LDFLAGS)
- else
- AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
- fi
- ;;
- xno)
- ;;
- *)
- if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
- BUILD_GLUPY=yes
- PYTHONDEV_CFLAGS="$CFLAGS"
- PYTHONDEV_CPPFLAGS="$CPPFLAGS"
- PYTHONDEV_LDFLAGS="$LDFLAGS"
- AC_SUBST(PYTHONDEV_CFLAGS)
- AC_SUBST(PYTHONDEV_CPPFLAGS)
- AC_SUBST(PYTHONDEV_LDFLAGS)
- else
+if test "x$enable_glupy" = "xyes"; then
+ dnl Check if python exists
+ AM_PATH_PYTHON()
+ dnl Check if version matches that we require
+ if echo $PYTHON_VERSION | grep ^2; then
+ have_python2=yes
+ fi
+
+ dnl Use pkg-config to get runtime search patch missing from ${PYTHON}-config
+ dnl Just do "true" on failure so that configure does not bail out
+ PKG_CHECK_MODULES([PYTHON], "python-$PYTHON_VERSION",,true)
+
+ PYTHONDEV_CPPFLAGS="`${PYTHON}-config --cflags`"
+ dnl Edit out the flags that are not required or are conflicting
+ PYTHONDEV_CPPFLAGS=`echo ${PYTHONDEV_CPPFLAGS} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[[0-9]]//g'`
+
+ dnl Find python libs at user configured libdir and also "lib" under prefix
+ PYTHONDEV_LDFLAGS="${PYTHON_LIBS} -L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
+
+ BUILD_PYTHON_SITE_PACKAGES=`$PYTHON -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
+ BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
+ BUILD_PYTHON_LIB=python$PYTHON_VERSION
+
+ GLUPY_SUBDIR=glupy
+ GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
+ GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
+
+ dnl Now check for python header using the include path obtained above
+ AC_CHECK_HEADERS([${BUILD_PYTHON_INC}/Python.h],[have_Python_h=yes],[])
+
+ if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
+ case $host_os in
+ darwin*)
+ BUILD_GLUPY=no
+ ;;
+ *)
+ BUILD_GLUPY=yes
+ ;;
+ esac
+ else
AC_MSG_WARN([
---------------------------------------------------------------------------------
- cannot build glupy. python 2.x and python-devel/python-dev package are required.
+ cannot build glupy. python 2.x and python-devel/python-dev package are required.
---------------------------------------------------------------------------------])
- fi
- ;;
-esac
-# Restore flags
-CFLAGS=$saved_CFLAGS
-CPPFLAGS=$saved_CPPFLAGS
-LDFLAGS=$saved_LDFLAGS
+ fi
-case $host_os in
- darwin*)
- BUILD_GLUPY=no
- ;;
-esac
+ if test "x$BUILD_GLUPY" = "xyes"; then
+
+ echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
-if test "x$BUILD_GLUPY" = "xyes"; then
- BUILD_PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix='$prefix'))"`
- BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
- BUILD_PYTHON_LIB=python$PYTHON_VERSION
- GLUPY_SUBDIR=glupy
- GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
- GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
- echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
- AC_SUBST(BUILD_PYTHON_SITE_PACKAGES)
- AC_SUBST(BUILD_PYTHON_INC)
- AC_SUBST(BUILD_PYTHON_LIB)
- AC_SUBST(GLUPY_SUBDIR)
- AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
- AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
+ AC_SUBST(PYTHONDEV_CPPFLAGS)
+ AC_SUBST(PYTHONDEV_LDFLAGS)
+ AC_SUBST(BUILD_PYTHON_SITE_PACKAGES)
+ AC_SUBST(BUILD_PYTHON_INC)
+ AC_SUBST(BUILD_PYTHON_LIB)
+ AC_SUBST(GLUPY_SUBDIR)
+ AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
+ AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
+ fi
fi
-# end glupy section
+dnl end glupy section
dnl Check for userspace-rcu
PKG_CHECK_MODULES([URCU], [liburcu-bp])