From 58dfd6b4420c1d0d9136dfa98829ccd17853b064 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 21 Dec 1996 01:56:50 +0000 Subject: copied from automake-1.1l --- m4/ccstdc.m4 | 61 ++++++++++++ m4/dmalloc.m4 | 21 ++++ m4/error.m4 | 13 +++ m4/gettext.m4 | 287 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/header.m4 | 12 +++ m4/init.m4 | 20 ++++ m4/install.m4 | 13 +++ m4/lcmessage.m4 | 14 +++ m4/lispdir.m4 | 38 ++++++++ m4/maintainer.m4 | 22 +++++ m4/mktime.m4 | 34 +++++++ m4/obstack.m4 | 15 +++ m4/progtest.m4 | 42 ++++++++ m4/protos.m4 | 25 +++++ m4/ptrdiff.m4 | 12 +++ m4/regex.m4 | 37 +++++++ m4/sanity.m4 | 19 ++++ m4/strtod.m4 | 69 +++++++++++++ m4/termios.m4 | 14 +++ m4/winsz.m4 | 35 +++++++ 20 files changed, 803 insertions(+) create mode 100644 m4/ccstdc.m4 create mode 100644 m4/dmalloc.m4 create mode 100644 m4/error.m4 create mode 100644 m4/gettext.m4 create mode 100644 m4/header.m4 create mode 100644 m4/init.m4 create mode 100644 m4/install.m4 create mode 100644 m4/lcmessage.m4 create mode 100644 m4/lispdir.m4 create mode 100644 m4/maintainer.m4 create mode 100644 m4/mktime.m4 create mode 100644 m4/obstack.m4 create mode 100644 m4/progtest.m4 create mode 100644 m4/protos.m4 create mode 100644 m4/ptrdiff.m4 create mode 100644 m4/regex.m4 create mode 100644 m4/sanity.m4 create mode 100644 m4/strtod.m4 create mode 100644 m4/termios.m4 create mode 100644 m4/winsz.m4 (limited to 'm4') diff --git a/m4/ccstdc.m4 b/m4/ccstdc.m4 new file mode 100644 index 000000000..727fea1f0 --- /dev/null +++ b/m4/ccstdc.m4 @@ -0,0 +1,61 @@ +## ----------------------------------------- ## +## ANSIfy the C compiler whenever possible. ## +## From Franc,ois Pinard ## +## ----------------------------------------- ## + +# serial 1 + +# @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 defines @code{__STDC__} to 1 and +# 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{am_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 + +AC_DEFUN(AM_PROG_CC_STDC, +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_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 -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#if !defined(__STDC__) || __STDC__ != 1 +choke me +#endif +/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */ +#ifdef _SEQUENT_ +# include +# include +#endif +], [ +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);};], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +AC_MSG_RESULT($am_cv_prog_cc_stdc) +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) diff --git a/m4/dmalloc.m4 b/m4/dmalloc.m4 new file mode 100644 index 000000000..365ef8039 --- /dev/null +++ b/m4/dmalloc.m4 @@ -0,0 +1,21 @@ +## ----------------------------------- ## +## Check if --with-dmalloc was given. ## +## From Franc,ois Pinard ## +## ----------------------------------- ## + +# serial 1 + +AC_DEFUN(AM_WITH_DMALLOC, +[AC_MSG_CHECKING(if malloc debugging is wanted) +AC_ARG_WITH(dmalloc, +[ --with-dmalloc use dmalloc, as in + ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz], +[if test "$withval" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(WITH_DMALLOC) + LIBS="$LIBS -ldmalloc" + LDFLAGS="$LDFLAGS -g" +else + AC_MSG_RESULT(no) +fi], [AC_MSG_RESULT(no)]) +]) diff --git a/m4/error.m4 b/m4/error.m4 new file mode 100644 index 000000000..eac272a50 --- /dev/null +++ b/m4/error.m4 @@ -0,0 +1,13 @@ +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN(AM_FUNC_ERROR_AT_LINE, +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 000000000..9361d77ee --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,287 @@ +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. + +# serial 1 + +AC_DEFUN(AM_WITH_NLS, + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + USE_INCLUDED_LIBINTL=no + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS) + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If gettext or catgets are available (in this order) we + dnl use this. Else we have to fall back to GNU NLS library. + dnl catgets is only used if permitted by option --with-catgets. + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, + [AC_TRY_LINK([#include ], [return (int) gettext ("")], + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + + if test "$gt_cv_func_gettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for gettext in libintl], + gt_cv_func_gettext_libintl, + [AC_TRY_LINK([], [return (int) gettext ("")], + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)])]) + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT) + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_CHECK_FUNCS(dcgettext) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + INSTOBJEXT=.mo + fi + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + AC_MSG_CHECKING([whether catgets can be used]) + AC_ARG_WITH(catgets, + [ --with-catgets use catgets functions if available], + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) + AC_MSG_RESULT($nls_cv_use_catgets) + + if test "$nls_cv_use_catgets" = "yes"; then + dnl No gettext in C library. Try catgets next. + AC_CHECK_LIB(i, main) + AC_CHECK_FUNC(catgets, + [AC_DEFINE(HAVE_CATGETS) + INTLOBJS="\$(CATOBJS)" + AC_PATH_PROG(GENCAT, gencat, no)dnl + if test "$GENCAT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, no) + if test "$GMSGFMT" = "no"; then + AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + fi + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi]) + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + dnl Neither gettext nor catgets in included in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_SUBST(MSGFMT) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLDEPS) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +AC_DEFUN(AM_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + AC_CHECK_FUNCS(stpcpy) + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + AC_DEFINE(HAVE_STPCPY) + fi + + AM_LC_MESSAGES + AM_WITH_NLS + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl Determine which catalog format we have (if any is needed) + dnl For now we know about two different formats: + dnl Linux libc-5 and the normal X/Open format + test -d intl || mkdir intl + if test "$CATOBJEXT" = ".cat"; then + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) + + dnl Transform the SED scripts while copying because some dumb SEDs + dnl cannot handle comments. + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + dnl po2tbl.sed is always needed. + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test $ac_aux_dir; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z $MKINSTALLDIRS; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) diff --git a/m4/header.m4 b/m4/header.m4 new file mode 100644 index 000000000..3a408e105 --- /dev/null +++ b/m4/header.m4 @@ -0,0 +1,12 @@ +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl +changequote([,]))]) diff --git a/m4/init.m4 b/m4/init.m4 new file mode 100644 index 000000000..8afadf27f --- /dev/null +++ b/m4/init.m4 @@ -0,0 +1,20 @@ +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AM_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +VERSION=[$2] +AC_SUBST(VERSION) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") +AM_SANITY_CHECK +AC_ARG_PROGRAM +AC_PROG_MAKE_SET]) diff --git a/m4/install.m4 b/m4/install.m4 new file mode 100644 index 000000000..78b049217 --- /dev/null +++ b/m4/install.m4 @@ -0,0 +1,13 @@ +## --------------------------------------------------------- ## +## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ## +## substitution. ## +## From Franc,ois Pinard ## +## --------------------------------------------------------- ## + +# serial 1 + +AC_DEFUN(AM_PROG_INSTALL, +[AC_REQUIRE([AC_PROG_INSTALL]) +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl +]) diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 new file mode 100644 index 000000000..d94fc3317 --- /dev/null +++ b/m4/lcmessage.m4 @@ -0,0 +1,14 @@ +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES) + fi + fi]) diff --git a/m4/lispdir.m4 b/m4/lispdir.m4 new file mode 100644 index 000000000..b04a17ca9 --- /dev/null +++ b/m4/lispdir.m4 @@ -0,0 +1,38 @@ +## ------------------------ +## Emacs LISP file handling +## From Ulrich Drepper +## ------------------------ + +# serial 1 + +AC_DEFUN(AM_PATH_LISPDIR, + [# If set to t, that means we are running in a shell under Emacs. + # If you have an Emacs named "t", then use the full path. + test "$EMACS" = t && EMACS= + AC_PATH_PROG(EMACS, emacs xemacs, no) + if test $EMACS != "no"; then + AC_MSG_CHECKING([where .elc files should go]) + dnl Set default value + lispdir="\$(datadir)/emacs/site-lisp" + if test "x$prefix" = "xNONE"; then + if test -d $ac_default_prefix/share/emacs/site-lisp; then + lispdir="\$(prefix)/share/emacs/site-lisp" + else + if test -d $ac_default_prefix/lib/emacs/site-lisp; then + lispdir="\$(prefix)/lib/emacs/site-lisp" + fi + fi + else + if test -d $prefix/share/emacs/site-lisp; then + lispdir="\$(prefix)/share/emacs/site-lisp" + else + if test -d $prefix/lib/emacs/site-lisp; then + lispdir="\$(prefix)/lib/emacs/site-lisp" + fi + fi + fi + AC_MSG_RESULT($lispdir) + ELCFILES="\$(ELCFILES)" + fi + AC_SUBST(lispdir) + AC_SUBST(ELCFILES)]) diff --git a/m4/maintainer.m4 b/m4/maintainer.m4 new file mode 100644 index 000000000..5d9a7658b --- /dev/null +++ b/m4/maintainer.m4 @@ -0,0 +1,22 @@ +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + if test $USE_MAINTAINER_MODE = yes; then + MAINT= + else + MAINT='#M#' + fi + AC_SUBST(MAINT)dnl +] +) diff --git a/m4/mktime.m4 b/m4/mktime.m4 new file mode 100644 index 000000000..3f03b1e0c --- /dev/null +++ b/m4/mktime.m4 @@ -0,0 +1,34 @@ +dnl From Jim Meyering. +dnl FIXME: this should migrate into libit. + +AC_DEFUN(AM_FUNC_MKTIME, +[AC_REQUIRE([AC_HEADER_TIME])dnl + AC_CHECK_HEADERS(sys/time.h) + AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime, + [AC_TRY_RUN([/* Test program from Tony Leneis (tony@plaza.ds.adp.com). */ +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +int +main () +{ + time_t today = time (0); + struct tm *local = localtime (&today); + exit (mktime (local) != today); +} + ], + am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no, + dnl When crosscompiling, assume mktime is missing or broken. + am_cv_func_working_mktime=no) + ]) + if test $am_cv_func_working_mktime = no; then + LIBOBJS="$LIBOBJS mktime.o" + fi +]) diff --git a/m4/obstack.m4 b/m4/obstack.m4 new file mode 100644 index 000000000..b702aee43 --- /dev/null +++ b/m4/obstack.m4 @@ -0,0 +1,15 @@ +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN(AM_FUNC_OBSTACK, +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 new file mode 100644 index 000000000..13a85fa08 --- /dev/null +++ b/m4/progtest.m4 @@ -0,0 +1,42 @@ +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/m4/protos.m4 b/m4/protos.m4 new file mode 100644 index 000000000..5c82294eb --- /dev/null +++ b/m4/protos.m4 @@ -0,0 +1,25 @@ +## ------------------------------- ## +## Check for function prototypes. ## +## From Franc,ois Pinard ## +## ------------------------------- ## + +# serial 1 + +AC_DEFUN(AM_C_PROTOTYPES, +[AC_REQUIRE([AM_PROG_CC_STDC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_MSG_CHECKING([for function prototypes]) +if test "$am_cv_prog_cc_stdc" != no; then + AC_MSG_RESULT(yes) + AC_DEFINE(PROTOTYPES) + U= ANSI2KNR= +else + AC_MSG_RESULT(no) + U=_ ANSI2KNR=./ansi2knr + # Ensure some checks needed by ansi2knr itself. + AC_HEADER_STDC + AC_CHECK_HEADERS(string.h) +fi +AC_SUBST(U)dnl +AC_SUBST(ANSI2KNR)dnl +]) diff --git a/m4/ptrdiff.m4 b/m4/ptrdiff.m4 new file mode 100644 index 000000000..85bf4aceb --- /dev/null +++ b/m4/ptrdiff.m4 @@ -0,0 +1,12 @@ +# From Ulrich Drepper. + +# serial 1 + +AC_DEFUN(AM_TYPE_PTRDIFF_T, + [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t, + [AC_TRY_COMPILE([#include ], [ptrdiff_t p], + am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)]) + if test $am_cv_type_ptrdiff_t = yes; then + AC_DEFINE(HAVE_PTRDIFF_T) + fi +]) diff --git a/m4/regex.m4 b/m4/regex.m4 new file mode 100644 index 000000000..007b16636 --- /dev/null +++ b/m4/regex.m4 @@ -0,0 +1,37 @@ +## --------------------------------- ## +## Check if --with-regex was given. ## +## --------------------------------- ## + +# serial 1 + +# The idea is to distribute rx.[hc] and regex.[hc] together, for a while. +# The WITH_REGEX symbol (which should also be documented in acconfig.h) +# is used to decide which of regex.h or rx.h should be included in the +# application. If `./configure --with-regex' is given (the default), the +# package will use gawk's regex. If `./configure --without-regex', a +# check is made to see if rx is already installed, as with newer Linux'es. +# If not found, the package will use the rx from the distribution. +# If found, the package will use the system's rx which, on Linux at least, +# will result in a smaller executable file. + +AC_DEFUN(AM_WITH_REGEX, +[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted) +AC_ARG_WITH(regex, +[ --without-regex use GNU rx in lieu of gawk's regex for matching], +[test "$withval" = yes && am_with_regex=1], +[am_with_regex=1]) +if test -n "$am_with_regex"; then + AC_MSG_RESULT(regex) + AC_DEFINE(WITH_REGEX) + AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex, + AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1], + am_cv_gnu_regex=yes, am_cv_gnu_regex=no)) + if test $am_cv_gnu_regex = no; then + LIBOBJS="$LIBOBJS regex.o" + fi +else + AC_MSG_RESULT(rx) + AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"]) +fi +AC_SUBST(LIBOBJS)dnl +]) diff --git a/m4/sanity.m4 b/m4/sanity.m4 new file mode 100644 index 000000000..65ca99993 --- /dev/null +++ b/m4/sanity.m4 @@ -0,0 +1,19 @@ +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +echo timestamp > conftestfile +# Do this in a subshell so we don't clobber the current shell's +# arguments. FIXME: maybe try `-L' hack like GETLOADAVG test? +if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) diff --git a/m4/strtod.m4 b/m4/strtod.m4 new file mode 100644 index 000000000..8aaf4b793 --- /dev/null +++ b/m4/strtod.m4 @@ -0,0 +1,69 @@ +## Copyright (C) 1996 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## From Jim Meyering. + +## serial 1 + +## @defmac AC_FUNC_STRTOD +## @maindex FUNC_STRTOD +## @ovindex LIBOBJS +## If the @code{strtod} function is not available, or does not work +## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output +## variable @code{LIBOBJS}. +## @end defmac + +AC_DEFUN(AM_FUNC_STRTOD, +[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, +[AC_TRY_RUN([ +double strtod (); +int +main() +{ + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + char *string = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + exit (1); + } + + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + exit (1); + } + exit (0); +} +], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)]) +test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" +AC_SUBST(LIBOBJS)dnl +am_cv_func_strtod_needs_libm=no +if test $am_cv_func_strtod = no; then + AC_CHECK_FUNCS(pow) + if test $ac_cv_func_pow = no; then + AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes], + [AC_MSG_WARN(can't find library containing definition of pow)]) + fi +fi +]) diff --git a/m4/termios.m4 b/m4/termios.m4 new file mode 100644 index 000000000..1eb31d1e3 --- /dev/null +++ b/m4/termios.m4 @@ -0,0 +1,14 @@ +dnl From Jim Meyering. + +# serial 1 + +AC_DEFUN(AM_SYS_POSIX_TERMIOS, +[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios, + [AC_TRY_LINK([#include +#include +#include ], + [/* SunOS 4.0.3 has termios.h but not the library calls. */ + tcgetattr(0, 0);], + am_cv_sys_posix_termios=yes, + am_cv_sys_posix_termios=no)]) +]) diff --git a/m4/winsz.m4 b/m4/winsz.m4 new file mode 100644 index 000000000..163e512bd --- /dev/null +++ b/m4/winsz.m4 @@ -0,0 +1,35 @@ +dnl From Jim Meyering. + +# serial 1 + +AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL, +[AC_REQUIRE([AM_SYS_POSIX_TERMIOS]) + AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h], + am_cv_sys_tiocgwinsz_needs_sys_ioctl_h, + [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no + + gwinsz_in_termios_h=no + if test $am_cv_sys_posix_termios = yes; then + AC_EGREP_CPP([yes], + [#include +# include +# ifdef TIOCGWINSZ + yes +# endif + ], gwinsz_in_termios_h=yes) + fi + + if test $gwinsz_in_termios_h = no; then + AC_EGREP_CPP([yes], + [#include +# include +# ifdef TIOCGWINSZ + yes +# endif + ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes) + fi + ]) + if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then + AC_DEFINE(GWINSZ_IN_SYS_IOCTL) + fi +]) -- cgit v1.2.3-70-g09d2