Create directory config if it does not exist
[pazpar2-moved-to-github.git] / buildconf.sh
1 #!/bin/sh
2 # $Id: buildconf.sh,v 1.4 2007-04-10 08:11:18 adam Exp $
3
4 automake=automake
5 aclocal=aclocal
6 autoconf=autoconf
7 libtoolize=libtoolize
8 autoheader=autoheader
9
10 test -d config || mkdir config
11
12 if [ "`uname -s`" = FreeBSD ]; then
13     # FreeBSD intalls the various auto* tools with version numbers
14     echo "Using special configuration for FreeBSD ..."
15     automake=automake19
16     aclocal="aclocal19 -I /usr/local/share/aclocal"
17     autoconf=autoconf259
18     libtoolize=libtoolize15
19     autoheader=autoheader259
20 fi
21 if $automake --version|head -1 |grep '1\.[4-7]'; then
22     echo "automake 1.4-1.7 is active. You should use automake 1.8 or later"
23     if test -f /etc/debian_version; then
24         echo " sudo apt-get install automake1.9"
25         echo " sudo update-alternatives --config automake"
26     fi
27     exit 1
28 fi
29
30 set -x
31
32 # I am tired of underquoted warnings for Tcl macros
33 $aclocal -I m4 2>&1 | grep -v aclocal/tcl.m4
34 $autoheader
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"
49     sh_flags="-g -Wall"
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 $*
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 Or just build the Debian packages without configuring
90   dpkg-buildpackage -rfakeroot
91
92 When building from a CVS checkout, you need these Debian tools:
93   libyaz-dev
94
95 EOF
96 fi
97 # Local Variables:
98 # mode:shell-script
99 # sh-indentation: 2
100 # sh-basic-offset: 4
101 # End: