1
# Use this file to store miscellaneous macros related to checking
4
############################################################################
6
# SIM_AC_CC_COMPILER_OPTION(OPTION-TO-TEST, ACTION-IF-TRUE [, ACTION-IF-FALSE])
7
# SIM_AC_CXX_COMPILER_OPTION(OPTION-TO-TEST, ACTION-IF-TRUE [, ACTION-IF-FALSE])
11
# Check whether the current C or C++ compiler can handle a
12
# particular command-line option.
15
# Author: Morten Eriksen, <mortene@sim.no>.
17
# * [mortene:19991218] improve macros by catching and analyzing
18
# stderr (at least to see if there was any output there)?
21
AC_DEFUN([SIM_AC_COMPILER_OPTION], [
22
sim_ac_save_cppflags=$CPPFLAGS
23
CPPFLAGS="$CPPFLAGS $1"
24
AC_TRY_COMPILE([], [], [sim_ac_accept_result=yes], [sim_ac_accept_result=no])
25
AC_MSG_RESULT([$sim_ac_accept_result])
26
CPPFLAGS=$sim_ac_save_cppflags
27
# This need to go last, in case CPPFLAGS is modified in $2 or $3.
28
if test $sim_ac_accept_result = yes; then
35
AC_DEFUN([SIM_AC_CC_COMPILER_OPTION], [
38
AC_MSG_CHECKING([whether $CC accepts $1])
39
SIM_AC_COMPILER_OPTION($1, $2, $3)
43
AC_DEFUN([SIM_AC_CXX_COMPILER_OPTION], [
46
AC_MSG_CHECKING([whether $CXX accepts $1])
47
SIM_AC_COMPILER_OPTION($1, $2, $3)