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