dc0ba93391491ff969c1aca8b5cb117c2be2be6a
[pazpar2-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 test .git; then
11     if test -d m4/.git -a -d doc/common/.git; then
12         :
13     else
14         git submodule init
15     fi
16     git submodule update
17 fi
18
19 if [ "`uname -s`" = FreeBSD ]; then
20     # FreeBSD intalls the various auto* tools with version numbers
21     echo "Using special configuration for FreeBSD ..."
22     automake=automake19
23     aclocal="aclocal19 -I /usr/local/share/aclocal"
24     autoconf=autoconf259
25     libtoolize=libtoolize15
26     autoheader=autoheader259
27 fi
28 if $automake --version|head -1 |grep '1\.[4-7]'; then
29     echo "automake 1.4-1.7 is active. You should use automake 1.8 or later"
30     if test -f /etc/debian_version; then
31         echo " sudo apt-get install automake1.9"
32         echo " sudo update-alternatives --config automake"
33     fi
34     exit 1
35 fi
36
37 set -x
38
39 # I am tired of underquoted warnings for Tcl macros
40 $aclocal -I m4 2>&1 | grep -v aclocal/tcl.m4
41 $autoheader
42 $automake --add-missing 
43 $autoconf
44 set -
45 if [ -f config.cache ]; then
46     rm config.cache
47 fi
48
49 enable_configure=false
50 enable_help=true
51 sh_flags=""
52 conf_flags=""
53 case $1 in
54     -d)
55     #sh_flags="-g -Wall -Wdeclaration-after-statement"
56     sh_flags="-g -Wall"
57     enable_configure=true
58     enable_help=false
59     shift
60     ;;
61     -c)
62     sh_flags=""
63     enable_configure=true
64     enable_help=false
65     shift
66     ;;
67 esac
68
69 if $enable_configure; then
70     if test -n "$sh_flags"; then
71         CFLAGS="$sh_flags" ./configure $*
72     else
73         ./configure $*
74     fi
75 fi
76 if $enable_help; then
77     cat <<EOF
78     
79 Build the Makefiles with the configure command.
80   ./configure [--someoption=somevalue ...]
81   
82 For help on options or configuring run
83   ./configure --help
84
85 Build and install binaries with the usual
86   make
87   make check
88   make install
89
90 Build distribution tarball with
91   make dist
92
93 Verify distribution tarball with
94   make distcheck
95
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 tools:
100   libyaz-dev
101
102 EOF
103 fi
104 # Local Variables:
105 # mode:shell-script
106 # sh-indentation: 2
107 # sh-basic-offset: 4
108 # End: