Maybe automake version handling will be right this time
[obnox/wireshark/wip.git] / autogen.sh
1 #!/bin/sh
2 #
3 # Run this to generate all the initial makefiles.
4 #
5 # $Id: autogen.sh,v 1.32 2004/03/08 23:37:51 jmayer Exp $
6
7 DIE=true
8 PROJECT="Ethereal"
9
10
11 # Check for python. There's no "--version" option!
12 python -c "print 'Checking for python.'"
13 if [ $? != 0 ] ; then
14   cat >&2 <<_EOF_
15
16         You must have Python in order to compile $PROJECT.
17         Download the appropriate package for your distribution/OS,
18         or get the source tarball at http://www.python.org/
19 _EOF_
20   DIE="exit 1"
21 fi
22
23
24 ACVER=`autoconf --version | grep '^autoconf' | sed 's/.*) *//'`
25 case "$ACVER" in
26 0* | 1\.* | 2\.[0-4]* | \
27 2\.5[0-1] | 2\.5[0-1][a-z]* )
28   cat >&2 <<_EOF_
29
30         You must have autoconf 2.52 or later installed to compile $PROJECT.
31         Download the appropriate package for your distribution/OS,
32         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/
33 _EOF_
34   DIE="exit 1"
35   ;;
36 esac
37
38
39 AMVER=`automake --version | grep '^automake' | sed 's/.*) *//'`
40 case "$AMVER" in
41 0.* | 1\.[0-5].* )
42
43   cat >&2 <<_EOF_
44
45         You must have automake 1.6 or later installed to compile $PROJECT.
46         Download the appropriate package for your distribution/OS,
47         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/
48 _EOF_
49   DIE="exit 1"
50   ;;
51 esac
52
53
54 #
55 # Apple's Developer Tools have a "libtool" that has nothing to do with
56 # the GNU libtool; they call the latter "glibtool".  They also call
57 # libtoolize "glibtoolize".
58 #
59 # Check for "glibtool" first.
60 #
61 LTVER=`glibtool --version 2>/dev/null | grep ' libtool)' | \
62     sed 's/.*) \([0-9][0-9.]*\) .*/\1/'`
63 if test -z "$LTVER"
64 then
65         LTVER=`libtool --version | grep ' libtool)' | \
66             sed 's/.*) \([0-9][0-9.]*\) .*/\1/' `
67         LIBTOOLIZE=libtoolize
68 else
69         LIBTOOLIZE=glibtoolize
70 fi
71 case "$LTVER" in
72 0* | 1\.[0-3]* )
73
74   cat >&2 <<_EOF_
75
76         You must have libtool 1.4 or later installed to compile $PROJECT.
77         Download the appropriate package for your distribution/OS,
78         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/libtool/
79 _EOF_
80   DIE="exit 1"
81   ;;
82 esac
83
84 $DIE
85
86 #
87 # We do NOT want libtoolize overwriting our versions of config.guess and
88 # config.sub, so move them away and then move them back.
89 # We don't omit "--force", as we want libtoolize to install other files
90 # without whining.
91 #
92 mv config.guess config.guess.save-libtool
93 mv config.sub config.sub.save-libtool
94 LTARGS=" --copy --force"
95 echo $LIBTOOLIZE $LTARGS
96 $LIBTOOLIZE $LTARGS || exit 1
97 rm -f config.guess config.sub
98 mv config.guess.save-libtool config.guess
99 mv config.sub.save-libtool config.sub
100
101 for dir in . epan wiretap ;  do
102   echo processing $dir
103   (
104     cd $dir
105     if [ "$dir" = "." ] ; then
106         topdir=.
107     else
108         topdir=..
109     fi
110     aclocal_flags=`$topdir/aclocal-flags`
111     aclocalinclude="$ACLOCAL_FLAGS $aclocal_flags";
112     echo aclocal $aclocalinclude
113     aclocal $aclocalinclude || exit 1
114     echo autoheader
115     autoheader || exit 1
116     echo automake --add-missing --gnu $am_opt
117     automake --add-missing --gnu $am_opt || exit 1
118     echo autoconf
119     autoconf || exit 1
120   ) || exit 1
121 done
122
123 #./configure "$@" || exit 1
124
125 echo
126 echo "Now type \"./configure [options]\" and \"make\" to compile $PROJECT."