]> git.ipfire.org Git - thirdparty/kmod.git/blob - autogen.sh
modprobe: Move insertion block into separate function
[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-rootlibdir=$(libdir /lib) \
29 "
30 fi
31
32 cd $oldpwd
33
34 hackargs="\
35 --enable-debug \
36 --enable-python \
37 --with-zstd \
38 --with-xz \
39 --with-zlib \
40 --with-openssl \
41 "
42
43 if [ "x$1" = "xc" ]; then
44 shift
45 $topdir/configure CFLAGS='-g -O2' $args $hackargs "$@"
46 make clean
47 elif [ "x$1" = "xg" ]; then
48 shift
49 $topdir/configure CFLAGS='-g -Og' $args "$@"
50 make clean
51 elif [ "x$1" = "xl" ]; then
52 shift
53 $topdir/configure CC=clang CXX=clang++ $args "$@"
54 make clean
55 elif [ "x$1" = "xa" ]; then
56 shift
57 $topdir/configure CFLAGS='-g -O2 -Wsuggest-attribute=pure -Wsuggest-attribute=const' $args "$@"
58 make clean
59 elif [ "x$1" = "xs" ]; then
60 shift
61 scan-build $topdir/configure CFLAGS='-g -O0 -std=gnu11' $args "$@"
62 scan-build make
63 else
64 echo
65 echo "----------------------------------------------------------------"
66 echo "Initialized build system. For a common configuration please run:"
67 echo "----------------------------------------------------------------"
68 echo
69 echo "$topdir/configure CFLAGS='-g -O2' $args"
70 echo
71 echo If you are debugging or hacking on kmod, consider configuring
72 echo like below:
73 echo
74 echo "$topdir/configure CFLAGS='-g -O2' $args $hackargs"
75 fi