From: Thomas Graf Date: Thu, 11 Sep 2014 19:34:21 +0000 (+0200) Subject: build: Respect CFLAGS and LDFLAGS passed to make X-Git-Tag: v2.4.0~1438 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=95626395a3dbd91b69af80207d79b3ecab7643c9 build: Respect CFLAGS and LDFLAGS passed to make configure cannot expect that the user will not pass additional CFLAGS and LDFLAGS at make time [0]. Use OVS_CFLAGS and OVS_LDFLAGS instead to collect compiler and linker flags and substitute in Makefile.am. This allows for: ./configure --with-dpdk=[...] make CFLAGS=-Wno-error=foo [0] http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html Signed-off-by: Thomas Graf Signed-off-by: Ben Pfaff --- diff --git a/Makefile.am b/Makefile.am index 161936d64..4c48e73a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,7 @@ SUBDIRS = datapath AM_CPPFLAGS = $(SSL_CFLAGS) AM_LDFLAGS = $(SSL_LDFLAGS) +AM_LDFLAGS += $(OVS_LDFLAGS) if WIN32 AM_CPPFLAGS += -I $(top_srcdir)/include/windows @@ -29,6 +30,7 @@ AM_CPPFLAGS += $(SSL_INCLUDES) AM_CFLAGS = -Wstrict-prototypes AM_CFLAGS += $(WARNING_FLAGS) +AM_CFLAGS += $(OVS_CFLAGS) if NDEBUG AM_CPPFLAGS += -DNDEBUG diff --git a/acinclude.m4 b/acinclude.m4 index b0794d24c..742862db2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -22,7 +22,7 @@ AC_DEFUN([OVS_ENABLE_WERROR], [], [enable_Werror=no]) AC_CONFIG_COMMANDS_PRE( [if test "X$enable_Werror" = Xyes; then - CFLAGS="$CFLAGS -Werror" + OVS_CFLAGS="$OVS_CFLAGS -Werror" fi])]) dnl OVS_CHECK_LINUX @@ -172,6 +172,8 @@ AC_DEFUN([OVS_CHECK_DPDK], [ DPDK_LIB_DIR=$RTE_SDK/lib DPDK_LIB=-lintel_dpdk + ovs_save_CFLAGS="$CFLAGS" + ovs_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$DPDK_LIB_DIR" CFLAGS="$CFLAGS -I$DPDK_INCLUDE" @@ -199,6 +201,10 @@ AC_DEFUN([OVS_CHECK_DPDK], [ if $found; then :; else AC_MSG_ERROR([cannot link with dpdk]) fi + CFLAGS="$ovs_save_CFLAGS" + LDFLAGS="$ovs_save_LDFLAGS" + OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" + OVS_CFLAGS="$OVS_CFLAGS -I$DPDK_INCLUDE" # DPDK 1.7.0 pmd drivers are not linked unless --whole-archive is used. # diff --git a/configure.ac b/configure.ac index f1c9f9f31..35e884ab2 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,8 @@ AC_SUBST(KARCH) OVS_CHECK_LINUX OVS_CHECK_DPDK OVS_CHECK_PRAGMA_MESSAGE +AC_SUBST([OVS_CFLAGS]) +AC_SUBST([OVS_LDFLAGS]) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(datapath/Makefile) diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index d54483b2b..6e24f2569 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -30,8 +30,8 @@ AC_DEFUN([OVS_CHECK_COVERAGE], esac], [coverage=false]) if $coverage; then - CFLAGS="$CFLAGS -O0 --coverage" - LDFLAGS="$LDFLAGS --coverage" + OVS_CFLAGS="$OVS_CFLAGS -O0 --coverage" + OVS_LDFLAGS="$OVS_LDFLAGS --coverage" fi]) dnl Checks for --enable-ndebug and defines NDEBUG if it is specified.