aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2019-06-20 16:13:34 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2019-06-26 08:34:24 +0300
commite2b2e2357d6999f62ccecdd5a34adefb7a8735fa (patch)
tree5a3b1a4592741437fd022adc618662e4d6dc93b7 /configure.ac
parentc317e53fa7268154ca5a50cc2685ca9cdf2a89d8 (diff)
configure: default CFLAGS definition
If user defines CFLAGS do not add -march option as user defined flags may contain another -march or other related options. Automake sets CFLAGS to "-g -O2" by default, so CFLAGS check must to be done before AM_INIT. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Dmitry Eremin-Solenikov <deremin-solenikov@cavium.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 14 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 8f9de1489..ab5393dbf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,13 @@ AC_SUBST(ODPH_VERSION_MAJOR)
ODPH_VERSION_MINOR=odph_version_minor
AC_SUBST(ODPH_VERSION_MINOR)
+##########################################################################
+# Test if user has set CFLAGS. Automake initializes CFLAGS to "-g -O2"
+# by default.
+##########################################################################
+AS_IF([test "$ac_cv_env_CFLAGS_set" = ""], [user_cflags=0], [user_cflags=1])
+
+# Initialize automake
AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects foreign nostdinc -Wall -Werror])
AC_CONFIG_SRCDIR([include/odp/api/spec/init.h])
AM_CONFIG_HEADER([include/config.h])
@@ -216,12 +223,16 @@ AC_ARG_ENABLE([abi-compat],
[if test "x$enableval" = "xno"; then
ODP_ABI_COMPAT=0
abi_compat=no
+
#if there is no ABI compatibility the .so numbers are meaningless
ODP_LIBSO_VERSION=0:0:0
- # do not try -march=native for clang due to possible failures on
- # clang optimizations
+
+ # do not use -march=native with clang (due to possible failures on
+ # clang optimizations) or when user have defined CFLAGS (may contain
+ # another -march option).
$CC --version | grep -q clang
- if test $? -ne 0; then
+
+ if test $? -ne 0 -a $user_cflags -eq 0; then
ODP_CHECK_CFLAG([-march=native])
fi
fi])