Restore *_REQUIRED macros
[autoconf.git] / configure.ac
blob3d849ac4fd22df0a703626d3dbf40607cbf0c6ed
1 #                                                       -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1992-1995, 1999-2017, 2020-2022 Free Software
5 # Foundation, Inc.
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/>.
20 AC_PREREQ([2.69])
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])
28 AC_INIT(
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.
41 RELEASE_YEAR=2022
42 AC_SUBST([RELEASE_YEAR])
44 AB_INIT
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:
50 #   $ uname -a
51 #   SunOS ondine 4.1.3 2 sun4m unknown
52 #   $ cat endless.sh
53 #   while false
54 #   do
55 #     :
56 #   done
57 #   exit 0
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],
69                [ac_cv_sh_working_n],
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
79   if (
80     unset BASH_VERSION ZSH_VERSION
81     "$cand_sh" -c '
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
87     '
88   ) 2>/dev/null
89   then
90     ac_cv_sh_working_n="$cand_sh"
91     break
92   fi
93 done
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
106 done
108 if test -n "$ac_cv_unsupported_fs_chars"; then
109   AC_MSG_RESULT([$ac_cv_unsupported_fs_chars])
110 else
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
119 stat=$?
120 rm -rf 'conftest.d '
121 case $stat$? in #(
122    00) ac_cv_dir_trailing_space=yes ;; #(
123    *) ac_cv_dir_trailing_space=no ;;
124 esac
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])
134 ## ---- ##
135 ## M4.  ##
136 ## ---- ##
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.
142 AC_PROG_GNU_M4
144 ## ----------- ##
145 ## Man pages.  ##
146 ## ----------- ##
148 AM_MISSING_PROG([HELP2MAN], [help2man])
151 ## ------ ##
152 ## Perl.  ##
153 ## ------ ##
155 # We use an absolute name for perl so the #! line in autoscan will work.
156 AC_PATH_PERL_WITH_TIME_HIRES_STAT
158 # Find out whether the system supports flock
159 # Note this test does not try to find out whether it works with this
160 # particular file system.  It merely avoids us running flock on systems
161 # where that bails out.
162 AC_CACHE_CHECK([whether $PERL Fcntl::flock is implemented],
163   [ac_cv_perl_flock_implemented],
164   [echo lock me > conftest.fil
165    if $PERL -e 'use Fcntl ":flock"; flock("conftest.fil", LOCK_EX); 1;'; then
166      ac_cv_perl_flock_implemented=yes
167    else
168      ac_cv_perl_flock_implemented=no
169    fi
170    rm -f conftest.fil
171   ])
172 AC_SUBST([PERL_FLOCK], [$ac_cv_perl_flock_implemented])
175 ## ------- ##
176 ## Emacs.  ##
177 ## ------- ##
179 TEST_EMACS=$EMACS
180 test x"$TEST_EMACS" = xt && TEST_EMACS=
181 AC_CHECK_PROGS([TEST_EMACS], [emacs xemacs], [no])
183 # autoconf-mode.el and autotest-mode.el do not work with older version of
184 # Emacs (i.e. 18.x.x).  During byte-compilation, Emacs complains:
185 # "Variable (broken nil) seen on pass 2 of byte compiler but not pass 1"
186 # We detect this problem here.
187 AS_IF([test "$TEST_EMACS" != no],
188   [AC_CACHE_CHECK([whether $TEST_EMACS is sufficiently recent],
189     [ac_cv_prog_emacs_ok],
190     [# Note: The quoted "EOF" is intentional.  It protects the ` in the text.
191     cat >conftest.el << "EOF"
192       (defvar broken)
193       (defun broken-mode () (setq broken-defaults `(broken nil)))
195     AS_IF([AC_RUN_LOG(
196       [$TEST_EMACS -batch -q -f batch-byte-compile conftest.el 1>&2])],
197       [ac_cv_prog_emacs_ok=yes], [ac_cv_prog_emacs_ok=no])
198     rm -f conftest.el conftest.elc])
199   AS_IF([test $ac_cv_prog_emacs_ok = no], [TEST_EMACS=no])])
201 AC_SUBST([EMACS], [$TEST_EMACS])
203 AM_PATH_LISPDIR
206 ## ---------------- ##
207 ## Grep, sed, awk.  ##
208 ## ---------------- ##
209 AC_PROG_GREP
210 AC_PROG_EGREP
211 AC_PROG_SED
212 # AC_PROG_AWK should have already been performed by AM_INIT_AUTOMAKE.
213 # AC_REQUIRE([AC_PROG_AWK]) doesn't work outside of an AC_DEFUN.
214 m4_provide_if([AC_PROG_AWK], [], [AC_PROG_AWK])
217 ## ----- ##
218 ## Make. ##
219 ## ----- ##
220 AC_PROG_MAKE_CASE_SENSITIVE
223 ## ------------ ##
224 ## Conclusion.  ##
225 ## ------------ ##
227 dnl Allow maintainer rules under GNU make even in VPATH builds.
228 AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
230 AC_CONFIG_FILES([Makefile])
231 AC_CONFIG_FILES([lib/version.m4:lib/version.in])
233 AC_OUTPUT
234 # Report the state of this version of Autoconf if this is a beta.
235 m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-a-z]],
236 [    cat <<EOF
238 You are about to use an experimental version of Autoconf.  Be sure to
239 read the relevant mailing lists, most importantly <autoconf@gnu.org>.
241 Below you will find information on the status of this version of Autoconf.
244     sed -n '/^\* Status/,$p' $srcdir/BUGS
245 echo
246 ])dnl