Make system cache folder in the post field of installation
[platform/upstream/fontconfig.git] / autogen.sh
1 #!/bin/sh
2 # fontconfig/autogen.sh
3 #
4 # Copyright © 2000 Keith Packard
5 #
6 # Permission to use, copy, modify, distribute, and sell this software and its
7 # documentation for any purpose is hereby granted without fee, provided that
8 # the above copyright notice appear in all copies and that both that
9 # copyright notice and this permission notice appear in supporting
10 # documentation, and that the name of the author(s) not be used in
11 # advertising or publicity pertaining to distribution of the software without
12 # specific, written prior permission.  The authors make no
13 # representations about the suitability of this software for any purpose.  It
14 # is provided "as is" without express or implied warranty.
15 #
16 # THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 # EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 # PERFORMANCE OF THIS SOFTWARE.
23
24 # Run this to generate all the initial makefiles, etc.
25
26 set -e
27
28 srcdir=`dirname $0`
29 test -z "$srcdir" && srcdir=.
30
31 case "$1" in
32 --noconf*) 
33         AUTOGEN_SUBDIR_MODE="true"
34         shift
35         ;;
36 esac
37
38 ORIGDIR=`pwd`
39 cd $srcdir
40 PROJECT=Fontconfig
41 TEST_TYPE=-f
42 FILE=fontconfig/fontconfig.h
43 ACLOCAL=${ACLOCAL-aclocal}
44 ACLOCAL_FLAGS="-I m4"
45 LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
46 AUTOMAKE=${AUTOMAKE-automake}
47 AUTOHEADER=${AUTOHEADER-autoheader}
48 AUTOCONF=${AUTOCONF-autoconf}
49 GPERF=${GPERF-gperf}
50 LIBTOOLIZE_FLAGS="--copy --force"
51
52 DIE=0
53
54 ($GPERF --version) < /dev/null > /dev/null 2>&1 || {
55         echo
56         echo "You must have gperf installed to compile $PROJECT."
57         echo "Install the appropriate package for your distribution."
58         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
59         DIE=1
60 }
61
62 have_libtool=false
63 if $LIBTOOLIZE --version < /dev/null > /dev/null 2>&1 ; then
64         libtool_version=`$LIBTOOLIZE --version | sed 's/^.* \([0-9][.][0-9.]*\)[^ ]*$/\1/'`
65         case $libtool_version in
66             1.4*|1.5*|1.6*|1.7*|2*)
67                 have_libtool=true
68                 ;;
69         esac
70 fi
71 if $have_libtool ; then : ; else
72         echo
73         echo "You must have libtool 1.4 installed to compile $PROJECT."
74         echo "Install the appropriate package for your distribution,"
75         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
76         DIE=1
77 fi
78
79 ($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
80         echo
81         echo "You must have autoconf installed to compile $PROJECT."
82         echo "libtool the appropriate package for your distribution,"
83         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
84         DIE=1
85 }
86
87 have_automake=false
88 need_libtoolize=true
89 if $AUTOMAKE --version < /dev/null > /dev/null 2>&1 ; then
90         automake_version=`$AUTOMAKE --version | grep 'automake (GNU automake)' | sed 's/^[^0-9]*\(.*\)/\1/'`
91         case $automake_version in
92            1.2*|1.3*|1.4) 
93                 ;;
94            1.4*)
95                 have_automake=true
96                 need_libtoolize=false
97                 ;;
98            *)
99                 have_automake=true
100                 ;;
101         esac
102 fi
103 if $have_automake ; then : ; else
104         echo
105         echo "You must have automake 1.4-p1 installed to compile $PROJECT."
106         echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.4-p1.tar.gz"
107         echo "(or a newer version if it is available)"
108         DIE=1
109 fi
110
111 if test "$DIE" -eq 1; then
112         exit 1
113 fi
114
115 test $TEST_TYPE $FILE || {
116         echo "You must run this script in the top-level $PROJECT directory"
117         exit 1
118 }
119
120 if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then
121         if test -z "$*"; then
122                 echo "I am going to run ./configure with no arguments - if you wish "
123                 echo "to pass any to it, please specify them on the $0 command line."
124         fi
125 fi
126
127 echo Running $ACLOCAL $ACLOCAL_FLAGS
128 $ACLOCAL $ACLOCAL_FLAGS
129
130 # optionally run autoheader
131 if $AUTOHEADER --version  < /dev/null > /dev/null 2>&1; then
132         echo Running $AUTOHEADER
133         $AUTOHEADER
134 fi
135
136 case $need_libtoolize in
137    true)
138         echo Running $LIBTOOLIZE $LIBTOOLIZE_FLAGS
139         $LIBTOOLIZE $LIBTOOLIZE_FLAGS
140         ;;
141 esac
142
143 echo Running $AUTOMAKE -a $am_opt
144 $AUTOMAKE -a $am_opt
145 echo Running $AUTOCONF
146 $AUTOCONF
147 cd $ORIGDIR
148
149 if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then
150         echo Running $srcdir/configure "$@"
151         $srcdir/configure "$@"
152
153         echo 
154         echo "Now type 'make' to compile $PROJECT."
155 fi