update to 0.19.7
[platform/upstream/fribidi.git] / bootstrap
1 #! /bin/sh
2 ##############################################################################
3 # $Id: bootstrap,v 1.4 2005-08-27 10:21:51 behdad Exp $
4 # $Author: behdad
5 # $Date: 2005-08-27 10:21:51 $
6 # $Revision: 1.4 $
7 # $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bootstrap,v $
8 ##############################################################################
9 #                                               -*- Bootstrap -*-
10 # Run this file to produce a configure script.
11
12 DEFAULT_BOOTSTRAPFLAGS="--force --install --autoreconf=auto"
13 DEFAULT_CONFIGUREFLAGS="--enable-maintainer-mode --enable-compile-warnings"
14
15 OLDDIR=`pwd`
16
17 # move to source dir
18 DIR=`echo $0 | sed 's,[^/]*$,,'`
19 test -n "$DIR" && cd "$DIR"
20
21 if test "$1" = --write-configure; then
22         test -f configure && \
23         ((echo '#! /bin/sh
24                 DIR=`echo $0 | sed "s,[^/]*\$,,"`
25                 exec ${DIR}bootstrap --configure -- "$@"' > configure \
26           && chmod a+x configure) || \
27          echo Failed writing to configure >&2)
28
29         exit $?
30 fi
31
32 # check if we are invoked as configure, or bootstrap
33 BASE=`echo $0 | sed 's,.*/,,'`
34 if test "$BASE" = "configure"; then
35         CONFIG=--config
36         EXTRA_CONFIGUREFLAGS=$@
37 else # bootstrap
38         EXTRA_BOOTSTRAPFLAGS=$*
39 fi
40
41 for arg in $DEFAULT_BOOTSTRAPFLAGS $BOOTSTRAPFLAGS $EXTRA_BOOTSTRAPFLAGS
42 do
43 if test -n "$DASHDASHFLAGS"; then
44         DASHDASHFLAGS="$DASHDASHFLAGS $arg"
45 else
46         case $arg in
47                 -h|--h|--he|--hel|--help)
48                         HELP=--help ;;
49                 -V|--vers|--versi|--versio|--version)
50                         VERSION=--version ;;
51                 -v|--verb|--verbo|--verbos|--verbose)
52                         VERBOSE=--verbose ;;
53                 -d|--de|--deb|--debu|--debug)
54                         DEBUG=--debug ;;
55                 -W|--w|--wa|--war|--warn|--warni|--warnin|--warning|--warnings|--warnings=yes|--warnings=all)
56                         WARNS=--warnings=all ;;
57                 --no-w|--no-wa|--no-war|--no-warn|--no-warni|--no-warnin|--no-warning|--no-warnings|--warn=no|--warning=no|--warnings=no)
58                         WARNS=--warnings=none ;;
59                 --w=*|--wa=*|--war=*|--warn=*|--warni=*|--warnin=*|--warning=*|--warnings=*)
60                         WARNS=$arg ;;
61                 -f|--f|--fo|--for|--forc|--force|--forced|--force=yes|--force-missing)
62                         FORCE=--force ;;
63                 --no-f|--no-fo|--no-for|--no-forc|--no-force|--no-forced|--force=no)
64                         FORCE=--no-force ;;
65                 -i|--i|--in|--ins|--inst|--insta|--instal|--install|--install=yes|-a|--add-missing)
66                         INSTALL=--install ;;
67                 --no-i|--no-in|--no-ins|--no-inst|--no-insta|--no-instal|--no-install|--install=no)
68                         INSTALL= ;;
69                 -s|--s|--sy|--sym|--syml|--symli|--symlin|--symlink|--symlink=yes|--no-copy|--copy=no)
70                         SYMLINK=--symlink ;;
71                 --no-s|--no-sy|--no-sym|--no-syml|--no-symli|--no-symlin|--no-symlink|--symlink=no|--copy|--copy=yes)
72                         SYMLINK= ;;
73                 -m|--m|--ma|--mak|--make|--make=yes)
74                         MAKE=--make
75                         CONFIG=--configure ;;
76                 --no-m|--no-ma|--no-mak|--no-make|--make=no)
77                         MAKE= ;;
78                 -c|--c|--co|--con|--conf|--confi|--config|--configu|--configur|--configure|--configure=yes)
79                         CONFIG=--configure ;;
80                 --no-c|--no-co|--no-con|--no-conf|--no-confi|--no-config|--no-configu|--no-configur|--no-configure|--configure=no)
81                         CONFIG= ;;
82                 -n|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)
83                         DRYRUN=echo ;;
84                 --auto|--autoreconf=auto)
85                         AUTORECONF=auto ;;
86                 --autoreconf|--autoreconf=yes)
87                         AUTORECONF=yes ;;
88                 --no-autoreconf|--autoreconf=no)
89                         AUTORECONF= ;;
90                 --)
91                         DASHDASHFLAGS=" " ;;
92                 *)
93                         echo Ignoring unknown parameter $arg
94         esac
95 fi
96 done
97
98 test -z "$SYMLINK" && COPY=--copy
99 test -n "$INSTALL" && ADDMISSING=--add-missing
100
101 # use autoreconf if possible, just check for version 2+
102 if test "$AUTORECONF" = auto; then
103         case `autoreconf --version 2>/dev/null` in
104                 *"autoreconf (GNU Autoconf) 2."* )
105                         echo Usable autoreconf found, running
106                 ;;
107                 *)
108                         AUTORECONF=
109                 ;;
110         esac
111 fi
112
113 if test -n "$AUTORECONF";  then
114         $DRYRUN autoreconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $INSTALL $SYMLINK $MAKE $WARNS $AUTORECONFFLAGS || exit $?
115 else
116
117 # add files 'config.guess', 'config.sub', 'ltconfig', 'ltmain.sh'
118 test -f Makefile.am && MY_LIBTOOLIZEFLAGS=--automake
119
120 if grep -q '^ *AC_PROG_LIBTOOL' configure.ac configure.in 2>/dev/null; then
121         $DRYRUN libtoolize $HELP $VERSION $COPY $DEBUG $FORCE $MY_LIBTOOLIZEFLAGS $LIBTOOLIZEFLAGS || exit $?
122 fi
123
124 # generate 'aclocal.m4'
125 if test -f configure.ac -o configure.in; then
126         $DRYRUN aclocal $HELP $VERSION $VERBOSE $FORCE $ACLOCALFLAGS || exit $?
127 fi
128
129 # generate 'config.h.in'
130 if test -f configure.ac -o configure.in; then
131         $DRYRUN autoheader $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNS $AUTOHEADERFLAGS || exit $?
132 fi
133
134 #  generate Makefile.in's from Makefile.am's
135 if test -f Makefile.am; then
136         $DRYRUN automake $HELP $VERSION $VERBOSE $ADDMISSING $COPY $FORCE $WARNS $AUTOMAKEFLAGS || exit $?
137 fi
138
139 # generate configure from configure.ac
140 if test -f configure.ac -o -f configure.in; then
141         $DRYRUN autoconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNS $AUTOCONFFLAGS || exit $?
142 fi
143
144 fi # !AUTOCONF
145
146 # move to build dir
147 cd $OLDDIR
148
149 # configure
150 if test -n "$CONFIG"; then
151         if test -f ${DIR}configure; then
152                 $DRYRUN ${DIR}configure $HELP $VERSION $DEFAULT_CONFIGUREFLAGS $CONFIGUREFLAGS $DASHDASHFLAGS $EXTRA_CONFIGUREFLAGS || exit $?
153         fi
154 fi
155
156 # make
157 if test -n "$MAKE"; then
158         if test -f Makefile; then
159                 $DRYRUN make $MAKEFLAGS || exit $?
160         fi
161 fi