Fixed check for Git submodules.
[yaz-moved-to-github.git] / buildconf.sh
1 #!/bin/sh
2 # $Id: buildconf.sh,v 1.46 2007-02-20 09:53:01 adam Exp $
3
4 automake=automake
5 aclocal=aclocal
6 autoconf=autoconf
7 libtoolize=libtoolize
8
9 test -d config || mkdir config
10 if test -d m4/.git -a -d doc/common/.git; then
11     :
12 else
13     git submodule init
14     git submodule update
15 fi
16
17 if [ "`uname -s`" = FreeBSD ]; then
18     # FreeBSD intalls the various auto* tools with version numbers
19     echo "Using special configuration for FreeBSD ..."
20     automake=automake19
21     aclocal="aclocal19 -I /usr/local/share/aclocal"
22     autoconf=autoconf259
23     libtoolize=libtoolize15
24 fi
25
26 if $automake --version|head -1 |grep '1\.[4-7]'; then
27     echo "automake 1.4-1.7 is active. You should use automake 1.8 or later"
28     if test -f /etc/debian_version; then
29         echo " sudo apt-get install automake1.9"
30         echo " sudo update-alternatives --config automake"
31     fi
32     exit 1
33 fi
34
35 set -x
36 # I am tired of underquoted warnings for Tcl macros
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_flags="-g -Wall -Wdeclaration-after-statement -Werror -Wstrict-prototypes"
53         sh_flags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
54         enable_configure=true
55         enable_help=false
56         shift
57         ;;
58     -c)
59         sh_flags=""
60         enable_configure=true
61         enable_help=false
62         shift
63         ;;
64 esac
65
66 if $enable_configure; then
67     if test -n "$sh_flags"; then
68         CFLAGS="$sh_flags" ./configure --disable-shared --enable-static $*
69     else
70         ./configure $*
71     fi
72 fi
73 if $enable_help; then
74     cat <<EOF
75
76 Build the Makefiles with the configure command.
77   ./configure [--someoption=somevalue ...]
78
79 For help on options or configuring run
80   ./configure --help
81
82 Build and install binaries with the usual
83   make
84   make check
85   make install
86
87 Build distribution tarball with
88   make dist
89
90 Verify distribution tarball with
91   make distcheck
92
93 EOF
94     if [ -f /etc/debian_version ]; then
95         cat <<EOF
96 Or just build the Debian packages without configuring
97   dpkg-buildpackage -rfakeroot
98
99 When building from a CVS checkout, you need these Debian packages:
100   autoconf, automake, libtool, gcc, bison, any tcl,
101   xsltproc, docbook, docbook-xml, docbook-xsl,
102   libxslt1-dev, libssl-dev, libreadline5-dev, libwrap0-dev,
103   libpcap0.8-dev
104 EOF
105     fi
106     if [ "`uname -s`" = FreeBSD ]; then
107         cat <<EOF
108 When building from a CVS checkout, you need these FreeBSD Ports:
109   autoconf259, automake19, libtool15, bison, tcl84,
110   docbook-xsl, libxml2, libxslt, g++-4.0, make
111 EOF
112     fi
113 fi