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