aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-05-06 17:16:15 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-05-06 17:16:15 +0000
commit18cfa35a67584affb2e08360899288a039da7372 (patch)
treeb5aac2e40f21229c48cd58b9f1aac3e4f772f8ec
parentae746c1cedfd6504f0cd69f69a99367878a07e33 (diff)
(hopefully) better handling of the arch-stuff: keeping cppflags and cflags separate
svn path=/trunk/externals/iem/iemmatrix/; revision=11246
-rw-r--r--src/Make.config.in11
-rw-r--r--src/Makefile2
-rw-r--r--src/acinclude.m459
-rw-r--r--src/configure.ac2
4 files changed, 42 insertions, 32 deletions
diff --git a/src/Make.config.in b/src/Make.config.in
index e38e9d5..838d0ee 100644
--- a/src/Make.config.in
+++ b/src/Make.config.in
@@ -20,14 +20,11 @@ LD = @LD@
STRIP = @STRIP@
STRIPFLAGS= @STRIPFLAGS@
-LFLAGS = @LFLAGS@
WFLAGS =
-AFLAGS = @ARCH_FLAGS@
-
-LIBRARY_CFLAGS = $(IFLAGS) $(DEFS) $(BUILDLIBRARY) -DPD $(WFLAGS) @CFLAGS@ $(CFLAGS)
-
-MAKEDEP_FLAGS = @MAKEDEP_FLAGS@
CONFIGUREFLAGS = @CONFIGUREFLAGS@
-
+MAKEDEP_FLAGS = @MAKEDEP_FLAGS@
+LIBRARY_CPPFLAGS = $(IFLAGS) $(DEFS) $(BUILDLIBRARY) -DPD $(WFLAGS) @CPPFLAGS@ $(CFLAGS)
+LFLAGS = @LFLAGS@
+LIBRARY_CFLAGS = $(IFLAGS) $(DEFS) $(BUILDLIBRARY) -DPD $(WFLAGS) @CFLAGS@ $(CFLAGS)
LIBS = @LIBS@
diff --git a/src/Makefile b/src/Makefile
index 6003f32..3271686 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -45,7 +45,7 @@ ifdef MAKEDEP_FLAGS
## see http://www.gnu.org/software/make/manual/html_node/make_47.html#SEC51
%.d: %.c
@set -e; rm -f $@; \
- $(CPP) $(MAKEDEP_FLAGS) $(LIBRARY_CFLAGS) $< > $@.$$$$; \
+ $(CPP) $(MAKEDEP_FLAGS) $(LIBRARY_CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
endif
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ölnig
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])
diff --git a/src/configure.ac b/src/configure.ac
index 6986703..2003445 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -126,8 +126,6 @@ fi
### can we build fat-binaries
AC_CHECK_FAT(ARCH_FLAGS)
-AC_SUBST(ARCH_FLAGS)
-
dnl isn't there a better way to check for good linker/stripper ?