5f60670eb48b152034f8d78f5282bbb46a22c8fd
[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 [ "`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 test -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 # I am tired of underquoted warnings for Tcl macros
38 $aclocal -I m4
39 $libtoolize --automake --force 
40 $automake --add-missing 
41 $autoconf
42 set -
43 if [ -f config.cache ]; then
44         rm config.cache
45 fi
46
47 enable_configure=false
48 enable_help=true
49 sh_flags=""
50 conf_flags=""
51 case $1 in
52     -d)
53         #sh_flags="-g -Wall -Wdeclaration-after-statement -Werror -Wstrict-prototypes"
54         sh_flags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
55         enable_configure=true
56         enable_help=false
57         shift
58         ;;
59     -c)
60         sh_flags=""
61         enable_configure=true
62         enable_help=false
63         shift
64         ;;
65 esac
66
67 if $enable_configure; then
68     if test -n "$sh_flags"; then
69         CFLAGS="$sh_flags" ./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 a CVS checkout, 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 EOF
106     fi
107     if [ "`uname -s`" = FreeBSD ]; then
108         cat <<EOF
109 When building from a CVS checkout, you need these FreeBSD Ports:
110   autoconf259, automake19, libtool15, bison, tcl84,
111   docbook-xsl, libxml2, libxslt, g++-4.0, make
112 EOF
113     fi
114 fi