Fix a build issue on platforms where doesn't support readlink()
[platform/upstream/fontconfig.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 set -e
5
6 srcdir=`dirname $0`
7 test -z "$srcdir" && srcdir=.
8
9 case "$1" in
10 --noconf*) 
11         AUTOGEN_SUBDIR_MODE="true"
12         shift
13         ;;
14 esac
15
16 ORIGDIR=`pwd`
17 cd $srcdir
18 PROJECT=Fontconfig
19 TEST_TYPE=-f
20 FILE=fontconfig/fontconfig.h
21 ACLOCAL=${ACLOCAL-aclocal}
22 ACLOCAL_FLAGS="-I m4"
23 LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
24 AUTOMAKE=${AUTOMAKE-automake}
25 AUTOHEADER=${AUTOHEADER-autoheader}
26 AUTOCONF=${AUTOCONF-autoconf}
27 GPERF=${GPERF-gperf}
28 LIBTOOLIZE_FLAGS="--copy --force"
29
30 DIE=0
31
32 ($GPERF --version) < /dev/null > /dev/null 2>&1 || {
33         echo
34         echo "You must have gperf installed to compile $PROJECT."
35         echo "Install the appropriate package for your distribution."
36         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
37         DIE=1
38 }
39
40 have_libtool=false
41 if $LIBTOOLIZE --version < /dev/null > /dev/null 2>&1 ; then
42         libtool_version=`$LIBTOOLIZE --version | sed 's/^.* \([0-9][.][0-9.]*\)[^ ]*$/\1/'`
43         case $libtool_version in
44             1.4*|1.5*|1.6*|1.7*|2*)
45                 have_libtool=true
46                 ;;
47         esac
48 fi
49 if $have_libtool ; then : ; else
50         echo
51         echo "You must have libtool 1.4 installed to compile $PROJECT."
52         echo "Install the appropriate package for your distribution,"
53         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
54         DIE=1
55 fi
56
57 ($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
58         echo
59         echo "You must have autoconf installed to compile $PROJECT."
60         echo "libtool the appropriate package for your distribution,"
61         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
62         DIE=1
63 }
64
65 have_automake=false
66 need_libtoolize=true
67 if $AUTOMAKE --version < /dev/null > /dev/null 2>&1 ; then
68         automake_version=`$AUTOMAKE --version | grep 'automake (GNU automake)' | sed 's/^[^0-9]*\(.*\)/\1/'`
69         case $automake_version in
70            1.2*|1.3*|1.4) 
71                 ;;
72            1.4*)
73                 have_automake=true
74                 need_libtoolize=false
75                 ;;
76            *)
77                 have_automake=true
78                 ;;
79         esac
80 fi
81 if $have_automake ; then : ; else
82         echo
83         echo "You must have automake 1.4-p1 installed to compile $PROJECT."
84         echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.4-p1.tar.gz"
85         echo "(or a newer version if it is available)"
86         DIE=1
87 fi
88
89 if test "$DIE" -eq 1; then
90         exit 1
91 fi
92
93 test $TEST_TYPE $FILE || {
94         echo "You must run this script in the top-level $PROJECT directory"
95         exit 1
96 }
97
98 if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then
99         if test -z "$*"; then
100                 echo "I am going to run ./configure with no arguments - if you wish "
101                 echo "to pass any to it, please specify them on the $0 command line."
102         fi
103 fi
104
105 echo Running $ACLOCAL $ACLOCAL_FLAGS
106 $ACLOCAL $ACLOCAL_FLAGS
107
108 # optionally run autoheader
109 if $AUTOHEADER --version  < /dev/null > /dev/null 2>&1; then
110         echo Running $AUTOHEADER
111         $AUTOHEADER
112 fi
113
114 case $need_libtoolize in
115    true)
116         echo Running $LIBTOOLIZE $LIBTOOLIZE_FLAGS
117         $LIBTOOLIZE $LIBTOOLIZE_FLAGS
118         ;;
119 esac
120
121 echo Running $AUTOMAKE -a $am_opt
122 $AUTOMAKE -a $am_opt
123 echo Running $AUTOCONF
124 $AUTOCONF
125 cd $ORIGDIR
126
127 if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then
128         echo Running $srcdir/configure "$@"
129         $srcdir/configure "$@"
130
131         echo 
132         echo "Now type 'make' to compile $PROJECT."
133 fi