From Alejandro Vaquero:
[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-4]* | \
36 2.5[0-1] | 2.5[0-1][a-z]* )
37   cat >&2 <<_EOF_
38
39         You must have autoconf 2.52 or later installed to compile $PROJECT.
40         Download the appropriate package for your distribution/OS,
41         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/
42 _EOF_
43   DIE="exit 1"
44   ;;
45 esac
46
47
48 AMVER=`$AUTOMAKE --version | grep '^automake' | sed 's/.*) *//'`
49 case "$AMVER" in
50 1.[6-9]* | 1.[1][0-9]*)
51   ;;
52
53 *)
54
55   cat >&2 <<_EOF_
56
57         You must have automake 1.6 or later installed to compile $PROJECT.
58         Download the appropriate package for your distribution/OS,
59         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/
60 _EOF_
61   DIE="exit 1"
62   ;;
63 esac
64
65
66 #
67 # Apple's Developer Tools have a "libtool" that has nothing to do with
68 # the GNU libtool; they call the latter "glibtool".  They also call
69 # libtoolize "glibtoolize".
70 #
71 # Check for "glibtool" first.
72 #
73 LTVER=`glibtool --version 2>/dev/null | grep ' libtool)' | \
74     sed 's/.*libtool) \([0-9][0-9.]*\)[^ ]* .*/\1/'`
75 if test -z "$LTVER"
76 then
77         LTVER=`libtool --version | grep ' libtool)' | \
78             sed 's/.*) \([0-9][0-9.]*\)[^ ]* .*/\1/' `
79         LIBTOOLIZE=libtoolize
80 else
81         LIBTOOLIZE=glibtoolize
82 fi
83 case "$LTVER" in
84 '' | 0.* | 1.[0-3]* )
85
86   cat >&2 <<_EOF_
87
88         You must have libtool 1.4 or later installed to compile $PROJECT.
89         Download the appropriate package for your distribution/OS,
90         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/libtool/
91 _EOF_
92   DIE="exit 1"
93   ;;
94 esac
95
96 $DIE
97
98 for dir in . wiretap ;  do
99   echo processing $dir
100   (
101     cd $dir
102     if [ "$dir" = "." ] ; then
103         topdir=.
104     else
105         topdir=..
106     fi
107     aclocal_flags=`$topdir/aclocal-flags`
108     aclocalinclude="$ACLOCAL_FLAGS $aclocal_flags";
109     echo $ACLOCAL $aclocalinclude
110     $ACLOCAL $aclocalinclude || exit 1
111     if [ "$dir" = "." ] ; then
112         #
113         # We do NOT want libtoolize overwriting our versions of config.guess and
114         # config.sub, so move them away and then move them back.
115         # We don't omit "--force", as we want libtoolize to install other files
116         # without whining.
117         #
118         mv config.guess config.guess.save-libtool
119         mv config.sub config.sub.save-libtool
120         LTARGS=" --copy --force"
121         echo $LIBTOOLIZE $LTARGS
122         $LIBTOOLIZE $LTARGS || exit 1
123         rm -f config.guess config.sub
124         mv config.guess.save-libtool config.guess
125         mv config.sub.save-libtool config.sub
126     fi
127     echo $AUTOHEADER
128     $AUTOHEADER || exit 1
129     echo $AUTOMAKE --add-missing --gnu $am_opt
130     $AUTOMAKE --add-missing --gnu $am_opt || exit 1
131     echo $AUTOCONF
132     $AUTOCONF || exit 1
133   ) || exit 1
134 done
135
136 #./configure "$@" || exit 1
137
138 echo
139 echo "Now type \"./configure [options]\" and \"make\" to compile $PROJECT."