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