source: configure @ e7de6cc

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

new version of dgp
added dgc, tre and compdic components
compiledic renamed to compdic_utf8
./configure updated

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