Happy new year.
[idzebra-moved-to-github.git] / buildconf.sh
1 #!/bin/sh
2
3 automake=automake
4 aclocal=aclocal
5 autoconf=autoconf
6 libtoolize=libtoolize
7 autoheader=autoheader
8
9 test -d config || mkdir config
10 if [ -d .git ]; then
11     git submodule init
12     git submodule update
13 fi
14 if [ "`uname -s`" = FreeBSD ]; then
15     # FreeBSD intalls the various auto* tools with version numbers
16     echo "Using special configuration for FreeBSD ..."
17     automake=automake19
18     aclocal="aclocal19 -I /usr/local/share/aclocal"
19     autoconf=autoconf259
20     libtoolize=libtoolize15
21     autoheader=autoheader259
22 fi
23
24 if [ "`uname -s`" = Darwin ]; then
25     echo "Using special configuration for Darwin/MacOS ..."
26     libtoolize=glibtoolize
27 fi
28
29 if $automake --version|head -1 |grep '1\.[4-7]'; then
30     echo "automake 1.4-1.7 is active. You should use automake 1.8 or later"
31     if [ -f /etc/debian_version ]; then
32         echo " sudo apt-get install automake1.9"
33         echo " sudo update-alternatives --config automake"
34     fi
35     exit 1
36 fi
37
38 set -x
39 $aclocal -I m4
40 if grep AC_CONFIG_HEADERS configure.ac >/dev/null; then
41     $autoheader
42 fi
43 $libtoolize --automake --force 
44 $automake --add-missing 
45 $autoconf
46 set -
47 if [ -f config.cache ]; then
48         rm config.cache
49 fi
50
51 enable_configure=false
52 enable_help=true
53 sh_flags=""
54 conf_flags=""
55 case $1 in
56     -d)
57         sh_cflags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
58         sh_cxxflags="-g -Wall"
59         enable_configure=true
60         enable_help=false
61         shift
62         ;;
63     -c)
64         sh_cflags=""
65         sh_cxxflags=""
66         enable_configure=true
67         enable_help=false
68         shift
69         ;;
70 esac
71
72 if $enable_configure; then
73     if [ -n "$sh_cflags" ]; then
74         CFLAGS="$sh_cflags" CXXFLAGS="$sh_cxxflags" ./configure --disable-shared --enable-static $*
75     else
76         ./configure $*
77     fi
78 fi
79 if $enable_help; then
80     cat <<EOF
81
82 Build the Makefiles with the configure command.
83   ./configure [--someoption=somevalue ...]
84
85 For help on options or configuring run
86   ./configure --help
87
88 Build and install binaries with the usual
89   make
90   make check
91   make install
92
93 Build distribution tarball with
94   make dist
95
96 Verify distribution tarball with
97   make distcheck
98
99 EOF
100     if [ -f /etc/debian_version ]; then
101         cat <<EOF
102 Or just build the Debian packages without configuring
103   dpkg-buildpackage -rfakeroot
104
105 When building from Git, you need these Debian packages:
106   autoconf, automake, libtool, gcc, bison, any tcl,
107   xsltproc, docbook, docbook-xml, docbook-xsl,
108   libxslt1-dev, libssl-dev, libreadline5-dev, libwrap0-dev,
109   libpcap0.8-dev
110
111 Also perhaps: libgnutls-dev libicu-dev
112
113 And if you want to make a Debian package: dpkg-dev fakeroot debhelper
114 (Then run "dpkg-buildpackage -rfakeroot" in this directory.)
115
116 EOF
117     fi
118     if [ "`uname -s`" = FreeBSD ]; then
119         cat <<EOF
120 When building from a Git, you need these FreeBSD Ports:
121   autoconf259, automake19, libtool15, bison, tcl84,
122   docbook-xsl, libxml2, libxslt, g++-4.0, make
123 EOF
124     fi
125 fi