Fix up coding style in ByteViewText.
[metze/wireshark/wip.git] / autogen.sh
1 #!/bin/sh
2 #
3 # Run this to generate all the initial makefiles.
4 #
5 # Copyright 2014 The Wireshark Authors
6 #
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 # Copyright 1998 Gerald Combs
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 DIE=true
26 PROJECT="Wireshark"
27
28 # If you are going to use the non-default name for automake becase your OS
29 # installaion has multiple versions, you need to call both aclocal and automake
30 # with that version number, as they come from the same package.
31 #AM_VERSION='-1.8'
32
33 ACLOCAL=aclocal$AM_VERSION
34 AUTOHEADER=autoheader
35 AUTOMAKE=automake$AM_VERSION
36 AUTOCONF=autoconf
37 PKG_CONFIG=pkg-config
38
39 # Check for python. Python did not support --version before version 2.5.
40 # Until we require a version > 2.5, we should use -V.
41 PYVER=`exec python -V 2>&1 | sed 's/Python *//'`
42 # If "python" isn't found, try "python3"
43 if test "$PYVER" = "exec: python: not found"
44 then
45     PYVER=`exec python3 -V 2>&1 | sed 's/Python *//'`
46 fi
47 case "$PYVER" in
48 2*|3*)
49   ;;
50 *)
51   cat >&2 <<_EOF_
52
53         You must have Python in order to compile $PROJECT.
54         Download the appropriate package for your distribution/OS,
55         or get the source tarball at http://www.python.org/
56 _EOF_
57   DIE="exit 1"
58 esac
59
60 ACVER=`$AUTOCONF --version | grep '^autoconf' | sed 's/.*) *//'`
61 case "$ACVER" in
62 '' | 0.* | 1.* | 2.[0-5]* | 2.6[0123]* )
63   cat >&2 <<_EOF_
64
65         You must have autoconf 2.64 or later installed to compile $PROJECT.
66         Download the appropriate package for your distribution/OS,
67         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/
68 _EOF_
69   DIE="exit 1"
70   ;;
71 esac
72
73
74 AMVER=`$AUTOMAKE --version | grep '^automake' | sed 's/.*) *//'`
75 case "$AMVER" in
76 1.11* | 1.1[2-9]*)
77   ;;
78
79 *)
80
81   cat >&2 <<_EOF_
82
83         You must have automake 1.11 or later installed to compile $PROJECT.
84         Download the appropriate package for your distribution/OS,
85         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/
86 _EOF_
87   DIE="exit 1"
88   ;;
89 esac
90
91
92 #
93 # Apple's Developer Tools have a "libtool" that has nothing to do with
94 # the GNU libtool; they call the latter "glibtool".  They also call
95 # libtoolize "glibtoolize".
96 #
97 # Check for "glibtool" first.
98 #
99 LTVER=`glibtool --version 2>/dev/null | grep ' libtool)' | \
100     sed 's/.*libtool) \([0-9][0-9.]*\)[^ ]* .*/\1/'`
101 if test -z "$LTVER"
102 then
103         LTVER=`libtool --version | grep ' libtool)' | \
104             sed 's/.*) \([0-9][0-9.]*\)[^ ]* .*/\1/' `
105         LIBTOOLIZE=libtoolize
106 else
107         LIBTOOLIZE=glibtoolize
108 fi
109 case "$LTVER" in
110 '' | 0.* | 1.* | 2.2 )
111
112   cat >&2 <<_EOF_
113
114         You must have libtool 2.2.2 or later installed to compile $PROJECT.
115         Download the appropriate package for your distribution/OS,
116         or get the source tarball at ftp://ftp.gnu.org/pub/gnu/libtool/
117 _EOF_
118   DIE="exit 1"
119   ;;
120 esac
121
122 #
123 # XXX - is there some minimum version for which we should be checking?
124 #
125 PCVER=`pkg-config --version`
126 if test -z "$PCVER"; then
127   cat >&2 <<_EOF_
128
129         You must have pkg-config installed to compile $PROJECT.
130         Download the appropriate package for your distribution/OS,
131         or get the source tarball at http://pkgconfig.freedesktop.org/releases/
132 _EOF_
133   DIE="exit 1"
134 fi
135
136 $DIE
137
138 aclocal_flags="-I m4"
139 aclocalinclude="$ACLOCAL_FLAGS $aclocal_flags";
140 echo $ACLOCAL $aclocalinclude
141 $ACLOCAL $aclocalinclude || exit 1
142 LTARGS=" --copy --force"
143 echo $LIBTOOLIZE $LTARGS
144 $LIBTOOLIZE $LTARGS || exit 1
145 echo $AUTOHEADER
146 $AUTOHEADER || exit 1
147 echo $AUTOMAKE --add-missing --gnu $am_opt
148 $AUTOMAKE --add-missing --gnu $am_opt || exit 1
149 echo $AUTOCONF
150 $AUTOCONF || exit 1
151
152 if [ `uname -s` = Darwin ] ; then
153     echo
154     echo "To configure Wireshark on OS X, you will need to type:"
155     echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig"
156     echo "before you can run configure."
157 fi
158
159 echo
160 echo "Now type \"./configure [options]\" and \"make\" to compile $PROJECT."