From c6548f4079e179b93b548f617de668b9a0233b17 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 10 Jun 2019 10:25:42 +0200 Subject: [PATCH] configure: Add user-flags configure option configure.ac adds by optimization and debug flags by default. This is not always intended so conifgure option is added. Support for using this option in specfile is added too. Also fix GDB_CFLAGS typo. GDB_FLAGS (without C) is the correct name of variable to print in the summary. Signed-off-by: Jan Friesse --- Makefile.am | 5 +++++ configure.ac | 14 +++++++++++++- corosync-qdevice.spec.in | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 11f7149..00ac436 100644 --- a/Makefile.am +++ b/Makefile.am @@ -110,6 +110,11 @@ $(SPEC): $(SPEC).in -e "s#@DIRTY@#$$dirty#g" \ -e "s#@date@#$$date#g" \ $< > $@-t +if BUILD_USERFLAGS + sed -i -e "s#@bcond_userflags@#bcond_without#g" $@-t +else + sed -i -e "s#@bcond_userflags@#bcond_with#g" $@-t +endif if BUILD_RUNAUTOGEN sed -i -e "s#@bcond_runautogen@#bcond_without#g" $@-t else diff --git a/configure.ac b/configure.ac index cd3a58d..fbb45c0 100644 --- a/configure.ac +++ b/configure.ac @@ -136,6 +136,11 @@ AC_ARG_ENABLE([secure-build], [], [enable_secure_build="yes"]) +AC_ARG_ENABLE([user-flags], + [ --enable-user-flags : rely on user environment. ], + [ default="no" ]) +AM_CONDITIONAL(BUILD_USERFLAGS, test x$enable_user_flags = xyes) + AC_ARG_ENABLE([systemd], [ --enable-systemd : Build with libsystemd and install systemd service files],, [ enable_systemd="no" ]) @@ -244,6 +249,13 @@ else WERROR_CFLAGS="" fi +# don't add addtional cflags +if test "x${enable_user_flags}" = xyes; then + OPT_CFLAGS="" + GDB_FLAGS="" + EXTRA_WARNINGS="" +fi + if test "x${enable_secure_build}" = xyes; then # stolen from apache configure snippet AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [ @@ -358,7 +370,7 @@ AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}]) AC_MSG_RESULT([]) AC_MSG_RESULT([$PACKAGE build info:]) AC_MSG_RESULT([ Default optimization = ${OPT_CFLAGS}]) -AC_MSG_RESULT([ Default debug options = ${GDB_CFLAGS}]) +AC_MSG_RESULT([ Default debug options = ${GDB_FLAGS}]) AC_MSG_RESULT([ Extra compiler warnings = ${EXTRA_WARNING}]) AC_MSG_RESULT([ Env. defined CFLAG = ${ENV_CFLAGS}]) AC_MSG_RESULT([ Env. defined CPPFLAGS = ${ENV_CPPFLAGS}]) diff --git a/corosync-qdevice.spec.in b/corosync-qdevice.spec.in index 36c2c01..1179167 100644 --- a/corosync-qdevice.spec.in +++ b/corosync-qdevice.spec.in @@ -5,6 +5,7 @@ # Conditionals # Invoke "rpmbuild --without " or "rpmbuild --with " # to disable or enable specific features +%@bcond_userflags@ userflags %@bcond_runautogen@ runautogen %@bcond_systemd@ systemd @@ -64,6 +65,9 @@ BuildRequires: autoconf automake libtool %endif %{configure} \ +%if %{with userflags} + --enable-user-flags \ +%endif %if %{with systemd} --enable-systemd \ %endif