]> git.ipfire.org Git - thirdparty/systemd.git/blame - autogen.sh
test-fs-util: fix memleak
[thirdparty/systemd.git] / autogen.sh
CommitLineData
72d25fd9 1#!/bin/sh
47be870b
LP
2
3# This file is part of systemd.
4#
47be870b 5# systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
6# under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; either version 2.1 of the License, or
47be870b
LP
8# (at your option) any later version.
9#
10# systemd is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 13# Lesser General Public License for more details.
47be870b 14#
5430f7f2 15# You should have received a copy of the GNU Lesser General Public License
47be870b
LP
16# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17
2fd8b540
ZJS
18set -e
19
a5e739a5
ZJS
20verb="$1"
21
2b7466a2
EV
22case "$verb" in
23"") ;;
24[cgals]) shift ;;
25*) echo "Unexpected argument: $verb" >&2; exit 1 ;;
26esac
a5e739a5 27
0f62019c
SW
28oldpwd=$(pwd)
29topdir=$(dirname $0)
30cd $topdir
31
72d25fd9
MM
32if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
33 # This part is allowed to fail
843605d3
LP
34 cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
35 chmod +x .git/hooks/pre-commit && \
72d25fd9 36 echo "Activated pre-commit hook." || :
47be870b
LP
37fi
38
6bd9fe5a
KS
39intltoolize --force --automake
40autoreconf --force --install --symlink
41
ae446765 42libdir() {
72d25fd9 43 echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd)
ae446765
KS
44}
45
6bd9fe5a 46args="\
6bd9fe5a
KS
47--sysconfdir=/etc \
48--localstatedir=/var \
49--libdir=$(libdir /usr/lib) \
23756070 50"
6bd9fe5a 51
9a20fcbc
DH
52if [ -f "$topdir/.config.args" ]; then
53 args="$args $(cat $topdir/.config.args)"
54fi
55
772f4698
KS
56if [ ! -L /bin ]; then
57args="$args \
759b98c5 58--with-rootprefix=/ \
772f4698
KS
59--with-rootlibdir=$(libdir /lib) \
60"
61fi
62
a5e739a5 63args="$args $@"
0f62019c
SW
64cd $oldpwd
65
a5e739a5 66if [ "$verb" = "c" ]; then
fe9d97c6 67 set -x
222953e8 68 $topdir/configure CFLAGS='-g -O0 -ftrapv' $args
fe9d97c6 69 make clean >/dev/null
a5e739a5 70elif [ "$verb" = "g" ]; then
fe9d97c6 71 set -x
222953e8 72 $topdir/configure CFLAGS='-g -Og -ftrapv' $args
fe9d97c6 73 make clean >/dev/null
a5e739a5 74elif [ "$verb" = "a" ]; then
fe9d97c6 75 set -x
222953e8 76 $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' $args
fe9d97c6 77 make clean >/dev/null
a5e739a5 78elif [ "$verb" = "l" ]; then
fe9d97c6 79 set -x
222953e8 80 $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' $args
fe9d97c6 81 make clean >/dev/null
a5e739a5 82elif [ "$verb" = "s" ]; then
fe9d97c6 83 set -x
222953e8 84 scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' $args
a8c78dec 85 scan-build make
843605d3
LP
86else
87 echo
88 echo "----------------------------------------------------------------"
89 echo "Initialized build system. For a common configuration please run:"
90 echo "----------------------------------------------------------------"
91 echo
222953e8 92 echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' $args"
843605d3 93 echo
47be870b 94fi