diff options
author | Luis Pabon <lpabon@redhat.com> | 2014-02-09 21:57:45 -0500 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2014-02-12 13:30:21 -0800 |
commit | 58d7ef2f7628744db4c7bf8bf5735671e023f1d7 (patch) | |
tree | 0bbc34a95630a12060dece85f64387f2724f80b5 | |
parent | 8eb83e6d9a91c813275f1cbc8e0dc5423fb1ccc0 (diff) |
build: CFLAGS was being polluted by python flags
The CFLAGS were being polluted by the python test for glupy. The
test also sets CFLAGS -NDEBUG even when passing --enable-debug to
configure.
To fix it, the patch now saves the necessary python flags into
new makefile flags which can now be used by the glupy Makefile.am.
BUG: 1063541
Change-Id: I8546a64b8ad4fe9318a97fb6a2f0c36087be1b29
Signed-off-by: Luis Pabon <lpabon@redhat.com>
Reviewed-on: http://review.gluster.org/6957
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
-rw-r--r-- | configure.ac | 52 | ||||
-rw-r--r-- | xlators/features/glupy/src/Makefile.am | 6 |
2 files changed, 35 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac index 010e270975e..0c516c4fdd7 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,18 @@ AC_PROG_CC AC_DISABLE_STATIC AC_PROG_LIBTOOL +# Initialize CFLAGS before usage +AC_ARG_ENABLE([debug], + AC_HELP_STRING([--enable-debug], + [Enable debug build options.])) +if test "x$enable_debug" = "xyes"; then + BUILD_DEBUG=yes + CFLAGS="-g -O0 -DDEBUG" +else + BUILD_DEBUG=no + CFLAGS="-g -O2" +fi + AC_ARG_WITH(pkgconfigdir, [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@], [pkgconfigdir=$withval], @@ -696,14 +708,14 @@ fi case $host_os in linux*) GF_HOST_OS="GF_LINUX_HOST_OS" - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\"" ;; solaris*) GF_HOST_OS="GF_SOLARIS_HOST_OS" - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -O0 -m64" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64" GF_LDFLAGS="" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" @@ -727,7 +739,7 @@ case $host_os in ;; *bsd*) GF_HOST_OS="GF_BSD_HOST_OS" - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" @@ -740,10 +752,10 @@ case $host_os in darwin*) GF_HOST_OS="GF_DARWIN_HOST_OS" LIBTOOL=glibtool - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE -O0" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" - GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace -O0" + GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse" ;; @@ -795,6 +807,8 @@ AM_PATH_PYTHON() if echo $PYTHON_VERSION | grep ^2; then have_python2=yes fi + +# Save flags before testing python saved_CFLAGS=$CFLAGS saved_CPPFLAGS=$CPPFLAGS saved_LDFLAGS=$LDFLAGS @@ -809,9 +823,12 @@ case x$enable_glupy in xyes) if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then BUILD_GLUPY=yes - saved_CFLAGS="$saved_CFLAGS $CFLAGS" - saved_CPPFLAGS="$saved_CPPFLAGS $CPPFLAGS" - saved_LDFLAGS="$saved_LDFLAGS $LDFLAGS" + 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 @@ -821,9 +838,12 @@ case x$enable_glupy in *) if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then BUILD_GLUPY=yes - saved_CFLAGS="$saved_CFLAGS $CFLAGS" - saved_CPPFLAGS="$saved_CPPFLAGS $CPPFLAGS" - saved_LDFLAGS="$saved_LDFLAGS $LDFLAGS" + PYTHONDEV_CFLAGS="$CFLAGS" + PYTHONDEV_CPPFLAGS="$CPPFLAGS" + PYTHONDEV_LDFLAGS="$LDFLAGS" + AC_SUBST(PYTHONDEV_CFLAGS) + AC_SUBST(PYTHONDEV_CPPFLAGS) + AC_SUBST(PYTHONDEV_LDFLAGS) else AC_MSG_WARN([ --------------------------------------------------------------------------------- @@ -832,6 +852,7 @@ case x$enable_glupy in fi ;; esac +# Restore flags CFLAGS=$saved_CFLAGS CPPFLAGS=$saved_CPPFLAGS LDFLAGS=$saved_LDFLAGS @@ -851,15 +872,6 @@ if test "x$BUILD_GLUPY" = "xyes"; then fi # end glupy section -# Other stuff (most notably the glupy section) might have injected another -O2 -# into CFLAGS, so *do this last*. -BUILD_DEBUG=no -if test "x$enable_debug" = "xyes"; then - BUILD_DEBUG=yes - CFLAGS=`echo $CFLAGS | sed -e s/O2/O0/g` -else - BUILD_DEBUG=no -fi AC_SUBST(CFLAGS) # end enable debug section diff --git a/xlators/features/glupy/src/Makefile.am b/xlators/features/glupy/src/Makefile.am index 9608628398f..21b91a16455 100644 --- a/xlators/features/glupy/src/Makefile.am +++ b/xlators/features/glupy/src/Makefile.am @@ -6,15 +6,15 @@ glupydir = $(xlatordir)/glupy glupy_PYTHON = gluster.py negative.py helloworld.py debug-trace.py -glupy_la_LDFLAGS = -module -avoid-version -shared -nostartfiles +glupy_la_LDFLAGS = $(PYTHONDEV_LDFLAGS) -module -avoid-version -shared -nostartfiles glupy_la_SOURCES = glupy.c glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ -lpthread -l$(BUILD_PYTHON_LIB) noinst_HEADERS = glupy.h -AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) +AM_CPPFLAGS = $(PYTHONDEV_CPPFLAGS) $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) -AM_CFLAGS = -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) +AM_CFLAGS = $(PYTHONDEV_CFLAGS) -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) CLEANFILES = |