]> git.ipfire.org Git - thirdparty/kmod.git/blob - autogen.sh
kmod 27
[thirdparty/kmod.git] / autogen.sh
1 #!/bin/sh
2
3 set -e
4
5 oldpwd=$(pwd)
6 topdir=$(dirname $0)
7 cd $topdir
8
9 gtkdocize --docdir libkmod/docs || touch libkmod/docs/gtk-doc.make
10 autoreconf --force --install --symlink
11
12 libdir() {
13 echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd)
14 }
15
16 args="\
17 --prefix=/usr \
18 --sysconfdir=/etc \
19 --libdir=$(libdir /usr/lib) \
20 "
21
22 if [ -f "$topdir/.config.args" ]; then
23 args="$args $(cat $topdir/.config.args)"
24 fi
25
26 if [ ! -L /bin ]; then
27 args="$args \
28 --with-rootprefix= \
29 --with-rootlibdir=$(libdir /lib) \
30 "
31 fi
32
33 cd $oldpwd
34
35 hackargs="--enable-debug --enable-python --with-xz --with-zlib --with-openssl"
36
37 if [ "x$1" = "xc" ]; then
38 shift
39 $topdir/configure CFLAGS='-g -O2' $args $hackargs "$@"
40 make clean
41 elif [ "x$1" = "xg" ]; then
42 shift
43 $topdir/configure CFLAGS='-g -Og' $args "$@"
44 make clean
45 elif [ "x$1" = "xl" ]; then
46 shift
47 $topdir/configure CC=clang CXX=clang++ $args "$@"
48 make clean
49 elif [ "x$1" = "xa" ]; then
50 shift
51 $topdir/configure CFLAGS='-g -O2 -Wsuggest-attribute=pure -Wsuggest-attribute=const' $args "$@"
52 make clean
53 elif [ "x$1" = "xs" ]; then
54 shift
55 scan-build $topdir/configure CFLAGS='-g -O0 -std=gnu11' $args "$@"
56 scan-build make
57 else
58 echo
59 echo "----------------------------------------------------------------"
60 echo "Initialized build system. For a common configuration please run:"
61 echo "----------------------------------------------------------------"
62 echo
63 echo "$topdir/configure CFLAGS='-g -O2' $args"
64 echo
65 echo If you are debugging or hacking on kmod, consider configuring
66 echo like below:
67 echo
68 echo "$topdir/configure CFLAGS='-g -O2' $args $hackargs"
69 fi