2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1992-1995, 1999-2017, 2020-2023 Free Software
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
22 # Keep both of these on a single line, and do not use quadrigraphs
23 # or nested quotes in their values, since the bootstrap script needs
24 # to be able to extract their values with sed.
25 m4_define([autoconf_PACKAGE_NAME], [GNU Autoconf])
26 m4_define([autoconf_PACKAGE_BUGREPORT], [bug-autoconf@gnu.org])
29 m4_defn([autoconf_PACKAGE_NAME]),
30 [m4_esyscmd([build-aux/git-version-gen .tarball-version])],
31 m4_defn([autoconf_PACKAGE_BUGREPORT])
33 AC_CONFIG_SRCDIR([lib/autoconf/autoconf.m4])
35 AC_CONFIG_AUX_DIR([build-aux])
37 AM_INIT_AUTOMAKE([1.11 dist-xz readme-alpha no-texinfo.tex std-options])
39 # Keep this on a line of its own, since it must be found and processed
40 # by the 'update-release-year' rule in our Makefile.
42 AC_SUBST([RELEASE_YEAR])
46 # We use 'sh -n script' to check that there are no syntax errors
47 # in the scripts. Although incredible, there are sh implementations
48 # that go into endless loops with '-n', e.g., SunOS's:
51 # SunOS ondine 4.1.3 2 sun4m unknown
58 # $ time sh endless.sh
59 # sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total
60 # $ time sh -nx endless.sh
61 # ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total
63 # Also, some implementations (e.g., Solaris 8) are soooo slow
64 # that they are unusable on large scripts like our testsuite.
66 # So we must identify a shell whose -n can safely be used.
68 AC_CACHE_CHECK([for a shell whose -n mode is known to work],
70 [ac_cv_sh_working_n=none
71 # Start by trying the shell that autoconf decided to use for this script,
72 # follow with a hardwired list of shells that are known to work and can
73 # be identified as such, starting with the ones with the fewest
74 # syntactic extensions. Unfortunately, several shells that are also
75 # known to work can't be easily identified (e.g. some BSD shells and dash).
76 # Try ksh93, which is often buggy, and plain ksh and sh last.
77 for cand_sh in "$SHELL" pdksh bash zsh ksh93 ksh sh
80 unset BASH_VERSION ZSH_VERSION
82 test ${BASH_VERSION+y} || # Bash
83 test ${KSH_VERSION+y} || # pdksh
84 test ${ZSH_VERSION+y} || # zsh
85 test ${NETBSD_SHELL+y} || # NetBSD sh
86 test -n "${.sh.version}" # ksh93; put this last since its syntax is dodgy
90 ac_cv_sh_working_n="$cand_sh"
95 AC_SUBST([SHELL_N], [$ac_cv_sh_working_n])
97 AC_MSG_CHECKING([for characters that cannot appear in file names])
98 AC_CACHE_VAL([ac_cv_unsupported_fs_chars],
99 [ac_cv_unsupported_fs_chars=
100 for c in '\\' \" '<' '>' '*' '?' '|'
102 touch "conftest.t${c}t" 2>/dev/null
103 test -f "conftest.t${c}t" && rm -f "conftest.t${c}t" && continue
104 # $c cannot be used in a file name.
105 ac_cv_unsupported_fs_chars=$ac_cv_unsupported_fs_chars$c
108 if test -n "$ac_cv_unsupported_fs_chars"; then
109 AC_MSG_RESULT([$ac_cv_unsupported_fs_chars])
111 AC_MSG_RESULT([none])
114 AC_SUBST([ac_cv_unsupported_fs_chars])
116 AC_CACHE_CHECK([whether directories can have trailing spaces],
117 [ac_cv_dir_trailing_space],
118 [rm -rf 'conftest.d ' && mkdir 'conftest.d ' && touch 'conftest.d /tfile' 2>/dev/null
122 00) ac_cv_dir_trailing_space=yes ;; #(
123 *) ac_cv_dir_trailing_space=no ;;
126 AC_SUBST([ac_cv_dir_trailing_space])
128 # Initialize the test suite.
129 AC_CONFIG_TESTDIR([tests])
130 AC_CONFIG_FILES([tests/atlocal])
131 AC_PATH_PROG([EXPR], [expr])
138 # We use an absolute name for GNU m4 so even if users have another m4 first in
139 # their path, the installer can configure with a path that has GNU m4
140 # on it and get that path embedded in the installed autoconf and
141 # autoheader scripts.
148 AM_MISSING_PROG([HELP2MAN], [help2man])
155 # We use an absolute name for perl so the #! line in autoscan will work.
156 AC_PATH_PROG([PERL], [perl], [no])
158 if test "$PERL" = no; then
159 AC_MSG_ERROR([perl is not found])
161 $PERL -e 'require 5.006;' || {
162 AC_MSG_ERROR([Perl 5.006 or better is required])
165 # Find out whether the system supports flock
166 # Note this test does not try to find out whether it works with this
167 # particular file system. It merely avoids us running flock on systems
168 # where that bails out.
169 AC_CACHE_CHECK([whether $PERL Fcntl::flock is implemented],
170 [ac_cv_perl_flock_implemented],
171 [echo lock me > conftest.fil
172 if $PERL -e 'use Fcntl ":flock"; flock("conftest.fil", LOCK_EX); 1;'; then
173 ac_cv_perl_flock_implemented=yes
175 ac_cv_perl_flock_implemented=no
179 AC_SUBST([PERL_FLOCK], [$ac_cv_perl_flock_implemented])
187 test x"$TEST_EMACS" = xt && TEST_EMACS=
188 AC_CHECK_PROGS([TEST_EMACS], [emacs xemacs], [no])
190 # autoconf-mode.el and autotest-mode.el do not work with older version of
191 # Emacs (i.e. 18.x.x). During byte-compilation, Emacs complains:
192 # "Variable (broken nil) seen on pass 2 of byte compiler but not pass 1"
193 # We detect this problem here.
194 AS_IF([test "$TEST_EMACS" != no],
195 [AC_CACHE_CHECK([whether $TEST_EMACS is sufficiently recent],
196 [ac_cv_prog_emacs_ok],
197 [# Note: The quoted "EOF" is intentional. It protects the ` in the text.
198 cat >conftest.el << "EOF"
200 (defun broken-mode () (setq broken-defaults `(broken nil)))
203 [$TEST_EMACS -batch -q -f batch-byte-compile conftest.el 1>&2])],
204 [ac_cv_prog_emacs_ok=yes], [ac_cv_prog_emacs_ok=no])
205 rm -f conftest.el conftest.elc])
206 AS_IF([test $ac_cv_prog_emacs_ok = no], [TEST_EMACS=no])])
208 AC_SUBST([EMACS], [$TEST_EMACS])
213 ## ---------------- ##
214 ## Grep, sed, awk. ##
215 ## ---------------- ##
219 # AC_PROG_AWK should have already been performed by AM_INIT_AUTOMAKE.
220 # AC_REQUIRE([AC_PROG_AWK]) doesn't work outside of an AC_DEFUN.
221 m4_provide_if([AC_PROG_AWK], [], [AC_PROG_AWK])
227 AC_PROG_MAKE_CASE_SENSITIVE
234 dnl Allow maintainer rules under GNU make even in VPATH builds.
235 AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
237 AC_CONFIG_FILES([Makefile])
238 AC_CONFIG_FILES([lib/version.m4:lib/version.in])
241 # Report the state of this version of Autoconf if this is a beta.
242 m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-a-z]],
245 You are about to use an experimental version of Autoconf. Be sure to
246 read the relevant mailing lists, most importantly <autoconf@gnu.org>.
248 Below you will find information on the status of this version of Autoconf.
251 sed -n '/^\* Status/,$p' $srcdir/BUGS