Extract static/private stuff too
[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_cflags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
54         sh_cxxflags="-g -Wall"
55         enable_configure=true
56         enable_help=false
57         shift
58         ;;
59     -c)
60         sh_cflags=""
61         sh_cxxflags=""
62         enable_configure=true
63         enable_help=false
64         shift
65         ;;
66 esac
67
68 if $enable_configure; then
69     if test -n "$sh_flags"; then
70         CFLAGS="$sh_cflags" CXXFLAGS="$sh_cxxflags" ./configure --disable-shared --enable-static $*
71     else
72         ./configure $*
73     fi
74 fi
75 if $enable_help; then
76     cat <<EOF
77
78 Build the Makefiles with the configure command.
79   ./configure [--someoption=somevalue ...]
80
81 For help on options or configuring run
82   ./configure --help
83
84 Build and install binaries with the usual
85   make
86   make check
87   make install
88
89 Build distribution tarball with
90   make dist
91
92 Verify distribution tarball with
93   make distcheck
94
95 EOF
96     if [ -f /etc/debian_version ]; then
97         cat <<EOF
98 Or just build the Debian packages without configuring
99   dpkg-buildpackage -rfakeroot
100
101 When building from a CVS checkout, you need these Debian packages:
102   autoconf, automake, libtool, gcc, bison, any tcl,
103   xsltproc, docbook, docbook-xml, docbook-xsl,
104   libxslt1-dev, libssl-dev, libreadline5-dev, libwrap0-dev,
105   libpcap0.8-dev
106
107 Also perhaps: libgnutls-dev libicu-dev
108
109 And if you want to make a Debian package: dpkg-dev fakeroot debhelper
110 (Then run "dpkg-buildpackage -rfakeroot" in this directory.)
111
112 EOF
113     fi
114     if [ "`uname -s`" = FreeBSD ]; then
115         cat <<EOF
116 When building from a CVS checkout, you need these FreeBSD Ports:
117   autoconf259, automake19, libtool15, bison, tcl84,
118   docbook-xsl, libxml2, libxslt, g++-4.0, make
119 EOF
120     fi
121 fi