2005-12-30 20:40:34 +01:00
|
|
|
dnl **************************************************
|
|
|
|
dnl Copyright (C) 2004 Matteo Settenvini
|
|
|
|
dnl **************************************************
|
|
|
|
|
2006-02-20 22:26:08 +01:00
|
|
|
dnl ---------- AC_CHECK_CXXFLAG ---------------------
|
2005-12-30 20:40:34 +01:00
|
|
|
dnl This macro checks if a particular flag for the
|
2006-02-20 22:26:08 +01:00
|
|
|
dnl C++ compiler works. If it is so, it puts the flag
|
|
|
|
dnl into the first macro parameter.
|
|
|
|
dnl Example of usage : AC_CHECK_CXXFLAG([CXXFLAGS],[Wall])
|
2005-12-30 20:40:34 +01:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
AC_DEFUN([AC_CHECK_CXXFLAG],
|
2006-02-20 22:26:08 +01:00
|
|
|
[ if test -z "$1" -o -z "$2"; then
|
|
|
|
AC_MSG_FAILURE([Wrong parameters passed to the m4 macro.
|
|
|
|
Please contact the package mantainer.])
|
|
|
|
fi
|
|
|
|
AC_REQUIRE([AC_PROG_CXX])dnl
|
|
|
|
AC_MSG_CHECKING([whether $CXX supports the -$2 flag])
|
2005-12-30 20:40:34 +01:00
|
|
|
ac_check_cxxflags=$CXXFLAGS
|
2006-02-20 22:26:08 +01:00
|
|
|
CXXFLAGS="-$2"
|
2005-12-30 20:40:34 +01:00
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
AC_LANG_PROGRAM([], [return 0;]),
|
|
|
|
[AC_MSG_RESULT([yes])
|
2006-02-20 22:26:08 +01:00
|
|
|
CXXFLAGS="$ac_check_cxxflags"
|
|
|
|
$1="-$2 $[$1]" ],
|
2005-12-30 20:40:34 +01:00
|
|
|
[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
|
2006-02-20 22:26:08 +01:00
|
|
|
dnl into the first macro parameter.
|
|
|
|
dnl Example of usage : AC_CHECK_CFLAG([CFLAGS],[Wall])
|
2005-12-30 20:40:34 +01:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
AC_DEFUN([AC_CHECK_CFLAG],
|
2006-02-20 22:26:08 +01:00
|
|
|
[ if test -z "$1" -o -z "$2"; then
|
|
|
|
AC_MSG_FAILURE([Wrong parameters passed to the m4 macro.
|
|
|
|
Please contact the package mantainer.])
|
|
|
|
fi
|
|
|
|
AC_REQUIRE([AC_PROG_CC])dnl
|
|
|
|
AC_MSG_CHECKING([whether $CC supports the -$2 flag])
|
2005-12-30 20:40:34 +01:00
|
|
|
ac_check_cflags=$CFLAGS
|
2006-02-20 22:26:08 +01:00
|
|
|
CFLAGS="-$2"
|
2005-12-30 20:40:34 +01:00
|
|
|
AC_LANG_PUSH([C])
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
AC_LANG_PROGRAM([], [return 0;]),
|
|
|
|
[AC_MSG_RESULT([yes])
|
2006-02-20 22:26:08 +01:00
|
|
|
CFLAGS="$ac_check_cflags"
|
|
|
|
$1="-$2 $[$1]" ],
|
2005-12-30 20:40:34 +01:00
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
CFLAGS=$ac_check_cflags ]
|
|
|
|
)
|
|
|
|
AC_LANG_POP
|
|
|
|
])dnl ------- AC_CHECK_CFLAG ----------------------
|
|
|
|
|