chiark / gitweb /
make: do not delete autotools generated file with distclean
[elogind.git] / autogen.sh
1 #!/bin/sh -e
2
3 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
4         echo
5         echo "You must have autoconf installed to generate the build system."
6         echo
7         exit 1
8 }
9 (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
10         echo
11         echo "You must have libtool installed to generate the build system."
12         echo
13         exit 1
14 }
15 (autoheader --version) < /dev/null > /dev/null 2>&1 || {
16         echo
17         echo "You must have autoheader installed to generate the build system."
18         echo
19         exit 1
20 }
21 (automake --version) < /dev/null > /dev/null 2>&1 || {
22         echo
23         echo "You must have automake installed to generate the build system."
24         echo
25         exit 1
26 }
27
28 test -f udev/udevd.c || {
29         echo "You must run this script in the top-level source directory"
30         exit 1
31 }
32
33 echo "   aclocal:    $(aclocal --version | head -1)"
34 aclocal
35 echo "   autoconf:   $(autoconf --version | head -1)"
36 autoconf
37 echo "   libtool:   $(automake --version | head -1)"
38 libtoolize --force
39 echo "   autoheader: $(autoheader --version | head -1)"
40 autoheader
41 echo "   automake:   $(automake --version | head -1)"
42 automake --add-missing
43
44 CFLAGS="-g -Wall \
45 -Wmissing-declarations -Wmissing-prototypes \
46 -Wnested-externs -Wpointer-arith \
47 -Wpointer-arith -Wsign-compare -Wchar-subscripts \
48 -Wstrict-prototypes -Wshadow"
49
50 args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux"
51 libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd))
52
53 case "$1" in
54         *install|"")
55                 args="$args --with-libdir-name=$libdir"
56                 export CFLAGS="$CFLAGS -O2"
57                 echo "   configure:  $args"
58                 echo
59                 ./configure $args
60                 ;;
61         *devel)
62                 args="$args --enable-debug --with-libdir-name=$libdir"
63                 export CFLAGS="$CFLAGS -O0"
64                 echo "   configure:  $args"
65                 echo
66                 ./configure $args
67                 ;;
68         *clean)
69                 ./configure
70                 make maintainer-clean
71                 find . -name Makefile.in | xargs -r rm
72                 rm -f depcomp aclocal.m4 config.h.in configure install-sh
73                 rm -f missing config.guess config.sub ltmain.sh
74                 exit 0
75                 ;;
76         *)
77                 echo "Usage: $0 [--install|--devel|--clean]"
78                 exit 1
79                 ;;
80 esac