Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
[yaz-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 test .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 $automake --version|head -1 |grep '1\.[4-7]'; then
23     echo "automake 1.4-1.7 is active. You should use automake 1.8 or later"
24     if test -f /etc/debian_version; then
25         echo " sudo apt-get install automake1.9"
26         echo " sudo update-alternatives --config automake"
27     fi
28     exit 1
29 fi
30
31 set -x
32 # I am tired of underquoted warnings for Tcl macros
33 $aclocal -I m4
34 $libtoolize --automake --force 
35 $automake --add-missing 
36 $autoconf
37 set -
38 if [ -f config.cache ]; then
39         rm config.cache
40 fi
41
42 enable_configure=false
43 enable_help=true
44 sh_flags=""
45 conf_flags=""
46 case $1 in
47     -d)
48         #sh_flags="-g -Wall -Wdeclaration-after-statement -Werror -Wstrict-prototypes"
49         sh_flags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
50         enable_configure=true
51         enable_help=false
52         shift
53         ;;
54     -c)
55         sh_flags=""
56         enable_configure=true
57         enable_help=false
58         shift
59         ;;
60 esac
61
62 if $enable_configure; then
63     if test -n "$sh_flags"; then
64         CFLAGS="$sh_flags" ./configure --disable-shared --enable-static $*
65     else
66         ./configure $*
67     fi
68 fi
69 if $enable_help; then
70     cat <<EOF
71
72 Build the Makefiles with the configure command.
73   ./configure [--someoption=somevalue ...]
74
75 For help on options or configuring run
76   ./configure --help
77
78 Build and install binaries with the usual
79   make
80   make check
81   make install
82
83 Build distribution tarball with
84   make dist
85
86 Verify distribution tarball with
87   make distcheck
88
89 EOF
90     if [ -f /etc/debian_version ]; then
91         cat <<EOF
92 Or just build the Debian packages without configuring
93   dpkg-buildpackage -rfakeroot
94
95 When building from a CVS checkout, you need these Debian packages:
96   autoconf, automake, libtool, gcc, bison, any tcl,
97   xsltproc, docbook, docbook-xml, docbook-xsl,
98   libxslt1-dev, libssl-dev, libreadline5-dev, libwrap0-dev,
99   libpcap0.8-dev
100 EOF
101     fi
102     if [ "`uname -s`" = FreeBSD ]; then
103         cat <<EOF
104 When building from a CVS checkout, you need these FreeBSD Ports:
105   autoconf259, automake19, libtool15, bison, tcl84,
106   docbook-xsl, libxml2, libxslt, g++-4.0, make
107 EOF
108     fi
109 fi