4e9fa3b60ff6edcaa025111f0d7448e827e413c3
[platform/upstream/dbus.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 ORIGDIR=`pwd`
8 cd $srcdir
9
10 PROJECT=dbus
11 TEST_TYPE=-f
12 FILE=dbus-1.pc.in
13
14 DIE=0
15
16 if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
17     echo "Activating pre-commit hook."
18     cp -av .git/hooks/pre-commit.sample .git/hooks/pre-commit
19     chmod -c +x  .git/hooks/pre-commit
20 fi
21
22 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
23         echo
24         echo "You must have autoconf installed to compile $PROJECT."
25         echo "Download the appropriate package for your distribution,"
26         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
27         DIE=1
28 }
29
30 # If the user hasn't explicitly chosen an Automake version, use 1.11. This is
31 # the earliest version that gives us silent rules.
32 if test -z "$AUTOMAKE"; then
33     AUTOMAKE=automake-1.11
34     ACLOCAL=aclocal-1.11
35 fi
36
37 ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
38         AUTOMAKE=automake
39         ACLOCAL=aclocal
40 }
41
42 ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
43         echo
44         echo "You must have automake installed to compile $PROJECT."
45         echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
46         echo "(or a newer version if it is available)"
47         DIE=1
48 }
49
50 (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
51         echo
52         echo "You must have libtoolize installed to compile $PROJECT."
53         echo "Install the libtool package from ftp.gnu.org or a mirror."
54         DIE=1
55 }
56
57 if test "$DIE" -eq 1; then
58         exit 1
59 fi
60
61 test $TEST_TYPE $FILE || {
62         echo "You must run this script in the top-level $PROJECT directory"
63         exit 1
64 }
65
66 if test -z "$*"; then
67         echo "I am going to run ./configure with no arguments - if you wish "
68         echo "to pass any to it, please specify them on the $0 command line."
69 fi
70
71 libtoolize --copy --force
72
73 $ACLOCAL $ACLOCAL_FLAGS
74
75 ## optionally feature autoheader
76 (autoheader --version)  < /dev/null > /dev/null 2>&1 && autoheader
77
78 $AUTOMAKE -a $am_opt
79 autoconf || echo "autoconf failed - version 2.5x is probably required"
80
81 cd $ORIGDIR
82
83 run_configure=true
84 for arg in $*; do
85     case $arg in 
86         --no-configure)
87             run_configure=false
88             ;;
89         *)
90             ;;
91     esac
92 done
93
94 if $run_configure; then
95     $srcdir/configure --enable-maintainer-mode --config-cache "$@"
96     echo 
97     echo "Now type 'make' to compile $PROJECT."
98 else
99     echo
100     echo "Now run 'configure' and 'make' to compile $PROJECT."
101 fi
102