From 44d5d43b3b8e141d194fc39465ed79e779f0f4b5 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 15 Oct 2013 09:16:36 -0700 Subject: [PATCH] FS-5819: configure fix for new clang detection and adjust cflags for building with newest clang --- build/config/ax_compiler_vendor.m4 | 2 +- configure.in | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/build/config/ax_compiler_vendor.m4 b/build/config/ax_compiler_vendor.m4 index a24a58da0f..b506b78aae 100644 --- a/build/config/ax_compiler_vendor.m4 +++ b/build/config/ax_compiler_vendor.m4 @@ -3,7 +3,7 @@ AC_DEFUN([AX_COMPILER_VENDOR], AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown # note: don't check for gcc first since some other compilers define __GNUC__ - for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ #if !($vencpp) diff --git a/configure.in b/configure.in index c24897e5e4..ecca14cf11 100644 --- a/configure.in +++ b/configure.in @@ -172,11 +172,19 @@ SWITCH_AM_LDFLAGS="-lm" #set SOLINK variable based on compiler and host if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then SOLINK="-Bdynamic -dy -G" -elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then +elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then case "$host" in - *darwin12.*|*darwin11.*|*darwin10.*) + *darwin*) SOLINK="-dynamic -force-flat-namespace" ;; + *) + AC_ERROR([Please update configure.in with SOLINK values for your compiler]) + ;; + + esac +elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then + case "$host" in +# older Xcode test for darwin, Xcode 4/5 use clang above *darwin*) SOLINK="-dynamic -bundle -force-flat-namespace" ;; @@ -190,7 +198,6 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then else AC_ERROR([Please update configure.in with SOLINK values for your compiler]) fi - # set DYNAMIC_LIB_EXTEN # we should really be using libtool so we don't need to do this case "$host" in @@ -727,6 +734,16 @@ if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then fi CFLAGS="$saved_CFLAGS" +# Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off +AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [ +AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no]) +]) +AC_MSG_RESULT($ac_cv_clang_extended_offsetof) +if test x"$ac_cv_clang_extended_offsetof" = xyes; then + APR_ADDTO(CFLAGS, -Wno-extended-offsetof) +fi + + # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready # Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_skypopen mod_h323 mod_khomp # mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed