From 95c3e2b2e8f5a5dc336ff668f797cf78360a2f6c Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 12 Nov 2013 10:27:45 +0100 Subject: [PATCH] add -Qunused-arguments option to clang --- configure.ac | 29 ++++++++++++++++++++++++++--- tools/Makefile.am | 3 +-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 90191ab53..2ebc0d7bb 100644 --- a/configure.ac +++ b/configure.ac @@ -35,9 +35,17 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],) AC_SUBST([docdir], [${datadir}/doc]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) +case $target in + *apple-darwin*) + AC_PROG_CXX(["xcrun clang++" g++]) + AC_PROG_CC(["xcrun clang" gcc]) + ;; + *) + AC_PROG_CC + AC_PROG_CXX + ;; +esac AC_ISC_POSIX -AC_PROG_CC -AC_PROG_CXX AC_C_INLINE AC_HEADER_STDC AM_PROG_CC_C_O @@ -73,6 +81,9 @@ case $target in esac + + + AC_SUBST(ACLOCAL_MACOS_FLAGS) AC_SUBST(CONSOLE_FLAGS) AC_SUBST(GUI_FLAGS) @@ -598,8 +609,20 @@ AC_ARG_ENABLE(strict, [strictness=yes] ) -STRICT_OPTIONS="-Wall " +STRICT_OPTIONS="-Wall" +#for clang + +LDFLAGS_SAV=$LDFLAGS +LDFLAGS="$LDFLAGS -Qunused-arguments -Wall -Werror" +AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + [[]])] + , [cc_option_q_allowed=yes] + , [cc_option_q_allowed=no]) +LD_FLAGS=$LDFLAGS_SAV +if test $cc_option_q_allowed = "yes"; then + STRICT_OPTIONS="$STRICT_OPTIONS -Qunused-arguments" +fi if test "$strictness" = "yes" ; then STRICT_OPTIONS="$STRICT_OPTIONS -Werror" CFLAGS="$CFLAGS -fno-strict-aliasing" diff --git a/tools/Makefile.am b/tools/Makefile.am index d0e6d350a..6fa7fadb4 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -2,8 +2,7 @@ AM_CPPFLAGS=\ -I$(top_srcdir) \ - -I$(top_srcdir)/coreapi \ - -I$(top_srcdir)/exosip + -I$(top_srcdir)/coreapi COMMON_CFLAGS=\ -DIN_LINPHONE \