]> git.ipfire.org Git - thirdparty/kmod.git/blobdiff - autogen.sh
build: enable openssl by default
[thirdparty/kmod.git] / autogen.sh
index 3a339fb203cbe7c9110f4a04b8944cd45707bf1b..67b119f6fc6e092c5d21f87088109ffaca9cdbf9 100755 (executable)
@@ -1,27 +1,69 @@
-#!/bin/sh -e
-
-autoreconf --install --symlink
-
-MYCFLAGS="-g -Wall -Wextra \
--Wmissing-declarations -Wmissing-prototypes \
--Wnested-externs -Wpointer-arith \
--Wpointer-arith -Wsign-compare -Wchar-subscripts \
--Wstrict-prototypes -Wshadow \
--Wformat-security -Wtype-limits \
--Wformat=2 -Wuninitialized -Winit-self -Wundef \
--Wmissing-include-dirs -Wold-style-definition \
--Wfloat-equal -Wredundant-decls -Wendif-labels \
--Wcast-align -Wstrict-aliasing -Wwrite-strings \
--Wno-unused-parameter"
+#!/bin/sh
+
+set -e
+
+oldpwd=$(pwd)
+topdir=$(dirname $0)
+cd $topdir
+
+gtkdocize --docdir libkmod/docs || touch libkmod/docs/gtk-doc.make
+autoreconf --force --install --symlink
 
 libdir() {
-       echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
+        echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd)
 }
 
-args="--prefix=/usr \
+args="\
+--prefix=/usr \
 --sysconfdir=/etc \
---libdir=$(libdir /usr/lib)"
+--libdir=$(libdir /usr/lib) \
+"
+
+if [ -f "$topdir/.config.args" ]; then
+    args="$args $(cat $topdir/.config.args)"
+fi
+
+if [ ! -L /bin ]; then
+    args="$args \
+        --with-rootprefix= \
+        --with-rootlibdir=$(libdir /lib) \
+        "
+fi
+
+cd $oldpwd
+
+hackargs="--enable-debug --enable-python --with-xz --with-zlib --with-openssl"
 
-if [ -z "$NOCONFIGURE" ]; then
-       ./configure $args CFLAGS="${MYCFLAGS} ${CFLAGS}" $@
+if [ "x$1" = "xc" ]; then
+        shift
+        $topdir/configure CFLAGS='-g -O2' $args $hackargs "$@"
+        make clean
+elif [ "x$1" = "xg" ]; then
+        shift
+        $topdir/configure CFLAGS='-g -Og' $args "$@"
+        make clean
+elif [ "x$1" = "xl" ]; then
+        shift
+        $topdir/configure CC=clang CXX=clang++ $args "$@"
+        make clean
+elif [ "x$1" = "xa" ]; then
+        shift
+        $topdir/configure CFLAGS='-g -O2 -Wsuggest-attribute=pure -Wsuggest-attribute=const' $args "$@"
+        make clean
+elif [ "x$1" = "xs" ]; then
+        shift
+        scan-build $topdir/configure CFLAGS='-g -O0 -std=gnu11' $args "$@"
+        scan-build make
+else
+        echo
+        echo "----------------------------------------------------------------"
+        echo "Initialized build system. For a common configuration please run:"
+        echo "----------------------------------------------------------------"
+        echo
+        echo "$topdir/configure CFLAGS='-g -O2' $args"
+        echo
+        echo If you are debugging or hacking on kmod, consider configuring
+        echo like below:
+        echo
+        echo "$topdir/configure CFLAGS='-g -O2' $args $hackargs"
 fi