1 dnl AC_SYS_COMPILER_FLAG, taken from the Pike 7.5 distribution at http://pike.ida.liu.se
2 dnl $Id: ac_pike_compiler_flag.m4,v 1.3 2004/05/13 21:50:08 dnelson Exp $
4 # option, cache_name, variable, do_if_failed, do_if_ok
5 AC_DEFUN([AC_PIKE_COMPILER_FLAG],
7 AC_MSG_CHECKING(for $1)
8 AC_CACHE_VAL(pike_cv_option_$2,
10 OLD_CPPFLAGS="[$]CPPFLAGS"
11 CPPFLAGS="[$]OLD_CPPFLAGS $1"
12 old_ac_link="[$]ac_link"
13 ac_link="[$]old_ac_link 2>conftezt.out.2"
16 int main(int argc, char **argv)
18 /* The following code triggs gcc:s generation of aline opcodes,
19 * which some versions of as does not support.
21 if (argc > 0) argc = 0;
24 ],pike_cv_option_$2=yes,
25 pike_cv_option_$2=no, [
26 AC_TRY_LINK([], [], pike_cv_option_$2=yes, pike_cv_option_$2=no)
28 if grep -i 'unrecognized option' <conftezt.out.2 >/dev/null; then
30 elif grep -i 'unknown option' <conftezt.out.2 >/dev/null; then
31 # cc/HPUX says the following regarding -q64:
33 # cc: warning 422: Unknown option "6" ignored.
34 # cc: warning 422: Unknown option "4" ignored.
36 elif grep -i 'optimizer bugs' <conftezt.out.2 >/dev/null; then
37 # gcc/FreeBSD-4.6/alpha says the following regarding -O2:
41 # *** The -O2 flag TRIGGERS KNOWN OPTIMIZER BUGS ON THIS PLATFORM
44 elif grep -i 'not found' <conftezt.out.2 >/dev/null; then
45 # cc/AIX says the following regarding +O3:
47 # cc: 1501-228 input file +O3 not found
49 elif grep -i 'ignored' <conftezt.out.2 >/dev/null; then
50 # gcc/AIX says the following regarding -fpic:
52 # cc1: warning: -fpic ignored (all code is position independent)
56 CPPFLAGS="[$]OLD_CPPFLAGS"
57 ac_link="[$]old_ac_link"
60 if test x"[$]pike_cv_option_$2" = "xyes" ; then