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