Fix portability problem with /usr/bin/awk on Solaris 10 in stats test
[dejagnu.git] / autogen.sh
blob1123cab85c3643a867637ab4c5d28ea340e86705
1 #!/bin/sh
3 #
4 # Copyright (C) 2005-2019, 2020 Free Software Foundation, Inc.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 # Run this to generate all the initial makefiles, etc.
21 srcdir=`dirname $0`
22 test -z "$srcdir" && srcdir=.
24 DIE=0
26 #Always use our macros
27 #ACLOCAL_FLAGS="-I macros $ACLOCAL_FLAGS"
29 if test "`uname`" = "Darwin"; then
30 LIBTOOLIZE=glibtoolize
33 (test -f $srcdir/configure.ac) || {
34 echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
35 echo " top-level package directory"
36 exit 1
39 (${AUTOCONF:-autoconf} --version) < /dev/null > /dev/null 2>&1 || {
40 echo
41 echo "**Error**: You must have \`autoconf' installed."
42 echo "Download the appropriate package for your distribution,"
43 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
44 DIE=1
47 (grep "^AC_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
48 (${INTLTOOLIZE:-intltoolize} --version) < /dev/null > /dev/null 2>&1 || {
49 echo
50 echo "**Error**: You must have \`intltool' installed."
51 echo "You can get it from:"
52 echo " ftp://ftp.gnome.org/pub/GNOME/"
53 DIE=1
57 (grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
58 (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
59 echo
60 echo "**Error**: You must have \`xml-i18n-toolize' installed."
61 echo "You can get it from:"
62 echo " ftp://ftp.gnome.org/pub/GNOME/"
63 DIE=1
67 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
68 (${LIBTOOL:-libtool} --version) < /dev/null > /dev/null 2>&1 || {
69 echo
70 echo "**Error**: You must have \`libtool' installed."
71 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
72 DIE=1
76 (grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
77 (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
78 (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
79 echo
80 echo "**Error**: You must have \`glib' installed."
81 echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
82 DIE=1
86 (${AUTOMAKE:-automake} --version) < /dev/null > /dev/null 2>&1 || {
87 echo
88 echo "**Error**: You must have \`automake' installed."
89 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
90 DIE=1
91 NO_AUTOMAKE=yes
95 # if no automake, don't bother testing for aclocal
96 test -n "$NO_AUTOMAKE" || (${ACLOCAL:-aclocal} --version) < /dev/null > /dev/null 2>&1 || {
97 echo
98 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
99 echo "installed doesn't appear recent enough."
100 echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
101 DIE=1
104 if test "$DIE" -eq 1; then
105 exit 1
108 case $CC in
109 xlc )
110 am_opt=--include-deps;;
111 esac
113 # Rather than have libltdl run it's own configure, the few tests libltdl needed
114 # were added to the main configure.ac. As we need to look at config.h in header
115 # files, which may conflict with other versions of config.h, this has been
116 # renamed to gnashconfig,h to be unique. As the files libtoolize copies insist
117 # on using config.h, we just edit the name, rather than adding a fixed copy to
118 # Gnash.
120 # This gets more interesting with libtool 2.x, which heavily changed how everything
121 # worked. Where libtool 1.5 installed only a header and had a single source file,
122 # libtool 2.x has an entire sub directory tree of headers and source files.
123 # So for libtool 1.5.x, we do everything the way this has always worked for Gnash.
124 # For libtool 2.x, we install in a subdirectory of libbase, because we have to
125 # hack the build directory, and everything configures tottally differernt than 1.5.x
126 # used to. For more fun, libtoolize has different command line arguments, but one thing
127 # that got fixed is for libtool 2.x there is an #define for the config file name, but
128 # for libtool 1.5 it expects config.h always, so we change this to gnashconfig.h.
129 ltdlver=`${LIBTOOLIZE:-libtoolize} --version | head -1 | cut -d ' ' -f 4`
130 ltdlmajor=`echo $ltdlver | cut -d '.' -f 1`
131 if test -z "$NO_LIBTOOLIZE" ; then
132 libtoolflags="--force --copy"
133 if test $ltdlmajor -eq 2; then
134 libtoolflags="${libtoolflags} --quiet --recursive"
136 echo "Running libtoolize $ltdlver ${libtoolflags} ..."
137 if ${LIBTOOLIZE:-libtoolize} ${libtoolflags}; then
138 # libtool insists on including config.h, but we use gnashconfig.h
139 # to avoid any problems, so we have to change this include
140 # so they all reference the right config header file.
141 if test -d libltdl; then
142 for i in libltdl/*.c; do
143 # echo "Fixing $i..."
144 mv $i $i.orig
145 sed -e 's/include <config.h>/include <gnashconfig.h>/' $i.orig > $i
146 done
148 # sized one to keep autoconf happy.
149 if test $ltdlmajor -eq 1; then
150 mv libltdl/Makefile.am Makefile.am.orig
151 touch libltdl/Makefile.am
153 if test -f ${ltbasedir}/config-h.in; then
154 chmod a+w ${ltbasedir}/config-h.in # Darwin needs this
156 else
157 echo
158 echo "**Error**: libtoolize failed, do you have libtool and libltdl3-dev packages installed?"
159 exit 1
163 #for coin in `find $srcdir -name CVS -prune -o -name configure.ac -print`
164 for coin in configure.ac
166 dr=`dirname $coin`
167 if test -f $dr/NO-AUTO-GEN; then
168 echo skipping $dr -- flagged as no auto-gen
169 else
170 echo processing $dr
171 ( cd $dr
173 if test -d macros; then
174 aclocalinclude="-I macros $ACLOCAL_FLAGS"
175 else
176 aclocalinclude="$ACLOCAL_FLAGS"
179 if test -d cygnal; then
180 aclocalinclude="-I cygnal ${aclocalinclude}"
183 if test -d libltdl/m4; then
184 aclocalinclude="-I libltdl/m4 -I macros $ACLOCAL_FLAGS"
187 if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
188 echo "Creating $dr/aclocal.m4 ..."
189 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
190 echo "Making $dr/aclocal.m4 writable ..."
191 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
193 if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then
194 echo "Running intltoolize --copy --force --automake ..."
195 ${INTLTOOLIZE:-intltoolize} --copy --force --automake
197 if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
198 echo "Running xml-i18n-toolize --copy --force --automake..."
199 xml-i18n-toolize --copy --force --automake
201 # if grep "^AC_PROG_LIBTOOL" configure.ac >/dev/null; then
202 # if test -z "$NO_LIBTOOLIZE" ; then
203 # echo "Running libtoolize --force --copy ..."
204 # ${LIBTOOLIZE:-libtoolize} --force --copy
205 # fi
206 # fi
207 echo "Running aclocal $aclocalinclude ..."
208 ${ACLOCAL:-aclocal} $aclocalinclude
209 if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then
210 echo "Running autoheader..."
211 ${AUTOHEADER:-autoheader}
213 # This is a hack. Any command line arguments maens don't run Automake.
214 # This is to prevent regenerating and checking in a pile of Makefiles
215 # that haven't really changed. They clutter up the checkin messages.
216 if test x"$1" = x ; then
217 echo "Running automake --add-missing --copy $am_opt ..."
218 ${AUTOMAKE:-automake} -Wno-portability --add-missing --copy $am_opt
220 echo "Running autoconf ..."
221 ${AUTOCONF:-autoconf} -Wno-portability
224 done
226 conf_flags="--enable-maintainer-mode"