Merge branch 'distcheck-vulnerability-CVE-2012-3386' into maint
[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 19
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(PACKAGE, VERSION, [NO-DEFINE])
15 # AM_INIT_AUTOMAKE([OPTIONS])
16 # -----------------------------------------------
17 # The call with PACKAGE and VERSION arguments is the old style
18 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
19 # and VERSION should now be passed to AC_INIT and removed from
20 # the call to AM_INIT_AUTOMAKE.
21 # We support both call styles for the transition.  After
22 # the next Automake release, Autoconf can make the AC_INIT
23 # arguments mandatory, and then we can depend on a new Autoconf
24 # release and drop the old call support.
25 AC_DEFUN([AM_INIT_AUTOMAKE],
26 [AC_PREREQ([2.62])dnl
27 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
28 dnl the ones we care about.
29 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
30 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
31 AC_REQUIRE([AC_PROG_INSTALL])dnl
32 if test "`cd $srcdir && pwd`" != "`pwd`"; then
33   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
34   # is not polluted with repeated "-I."
35   AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
36   # test to see if srcdir already configured
37   if test -f $srcdir/config.status; then
38     AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
39   fi
40 fi
41
42 # test whether we have cygpath
43 if test -z "$CYGPATH_W"; then
44   if (cygpath --version) >/dev/null 2>/dev/null; then
45     CYGPATH_W='cygpath -w'
46   else
47     CYGPATH_W=echo
48   fi
49 fi
50 AC_SUBST([CYGPATH_W])
51
52 # Define the identity of the package.
53 dnl Distinguish between old-style and new-style calls.
54 m4_ifval([$2],
55 [AC_DIAGNOSE([obsolete],
56 [$0: two- and three-arguments forms are deprecated.  For more info, see:
57 http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
58 m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
59  AC_SUBST([PACKAGE], [$1])dnl
60  AC_SUBST([VERSION], [$2])],
61 [_AM_SET_OPTIONS([$1])dnl
62 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
63 m4_if(
64   m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
65   [ok:ok],,
66   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
67  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
68  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
69
70 _AM_IF_OPTION([no-define],,
71 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
72  AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
73
74 # Some tools Automake needs.
75 AC_REQUIRE([AM_SANITY_CHECK])dnl
76 AC_REQUIRE([AC_ARG_PROGRAM])dnl
77 AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
78 AM_MISSING_PROG([AUTOCONF], [autoconf])
79 AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
80 AM_MISSING_PROG([AUTOHEADER], [autoheader])
81 AM_MISSING_PROG([MAKEINFO], [makeinfo])
82 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
83 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
84 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
85 # For better backward compatibility.  To be removed once Automake 1.9.x
86 # dies out for good.  For more background, see:
87 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
88 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
89 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
90 # We need awk for the "check" target.  The system "awk" is bad on
91 # some platforms.
92 AC_REQUIRE([AC_PROG_AWK])dnl
93 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
94 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
95 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
96               [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
97                              [_AM_PROG_TAR([v7])])])
98 _AM_IF_OPTION([no-dependencies],,
99 [AC_PROVIDE_IFELSE([AC_PROG_CC],
100                   [_AM_DEPENDENCIES([CC])],
101                   [m4_define([AC_PROG_CC],
102                              m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
103 AC_PROVIDE_IFELSE([AC_PROG_CXX],
104                   [_AM_DEPENDENCIES([CXX])],
105                   [m4_define([AC_PROG_CXX],
106                              m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
107 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
108                   [_AM_DEPENDENCIES([OBJC])],
109                   [m4_define([AC_PROG_OBJC],
110                              m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
111 dnl Support for Objective C++ was only introduced in Autoconf 2.65,
112 dnl but we still cater to Autoconf 2.62.
113 m4_ifdef([AC_PROG_OBJCXX],
114 [AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
115                   [_AM_DEPENDENCIES([OBJCXX])],
116                   [m4_define([AC_PROG_OBJCXX],
117                              m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
118 ])
119 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
120 dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
121 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
122 dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
123 AC_CONFIG_COMMANDS_PRE(dnl
124 [m4_provide_if([_AM_COMPILER_EXEEXT],
125   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
126 ])
127
128 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
129 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
130 dnl mangled by Autoconf and run in a shell conditional statement.
131 m4_define([_AC_COMPILER_EXEEXT],
132 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
133
134
135 # When config.status generates a header, we must update the stamp-h file.
136 # This file resides in the same directory as the config header
137 # that is generated.  The stamp files are numbered to have different names.
138
139 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
140 # loop where config.status creates the headers, so we can generate
141 # our stamp files there.
142 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
143 [# Compute $1's index in $config_headers.
144 _am_arg=$1
145 _am_stamp_count=1
146 for _am_header in $config_headers :; do
147   case $_am_header in
148     $_am_arg | $_am_arg:* )
149       break ;;
150     * )
151       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
152   esac
153 done
154 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])