| 82 |
83 |
| 83 # help text |
84 # help text |
| 84 printhelp() |
85 printhelp() |
| 85 { |
86 { |
| 86 echo "Usage: $0 [OPTIONS]..." |
87 echo "Usage: $0 [OPTIONS]..." |
| 87 cat << __EOF__ |
88 echo 'Configuration:' |
| 88 Installation directories: |
89 if true \ |
| 89 --prefix=PREFIX path prefix for architecture-independent files |
90 ; then |
| 90 [$prefix] |
91 : |
| 91 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
92 if test -z "$prefix__described__"; then |
| 92 [PREFIX] |
93 prefix__described__=1 |
| 93 |
94 cat << '__EOF__' |
| 94 --bindir=DIR user executables [EPREFIX/bin] |
95 --prefix path prefix for architecture-independent files |
| 95 --sbindir=DIR system admin executables [EPREFIX/sbin] |
96 [`pwd`/work] |
| 96 --libexecdir=DIR program executables [EPREFIX/libexec] |
97 __EOF__ |
| 97 --sysconfdir=DIR system configuration files [PREFIX/etc] |
98 fi |
| 98 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
99 if test -z "$exec_prefix__described__"; then |
| 99 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
100 exec_prefix__described__=1 |
| 100 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
101 cat << '__EOF__' |
| 101 --libdir=DIR object code libraries [EPREFIX/lib] |
102 --exec-prefix path prefix for architecture-dependent files [PREFIX] |
| 102 --includedir=DIR C header files [PREFIX/include] |
103 __EOF__ |
| 103 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
104 fi |
| 104 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
105 fi |
| 105 --infodir=DIR info documentation [DATAROOTDIR/info] |
106 cat << '__EOF__' |
| 106 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
| 107 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
| 108 |
107 |
| 109 Build Types: |
108 Build Types: |
| 110 --debug add extra compile flags for debug builds |
109 --debug add extra compile flags for debug builds |
| 111 --release add extra compile flags for release builds |
110 --release add extra compile flags for release builds |
| 112 |
111 |
| 113 Optional Features: |
112 Optional Features: |
| 114 --enable-postgresql |
113 --enable-postgresql |
| 115 |
114 |
| 116 __EOF__ |
115 __EOF__ |
| |
116 abort_configure |
| 117 } |
117 } |
| 118 |
118 |
| 119 # create temporary directory |
119 # create temporary directory |
| 120 TEMP_DIR=".tmp-`uname -n`" |
120 TEMP_DIR=".tmp-`uname -n`" |
| 121 rm -Rf "$TEMP_DIR" |
121 rm -Rf "$TEMP_DIR" |
| 162 # |
154 # |
| 163 BUILD_TYPE="default" |
155 BUILD_TYPE="default" |
| 164 for ARG in "$@" |
156 for ARG in "$@" |
| 165 do |
157 do |
| 166 case "$ARG" in |
158 case "$ARG" in |
| 167 "--prefix="*) prefix=${ARG#--prefix=} ;; |
159 "--prefix="*) prefix=${ARG#--prefix=} ;; |
| 168 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
160 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
| 169 "--bindir="*) bindir=${ARG#----bindir=} ;; |
161 "--help"*) printhelp ;; |
| 170 "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
162 "--debug") BUILD_TYPE="debug" ;; |
| 171 "--libdir="*) libdir=${ARG#--libdir=} ;; |
163 "--release") BUILD_TYPE="release" ;; |
| 172 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
|
| 173 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
|
| 174 "--datadir="*) datadir=${ARG#--datadir=} ;; |
|
| 175 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
|
| 176 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
|
| 177 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
|
| 178 "--includedir="*) includedir=${ARG#--includedir=} ;; |
|
| 179 "--infodir="*) infodir=${ARG#--infodir=} ;; |
|
| 180 "--mandir"*) mandir=${ARG#--mandir} ;; |
|
| 181 "--localedir"*) localedir=${ARG#--localedir} ;; |
|
| 182 "--help"*) printhelp; abort_configure ;; |
|
| 183 "--debug") BUILD_TYPE="debug" ;; |
|
| 184 "--release") BUILD_TYPE="release" ;; |
|
| 185 "--enable-postgresql") FEATURE_POSTGRESQL=on ;; |
164 "--enable-postgresql") FEATURE_POSTGRESQL=on ;; |
| 186 "--disable-postgresql") unset FEATURE_POSTGRESQL ;; |
165 "--disable-postgresql") unset FEATURE_POSTGRESQL ;; |
| 187 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
166 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
| 188 esac |
167 esac |
| 189 done |
168 done |
| |
169 |
| |
170 # toolchain detection utilities |
| |
171 . make/toolchain.sh |
| |
172 |
| |
173 # check languages |
| |
174 lang_c= |
| |
175 lang_cpp= |
| |
176 if detect_c_compiler ; then |
| |
177 lang_c=1 |
| |
178 fi |
| 190 |
179 |
| 191 |
180 |
| 192 |
181 |
| 193 # set defaults for dir variables |
182 # set defaults for dir variables |
| 194 : ${exec_prefix:="$prefix"} |
183 : ${exec_prefix:="$prefix"} |
| 196 : ${sbindir:='${exec_prefix}/sbin'} |
185 : ${sbindir:='${exec_prefix}/sbin'} |
| 197 : ${libdir:='${exec_prefix}/lib'} |
186 : ${libdir:='${exec_prefix}/lib'} |
| 198 : ${libexecdir:='${exec_prefix}/libexec'} |
187 : ${libexecdir:='${exec_prefix}/libexec'} |
| 199 : ${datarootdir:='${prefix}/share'} |
188 : ${datarootdir:='${prefix}/share'} |
| 200 : ${datadir:='${datarootdir}'} |
189 : ${datadir:='${datarootdir}'} |
| 201 : ${sysconfdir:='${prefix}/etc'} |
|
| 202 : ${sharedstatedir:='${prefix}/com'} |
190 : ${sharedstatedir:='${prefix}/com'} |
| 203 : ${localstatedir:='${prefix}/var'} |
191 if [ -z "$sysconfdir" ]; then |
| 204 : ${runstatedir:='${localstatedir}/run'} |
192 if [ "$prefix" = '/usr' ]; then |
| |
193 sysconfdir='/etc' |
| |
194 else |
| |
195 sysconfdir='${prefix}/etc' |
| |
196 fi |
| |
197 fi |
| |
198 if [ -z "$localstatedir" ]; then |
| |
199 if [ "$prefix" = '/usr' ]; then |
| |
200 localstatedir='/var' |
| |
201 else |
| |
202 localstatedir='${prefix}/var' |
| |
203 fi |
| |
204 fi |
| |
205 if [ -z "$runstatedir" ]; then |
| |
206 if [ "$prefix" = '/usr' ]; then |
| |
207 runstatedir='/var/run' |
| |
208 else |
| |
209 runstatedir='${prefix}/var' |
| |
210 fi |
| |
211 fi |
| 205 : ${includedir:='${prefix}/include'} |
212 : ${includedir:='${prefix}/include'} |
| 206 : ${infodir:='${datarootdir}/info'} |
213 : ${infodir:='${datarootdir}/info'} |
| 207 : ${mandir:='${datarootdir}/man'} |
214 : ${mandir:='${datarootdir}/man'} |
| 208 : ${localedir:='${datarootdir}/locale'} |
215 : ${localedir:='${datarootdir}/locale'} |
| 209 |
216 |
| 210 # remember the above values and compare them later |
|
| 211 orig_bindir="$bindir" |
|
| 212 orig_sbindir="$sbindir" |
|
| 213 orig_libdir="$libdir" |
|
| 214 orig_libexecdir="$libexecdir" |
|
| 215 orig_datarootdir="$datarootdir" |
|
| 216 orig_datadir="$datadir" |
|
| 217 orig_sysconfdir="$sysconfdir" |
|
| 218 orig_sharedstatedir="$sharedstatedir" |
|
| 219 orig_localstatedir="$localstatedir" |
|
| 220 orig_runstatedir="$runstatedir" |
|
| 221 orig_includedir="$includedir" |
|
| 222 orig_infodir="$infodir" |
|
| 223 orig_mandir="$mandir" |
|
| 224 orig_localedir="$localedir" |
|
| 225 |
217 |
| 226 # check if a config.site exists and load it |
218 # check if a config.site exists and load it |
| |
219 CONFIG_SITE_OK=0 |
| 227 if [ -n "$CONFIG_SITE" ]; then |
220 if [ -n "$CONFIG_SITE" ]; then |
| 228 # CONFIG_SITE may contain space separated file names |
221 # CONFIG_SITE may contain space separated file names |
| 229 for cs in $CONFIG_SITE; do |
222 for cs in $CONFIG_SITE; do |
| 230 printf "loading defaults from $cs... " |
223 printf "loading defaults from $cs... " |
| 231 . "$cs" |
224 if [ -f "$cs" ]; then |
| 232 echo ok |
225 . "$cs" |
| |
226 echo ok |
| |
227 CONFIG_SITE_OK=1 |
| |
228 break |
| |
229 else |
| |
230 echo "not found" |
| |
231 fi |
| 233 done |
232 done |
| 234 elif [ -f "$prefix/share/config.site" ]; then |
233 elif [ -f "$prefix/share/config.site" ]; then |
| 235 printf "loading site defaults... " |
234 printf "loading site defaults... " |
| 236 . "$prefix/share/config.site" |
235 . "$prefix/share/config.site" |
| 237 echo ok |
236 echo ok |
| |
237 CONFIG_SITE_OK=1 |
| 238 elif [ -f "$prefix/etc/config.site" ]; then |
238 elif [ -f "$prefix/etc/config.site" ]; then |
| 239 printf "loading site defaults... " |
239 printf "loading site defaults... " |
| 240 . "$prefix/etc/config.site" |
240 . "$prefix/etc/config.site" |
| 241 echo ok |
241 echo ok |
| |
242 CONFIG_SITE_OK=1 |
| |
243 fi |
| |
244 |
| |
245 if [ $CONFIG_SITE_OK -eq 0 ]; then |
| |
246 # try to detect the correct libdir on our own, except it was changed by the user |
| |
247 if [ "$libdir" = '${exec_prefix}/lib' ] ; then |
| |
248 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then |
| |
249 if [ "$OS" = "SunOS" ]; then |
| |
250 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64' |
| |
251 else |
| |
252 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' |
| |
253 fi |
| |
254 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then |
| |
255 if [ "$OS" = "SunOS" ]; then |
| |
256 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32' |
| |
257 else |
| |
258 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32' |
| |
259 fi |
| |
260 fi |
| |
261 fi |
| 242 fi |
262 fi |
| 243 |
263 |
| 244 |
264 |
| 245 # generate vars.mk |
265 # generate vars.mk |
| 246 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
266 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
| |
267 host=$host |
| 247 prefix=$prefix |
268 prefix=$prefix |
| 248 exec_prefix=$exec_prefix |
269 exec_prefix=$exec_prefix |
| 249 bindir=$bindir |
270 __EOF__ |
| 250 sbindir=$sbindir |
271 |
| 251 libdir=$libdir |
|
| 252 libexecdir=$libexecdir |
|
| 253 datarootdir=$datarootdir |
|
| 254 datadir=$datadir |
|
| 255 sysconfdir=$sysconfdir |
|
| 256 sharedstatedir=$sharedstatedir |
|
| 257 localstatedir=$localstatedir |
|
| 258 runstatedir=$runstatedir |
|
| 259 includedir=$includedir |
|
| 260 infodir=$infodir |
|
| 261 mandir=$mandir |
|
| 262 localedir=$localedir |
|
| 263 __EOF__ |
|
| 264 |
|
| 265 # toolchain detection utilities |
|
| 266 . make/toolchain.sh |
|
| 267 |
272 |
| 268 # |
273 # |
| 269 # DEPENDENCIES |
274 # DEPENDENCIES |
| 270 # |
275 # |
| 271 |
276 |
| 272 # check languages |
277 |
| 273 lang_c= |
|
| 274 lang_cpp= |
|
| 275 if detect_c_compiler ; then |
|
| 276 lang_c=1 |
|
| 277 fi |
|
| 278 |
278 |
| 279 # create buffer for make variables required by dependencies |
279 # create buffer for make variables required by dependencies |
| 280 echo > "$TEMP_DIR/make.mk" |
280 echo > "$TEMP_DIR/make.mk" |
| 281 |
281 |
| 282 test_pkg_config() |
282 test_pkg_config() |
| 674 fi |
674 fi |
| 675 if [ -n "$TOOLCHAIN_CSTD" ]; then |
675 if [ -n "$TOOLCHAIN_CSTD" ]; then |
| 676 echo " default C std: $TOOLCHAIN_CSTD" |
676 echo " default C std: $TOOLCHAIN_CSTD" |
| 677 fi |
677 fi |
| 678 echo |
678 echo |
| 679 echo "Build Config:" |
679 echo "Config:" |
| 680 echo " prefix: $prefix" |
680 printf ' %-16s' 'prefix:' |
| 681 echo " exec_prefix: $exec_prefix" |
681 echo "$prefix" |
| 682 if [ "$orig_bindir" != "$bindir" ]; then |
682 printf ' %-16s' 'exec-prefix:' |
| 683 echo " bindir: $bindir" |
683 echo "$exec_prefix" |
| 684 fi |
|
| 685 if [ "$orig_sbindir" != "$sbindir" ]; then |
|
| 686 echo " sbindir: $sbindir" |
|
| 687 fi |
|
| 688 if [ "$orig_libdir" != "$libdir" ]; then |
|
| 689 echo " libdir: $libdir" |
|
| 690 fi |
|
| 691 if [ "$orig_libexecdir" != "$libexecdir" ]; then |
|
| 692 echo " libexecdir: $libexecdir" |
|
| 693 fi |
|
| 694 if [ "$orig_datarootdir" != "$datarootdir" ]; then |
|
| 695 echo " datarootdir: $datarootdir" |
|
| 696 fi |
|
| 697 if [ "$orig_datadir" != "$datadir" ]; then |
|
| 698 echo " datadir: $datadir" |
|
| 699 fi |
|
| 700 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then |
|
| 701 echo " sysconfdir: $sysconfdir" |
|
| 702 fi |
|
| 703 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then |
|
| 704 echo " sharedstatedir: $sharedstatedir" |
|
| 705 fi |
|
| 706 if [ "$orig_localstatedir" != "$localstatedir" ]; then |
|
| 707 echo " localstatedir: $localstatedir" |
|
| 708 fi |
|
| 709 if [ "$orig_runstatedir" != "$runstatedir" ]; then |
|
| 710 echo " runstatedir: $runstatedir" |
|
| 711 fi |
|
| 712 if [ "$orig_includedir" != "$includedir" ]; then |
|
| 713 echo " includedir: $includedir" |
|
| 714 fi |
|
| 715 if [ "$orig_infodir" != "$infodir" ]; then |
|
| 716 echo " infodir: $infodir" |
|
| 717 fi |
|
| 718 if [ "$orig_mandir" != "$mandir" ]; then |
|
| 719 echo " mandir: $mandir" |
|
| 720 fi |
|
| 721 if [ "$orig_localedir" != "$localedir" ]; then |
|
| 722 echo " localedir: $localedir" |
|
| 723 fi |
|
| 724 echo |
684 echo |
| 725 echo "Features:" |
685 echo "Features:" |
| |
686 printf ' %-16s' 'postgresql:' |
| 726 if [ -n "$FEATURE_POSTGRESQL" ]; then |
687 if [ -n "$FEATURE_POSTGRESQL" ]; then |
| 727 echo " postgresql: on" |
688 echo 'on' |
| 728 else |
689 else |
| 729 echo " postgresql: off" |
690 echo 'off' |
| 730 fi |
691 fi |
| 731 echo |
692 echo |
| 732 |
693 |
| 733 # generate the config.mk file |
694 # generate the config.mk file |
| 734 pwd=`pwd` |
695 pwd=`pwd` |