docs: add a "make sure your app works when there's no polkitd(8)" note
[platform/upstream/polkit.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 srcdir=`dirname $0`
5 test -z "$srcdir" && srcdir=.
6
7 DIE=0
8
9 (test -f $srcdir/configure.ac) || {
10     echo -n "**Error**: Directory $srcdir does not look like the"
11     echo " top-level package directory"
12     exit 1
13 }
14
15 olddir=`pwd`
16 cd "$srcdir"
17
18 touch ChangeLog
19
20 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
21   echo
22   echo "**Error**: You must have autoconf installed."
23   echo "Download the appropriate package for your distribution,"
24   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
25   DIE=1
26 }
27
28 (grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null) && {
29   (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
30     echo
31     echo "**Error**: You must have libtool installed."
32     echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
33     DIE=1
34   }
35 }
36
37 (gtkdocize --flavour no-tmpl) < /dev/null > /dev/null 2>&1 || {
38         echo
39         echo "You must have gtk-doc installed to compile $PROJECT."
40         echo "Install the appropriate package for your distribution,"
41         echo "or get the source tarball at http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
42         DIE=1
43 }
44
45 (automake --version) < /dev/null > /dev/null 2>&1 || {
46   echo
47   echo "**Error**: You must have automake installed."
48   echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
49   DIE=1
50   NO_AUTOMAKE=yes
51 }
52
53
54 # if no automake, don't bother testing for aclocal
55 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
56   echo
57   echo "**Error**: Missing aclocal.  The version of automake"
58   echo "installed doesn't appear recent enough."
59   echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
60   DIE=1
61 }
62
63
64 # if no automake, don't bother testing for autoreconf
65 test -n "$NO_AUTOMAKE" || (autoreconf --version) < /dev/null > /dev/null 2>&1 || {
66   echo
67   echo "**Error**: You must have autoreconf installed."
68   echo "You can get autoreconf from ..."
69   DIE=1
70 }
71
72
73 if test "$DIE" -eq 1; then
74   exit 1
75 fi
76
77 if test -z "$*"; then
78   echo "**Warning**: I am going to run configure with no arguments."
79   echo "If you wish to pass any to it, please specify them on the"
80   echo $0 " command line."
81   echo
82 fi
83
84 case $CC in
85 xlc )
86   am_opt=--include-deps;;
87 esac
88
89       aclocalinclude="$ACLOCAL_FLAGS"
90
91       echo "Running autoreconf on test/mocklibc ..."
92       (cd "test/mocklibc"; autoreconf --install)
93
94       if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
95         if test -z "$NO_LIBTOOLIZE" ; then 
96           echo "Running libtoolize..."
97           libtoolize --force --copy
98         fi
99       fi
100       echo "Running aclocal $aclocalinclude ..."
101       aclocal $aclocalinclude
102       if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
103         echo "Running autoheader..."
104         autoheader
105       fi
106       echo "Running automake --gnu -Wno-portability $am_opt ..."
107       automake --add-missing --gnu -Wno-portability $am_opt
108       echo "Running autoconf ..."
109       autoconf
110
111 intltoolize --copy --force --automake                  || exit 1
112
113 cd "$olddir"
114
115 conf_flags="--enable-maintainer-mode --enable-gtk-doc"
116
117 if test x$NOCONFIGURE = x; then
118   echo "Running $srcdir/configure $conf_flags $@ ..."
119   $srcdir/configure $conf_flags "$@" \
120   && echo "Now type make to compile." || exit 1
121 else
122   echo "Skipping configure process."
123 fi