Use awk for config header generation.
[autoconf/tsuna.git] / configure.ac
blob1a32ea329c7428a4cab5764654fbb29043411b9e
1 #                                                       -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
5 # 2004, 2005, 2006, 2007 Free Software 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 <http://www.gnu.org/licenses/>.
20 # We need AC_CONFIG_TESTDIR.
21 AC_PREREQ([2.59])
23 AC_INIT([GNU Autoconf], [2.61b], [bug-autoconf@gnu.org])
24 AC_SUBST([PACKAGE_NAME])dnl
25 AC_CONFIG_SRCDIR([ChangeLog])
27 AC_CONFIG_AUX_DIR([build-aux])
29 AM_INIT_AUTOMAKE([check-news 1.7.9 dist-bzip2 readme-alpha])
31 # We use `/bin/sh -n script' to check that there are no syntax errors
32 # in the scripts.  Although incredible, there are /bin/sh that go into
33 # endless loops with `-n', e.g., SunOS's:
35 #   $ uname -a
36 #   SunOS ondine 4.1.3 2 sun4m unknown
37 #   $ cat endless.sh
38 #   while false
39 #   do
40 #     :
41 #   done
42 #   exit 0
43 #   $ time sh endless.sh
44 #   sh endless.sh  0,02s user 0,03s system 78% cpu 0,064 total
45 #   $ time sh -nx endless.sh
46 #   ^Csh -nx endless.sh  3,67s user 0,03s system 63% cpu 5,868 total
48 # Also, some implementations of /bin/sh (e.g., Solaris 8) are soooo slow
49 # that they are unusable on large scripts like our testsuite.
51 # So before using `/bin/sh -n' to check our scripts, we first check
52 # that `/bin/sh -n' is known to not have these problems.
54 AC_CACHE_CHECK([whether /bin/sh -n is known to work], ac_cv_sh_n_works,
55 [if (
56     unset BASH_VERSION ZSH_VERSION
57     /bin/sh -c '
58       test -n "${BASH_VERSION+set}" || # Bash
59       test -n "${KSH_VERSION+set}" || # pdksh
60       test -n "${ZSH_VERSION+set}" || # zsh
61       test -n "${.sh.version}" # ksh93; put this last since its syntax is dodgy
62     '
63   ) 2>/dev/null
64 then ac_cv_sh_n_works=yes
65 else ac_cv_sh_n_works=no
68 AC_SUBST(ac_cv_sh_n_works)
70 # Initialize the test suite.
71 AC_CONFIG_TESTDIR([tests])
72 AC_CONFIG_FILES([tests/Makefile tests/atlocal])
73 AC_PATH_PROG([EXPR], [expr])
76 ## ---- ##
77 ## M4.  ##
78 ## ---- ##
80 # We use an absolute name for GNU m4 so even if users have another m4 first in
81 # their path, the installer can configure with a path that has GNU m4
82 # on it and get that path embedded in the installed autoconf and
83 # autoheader scripts.
84 AC_PROG_GNU_M4
86 ## ----------- ##
87 ## Man pages.  ##
88 ## ----------- ##
90 AC_CONFIG_FILES(man/Makefile)
91 AM_MISSING_PROG(HELP2MAN, help2man)
94 ## ------ ##
95 ## Perl.  ##
96 ## ------ ##
98 # We use an absolute name for perl so the #! line in autoscan will work.
99 AC_PATH_PROG([PERL], perl, no)
100 AC_SUBST([PERL])dnl
101 if test "$PERL" = no; then
102   AC_MSG_ERROR([perl is not found])
104 $PERL -e 'require 5.005_03;' || {
105    AC_MSG_ERROR([Perl 5.005_03 or better is required])
109 ## ------- ##
110 ## Emacs.  ##
111 ## ------- ##
113 AC_CONFIG_FILES([lib/emacs/Makefile])
114 TEST_EMACS=$EMACS
115 test x"$TEST_EMACS" = xt && TEST_EMACS=
116 AC_CHECK_PROGS([TEST_EMACS], [emacs xemacs], [no])
118 # autoconf-mode.el and autotest-mode.el do not work with older version of
119 # Emacs (i.e. 18.x.x).  During byte-compilation, Emacs complains:
120 # "Variable (broken nil) seen on pass 2 of byte compiler but not pass 1"
121 # We detect this problem here.
122 AS_IF([test "$TEST_EMACS" != no],
123   [AC_CACHE_CHECK([whether $TEST_EMACS is sufficiently recent],
124     [ac_cv_prog_emacs_ok],
125     [# Note: The quoted "EOF" is intentional.  It protects the ` in the text.
126     cat >conftest.el << "EOF"
127       (defvar broken)
128       (defun broken-mode () (setq broken-defaults `(broken nil)))
130     AS_IF([AC_RUN_LOG(
131       [$TEST_EMACS -batch -q -f batch-byte-compile conftest.el 1>&2])],
132       [ac_cv_prog_emacs_ok=yes], [ac_cv_prog_emacs_ok=no])
133     rm -f conftest.el conftest.elc])
134   AS_IF([test $ac_cv_prog_emacs_ok = no], [TEST_EMACS=no])])
136 AC_SUBST([EMACS], [$TEST_EMACS])
138 AM_PATH_LISPDIR
141 ## ------------ ##
142 ## Grep & sed.  ##
143 ## ------------ ##
144 AC_PROG_GREP
145 AC_PROG_EGREP
146 AC_PROG_SED
149 ## ------------ ##
150 ## Conclusion.  ##
151 ## ------------ ##
153 AC_CONFIG_FILES([Makefile doc/Makefile
154                  lib/Makefile lib/Autom4te/Makefile lib/autoscan/Makefile
155                  lib/m4sugar/Makefile
156                  lib/autoconf/Makefile lib/autotest/Makefile
157                  bin/Makefile])
159 AC_OUTPUT
160 # Report the state of this version of Autoconf if this is a beta.
161 m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),  [[a-z]],
162 [    cat <<EOF
164 You are about to use an experimental version of Autoconf.  Be sure to
165 read the relevant mailing lists, most importantly <autoconf@gnu.org>.
167 Below you will find information on the status of this version of Autoconf.
171     sed -n '/^\* Status/,$p' $srcdir/BUGS
172 ])dnl