diff options
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 6c5a5f38..ac2cbac8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2,7 +2,7 @@ dnl Macros for auto-configure script. dnl written feb/1997 dnl by T.E.Dickey <dickey@clark.net> dnl and Jim Spath <jspath@mail.bcpl.lib.md.us> - +dnl dnl --------------------------------------------------------------------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. Also, don't add /usr/local/include if we're using gcc. @@ -27,6 +27,47 @@ do cf_add_incdir="$cf_top_incdir" done done +])dnl +dnl --------------------------------------------------------------------------- +dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' +dnl in the sharutils 4.2 distribution. +AC_DEFUN([CF_ANSI_CC], +[ +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(cf_cv_ansi_cc,[ +cf_cv_ansi_cc=no +cf_save_CFLAGS="$CFLAGS" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) +for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc +do + CFLAGS="$cf_save_CFLAGS $cf_arg" + AC_TRY_COMPILE( +[ +#ifndef CC_HAS_PROTOS +#if !defined(__STDC__) || __STDC__ != 1 +choke me +#endif +#endif +],[ + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);};], + [cf_cv_ansi_cc="$cf_arg"; break]) +done +CFLAGS="$cf_save_CFLAGS" +]) +AC_MSG_RESULT($cf_cv_ansi_cc) +if test "$cf_cv_ansi_cc" != "no"; then +if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then + CFLAGS="$CFLAGS $cf_cv_ansi_cc" +fi +fi ]) dnl --------------------------------------------------------------------------- dnl Check for existence of alternate-character-set support in curses, so we |