Merge branch 'maint'
[platform/upstream/automake.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 # Copyright (C) 1995-2012 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 AC_PREREQ([2.69])
19 AC_INIT([GNU Automake], [1.12a], [bug-automake@gnu.org])
20
21 AC_CONFIG_SRCDIR([automake.in])
22 AC_CONFIG_AUX_DIR([lib])
23
24 AM_SILENT_RULES([yes])
25
26 AC_CANONICAL_HOST
27 AC_CANONICAL_BUILD
28
29 # Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
30 # way we can run Autoconf tests from configure (or from the test
31 # suite) without being bothered by 'missing'.  Likewise for autom4te,
32 # autoreconf, autoheader, and autoupdate.
33 AC_SUBST([am_AUTOCONF], ["${AUTOCONF-autoconf}"])
34 AC_SUBST([am_AUTOM4TE], ["${AUTOM4TE-autom4te}"])
35 AC_SUBST([am_AUTORECONF], ["${AUTORECONF-autoreconf}"])
36 AC_SUBST([am_AUTOHEADER], ["${AUTOHEADER-autoheader}"])
37 AC_SUBST([am_AUTOUPDATE], ["${AUTOUPDATE-autoupdate}"])
38
39 dnl We call AC_PROG_CC in an unusual way, and only for use in our
40 dnl testsuite, so also use 'no-dependencies' and 'no-define' among
41 dnl the automake options to avoid bloating and potential problems.
42 AM_INIT_AUTOMAKE([dist-xz filename-length-max=99 color-tests
43                   parallel-tests silent-rules no-define no-dependencies])
44
45 ## Keep this on a line of its own, since it must be found and processed
46 ## by the 'update-copyright' rule in out Makefile.
47 RELEASE_YEAR=2012
48 AC_SUBST([RELEASE_YEAR])
49
50 # The API version is the base version.  We must guarantee
51 # compatibility for all releases with the same API version.
52 # Our current rule is that:
53 # * All releases, including the prereleases, in an X.Y series
54 #   are compatible.  So 1.5.1c is compatible with 1.5.
55 # * Prereleases on the trunk are all incompatible -- 1.5b and 1.5c
56 #   aren't the same.
57 APIVERSION=`echo "$VERSION" | sed -e 's/^\([[0-9]]*\.[[0-9]]*[[a-z]]*\).*$/\1/'`
58 AC_SUBST([APIVERSION])
59
60 AC_SUBST([pkgvdatadir], ["\${datadir}/$PACKAGE-$APIVERSION"])
61 AC_SUBST([scriptdir], ["\${pkgvdatadir}"])
62 AC_SUBST([amdir], ["\${pkgvdatadir}/am"])
63 AC_SUBST([automake_acdir], ["\${datadir}/aclocal-$APIVERSION"])
64 AC_SUBST([system_acdir], ["\${datadir}/aclocal"])
65
66 # $AUTOMAKE and $ACLOCAL are always run after a "cd $top_srcdir",
67 # hence '.' is really what we want for perllibdir, libdir, and acdir.
68 ACLOCAL="perllibdir=\"`pwd`/lib$PATH_SEPARATOR./lib\" \"`pwd`/aclocal\" --acdir=m4 -I m4"
69 AUTOMAKE="perllibdir=\"`pwd`/lib$PATH_SEPARATOR./lib\" \"`pwd`/automake\" --libdir=lib"
70
71 AC_PATH_PROG([PERL], [perl])
72 if test -z "$PERL"; then
73    AC_MSG_ERROR([perl not found])
74 fi
75 # Save details about the selected perl interpreter in config.log.
76 AM_RUN_LOG([$PERL --version])
77 $PERL -e 'require 5.006;' || {
78    AC_MSG_ERROR(
79 [perl 5.6 or better is required; perl 5.8.2 or better
80 is recommended.  If you have several perl versions
81 installed, select the one Automake should use using
82   ./configure PERL=/path/to/perl])
83 }
84
85 # We require ithreads support, and version 5.7.2 for CLONE.
86 AC_CACHE_CHECK([whether $PERL supports ithreads], [am_cv_prog_PERL_ithreads],
87 [if $PERL -e '
88     require 5.007_002;
89     use Config;
90     if ($Config{useithreads})
91       {
92         require threads;
93         import threads;
94         require Thread::Queue;
95         import Thread::Queue;
96         exit 0;
97       }
98     exit 1;' >&AS_MESSAGE_LOG_FD 2>&1
99 then
100   am_cv_prog_PERL_ithreads=yes
101 else
102   am_cv_prog_PERL_ithreads=no
103 fi])
104 if test $am_cv_prog_PERL_ithreads = yes; then
105   PERL_THREADS=1;
106 else
107   PERL_THREADS=0;
108 fi
109 AC_SUBST([PERL_THREADS])
110
111 # The test suite will skip some tests if tex is absent.
112 AC_CHECK_PROG([TEX], [tex], [tex])
113 # Save details about the selected TeX program in config.log.
114 # Redirect input from /dev/null, as TeX might otherwise hang waiting
115 # for input from the terminal.
116 AM_RUN_LOG([$TEX --version </dev/null])
117
118 # The test suite will skip some tests if no lex or yacc program is
119 # available.
120 # We don't use AC_PROG_LEX nor AC_PROG_YACC here because:
121 #  1. we don't want flex (resp. bison) to be preferred to system lex
122 #     (resp. system yacc);
123 #  2. we don't want $LEX (resp. $YACC) to be defined to ':' (resp. 'yacc')
124 #     by default;
125 #  3. we prefer not to have the variables YFLAGS, LEX_OUTPUT_ROOT and
126 #     LEXLIB to be calculated and/or AC_SUBST'd;
127 #  4. we prefer that the YACC and LEX variables are not reported in the
128 #     configure help screen.
129 AC_CHECK_PROGS([YACC], [yacc byacc 'bison -y'], [false])
130 AC_CHECK_PROGS([LEX], [lex flex], [false])
131
132 # Test for Autoconf.  We run Autoconf in a subdirectory to ease
133 # deletion of any files created (such as those added to
134 # autom4te.cache).  We used to perform only the last of the three
135 # following tests, but some users were unable to figure out that their
136 # installation was broken since --version appeared to work.
137
138 required_autoconf_version=2.62
139 AC_CACHE_CHECK([whether autoconf is installed], [am_cv_autoconf_installed],
140 [if AM_RUN_LOG([$am_AUTOCONF --version]);
141 then
142   am_cv_autoconf_installed=yes
143 else
144   am_cv_autoconf_installed=no
145 fi])
146 if test "$am_cv_autoconf_installed" = no; then
147   AC_MSG_ERROR([Autoconf $required_autoconf_version or better is required.
148     Please make sure it is installed and in your PATH.])
149 fi
150
151 AC_CACHE_CHECK([whether autoconf works], [am_cv_autoconf_works],
152 [mkdir conftest
153 echo 'AC''_INIT' > conftest/conftest.ac
154 if AM_RUN_LOG([cd conftest && $am_AUTOCONF -o /dev/null conftest.ac]);
155 then
156   am_cv_autoconf_works=yes
157 else
158   am_cv_autoconf_works=no
159 fi
160 rm -rf conftest])
161 if test "$am_cv_autoconf_works" = no; then
162   AC_MSG_ERROR([The installed version of autoconf does not work.
163     Please check config.log for error messages before this one.])
164 fi
165
166 AC_CACHE_CHECK([whether autoconf is recent enough], [am_cv_autoconf_version],
167 [mkdir conftest
168 dnl Creative quoting required to avoid spurious expansion of AC_PREREQ macro
169 echo 'AC'"_PREREQ([[$required_autoconf_version]])" > conftest/conftest.ac
170 if AM_RUN_LOG([cd conftest && $am_AUTOCONF -o /dev/null conftest.ac]);
171 then
172   am_cv_autoconf_version=yes
173 else
174   am_cv_autoconf_version=no
175 fi
176 rm -rf conftest])
177 if test "$am_cv_autoconf_version" = no; then
178   AC_MSG_ERROR([Autoconf $required_autoconf_version or better is required.])
179 fi
180
181 # Test for ln.  We need use it to install the versioned binaries.
182 AC_MSG_CHECKING([whether ln works])
183 AC_CACHE_VAL([am_cv_prog_ln], [
184 rm -f conftest conftest.file
185 : >conftest.file
186 if ln conftest.file conftest 2>/dev/null; then
187   am_cv_prog_ln=ln
188 else
189   am_cv_prog_ln='cp -p'
190 fi
191 rm -f conftest conftest.file])
192 AC_SUBST([LN], [$am_cv_prog_ln])
193 result=no
194 test "x$am_cv_prog_ln" = xln && result=yes
195 AC_MSG_RESULT([$result])
196
197 # The amount we should wait after modifying files depends on the platform.
198 # On Windows '95, '98 and ME, files modifications have 2-seconds
199 # granularity and can be up to 3 seconds in the future w.r.t. the
200 # system clock.  When it is important to ensure one file is older
201 # than another we wait at least 5 seconds between creations.
202 case $build in
203   *-pc-msdosdjgpp) MODIFICATION_DELAY=5;;
204   *)               MODIFICATION_DELAY=2;;
205 esac
206 AC_SUBST([MODIFICATION_DELAY])
207
208 # Test for things needed by the test suite.
209 AC_PROG_EGREP
210 AC_PROG_FGREP
211
212 AC_CACHE_CHECK([whether $SHELL has working 'set -e' with exit trap],
213 [am_cv_sh_errexit_works],
214 [if $SHELL -ec "trap 'exit \$?' 0; (exit 77); exit 77"; test $? = 77
215 then
216   am_cv_sh_errexit_works=yes
217 else
218   am_cv_sh_errexit_works=no
219 fi
220 ])
221 if test $am_cv_sh_errexit_works = no; then
222   AC_MSG_WARN(["${MAKE-make} check" will leave leftover directories t/*.dir])
223   AC_MSG_WARN([you can clean them up manually using "${MAKE-make} clean" or])
224   AC_MSG_WARN(["cd t && ${MAKE-make} clean-local-check'])
225 fi
226 AC_SUBST([sh_errexit_works], [$am_cv_sh_errexit_works])
227
228
229 ###########################################################################
230
231 # Look for C, C++ and fortran compilers to be used in the testsuite.
232
233 dnl We don't want to abort our configuration script if no C compiler is
234 dnl available, as such a compiler is only required to run part of the
235 dnl testsuite, not to build or install Automake.  Ditto for C++, Fortran
236 dnl and Fortran 77 compilers.  Unfortunately, autoconf does not offer an
237 dnl easy way to obtain this behaviour, so we'll need a few hacks.
238
239 dnl We want the body of this macro to expand as a single shell statement,
240 dnl thus we wrap it into { ... } brackets.
241 AC_DEFUN([_AM_WRAP_MSG_ERROR], [ {
242   AC_MSG_WARN([$1])
243   am__failed=yes
244   break
245 } ])
246
247 AC_DEFUN([_AM_COMPILER_CAN_FAIL], [
248   m4_pushdef([AC_MSG_FAILURE], m4_defn([_AM_WRAP_MSG_ERROR]))
249   m4_pushdef([AC_MSG_ERROR],   m4_defn([_AM_WRAP_MSG_ERROR]))
250   am__failed=no
251   while :; do
252      $1
253      break
254   done
255   AS_IF([test $am__failed = yes], [$2])
256   # We have to clear these cache variables, so that future checks on
257   # compilers for different languages won't be confused.
258   unset ac_cv_objext ac_cv_exeext
259   # We also need to meddle with the autoconf internals to ensure that
260   # checks to find object and executable extensions will be run anew.
261   # FIXME: In the long run, the better thing to do would be to fix
262   # FIXME: autoconf instead ...
263   m4_undefine([m4_provide(_AC_COMPILER_OBJEXT)])
264   m4_undefine([m4_provide(_AC_COMPILER_EXEEXT)])
265   m4_popdef([AC_MSG_FAILURE])
266   m4_popdef([AC_MSG_ERROR])
267 ])
268
269 AC_DEFUN([_AM_SKIP_COMP_TESTS],
270   [AC_MSG_NOTICE([tests requiring the $1 compiler will be skipped])])
271
272 # Prefer generic compilers to GNU ones when possible.  This will ensure
273 # more testsuite coverage "in the wild".
274 # Note that we don't look for the MSVC C/C++ compiler here.  This is
275 # deliberate; for more discussion and rationale, see:
276 # <http://lists.gnu.org/archive/html/automake-patches/2012-01/msg00130.html>
277
278 AC_MSG_NOTICE([will now look for generic compilers])
279
280 # C compiler.
281 _AM_COMPILER_CAN_FAIL(dnl
282   [AC_PROG_CC([cc gcc])],
283   [CC=false; _AM_SKIP_COMP_TESTS([C])])
284
285 AS_IF([test x"$GCC" = x"yes"], [am_CC_is_GNU=yes], [am_CC_is_GNU=no])
286
287 # The list of C++ compilers here has been copied, pasted and edited
288 # from 'lib/autoconf/c.m4:AC_PROG_CXX' in the Autoconf distribution.
289 # Keep it in sync, or better again, find out a way to avoid this code
290 # duplication.
291 _AM_COMPILER_CAN_FAIL([AC_PROG_CXX(dnl
292   [aCC CC FCC KCC RCC xlC_r xlC c++ cxx cc++ gpp g++])],
293   [CXX=false; _AM_SKIP_COMP_TESTS([C++])])
294
295 AS_IF([test x"$GXX" = x"yes"], [am_CXX_is_GNU=yes], [am_CXX_is_GNU=no])
296
297 # The lists of Fortran compilers here has been copied, pasted and edited
298 # from file 'lib/autoconf/fortran.m4' in the Autoconf distribution.
299 # Keep it in sync, or better again, find out a way to avoid this code
300 # duplication.
301
302 _AM_COMPILER_CAN_FAIL([AC_PROG_FC(dnl
303   [xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor] dnl
304   [xlf90 f90 pgf90 pghpf epcf90 g95 gfortran])],
305   [FC=false; _AM_SKIP_COMP_TESTS([Fortran])])
306
307 AS_IF([test x"$GFC" = x"yes"], [am_FC_is_GNU=yes], [am_FC_is_GNU=no])
308
309 _AM_COMPILER_CAN_FAIL([AC_PROG_F77(dnl
310   [xlf f77 frt pgf77 cf77 fort77 fl32 af77 g77 gfortran])],
311   [F77=false; _AM_SKIP_COMP_TESTS([Fortran 77])])
312
313 AS_IF([test x"$G77" = x"yes"], [am_F77_is_GNU=yes], [am_F77_is_GNU=no])
314
315 # Some tests will need the GNU compilers.  Searching for them here would
316 # be overkill, since our testsuite already handles their search and setup
317 # pretty well.  But in case the compilers already found are the GNU ones,
318 # we want to use them in the testsuite where GNU compilers are required.
319 # Also, in case the compilers detected above (at configure time) are not
320 # the GNU ones, we cannot use the values of CFLAGS, CXXFLAGS, FCFLAGS and
321 # FFLAGS detected for them with the GNU compilers too, since it's likely
322 # they won't be compatible.  So we allow the user to define variants of
323 # these variables for the GNU compilers separately.
324
325 AC_MSG_NOTICE([will now look for GNU compilers])
326
327 # GNU C compiler.
328 AC_ARG_VAR([GNU_CC],     [GNU C compiler])
329 AC_ARG_VAR([GNU_CFLAGS], [GNU C compiler flags])
330 if test $am_CC_is_GNU = yes; then
331   AC_MSG_NOTICE([$CC is already a GNU C compiler])
332   GNU_CC=$CC GNU_CFLAGS=${GNU_CFLAGS-$CFLAGS}
333 else
334   AC_CHECK_TOOLS([GNU_CC], [gcc], [false])
335 fi
336 AS_IF([AM_RUN_LOG([$GNU_CC --version && $GNU_CC -v])], [],
337       [AC_MSG_WARN([botched installation for GNU C compiler])
338        _AM_SKIP_COMP_TESTS([GNU C])])
339
340 # GNU C++ compiler.
341 AC_ARG_VAR([GNU_CXX],      [GNU C++ compiler])
342 AC_ARG_VAR([GNU_CXXFLAGS], [GNU C++ compiler flags])
343 if test $am_CXX_is_GNU = yes; then
344   AC_MSG_NOTICE([$CXX is already a GNU C++ compiler])
345   GNU_CXX=$CXX
346   GNU_CXXFLAGS=${GNU_CXXFLAGS-$CXXFLAGS}
347 else
348   AC_CHECK_TOOLS([GNU_CXX], [g++ gpp], [false])
349 fi
350 AS_IF([AM_RUN_LOG([$GNU_CXX --version && $GNU_CXX -v])], [],
351       [AC_MSG_WARN([botched installation for GNU C++ compiler])
352        _AM_SKIP_COMP_TESTS([GNU C++])])
353
354 # GNU Fortran compiler.
355 AC_ARG_VAR([GNU_FC],      [GNU Fortran compiler])
356 AC_ARG_VAR([GNU_FCFLAGS], [GNU Fortran compiler flags])
357 if test $am_FC_is_GNU = yes; then
358   AC_MSG_NOTICE([$FC is already a GNU Fortran compiler])
359   GNU_FC=$FC
360   GNU_FCFLAGS=${GNU_FCFLAGS-$FCFLAGS}
361 else
362   AC_CHECK_TOOLS([GNU_FC], [gfortran], [false])
363 fi
364 AS_IF([AM_RUN_LOG([$GNU_FC --version && $GNU_FC -v])], [],
365       [AC_MSG_WARN([botched installation for GNU Fortran compiler])
366        _AM_SKIP_COMP_TESTS([GNU Fortran])])
367
368 # GNU Fortran 77 compiler.
369 AC_ARG_VAR([GNU_F77],    [GNU Fortran 77 compiler])
370 AC_ARG_VAR([GNU_FFLAGS], [GNU Fortran 77 compiler flags])
371 if test $am_F77_is_GNU = yes; then
372   AC_MSG_NOTICE([$F77 is already a GNU Fortran 77 compiler])
373   GNU_F77=$F77
374   GNU_FFLAGS=${GNU_FFLAGS-$FFLAGS}
375 else
376   AC_CHECK_TOOLS([GNU_F77], [g77 gfortran], [false])
377 fi
378 AS_IF([AM_RUN_LOG([$GNU_F77 --version && $GNU_F77 -v])], [],
379       [AC_MSG_WARN([botched installation for GNU Fortran 77 compiler])
380       _AM_SKIP_COMP_TESTS([GNU Fortran 77])])
381
382 # GNU Java compiler.
383 AC_ARG_VAR([GNU_GCJ], [GNU Java compiler])
384 AC_ARG_VAR([GNU_GCJFLAGS], [GNU Java compiler flags])
385 AC_CHECK_TOOLS([GNU_GCJ], [gcj], [false])
386 AS_IF([AM_RUN_LOG([$GNU_GCJ --version && $GNU_GCJ -v])], [],
387       [AC_MSG_WARN([botched installation for GNU Java compiler])
388       _AM_SKIP_COMP_TESTS([GNU Java])])
389
390 # If we have been able to find at least a working compiler above, we
391 # know what the object and executable extensions for this platform are.
392 OBJEXT=${ac_cv_objext-UNKNOWN}
393 EXEEXT=${ac_cv_exeext-UNKNOWN}
394 AC_SUBST([OBJEXT])
395 AC_SUBST([EXEEXT])
396
397 ###########################################################################
398
399 AC_CONFIG_FILES([Makefile])
400
401 AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
402 AC_CONFIG_LINKS([defs:defs])
403
404 AC_CONFIG_FILES([t/wrap/aclocal-${APIVERSION}:t/wrap/aclocal.in],
405                 [chmod +x t/wrap/aclocal-${APIVERSION}],
406                 [APIVERSION=$APIVERSION])
407 AC_CONFIG_FILES([t/wrap/automake-${APIVERSION}:t/wrap/automake.in],
408                 [chmod +x t/wrap/automake-${APIVERSION}],
409                 [APIVERSION=$APIVERSION])
410
411 AC_OUTPUT
412
413 # Inform the user if this version of automake is a beta release or
414 # a development snapshot.
415 # According to HACKING, the version of a development snapshot should
416 # end with an "odd" letter (a, c, ...), the version of a test release
417 # should end wit an "even" letter (b, d, ...).
418
419 am_stable_version_rx='[[1-9]\.[0-9]+(\.[0-9]+)?]'
420 am_beta_version_rx="[$am_stable_version_rx[bdfhjlnprtvxz]]"
421
422 am_release_type=`AS_ECHO(["$PACKAGE_VERSION"]) | LC_ALL=C awk ["
423   /^$am_stable_version_rx$/ { print \"stable\"; exit(0); }
424   /^$am_beta_version_rx$/ { print \"beta version\"; exit(0); }
425   { print \"development snapshot\"; }"]`
426
427 test "$am_release_type" = stable || cat <<EOF
428
429 WARNING: You are about to use a $am_release_type of automake.
430 WARNING: It might easily suffer from new bugs or regressions.
431 WARNING: You are strongly advised not to use it in production code.
432
433 Please report bugs, problems and feedback to <AC_PACKAGE_BUGREPORT>.
434 EOF
435
436 AS_EXIT([0])