- Timestamp:
- 02/07/12 15:47:14 (13 years ago)
- Branches:
- master
- Children:
- 2ff1f65
- Parents:
- 5f4d9c3
- git-author:
- Maciej Prill <mprill@…> (02/07/12 15:47:14)
- git-committer:
- Maciej Prill <mprill@…> (02/07/12 15:47:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
ra6e708f rc21bdd6 1 1 #!/bin/sh 2 2 3 . ./auto/defaults 4 . ./auto/options 5 6 if [ -f ./src/config.h ]; then 7 echo ERROR: config.h exists 8 exit 9 fi 10 11 if [ -f ./Makefile ]; then 12 echo ERROR: Makefile exists 13 exit 14 fi 15 16 if [ ! -d ./src ]; then 17 mkdir ./src 18 fi 19 20 . ./auto/output/config_h 21 . ./auto/output/Makefile 22 23 . ./auto/summary 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 7 CUR_DIR=$(pwd) 8 SRC_DIR="${CUR_DIR}/src" 9 10 # list of components to compile 11 CMPLIST="compiledic cor dgp fla gph grp gue kon kor kot lem mar rm12 rs12 sen-nl ser tags tok.c tok.l tok.pl unfla" 12 COMP= 13 14 15 # sets all variables to a defined value 16 set_all(){ 17 value=$1 18 shift 19 for var in $*; do 20 eval $var=$value 21 done 22 } 23 24 # enables a feature 25 enable(){ 26 set_all yes $* 27 } 28 29 # disables a feature 30 disable(){ 31 set_all no $* 32 } 33 34 # checks whether a feature is enabled 35 enabled(){ 36 eval test "x\$$1" = "xyes" 37 } 38 39 # checks whether a feature is disabled 40 disabled(){ 41 eval test "x\$$1" = "xno" 42 } 43 44 show_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 73 die_unknown(){ 74 echo "Unknown option \"$1\"." 75 echo "See $0 --help for availible options." 76 exit 1 77 } 78 79 # 80 # default values 81 PREFIX="/usr/local" 82 83 bindir="${PREFIX}/bin" 84 confdir="/etc/utt" 85 sharedir="${PREFIX}/share" 86 docdir="${PREFIX}/share/doc/utt" 87 langdir="${PREFIX}/share/utt" 88 libdir="${PREFIX}/lib/utt" 89 90 cc_default="gcc" 91 cxx_default="g++" 92 gengetopt_default="gengetopt" 93 flex_default="flex" 94 makeinfo_default="makeinfo" 95 texi2dvi_default="texi2dvi" 96 texi2pdf_default="texi2pdf" 97 dvips_default="dvips" 98 99 # default switch values 100 DEFAULT=" 101 " 102 103 DEFAULT_NO="static 104 utf8 105 " 106 107 DEFAULT_YES="doc 108 " 109 110 CMDLINE_SELECT="$DEFAULT 111 $DEFAULT_NO 112 $DEFAULT_YES 113 " 114 115 enable $DEFAULT_YES 116 disable $DEFAULT_NO 117 118 for 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 183 done 184 185 if ! test -z $cc; then 186 cc_default="${cc}" 187 fi 188 cc="${cc_default}" 189 190 if ! test -z $cxx; then 191 cxx_default="${cxx}" 192 fi 193 194 cxx="${cxx_default}" 195 196 if ! test -z $gengetopt; then 197 gengetopt_default="${gengetopt}" 198 fi 199 200 gengetopt="${gengetopt_default}" 201 202 if ! test -z $flex; then 203 flex_default="$flex" 204 fi 205 206 flex="${flex_default}" 207 208 enabled 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 230 echo "# Automatically generated by configure" > config.mak 231 echo "PREFIX=$PREFIX" >> config.mak 232 echo "BIN_DIR=$bindir" >> config.mak 233 echo "CONF_DIR=$confdir" >> config.mak 234 echo "SHARE_DIR=$sharedir" >> config.mak 235 echo "DOC_DIR=$docdir" >> config.mak 236 echo "LANG_DIR=$langdir" >> config.mak 237 echo "LIB_DIR=$libdir" >> config.mak 238 echo "CC=$cc" >> config.mak 239 echo "CXX=$cxx" >> config.mak 240 echo "GENGETOPT=$gengetopt" >> config.mak 241 echo "FLEX=$flex" >> config.mak 242 enabled 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 } 248 echo "BUILD_UTF8=$utf8" >> config.mak 249 echo "BUILD_STATIC=$static" >> config.mak 250 echo "BUILD_DOC=$doc" >> config.mak 251 252 enabled 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 262 disabled utf8 && { 263 for cmp in $CMPLIST; do 264 COMPONENTS="${COMPONENTS} ${cmp}" 265 done 266 } 267 COMPONENTS=$(echo $COMPONENTS | cut -c1-) 268 echo "COMPONENTS=$COMPONENTS" >> config.mak 269 270 # echoing the configuration to console 271 echo "prefix: $PREFIX" 272 echo "bindir: $bindir" 273 echo "confdir: $confdir" 274 echo "sharedir: $sharedir" 275 echo "docdir: $docdir" 276 echo "langdir: $langdir" 277 echo "libdir: $libdir" 278 enabled doc && { 279 echo "makeinfo: $makeinfo" 280 echo "texi2dvi: $texi2dvi" 281 echo "texi2pdf: $texi2pdf" 282 echo "dvips: $dvips" 283 } 284 echo "cc: $cc" 285 echo "cxx: $cxx" 286 echo "gengetopt: $gengetopt" 287 echo "flex: $flex" 288 echo "utf8: $utf8" 289 echo "static: $static" 290 echo "doc: $doc"
Note: See TracChangeset
for help on using the changeset viewer.