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 # 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 # We need awk for the "check" target.  The system "awk" is bad on
73 # some platforms.
74 AC_REQUIRE([AC_PROG_AWK])dnl
75 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
76 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
77 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
78               [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
79                              [_AM_PROG_TAR([v7])])])
80 _AM_IF_OPTION([no-dependencies],,
81 [AC_PROVIDE_IFELSE([AC_PROG_CC],
82                   [_AM_DEPENDENCIES([CC])],
83                   [m4_define([AC_PROG_CC],
84                              m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
85 AC_PROVIDE_IFELSE([AC_PROG_CXX],
86                   [_AM_DEPENDENCIES([CXX])],
87                   [m4_define([AC_PROG_CXX],
88                              m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
89 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
90                   [_AM_DEPENDENCIES([OBJC])],
91                   [m4_define([AC_PROG_OBJC],
92                              m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
93 AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
94                   [_AM_DEPENDENCIES([OBJCXX])],
95                   [m4_define([AC_PROG_OBJCXX],
96                              m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
97 ])
98 AC_REQUIRE([AM_SILENT_RULES])dnl
99 dnl The testsuite driver may need to know about EXEEXT, so add the
100 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
101 dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
102 AC_CONFIG_COMMANDS_PRE(dnl
103 [m4_provide_if([_AM_COMPILER_EXEEXT],
104   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
105 ])
106
107 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
108 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
109 dnl mangled by Autoconf and run in a shell conditional statement.
110 m4_define([_AC_COMPILER_EXEEXT],
111 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
112
113
114 # When config.status generates a header, we must update the stamp-h file.
115 # This file resides in the same directory as the config header
116 # that is generated.  The stamp files are numbered to have different names.
117
118 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
119 # loop where config.status creates the headers, so we can generate
120 # our stamp files there.
121 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
122 [# Compute $1's index in $config_headers.
123 _am_arg=$1
124 _am_stamp_count=1
125 for _am_header in $config_headers :; do
126   case $_am_header in
127     $_am_arg | $_am_arg:* )
128       break ;;
129     * )
130       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
131   esac
132 done
133 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])