From 0b3b86e1b0c4d164fd85b5437ba4148acfbdd564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sat, 7 Jan 2006 17:18:30 +0000 Subject: checks for compiler-flags (i should commit them to a autoconf repository) svn path=/trunk/externals/zexy/; revision=4374 --- src/acinclude.m4 | 95 ++++++++++++++++++++++++++++++++++++++++++++++++ src/aclocal.m4 | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 src/acinclude.m4 create mode 100644 src/aclocal.m4 diff --git a/src/acinclude.m4 b/src/acinclude.m4 new file mode 100644 index 0000000..4a7ae76 --- /dev/null +++ b/src/acinclude.m4 @@ -0,0 +1,95 @@ +dnl Copyright (C) 2005-2006 IOhannes m zmölnig +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) +# +# checks whether the $(CXX) compiler accepts the ADDITIONAL-CXXFLAGS +# if so, they are added to the CXXFLAGS +AC_DEFUN([AC_CHECK_CXXFLAGS], +[ + AC_MSG_CHECKING([whether $CXX 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 +then + AC_MSG_RESULT([yes]) + CXXFLAGS="${CXXFLAGS} [$1]" + [$2] +else + AC_MSG_RESULT([no]) + [$3] +fi +])# AC_CHECK_CXXFLAGS + +# 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 $CC $CFLAGS -o conftest.o conftest.c++ [$1] > /dev/null 2>&1 +then + AC_MSG_RESULT([yes]) + CFLAGS="${CFLAGS} [$1]" + [$2] +else + AC_MSG_RESULT([no]) + [$3] +fi +])# AC_CHECK_CFLAGS + +# AC_CHECK_FRAMEWORK(FRAMEWORK, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# +# +AC_DEFUN([AC_CHECK_FRAMEWORK], +[ + AC_MSG_CHECKING([for "$1"-framework]) + + temp_check_ldflags_org="${LDFLAGS}" + LDFLAGS="-framework [$1] ${LDFLAGS}" + + AC_LINK_IFELSE(AC_LANG_PROGRAM(,), [temp_check_ldflags_success="yes"],[temp_check_ldflags_success="no"]) + + if test "x$temp_check_ldflags_success" = "xyes"; then + AC_MSG_RESULT([yes]) + [$2] + else + AC_MSG_RESULT([no]) + LDFLAGS="$temp_check_ldflags_org" + [$3] + fi +])# AC_CHECK_FRAMEWORK + +# AC_CHECK_LDFLAGS(ADDITIONAL-LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# +# checks whether the $(LD) linker accepts the ADDITIONAL-LDFLAGS +# if so, they are added to the LDFLAGS +AC_DEFUN([AC_CHECK_LDFLAGS], +[ + AC_MSG_CHECKING([whether linker accepts "$1"]) + temp_check_ldflags_org="${LDFLAGS}" + LDFLAGS="$1 ${LDFLAGS}" + + AC_LINK_IFELSE(AC_LANG_PROGRAM(,), [temp_check_ldflags_success="yes"],[temp_check_ldflags_success="no"]) + + if test "x$temp_check_ldflags_success" = "xyes"; then + AC_MSG_RESULT([yes]) + [$2] + else + AC_MSG_RESULT([no]) + LDFLAGS="$temp_check_ldflags_org" + [$3] + fi +])# AC_CHECK_LDFLAGS + diff --git a/src/aclocal.m4 b/src/aclocal.m4 new file mode 100644 index 0000000..74ce492 --- /dev/null +++ b/src/aclocal.m4 @@ -0,0 +1,109 @@ +# generated automatically by aclocal 1.7.9 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +dnl Copyright (C) 2005-2006 IOhannes m zmölnig +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) +# +# checks whether the $(CXX) compiler accepts the ADDITIONAL-CXXFLAGS +# if so, they are added to the CXXFLAGS +AC_DEFUN([AC_CHECK_CXXFLAGS], +[ + AC_MSG_CHECKING([whether $CXX 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 +then + AC_MSG_RESULT([yes]) + CXXFLAGS="${CXXFLAGS} [$1]" + [$2] +else + AC_MSG_RESULT([no]) + [$3] +fi +])# AC_CHECK_CXXFLAGS + +# 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 $CC $CFLAGS -o conftest.o conftest.c++ [$1] > /dev/null 2>&1 +then + AC_MSG_RESULT([yes]) + CFLAGS="${CFLAGS} [$1]" + [$2] +else + AC_MSG_RESULT([no]) + [$3] +fi +])# AC_CHECK_CFLAGS + +# AC_CHECK_FRAMEWORK(FRAMEWORK, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# +# +AC_DEFUN([AC_CHECK_FRAMEWORK], +[ + AC_MSG_CHECKING([for "$1"-framework]) + + temp_check_ldflags_org="${LDFLAGS}" + LDFLAGS="-framework [$1] ${LDFLAGS}" + + AC_LINK_IFELSE(AC_LANG_PROGRAM(,), [temp_check_ldflags_success="yes"],[temp_check_ldflags_success="no"]) + + if test "x$temp_check_ldflags_success" = "xyes"; then + AC_MSG_RESULT([yes]) + [$2] + else + AC_MSG_RESULT([no]) + LDFLAGS="$temp_check_ldflags_org" + [$3] + fi +])# AC_CHECK_FRAMEWORK + +# AC_CHECK_LDFLAGS(ADDITIONAL-LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# +# checks whether the $(LD) linker accepts the ADDITIONAL-LDFLAGS +# if so, they are added to the LDFLAGS +AC_DEFUN([AC_CHECK_LDFLAGS], +[ + AC_MSG_CHECKING([whether linker accepts "$1"]) + temp_check_ldflags_org="${LDFLAGS}" + LDFLAGS="$1 ${LDFLAGS}" + + AC_LINK_IFELSE(AC_LANG_PROGRAM(,), [temp_check_ldflags_success="yes"],[temp_check_ldflags_success="no"]) + + if test "x$temp_check_ldflags_success" = "xyes"; then + AC_MSG_RESULT([yes]) + [$2] + else + AC_MSG_RESULT([no]) + LDFLAGS="$temp_check_ldflags_org" + [$3] + fi +])# AC_CHECK_LDFLAGS + + -- cgit v1.2.1