Merge branch 'maint' (with fix for CVE-2012-3386)
[platform/upstream/automake.git] / m4 / init.m4
1 # Do all the work for Automake.                             -*- Autoconf -*-
2
3 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # serial 22
10
11 # This macro actually does too much.  Some checks are only needed if
12 # your package does certain things.  But this isn't really a big deal.
13
14 # AM_INIT_AUTOMAKE([OPTIONS])
15 # ---------------------------
16 AC_DEFUN([AM_INIT_AUTOMAKE],
17 [AC_PREREQ([2.65])dnl
18 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
19 dnl the ones we care about.
20 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
21 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
22 AC_REQUIRE([AC_PROG_INSTALL])dnl
23 if test "`cd $srcdir && pwd`" != "`pwd`"; then
24   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
25   # is not polluted with repeated "-I."
26   AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27   # test to see if srcdir already configured
28   if test -f $srcdir/config.status; then
29     AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
30   fi
31 fi
32
33 # test whether we have cygpath
34 if test -z "$CYGPATH_W"; then
35   if (cygpath --version) >/dev/null 2>/dev/null; then
36     CYGPATH_W='cygpath -w'
37   else
38     CYGPATH_W=echo
39   fi
40 fi
41 AC_SUBST([CYGPATH_W])
42
43 # Define the identity of the package.
44 dnl Error out on old-style AM_INIT_AUTOMAKE calls.
45 m4_ifval([$2], [m4_fatal(
46 [$0: old-style two- and three-arguments forms are now unsupported.  For more info:
47 http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])])
48 _AM_SET_OPTIONS([$1])dnl
49 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
50 m4_if(
51   m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
52   [ok:ok],,
53   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
54  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
55  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])dnl
56
57 _AM_IF_OPTION([no-define],,
58 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
59  AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
60
61 # Some tools Automake needs.
62 AC_REQUIRE([AM_SANITY_CHECK])dnl
63 AC_REQUIRE([AC_ARG_PROGRAM])dnl
64 AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
65 AM_MISSING_PROG([AUTOCONF], [autoconf])
66 AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
67 AM_MISSING_PROG([AUTOHEADER], [autoheader])
68 AM_MISSING_PROG([MAKEINFO], [makeinfo])
69 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
70 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
71 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
72 # For better backward compatibility.  To be removed once Automake 1.9.x
73 # dies out for good.  For more background, see:
74 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
75 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
76 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
77 # We need awk for the "check" target.  The system "awk" is bad on
78 # some platforms.
79 AC_REQUIRE([AC_PROG_AWK])dnl
80 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
81 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
82 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
83               [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
84                              [_AM_PROG_TAR([v7])])])
85 _AM_IF_OPTION([no-dependencies],,
86 [AC_PROVIDE_IFELSE([AC_PROG_CC],
87                   [_AM_DEPENDENCIES([CC])],
88                   [m4_define([AC_PROG_CC],
89                              m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
90 AC_PROVIDE_IFELSE([AC_PROG_CXX],
91                   [_AM_DEPENDENCIES([CXX])],
92                   [m4_define([AC_PROG_CXX],
93                              m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
94 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
95                   [_AM_DEPENDENCIES([OBJC])],
96                   [m4_define([AC_PROG_OBJC],
97                              m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
98 AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
99                   [_AM_DEPENDENCIES([OBJCXX])],
100                   [m4_define([AC_PROG_OBJCXX],
101                              m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
102 ])
103 AC_REQUIRE([AM_SILENT_RULES])dnl
104 dnl The testsuite driver may need to know about EXEEXT, so add the
105 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
106 dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
107 AC_CONFIG_COMMANDS_PRE(dnl
108 [m4_provide_if([_AM_COMPILER_EXEEXT],
109   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
110 ])
111
112 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
113 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
114 dnl mangled by Autoconf and run in a shell conditional statement.
115 m4_define([_AC_COMPILER_EXEEXT],
116 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
117
118
119 # When config.status generates a header, we must update the stamp-h file.
120 # This file resides in the same directory as the config header
121 # that is generated.  The stamp files are numbered to have different names.
122
123 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
124 # loop where config.status creates the headers, so we can generate
125 # our stamp files there.
126 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
127 [# Compute $1's index in $config_headers.
128 _am_arg=$1
129 _am_stamp_count=1
130 for _am_header in $config_headers :; do
131   case $_am_header in
132     $_am_arg | $_am_arg:* )
133       break ;;
134     * )
135       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
136   esac
137 done
138 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])