1#!/bin/bash
2
3# This file is part of libcanberra.
4#
5# Copyright 2008 Lennart Poettering
6#
7# libcanberra is free software; you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License as
9# published by the Free Software Foundation, either version 2.1 of the
10# License, or (at your option) any later version.
11#
12# libcanberra is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public
18# License along with libcanberra. If not, see
19# <http://www.gnu.org/licenses/>.
20
21if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
22        cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
23        chmod +x .git/hooks/pre-commit && \
24        echo "Activated pre-commit hook."
25fi
26
27GTKDOCIZE=$(which gtkdocize 2>/dev/null)
28if test -z $GTKDOCIZE; then
29        echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."
30        echo 'EXTRA_DIST =' > gtkdoc/gtk-doc.make
31else
32        gtkdocize --docdir gtkdoc/
33        gtkdocargs=--enable-gtk-doc
34fi
35
36autoreconf --force --install --symlink
37
38libdir() {
39        echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
40}
41
42args="\
43--sysconfdir=/etc \
44--localstatedir=/var \
45--libdir=$(libdir /usr/lib) \
46--libexecdir=/usr/lib \
47$gtkdocargs"
48
49if [ "x$1" == "xc" ]; then
50        ./configure CFLAGS='-g -O0 -Wp,-U_FORTIFY_SOURCE' $args
51        make clean
52else
53        echo
54        echo "----------------------------------------------------------------"
55        echo "Initialized build system. For a common configuration please run:"
56        echo "----------------------------------------------------------------"
57        echo
58        echo "./configure CFLAGS='-g -O0 -Wp,-U_FORTIFY_SOURCE' $args"
59        echo
60fi
61