From 18cfa35a67584affb2e08360899288a039da7372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 6 May 2009 17:16:15 +0000 Subject: (hopefully) better handling of the arch-stuff: keeping cppflags and cflags separate svn path=/trunk/externals/iem/iemmatrix/; revision=11246 --- src/acinclude.m4 | 59 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'src/acinclude.m4') diff --git a/src/acinclude.m4 b/src/acinclude.m4 index 30a5080..613f7e3 100644 --- a/src/acinclude.m4 +++ b/src/acinclude.m4 @@ -3,51 +3,70 @@ dnl This file is free software; IOhannes m zm dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -# AC_CHECK_CXXFLAGS(ADDITIONAL-CXXFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# AC_CHECK_CPPFLAGS(ADDITIONAL-CPPFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) # -# checks whether the $(CXX) compiler accepts the ADDITIONAL-CXXFLAGS -# if so, they are added to the CXXFLAGS -AC_DEFUN([AC_CHECK_CXXFLAGS], +# checks whether the $(C) compiler accepts the ADDITIONAL-CPPFLAGS +# if so, they are added to the CPPFLAGS +AC_DEFUN([AC_CHECK_CPPFLAGS], [ - AC_MSG_CHECKING([whether $CXX accepts "$1"]) -cat > conftest.c++ << EOF + AC_MSG_CHECKING([whether $CPP accepts "$1"]) + temp_check_cppflags="${CPPFLAGS}" + CPPFLAGS="$1 ${CPPFLAGS}" + AC_PREPROC_IFELSE( + [AC_LANG_SOURCE([[int main(void){return 0;}]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]); CPPFLAGS="${temp_check_cppflags}"]) +])# AC_CHECK_CPPFLAGS + + + +# AC_CHECK_CFLAGS(ADDITIONAL-CFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# +# checks whether the $(C) compiler accepts the ADDITIONAL-CFLAGS +# if so, they are added to the CFLAGS +AC_DEFUN([AC_CHECK_CFLAGS], +[ + AC_MSG_CHECKING([whether $CC accepts "$1"]) +cat > conftest.c << EOF int main(){ return 0; } EOF -if $CXX $CPPFLAGS $CXXFLAGS -o conftest.o conftest.c++ [$1] > /dev/null 2>&1 +if $CC $CFLAGS [$1] -o conftest.o conftest.c > /dev/null 2>&1 then AC_MSG_RESULT([yes]) - CXXFLAGS="${CXXFLAGS} [$1]" + CFLAGS="${CFLAGS} [$1]" + AC_CHECK_CPPFLAGS([$1]) [$2] else AC_MSG_RESULT([no]) [$3] fi -])# AC_CHECK_CXXFLAGS +])# AC_CHECK_CFLAGS -# AC_CHECK_CFLAGS(ADDITIONAL-CFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# AC_CHECK_CXXFLAGS(ADDITIONAL-CXXFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) # -# checks whether the $(C) compiler accepts the ADDITIONAL-CFLAGS -# if so, they are added to the CFLAGS -AC_DEFUN([AC_CHECK_CFLAGS], +# checks whether the $(CXX) (c++) compiler accepts the ADDITIONAL-CXXFLAGS +# if so, they are added to the CXXFLAGS +AC_DEFUN([AC_CHECK_CXXFLAGS], [ - AC_MSG_CHECKING([whether $CC accepts "$1"]) -cat > conftest.c << EOF + AC_MSG_CHECKING([whether $CXX accepts "$1"]) +cat > conftest.c++ << EOF int main(){ return 0; } EOF -if $CC $CFLAGS [$1] -o conftest.o conftest.c > /dev/null 2>&1 +if $CXX $CPPFLAGS $CXXFLAGS -o conftest.o conftest.c++ [$1] > /dev/null 2>&1 then AC_MSG_RESULT([yes]) - CFLAGS="${CFLAGS} [$1]" + CXXFLAGS="${CXXFLAGS} [$1]" + AC_CHECK_CPPFLAGS([$1]) [$2] else AC_MSG_RESULT([no]) [$3] fi -])# AC_CHECK_CFLAGS +])# AC_CHECK_CXXFLAGS # AC_CHECK_FRAMEWORK(FRAMEWORK, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) # @@ -131,15 +150,11 @@ if test "$fat_binary" != no; then done if test "x$[]Name" != "x"; then - tmp_arch_cflags="$CFLAGS" AC_CHECK_CFLAGS($[]Name,,[]Name="") - CFLAGS="$tmp_arch_cflags" fi if test "x$[]Name" != "x"; then - tmp_arch_ldflags="$LDFLAGS" AC_CHECK_LDFLAGS($[]Name,,[]Name="") - LDFLAGS="$tmp_arch_ldflags" fi undefine([Name]) -- cgit v1.2.1