Always run 'git submodule update' when git is in use
[idzebra-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     if test -d m4/.git -a -d doc/common/.git; then
11         :
12     else
13         git submodule init
14     fi
15     git submodule update
16 fi
17
18 if [ "`uname -s`" = FreeBSD ]; then
19     # FreeBSD intalls the various auto* tools with version numbers
20     echo "Using special configuration for FreeBSD ..."
21     automake=automake19
22     aclocal="aclocal19 -I /usr/local/share/aclocal"
23     autoconf=autoconf259
24     libtoolize=libtoolize15
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 2>&1 | grep -v aclocal/tcl.m4
39 $libtoolize --automake --force 
40 $automake -a 
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 -O0 -Wdeclaration-after-statement -Wstrict-prototypes"
54         enable_configure=true
55         enable_help=false
56         shift
57         ;;
58     -p)
59         sh_flags="-g -pg -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
60         enable_configure=true
61         enable_help=false
62         shift
63         ;;
64     -o)
65         sh_flags="-g -Wall -O3 -Wdeclaration-after-statement -Wstrict-prototypes"
66         enable_configure=true
67         enable_help=false
68         shift
69         ;;
70     -c)
71         sh_flags=""
72         enable_configure=true
73         enable_help=false
74         shift
75         ;;
76 esac
77
78 if $enable_configure; then
79     if test -n "$sh_flags"; then
80         CFLAGS="$sh_flags" ./configure --disable-shared $*
81     else
82         ./configure $*
83     fi
84 fi
85 if $enable_help; then
86     cat <<EOF
87
88 Build the Makefiles with the configure command.
89   ./configure [--someoption=somevalue ...]
90
91 For help on options or configuring run
92   ./configure --help
93
94 Build and install binaries with the usual
95   make
96   make check
97   make install
98
99 Build distribution tarball with
100   make dist
101
102 Verify distribution tarball with
103   make distcheck
104
105 Or just build the Debian packages without configuring
106   dpkg-buildpackage -rfakeroot
107
108 When building from a CVS checkout, you need these Debian packages:
109   docbook, docbook-xml, docbook-xsl, xsltproc,
110   libyaz-dev, libexpat1-dev, tcl8.4-dev, libbz2-dev
111 and if you want the Alvis/XSLT filter, you also need:
112   libxslt1-dev
113 EOF
114 fi