]> git.ipfire.org Git - thirdparty/systemd.git/blob - autogen.sh
sysctl: run sysctl service if /proc/sys/net is writable (#4425)
[thirdparty/systemd.git] / autogen.sh
1 #!/bin/sh
2
3 # This file is part of systemd.
4 #
5 # systemd is free software; you can redistribute it and/or modify it
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
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
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
17
18 set -e
19
20 verb="$1"
21
22 if [[ -n "$verb" ]]; then
23 if [[ "$verb" != [cgals] ]]; then
24 echo "Unexpected argument: $verb" >&2
25 exit 1
26 fi
27 shift
28 fi
29
30 oldpwd=$(pwd)
31 topdir=$(dirname $0)
32 cd $topdir
33
34 if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
35 # This part is allowed to fail
36 cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
37 chmod +x .git/hooks/pre-commit && \
38 echo "Activated pre-commit hook." || :
39 fi
40
41 intltoolize --force --automake
42 autoreconf --force --install --symlink
43
44 libdir() {
45 echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd)
46 }
47
48 args="\
49 --sysconfdir=/etc \
50 --localstatedir=/var \
51 --libdir=$(libdir /usr/lib) \
52 "
53
54 if [ -f "$topdir/.config.args" ]; then
55 args="$args $(cat $topdir/.config.args)"
56 fi
57
58 if [ ! -L /bin ]; then
59 args="$args \
60 --with-rootprefix=/ \
61 --with-rootlibdir=$(libdir /lib) \
62 "
63 fi
64
65 args="$args $@"
66 cd $oldpwd
67
68 if [ "$verb" = "c" ]; then
69 set -x
70 $topdir/configure CFLAGS='-g -O0 -ftrapv' $args
71 make clean >/dev/null
72 elif [ "$verb" = "g" ]; then
73 set -x
74 $topdir/configure CFLAGS='-g -Og -ftrapv' $args
75 make clean >/dev/null
76 elif [ "$verb" = "a" ]; then
77 set -x
78 $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' $args
79 make clean >/dev/null
80 elif [ "$verb" = "l" ]; then
81 set -x
82 $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' $args
83 make clean >/dev/null
84 elif [ "$verb" = "s" ]; then
85 set -x
86 scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' $args
87 scan-build make
88 else
89 echo
90 echo "----------------------------------------------------------------"
91 echo "Initialized build system. For a common configuration please run:"
92 echo "----------------------------------------------------------------"
93 echo
94 echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' $args"
95 echo
96 fi