The shell script autogen.sh can create all these removed files, but be
[oweals/tinc.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5
6 srcdir="`pwd`"
7
8 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
9   echo
10   echo "**Error**: You must have \`autoconf' installed to compile Gnome."
11   echo "Download the appropriate package for your distribution,"
12   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
13   DIE=1
14 }
15
16 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
17   (libtool --version) < /dev/null > /dev/null 2>&1 || {
18     echo
19     echo "**Error**: You must have \`libtool' installed to compile Gnome."
20     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
21     echo "(or a newer version if it is available)"
22     DIE=1
23   }
24 }
25
26 grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
27   grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
28   (gettext --version) < /dev/null > /dev/null 2>&1 || {
29     echo
30     echo "**Error**: You must have \`gettext' installed to compile Gnome."
31     echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
32     echo "(or a newer version if it is available)"
33     DIE=1
34   }
35 }
36
37 grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
38   grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
39   (gettext --version) < /dev/null > /dev/null 2>&1 || {
40     echo
41     echo "**Error**: You must have \`gettext' installed to compile Gnome."
42     echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
43     echo "(or a newer version if it is available)"
44     DIE=1
45   }
46 }
47
48 (automake --version) < /dev/null > /dev/null 2>&1 || {
49   echo
50   echo "**Error**: You must have \`automake' installed to compile Gnome."
51   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
52   echo "(or a newer version if it is available)"
53   DIE=1
54   NO_AUTOMAKE=yes
55 }
56
57
58 # if no automake, don't bother testing for aclocal
59 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
60   echo
61   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
62   echo "installed doesn't appear recent enough."
63   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
64   echo "(or a newer version if it is available)"
65   DIE=1
66 }
67
68 if test "$DIE" -eq 1; then
69   exit 1
70 fi
71
72 if test -z "$*"; then
73   echo "**Warning**: I am going to run \`configure' with no arguments."
74   echo "If you wish to pass any to it, please specify them on the"
75   echo \`$0\'" command line."
76   echo
77 fi
78
79 case $CC in
80 xlc )
81   am_opt=--include-deps;;
82 esac
83
84 for coin in `find $srcdir -name configure.in -print`
85 do 
86   dr=`dirname $coin`
87   if test -f $dr/NO-AUTO-GEN; then
88     echo skipping $dr -- flagged as no auto-gen
89   else
90     echo processing $dr
91     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
92     ( cd $dr
93       aclocalinclude="$ACLOCAL_FLAGS"
94       for k in $macrodirs; do
95         if test -d $k; then
96           aclocalinclude="$aclocalinclude -I $k"
97         ##else 
98         ##  echo "**Warning**: No such directory \`$k'.  Ignored."
99         fi
100       done
101       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
102         if grep "sed.*POTFILES" configure.in >/dev/null; then
103           : do nothing -- we still have an old unmodified configure.in
104         else
105           echo "Creating $dr/aclocal.m4 ..."
106           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
107           echo "Running gettextize...  Ignore non-fatal messages."
108           echo "no" | gettextize --force --copy
109           echo "Making $dr/aclocal.m4 writable ..."
110           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
111         fi
112       fi
113       if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
114         echo "Creating $dr/aclocal.m4 ..."
115         test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
116         echo "Running gettextize...  Ignore non-fatal messages."
117         echo "no" | gettextize --force --copy
118         echo "Making $dr/aclocal.m4 writable ..."
119         test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
120       fi
121       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
122         echo "Running libtoolize..."
123         libtoolize --force --copy
124       fi
125       echo "Running aclocal $aclocalinclude ..."
126       aclocal $aclocalinclude
127       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
128         echo "Running autoheader..."
129         autoheader
130       fi
131       echo "Running automake --gnu $am_opt ..."
132       automake --add-missing --gnu $am_opt
133       echo "Running autoconf ..."
134       autoconf
135     )
136   fi
137 done
138
139 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
140
141 if test x$NOCONFIGURE = x; then
142   echo Running $srcdir/configure $conf_flags "$@" ...
143   $srcdir/configure $conf_flags "$@" \
144   && echo Now type \`make\' to compile $PKG_NAME || exit 1
145 else
146   echo Skipping configure process.
147 fi