sgpemv2/m4/compilerflags.m4

51 lines
1.6 KiB
Plaintext
Raw Normal View History

dnl **************************************************
dnl Copyright (C) 2004 Matteo Settenvini
dnl **************************************************
dnl ---------- AX_CHECK_CXXFLAG ---------------------
dnl This macro checks if a particular flag for the
dnl C++ compiler works. If it is so, it adds the flag
dnl to the CXXFLAGS variable.
dnl Example of usage : AC_CHECK_CXXFLAG([Wall])
dnl -------------------------------------------------
AC_DEFUN([AC_CHECK_CXXFLAG],
[ AC_REQUIRE([AC_PROG_CXX])dnl
AC_MSG_CHECKING([whether $CXX supports the -$1 flag])
ac_check_cxxflags=$CXXFLAGS
CXXFLAGS="-$1"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [return 0;]),
[AC_MSG_RESULT([yes])
CXXFLAGS="-$1 $ac_check_cxxflags" ],
[AC_MSG_RESULT([no])
CXXFLAGS=$ac_check_cxxflags ]
)
AC_LANG_POP
])dnl ------- AC_CHECK_CXXFLAG ----------------------
dnl ---------- AC_CHECK_CFLAG ---------------------
dnl This macro checks if a particular flag for the
dnl C compiler works. If it is so, it adds the flag
dnl to the CFLAGS variable.
dnl Example of usage : AC_CHECK_CFLAG([Wall])
dnl -------------------------------------------------
AC_DEFUN([AC_CHECK_CFLAG],
[ AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([whether $CC supports the -$1 flag])
ac_check_cflags=$CFLAGS
CFLAGS="-$1"
AC_LANG_PUSH([C])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [return 0;]),
[AC_MSG_RESULT([yes])
CFLAGS="-$1 $ac_check_cflags" ],
[AC_MSG_RESULT([no])
CFLAGS=$ac_check_cflags ]
)
AC_LANG_POP
])dnl ------- AC_CHECK_CFLAG ----------------------