Tizen 2.1 base
[external/enchant.git] / autogen.sh
1 #!/bin/sh
2
3 # Run this before configure
4 #
5 # This file blatantly ripped off from subversion.
6 #
7 # Note: this dependency on Perl is fine: only developers use autogen.sh
8 #       and we can state that dev people need Perl on their machine
9 #
10
11 rm -f autogen.err
12
13 srcdir=`dirname $0`
14 test -z "$srcdir" && srcdir=.
15
16 olddir=`pwd`
17 cd $srcdir
18
19 automake --version | perl -ne 'if (/\(GNU automake\) (([0-9]+).([0-9]+))/) {print; if ($2 < 1 || ($2 == 1 && $3 < 4)) {exit 1;}}'
20
21 if [ $? -ne 0 ]; then
22     echo "Error: you need automake 1.4 or later.  Please upgrade."
23     exit 1
24 fi
25
26 if test ! -d `aclocal --print-ac-dir 2>> autogen.err`; then
27   echo "Bad aclocal (automake) installation"
28   exit 1
29 fi
30
31 libtoolize=""
32 for found_lib in libtoolize glibtoolize ; do
33     $found_lib --version > /dev/null 2>&1
34     if [ $? = 0 ]; then
35         libtoolize=$found_lib
36         break
37     fi
38 done
39
40 $libtoolize --force --copy || {
41     echo "error: libtoolize failed"
42     exit 1
43 }
44
45 # Produce aclocal.m4, so autoconf gets the automake macros it needs
46
47 echo "Creating aclocal.m4: aclocal -I ac-helpers $ACLOCAL_FLAGS"
48
49 aclocal -I ac-helpers $ACLOCAL_FLAGS 2>> autogen.err
50
51 # Produce all the `GNUmakefile.in's and create neat missing things
52 # like `install-sh', etc.
53
54 echo "automake --add-missing --copy --foreign"
55
56 automake --add-missing --copy --foreign 2>> autogen.err || {
57     echo ""
58     echo "* * * warning: possible errors while running automake - check autogen.err"
59     echo ""
60 }
61
62 # If there's a config.cache file, we may need to delete it.  
63 # If we have an existing configure script, save a copy for comparison.
64 if [ -f config.cache ] && [ -f configure ]; then
65   cp configure configure.$$.tmp
66 fi
67
68 # Produce ./configure
69
70 echo "Creating configure..."
71
72 autoconf 2>> autogen.err || {
73     echo ""
74     echo "* * * warning: possible errors while running automake - check autogen.err"
75     echo ""
76 }
77
78 cd $olddir
79
80 run_configure=true
81 for arg in $*; do
82     case $arg in
83         --no-configure)
84             run_configure=false
85             ;;
86         *)
87             ;;
88     esac
89 done
90
91 if $run_configure; then
92     $srcdir/configure --enable-maintainer-mode "$@"
93     echo
94     echo "Now type 'make' to compile enchant."
95 else
96     echo
97     echo "Now run 'configure' and 'make' to compile enchant."
98 fi
99