aboutsummaryrefslogtreecommitdiff
path: root/src/acinclude.m4
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-05-06 15:34:20 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-05-06 15:34:20 +0000
commita329cfaf34c1e5f7b60e19a6e2609ebb0e33659a (patch)
tree8e8d0d912bc5d0fb87bf150a169a87e1becda714 /src/acinclude.m4
parent5eb7f197b0a2a6b90bc5dd0acaacf84462fb48cc (diff)
hopefully better tests for universal binary support
svn path=/trunk/externals/zexy/; revision=11243
Diffstat (limited to 'src/acinclude.m4')
-rw-r--r--src/acinclude.m458
1 files changed, 36 insertions, 22 deletions
diff --git a/src/acinclude.m4 b/src/acinclude.m4
index 30a5080..f546de5 100644
--- a/src/acinclude.m4
+++ b/src/acinclude.m4
@@ -3,51 +3,69 @@ 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]"
+ AC_CHECK_CPPFLAGS([$1])
+ CFLAGS="${CFLAGS} [$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]"
[$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 +149,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])