buildconf.sh: update package list for compiling with sources
[yazpp-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=automake
18     aclocal="aclocal -I /usr/local/share/aclocal"
19     autoconf=autoconf
20     libtoolize=libtoolize
21     autoheader=autoheader
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 \
75                 --disable-shared --enable-static --with-pic $*
76     else
77         ./configure $*
78     fi
79 fi
80 if $enable_help; then
81     cat <<EOF
82
83 Build the Makefiles with the configure command.
84   ./configure [--someoption=somevalue ...]
85
86 For help on options or configuring run
87   ./configure --help
88
89 Build and install binaries with the usual
90   make
91   make check
92   make install
93
94 Build distribution tarball with
95   make dist
96
97 Verify distribution tarball with
98   make distcheck
99
100 EOF
101     if [ -f /etc/debian_version ]; then
102         cat <<EOF
103 Or just build the Debian packages without configuring
104   dpkg-buildpackage -rfakeroot
105
106 When building from Git, you need these Debian packages:
107   autoconf automake libtool g++ tcl8.4
108   xsltproc docbook docbook-xml docbook-xsl
109   libxslt1-dev libgnutls-dev libreadline5-dev
110   libicu-dev
111
112 And if you want to make a Debian package: dpkg-dev fakeroot debhelper
113 (Then run "dpkg-buildpackage -rfakeroot" in this directory.)
114
115 EOF
116     fi
117     if [ "`uname -s`" = FreeBSD ]; then
118         cat <<EOF
119 When building from a Git, you need these FreeBSD Ports:
120   pkg_add -r autoconf262 automake110 libtool bison tcl84 \\
121              docbook-xsl libxml2 libxslt
122   pkg_add -r icu4
123 EOF
124     fi
125 fi