source: configure

Last change on this file was f600a02, checked in by Tomasz Obrebski <obrebski@…>, 10 years ago

Bugs in build and installation process fixed, lem.bin and gram.dgp built while compilation

  • Property mode set to 100755
File size: 6.5 KB
Line 
1#!/bin/sh
2
3# utt configure file
4# creates config.mak which is used by other makefiles
5
6# variables for dynamically selecting whether to compile utf8 versions
7CUR_DIR=$(pwd)
8SRC_DIR="${CUR_DIR}/src"
9
10# list of components to compile
11CMPLIST="compdic cor dgc dgp fla gph grp gue kon kor kot lem mar rm12 rs12 sen sen-nl ser tags tok.c tok.l tok.pl tre unfla"
12COMP=
13
14
15# sets all variables to a defined value
16set_all(){
17        value=$1
18        shift
19        for var in $*; do
20                eval $var=$value
21        done
22}
23
24# enables a feature
25enable(){
26        set_all yes $*
27}
28
29# disables a feature
30disable(){
31        set_all no $*
32}
33
34# checks whether a feature is enabled
35enabled(){
36        eval test "x\$$1" = "xyes"
37}
38
39# checks whether a feature is disabled
40disabled(){
41        eval test "x\$$1" = "xno"
42}
43
44show_help(){
45        echo "Usage configure [options]"
46        echo "Options: [defaults in brackets after descriptions]"
47        echo "All \"enable\" options have \"disable\" counterparts"
48        echo
49        echo "   --help                    print this message"
50        echo "   --prefix=PREFIX           install in PREFIX [$PREFIX]"
51        echo "   --bindir=BINDIR           install binaries in BINDIR [$bindir]"
52        echo "   --confdir=CONFDIR         install configuration in CONFDIR [$confdir]"
53        echo "   --sharedir=SHAREDIR       install shared in SHAREDIR [$sharedir]"
54        echo "   --docdir=DOCDIR           install doc in DOCDIR [$docdir]"
55        echo "   --langdir=LANGDIR         install lang in LANGDIR [$langdir]"
56        echo "   --libdir=LIBDIR           install libraries in LIBDIR [$libdir]"
57        echo
58        echo "   --language=LANGUAGE           select language"
59        echo
60        echo "   --enable-static           build static versions [no]"
61        echo "   --enable-doc              build documentation [yes]"
62        echo "   --enable-utf8             build UTF-8 versions of applications [no]"
63        echo
64        echo "   --cc=CC                   use C compiler CC [$cc_default]"
65        echo "   --cxx=CXX                 use C++ compiler CXX [$cxx_default]"
66        echo "   --gengetopt=GGO           use gengetopt GGO [$gengetopt_default]"
67        echo "   --flex=FLEX               use flex FLEX [$flex_default]"
68        echo "   --makeinfo=MAKEINFO       use makeinfo MAKEINFO [$makeinfo_default]"
69        echo "   --texi2dvi=TEXI2DVI       use texi2dvi TEXI2DVI [$texi2dvi_default]"
70        echo "   --texi2pdf=TEXI2PDF       use texi2pdf TEXI2PDF [$texi2pdf_default]"
71        echo "   --dvips=DVIPS             use dvips DVIPS [$dvips_default]"
72        exit 1
73}
74
75die_unknown(){
76        echo "Unknown option \"$1\"."
77        echo "See $0 --help for availible options."
78        exit 1
79}
80
81#
82# default values
83PREFIX="/usr/local"
84
85bindir="${PREFIX}/bin"
86confdir="/etc/utt"
87sharedir="${PREFIX}/share"
88docdir="${PREFIX}/share/doc/utt"
89langdir="${PREFIX}/share/utt"
90libdir="${PREFIX}/lib/utt"
91
92languages="pl_PL.ISO-8859-2"
93language="pl_PL.ISO-8859-2"
94
95cc_default="gcc"
96cxx_default="g++"
97gengetopt_default="gengetopt"
98flex_default="flex"
99makeinfo_default="makeinfo"
100texi2dvi_default="texi2dvi"
101texi2pdf_default="texi2pdf"
102dvips_default="dvips"
103
104# default switch values
105DEFAULT="
106"
107
108DEFAULT_NO="static
109utf8
110"
111
112DEFAULT_YES="doc
113"
114
115CMDLINE_SELECT="$DEFAULT
116  $DEFAULT_NO
117  $DEFAULT_YES
118"
119
120enable $DEFAULT_YES
121disable $DEFAULT_NO
122
123for opt do
124        optval="${opt#*=}"
125        case "$opt" in
126        --help)
127                show_help
128        ;;
129        --prefix=*)
130                PREFIX="$optval"
131    bindir="$optval/bin"
132    sharedir="$optval/share"
133    docdir="$optval/share/doc/utt"
134    langdir="$optval/share/utt"
135    libdir="$optval/lib/utt"
136        ;;
137        --bindir=*)
138                bindir="$optval"
139        ;;
140        --confdir=*)
141                confdir="$optval"
142        ;;
143        --sharedir=*)
144                sharedir="$optval"
145        ;;
146        --docdir=*)
147                docdir="$optval"
148        ;;
149        --langdir=*)
150                langdir="$optval"
151        ;;
152        --libdir=*)
153                libdir="$optval"
154        ;;
155        --language=*)
156                language="$optval"
157        ;;
158        --cc=*)
159                cc="$optval"
160        ;;
161        --cxx=*)
162                cxx="$optval"
163        ;;
164        --gengetopt=*)
165                gengetopt="$optval"
166        ;;
167        --flex=*)
168                flex="$optval"
169        ;;
170        --makeinfo=*)
171                makeinfo="$optval"
172        ;;
173        --texi2dvi=*)
174                texi2dvi="$optval"
175        ;;
176        --texi2pdf=*)
177                texi2pdf="$optval"
178        ;;
179        --dvips=*)
180                dvips="$optval"
181        ;;
182        --enable-?*|--disable-?*)
183                eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
184    echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
185                $action $option
186        ;;
187        *)
188                die_unknown $opt
189        ;;
190        esac
191done
192
193if ! test -z $cc; then
194        cc_default="${cc}"
195fi
196cc="${cc_default}"
197
198if ! test -z $cxx; then
199        cxx_default="${cxx}"
200fi
201
202cxx="${cxx_default}"
203
204if ! test -z $gengetopt; then
205        gengetopt_default="${gengetopt}"
206fi
207
208gengetopt="${gengetopt_default}"
209
210if ! test -z $flex; then
211  flex_default="$flex"
212fi
213
214flex="${flex_default}"
215
216enabled doc && {
217        if ! test -z $makeinfo; then
218                makeinfo_default="${makeinfo}"
219        fi
220        if ! test -z $texi2dvi; then
221                texi2dvi_default="${texi2dvi}"
222        fi
223        if ! test -z $texi2pdf; then
224                texi2pdf_default="${texi2pdf}"
225        fi
226        if ! test -z $dvips; then
227                dvips_default="${dvips}"
228        fi
229       
230        makeinfo="${makeinfo_default}"
231        texi2dvi="${texi2dvi_default}"
232        texi2pdf="${texi2pdf_default}"
233        dvips="${dvips_default}"
234}
235
236# generating config.mak
237
238echo "# Automatically generated by configure" > config.mak
239echo "PREFIX=$PREFIX" >> config.mak
240echo "BIN_DIR=$bindir" >> config.mak
241echo "CONF_DIR=$confdir" >> config.mak
242echo "SHARE_DIR=$sharedir" >> config.mak
243echo "DOC_DIR=$docdir" >> config.mak
244echo "LANG_DIR=$langdir" >> config.mak
245echo "LIB_DIR=$libdir" >> config.mak
246echo "LANGUAGES=$languages" >> config.mak
247echo "LANGUAGE=$language" >> config.mak
248echo "CC=$cc" >> config.mak
249echo "CXX=$cxx" >> config.mak
250echo "GENGETOPT=$gengetopt" >> config.mak
251echo "FLEX=$flex" >> config.mak
252enabled doc && {
253        echo "MAKEINFO=$makeinfo" >> config.mak
254        echo "TEXI2DVI=$texi2dvi" >> config.mak
255        echo "TEXI2PDF=$texi2pdf" >> config.mak
256        echo "DVIPS=$dvips" >> config.mak
257}
258echo "BUILD_UTF8=$utf8" >> config.mak
259echo "BUILD_STATIC=$static" >> config.mak
260echo "BUILD_DOC=$doc" >> config.mak
261
262enabled utf8 && {
263  for cmp in $CMPLIST; do
264    if [ -d "${SRC_DIR}/${cmp}_utf8" ]; then
265      COMPONENTS="${COMPONENTS} ${cmp}_utf8"
266    else
267      COMPONENTS="${COMPONENTS} ${cmp}"
268    fi
269  done
270}
271
272disabled utf8 && {
273  for cmp in $CMPLIST; do
274    COMPONENTS="${COMPONENTS} ${cmp}"
275  done
276}
277COMPONENTS=$(echo $COMPONENTS | cut -c1-)
278echo "COMPONENTS=$COMPONENTS" >> config.mak
279
280# echoing the configuration to console
281echo "prefix:     $PREFIX"
282echo "bindir:     $bindir"
283echo "confdir:    $confdir"
284echo "sharedir:   $sharedir"
285echo "docdir:     $docdir"
286echo "langdir:    $langdir"
287echo "libdir:     $libdir"
288echo "languages:  $languages"
289echo "language:   $language"
290enabled doc && {
291echo "makeinfo:   $makeinfo"
292echo "texi2dvi:   $texi2dvi"
293echo "texi2pdf:   $texi2pdf"
294echo "dvips:      $dvips"
295}
296echo "cc:         $cc"
297echo "cxx:        $cxx"
298echo "gengetopt:  $gengetopt"
299echo "flex:       $flex"
300echo "utf8:       $utf8"
301echo "static:     $static"
302echo "doc:        $doc"
Note: See TracBrowser for help on using the repository browser.