source: configure @ abd28d1

Last change on this file since abd28d1 was abd28d1, checked in by Tomasz Obrebski <to@…>, 12 years ago

fixed further bugs around compdic
cats file renamed and moved
config files updated

  • Property mode set to 100755
File size: 6.4 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
92language="pl_PL.ISO-8859-2"
93
94cc_default="gcc"
95cxx_default="g++"
96gengetopt_default="gengetopt"
97flex_default="flex"
98makeinfo_default="makeinfo"
99texi2dvi_default="texi2dvi"
100texi2pdf_default="texi2pdf"
101dvips_default="dvips"
102
103# default switch values
104DEFAULT="
105"
106
107DEFAULT_NO="static
108utf8
109"
110
111DEFAULT_YES="doc
112"
113
114CMDLINE_SELECT="$DEFAULT
115  $DEFAULT_NO
116  $DEFAULT_YES
117"
118
119enable $DEFAULT_YES
120disable $DEFAULT_NO
121
122for opt do
123        optval="${opt#*=}"
124        case "$opt" in
125        --help)
126                show_help
127        ;;
128        --prefix=*)
129                PREFIX="$optval"
130    bindir="$optval/bin"
131    sharedir="$optval/share"
132    docdir="$optval/share/doc/utt"
133    langdir="$optval/share/utt"
134    libdir="$optval/lib/utt"
135        ;;
136        --bindir=*)
137                bindir="$optval"
138        ;;
139        --confdir=*)
140                confdir="$optval"
141        ;;
142        --sharedir=*)
143                sharedir="$optval"
144        ;;
145        --docdir=*)
146                docdir="$optval"
147        ;;
148        --langdir=*)
149                langdir="$optval"
150        ;;
151        --libdir=*)
152                libdir="$optval"
153        ;;
154        --language=*)
155                language="$optval"
156        ;;
157        --cc=*)
158                cc="$optval"
159        ;;
160        --cxx=*)
161                cxx="$optval"
162        ;;
163        --gengetopt=*)
164                gengetopt="$optval"
165        ;;
166        --flex=*)
167                flex="$optval"
168        ;;
169        --makeinfo=*)
170                makeinfo="$optval"
171        ;;
172        --texi2dvi=*)
173                texi2dvi="$optval"
174        ;;
175        --texi2pdf=*)
176                texi2pdf="$optval"
177        ;;
178        --dvips=*)
179                dvips="$optval"
180        ;;
181        --enable-?*|--disable-?*)
182                eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
183    echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
184                $action $option
185        ;;
186        *)
187                die_unknown $opt
188        ;;
189        esac
190done
191
192if ! test -z $cc; then
193        cc_default="${cc}"
194fi
195cc="${cc_default}"
196
197if ! test -z $cxx; then
198        cxx_default="${cxx}"
199fi
200
201cxx="${cxx_default}"
202
203if ! test -z $gengetopt; then
204        gengetopt_default="${gengetopt}"
205fi
206
207gengetopt="${gengetopt_default}"
208
209if ! test -z $flex; then
210  flex_default="$flex"
211fi
212
213flex="${flex_default}"
214
215enabled doc && {
216        if ! test -z $makeinfo; then
217                makeinfo_default="${makeinfo}"
218        fi
219        if ! test -z $texi2dvi; then
220                texi2dvi_default="${texi2dvi}"
221        fi
222        if ! test -z $texi2pdf; then
223                texi2pdf_default="${texi2pdf}"
224        fi
225        if ! test -z $dvips; then
226                dvips_default="${dvips}"
227        fi
228       
229        makeinfo="${makeinfo_default}"
230        texi2dvi="${texi2dvi_default}"
231        texi2pdf="${texi2pdf_default}"
232        dvips="${dvips_default}"
233}
234
235# generating config.mak
236
237echo "# Automatically generated by configure" > config.mak
238echo "PREFIX=$PREFIX" >> config.mak
239echo "BIN_DIR=$bindir" >> config.mak
240echo "CONF_DIR=$confdir" >> config.mak
241echo "SHARE_DIR=$sharedir" >> config.mak
242echo "DOC_DIR=$docdir" >> config.mak
243echo "LANG_DIR=$langdir" >> config.mak
244echo "LIB_DIR=$libdir" >> config.mak
245echo "LANGUAGE=$language" >> config.mak
246echo "CC=$cc" >> config.mak
247echo "CXX=$cxx" >> config.mak
248echo "GENGETOPT=$gengetopt" >> config.mak
249echo "FLEX=$flex" >> config.mak
250enabled doc && {
251        echo "MAKEINFO=$makeinfo" >> config.mak
252        echo "TEXI2DVI=$texi2dvi" >> config.mak
253        echo "TEXI2PDF=$texi2pdf" >> config.mak
254        echo "DVIPS=$dvips" >> config.mak
255}
256echo "BUILD_UTF8=$utf8" >> config.mak
257echo "BUILD_STATIC=$static" >> config.mak
258echo "BUILD_DOC=$doc" >> config.mak
259
260enabled utf8 && {
261  for cmp in $CMPLIST; do
262    if [ -d "${SRC_DIR}/${cmp}_utf8" ]; then
263      COMPONENTS="${COMPONENTS} ${cmp}_utf8"
264    else
265      COMPONENTS="${COMPONENTS} ${cmp}"
266    fi
267  done
268}
269
270disabled utf8 && {
271  for cmp in $CMPLIST; do
272    COMPONENTS="${COMPONENTS} ${cmp}"
273  done
274}
275COMPONENTS=$(echo $COMPONENTS | cut -c1-)
276echo "COMPONENTS=$COMPONENTS" >> config.mak
277
278# echoing the configuration to console
279echo "prefix:     $PREFIX"
280echo "bindir:     $bindir"
281echo "confdir:    $confdir"
282echo "sharedir:   $sharedir"
283echo "docdir:     $docdir"
284echo "langdir:    $langdir"
285echo "libdir:     $libdir"
286echo "language:   $language"
287enabled doc && {
288echo "makeinfo:   $makeinfo"
289echo "texi2dvi:   $texi2dvi"
290echo "texi2pdf:   $texi2pdf"
291echo "dvips:      $dvips"
292}
293echo "cc:         $cc"
294echo "cxx:        $cxx"
295echo "gengetopt:  $gengetopt"
296echo "flex:       $flex"
297echo "utf8:       $utf8"
298echo "static:     $static"
299echo "doc:        $doc"
Note: See TracBrowser for help on using the repository browser.