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