1999-10-31 Ben Elliston <bje@cygnus.com>
+ * acspecific.m4 (AC_PROG_CC_STDC, AC_C_PROTOTYPES): Inherit from
+ Automake. From Franc,ois Pinard.
+ * autoconf.texi (Particular Programs): Document AC_PROG_CC_STDC.
+ (C Compiler Characteristics): Document AC_C_PROTOTYPES.
+
* testsuite/autoconf.s/defines.exp: Changed `fail' and `pass' in
`xfail' and `xpass'. The testsuite checks that acconfig.h
templates the AC_DEFINEs. Since we no longer rely on acconfig.h,
1999-10-27 Ben Elliston <bje@cygnus.com>
- * THANKS: Updated Alexandre's address.
-
* autoconf.texi (Generic Programs): @defmac for AC_PATH_TOOL may
not span multiple lines.
Document and ask for the registration of an envvar.
- AC_CONFIG_LINKS
Replaces the now obsolete AC_LINK_FILES.
+ - AC_PROG_CC_STDC
+ Checks if the compiler supports ISO C, included when needs special
+ options.
+
* Environment variables are kept when reconfiguring.
The previous scheme to set envvar before running configure was
ENV=VAL ./configure
** Move AM_PROG_CC_STDC into Autoconf.
Autoconf should provide the means to determine the ANSIsm of the
compiler, not Automake.
+I've done it, but this is the last opportunity to change this macro
+name: AC_PROG_CC_ISO? Or even more specific for the ISO version?
** Provide means to provides commands to run before AC_OUTPUT.
This is what is needed for LTLIBOBJS and others.
fi
])
+
dnl AC_PROG_CC_WORKS
dnl ----------------
AC_DEFUN(AC_PROG_CC_WORKS,
cross_compiling=$ac_cv_prog_cc_cross
])
+
dnl AC_PROG_CXX_WORKS
dnl -----------------
AC_DEFUN(AC_PROG_CXX_WORKS,
cross_compiling=$ac_cv_prog_cxx_cross
])
+
dnl AC_PROG_F77_WORKS
dnl -----------------
dnl Test whether the Fortran 77 compiler can compile and link a trivial
cross_compiling=$ac_cv_prog_f77_cross
])
+
dnl AC_PROG_CC_GNU
dnl --------------
AC_DEFUN(AC_PROG_CC_GNU,
ac_cv_prog_gcc=no
fi])])
+
dnl AC_PROG_CXX_GNU
dnl ---------------
AC_DEFUN(AC_PROG_CXX_GNU,
ac_cv_prog_gxx=no
fi])])
+
dnl AC_PROG_F77_GNU
dnl ---------------
dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77
rm -f conftest*
])])
+
+dnl AC_PROG_GCC_TRADITIONAL
+dnl -----------------------
AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
CC="$CC -traditional"
fi
fi
-])
+])dnl AC_PROG_GCC_TRADITIONAL
+
dnl AC_PROG_CC_C_O
dnl --------------
])dnl AC_PROG_CC_C_O
+dnl AC_PROG_F77_C_O
+dnl ---------------
dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o'
dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not.
dnl
dnl The usefulness of this macro is questionable, as I can't really see
dnl why anyone would use it. The only reason I include it is for
dnl completeness, since a similar test exists for the C compiler.
-dnl
-dnl AC_PROG_F77_C_O
AC_DEFUN(AC_PROG_F77_C_O,
[AC_BEFORE([$0], [AC_PROG_F77])dnl
AC_MSG_CHECKING(whether $F77 understand -c and -o together)
AC_DEFINE(F77_NO_MINUS_C_MINUS_O, 1,
[Define if your Fortran 77 compiler doesn't accept -c and -o together.])
fi
+])dnl AC_PROG_F77_C_O
+
+
+dnl AC_PROG_CC_STDC
+dnl ---------------
+dnl If the C compiler in not in ANSI C mode by default, try to add an
+dnl option to output variable @code{CC} to make it so. This macro tries
+dnl various options that select ANSI C on some system or another. It
+dnl considers the compiler to be in ANSI C mode if it handles function
+dnl prototypes correctly.
+AC_DEFUN(AC_PROG_CC_STDC,
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_BEFORE([$0], [AC_C_INLINE])dnl
+AC_BEFORE([$0], [AC_C_CONST])dnl
+dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
+dnl a magic option to avoid problems with ANSI preprocessor commands
+dnl like #elif.
+dnl FIXME: can't do this because then AC_AIX won't work due to a
+dnl circular dependency.
+dnl AC_BEFORE([$0], [AC_PROG_CPP])
+AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
+AC_CACHE_VAL(ac_cv_prog_cc_stdc,
+[ac_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# 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 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_TRY_COMPILE(
+[#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+], [
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+],
+[ac_cv_prog_cc_stdc="$ac_arg"; break])
+done
+CC="$ac_save_CC"
])
+if test -z "$ac_cv_prog_cc_stdc"; then
+ AC_MSG_RESULT([none needed])
+else
+ AC_MSG_RESULT($ac_cv_prog_cc_stdc)
+fi
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+])dnl AC_PROG_CC_STDC
+
dnl AC_PROG_MAKE_SET
dnl ----------------
fi
])
+dnl AC_C_INLINE
+dnl -----------
dnl Do nothing if the compiler accepts the inline keyword.
dnl Otherwise define inline to __inline__ or __inline if one of those work,
dnl otherwise define inline to be empty.
esac
])
+
+dnl AC_C_CONST
+dnl ----------
AC_DEFUN(AC_C_CONST,
[dnl This message is consistent in form with the other checking messages,
dnl and with the result message.
AC_DEFINE(const,,
[Define to empty if the keyword `const' does not work.])
fi
-])
+])dnl AC_C_CONST
+
dnl AC_C_VOLATILE
dnl -------------
fi
])
+
dnl AC_C_STRINGIZE
dnl --------------
dnl Checks if `#' can be used to glue strings together at the CPP level.
[Define if you have the ANSI # stringizing operator in cpp.])
fi
AC_MSG_RESULT([${ac_cv_c_stringize}])
-])dnl
+])dnl AC_C_STRINGIZE
+
+
+dnl AC_C_PROTOTYPES
+dnl ---------------
+dnl Check if the C compiler supports prototypes, included if it needs
+dnl options.
+AC_DEFUN(AC_C_PROTOTYPES,
+[AC_REQUIRE([AC_PROG_CC_STDC])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_MSG_CHECKING([for function prototypes])
+if test "$ac_cv_prog_cc_stdc" != no; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PROTOTYPES, 1,
+ [Define if the compiler supports function prototypes.])
+else
+ AC_MSG_RESULT(no)
+fi
+])dnl AC_C_PROTOTYPES
+
define(AC_ARG_ARRAY,
[AC_FATAL([$0 has been removed; don't do non-portable things with arguments], 4)])
simultaneously, define @code{NO_MINUS_C_MINUS_O}.
@end defmac
+@defmac AC_PROG_CC_STDC
+@maindex PROG_CC_STDC
+@ovindex CC
+If the C compiler in not in ANSI C mode by default, try to add an option
+to output variable @code{CC} to make it so. This macro tries various
+options that select ANSI C on some system or another. It considers the
+compiler to be in ANSI C mode if it handles function prototypes
+correctly.
+
+If you use this macro, you should check after calling it whether the C
+compiler has been set to accept ANSI C; if not, the shell variable
+@code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
+code in ANSI C, you can make an un-ANSIfied copy of it by using the
+program @code{ansi2knr}, which comes with Ghostscript.
+@end defmac
+
+
@defmac AC_PROG_CPP
@maindex PROG_CPP
@ovindex CPP
volatile, but does not defined @code{__STDC__}.
@end defmac
-
@defmac AC_C_INLINE
@maindex C_INLINE
@cvindex inline
@end example
@end defmac
+@defmac AC_C_PROTOTYPES
+@maindex C_PROTOTYPES
+@cvindex PROTOTYPES
+@cvindex PARAMS
+Check to see if function prototypes are understood by the compiler. If
+so, define @samp{PROTOTYPES}. In the case the compiler does not handle
+prototypes, you should use @code{ansi2knr}, which comes with the
+Ghostscript distribution, to unprotoize function definitions. For
+function prototypes, you should first define @code{PARAMS}:
+@example
+#ifndef PARAMS
+# if PROTOTYPES
+# define PARAMS(protos) protos
+# else /* no PROTOTYPES */
+# define PARAMS(protos) ()
+# endif /* no PROTOTYPES */
+#endif
+@end example
+then use it this way:
+@example
+size_t my_strlen PARAMS ((const char *));
+@end example
+@end defmac
+
+@c FIXME: What the heck is this macro doing here? Move it out of
+@c the way, in its proper section!!!
@defmac AC_CHECK_SIZEOF (@var{type} @r{[}, @var{cross-size}@r{[}, @var{includes}@r{]]})
@maindex CHECK_SIZEOF
Define @code{SIZEOF_@var{uctype}} to be the size in bytes of the C (or
simultaneously, define @code{NO_MINUS_C_MINUS_O}.
@end defmac
+@defmac AC_PROG_CC_STDC
+@maindex PROG_CC_STDC
+@ovindex CC
+If the C compiler in not in ANSI C mode by default, try to add an option
+to output variable @code{CC} to make it so. This macro tries various
+options that select ANSI C on some system or another. It considers the
+compiler to be in ANSI C mode if it handles function prototypes
+correctly.
+
+If you use this macro, you should check after calling it whether the C
+compiler has been set to accept ANSI C; if not, the shell variable
+@code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
+code in ANSI C, you can make an un-ANSIfied copy of it by using the
+program @code{ansi2knr}, which comes with Ghostscript.
+@end defmac
+
+
@defmac AC_PROG_CPP
@maindex PROG_CPP
@ovindex CPP
volatile, but does not defined @code{__STDC__}.
@end defmac
-
@defmac AC_C_INLINE
@maindex C_INLINE
@cvindex inline
@end example
@end defmac
+@defmac AC_C_PROTOTYPES
+@maindex C_PROTOTYPES
+@cvindex PROTOTYPES
+@cvindex PARAMS
+Check to see if function prototypes are understood by the compiler. If
+so, define @samp{PROTOTYPES}. In the case the compiler does not handle
+prototypes, you should use @code{ansi2knr}, which comes with the
+Ghostscript distribution, to unprotoize function definitions. For
+function prototypes, you should first define @code{PARAMS}:
+@example
+#ifndef PARAMS
+# if PROTOTYPES
+# define PARAMS(protos) protos
+# else /* no PROTOTYPES */
+# define PARAMS(protos) ()
+# endif /* no PROTOTYPES */
+#endif
+@end example
+then use it this way:
+@example
+size_t my_strlen PARAMS ((const char *));
+@end example
+@end defmac
+
+@c FIXME: What the heck is this macro doing here? Move it out of
+@c the way, in its proper section!!!
@defmac AC_CHECK_SIZEOF (@var{type} @r{[}, @var{cross-size}@r{[}, @var{includes}@r{]]})
@maindex CHECK_SIZEOF
Define @code{SIZEOF_@var{uctype}} to be the size in bytes of the C (or
fi
])
+
dnl AC_PROG_CC_WORKS
dnl ----------------
AC_DEFUN(AC_PROG_CC_WORKS,
cross_compiling=$ac_cv_prog_cc_cross
])
+
dnl AC_PROG_CXX_WORKS
dnl -----------------
AC_DEFUN(AC_PROG_CXX_WORKS,
cross_compiling=$ac_cv_prog_cxx_cross
])
+
dnl AC_PROG_F77_WORKS
dnl -----------------
dnl Test whether the Fortran 77 compiler can compile and link a trivial
cross_compiling=$ac_cv_prog_f77_cross
])
+
dnl AC_PROG_CC_GNU
dnl --------------
AC_DEFUN(AC_PROG_CC_GNU,
ac_cv_prog_gcc=no
fi])])
+
dnl AC_PROG_CXX_GNU
dnl ---------------
AC_DEFUN(AC_PROG_CXX_GNU,
ac_cv_prog_gxx=no
fi])])
+
dnl AC_PROG_F77_GNU
dnl ---------------
dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77
rm -f conftest*
])])
+
+dnl AC_PROG_GCC_TRADITIONAL
+dnl -----------------------
AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
CC="$CC -traditional"
fi
fi
-])
+])dnl AC_PROG_GCC_TRADITIONAL
+
dnl AC_PROG_CC_C_O
dnl --------------
])dnl AC_PROG_CC_C_O
+dnl AC_PROG_F77_C_O
+dnl ---------------
dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o'
dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not.
dnl
dnl The usefulness of this macro is questionable, as I can't really see
dnl why anyone would use it. The only reason I include it is for
dnl completeness, since a similar test exists for the C compiler.
-dnl
-dnl AC_PROG_F77_C_O
AC_DEFUN(AC_PROG_F77_C_O,
[AC_BEFORE([$0], [AC_PROG_F77])dnl
AC_MSG_CHECKING(whether $F77 understand -c and -o together)
AC_DEFINE(F77_NO_MINUS_C_MINUS_O, 1,
[Define if your Fortran 77 compiler doesn't accept -c and -o together.])
fi
+])dnl AC_PROG_F77_C_O
+
+
+dnl AC_PROG_CC_STDC
+dnl ---------------
+dnl If the C compiler in not in ANSI C mode by default, try to add an
+dnl option to output variable @code{CC} to make it so. This macro tries
+dnl various options that select ANSI C on some system or another. It
+dnl considers the compiler to be in ANSI C mode if it handles function
+dnl prototypes correctly.
+AC_DEFUN(AC_PROG_CC_STDC,
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_BEFORE([$0], [AC_C_INLINE])dnl
+AC_BEFORE([$0], [AC_C_CONST])dnl
+dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
+dnl a magic option to avoid problems with ANSI preprocessor commands
+dnl like #elif.
+dnl FIXME: can't do this because then AC_AIX won't work due to a
+dnl circular dependency.
+dnl AC_BEFORE([$0], [AC_PROG_CPP])
+AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
+AC_CACHE_VAL(ac_cv_prog_cc_stdc,
+[ac_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# 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 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_TRY_COMPILE(
+[#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+], [
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+],
+[ac_cv_prog_cc_stdc="$ac_arg"; break])
+done
+CC="$ac_save_CC"
])
+if test -z "$ac_cv_prog_cc_stdc"; then
+ AC_MSG_RESULT([none needed])
+else
+ AC_MSG_RESULT($ac_cv_prog_cc_stdc)
+fi
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+])dnl AC_PROG_CC_STDC
+
dnl AC_PROG_MAKE_SET
dnl ----------------
fi
])
+dnl AC_C_INLINE
+dnl -----------
dnl Do nothing if the compiler accepts the inline keyword.
dnl Otherwise define inline to __inline__ or __inline if one of those work,
dnl otherwise define inline to be empty.
esac
])
+
+dnl AC_C_CONST
+dnl ----------
AC_DEFUN(AC_C_CONST,
[dnl This message is consistent in form with the other checking messages,
dnl and with the result message.
AC_DEFINE(const,,
[Define to empty if the keyword `const' does not work.])
fi
-])
+])dnl AC_C_CONST
+
dnl AC_C_VOLATILE
dnl -------------
fi
])
+
dnl AC_C_STRINGIZE
dnl --------------
dnl Checks if `#' can be used to glue strings together at the CPP level.
[Define if you have the ANSI # stringizing operator in cpp.])
fi
AC_MSG_RESULT([${ac_cv_c_stringize}])
-])dnl
+])dnl AC_C_STRINGIZE
+
+
+dnl AC_C_PROTOTYPES
+dnl ---------------
+dnl Check if the C compiler supports prototypes, included if it needs
+dnl options.
+AC_DEFUN(AC_C_PROTOTYPES,
+[AC_REQUIRE([AC_PROG_CC_STDC])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_MSG_CHECKING([for function prototypes])
+if test "$ac_cv_prog_cc_stdc" != no; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PROTOTYPES, 1,
+ [Define if the compiler supports function prototypes.])
+else
+ AC_MSG_RESULT(no)
+fi
+])dnl AC_C_PROTOTYPES
+
define(AC_ARG_ARRAY,
[AC_FATAL([$0 has been removed; don't do non-portable things with arguments], 4)])