configure

changeset 100
714fbd1391a2
parent 94
48ebc3dd34a5
equal deleted inserted replaced
99:d45f3f11ad76 100:714fbd1391a2
83 83
84 # help text 84 # help text
85 printhelp() 85 printhelp()
86 { 86 {
87 echo "Usage: $0 [OPTIONS]..." 87 echo "Usage: $0 [OPTIONS]..."
88 cat << __EOF__ 88 echo 'Configuration:'
89 Installation directories: 89 if true \
90 --prefix=PREFIX path prefix for architecture-independent files 90 ; then
91 [$prefix] 91 :
92 --exec-prefix=EPREFIX path prefix for architecture-dependent files 92 fi
93 [PREFIX] 93 cat << '__EOF__'
94
95 --bindir=DIR user executables [EPREFIX/bin]
96 --sbindir=DIR system admin executables [EPREFIX/sbin]
97 --libexecdir=DIR program executables [EPREFIX/libexec]
98 --sysconfdir=DIR system configuration files [PREFIX/etc]
99 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
100 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
101 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run]
102 --libdir=DIR object code libraries [EPREFIX/lib]
103 --includedir=DIR C header files [PREFIX/include]
104 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
105 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
106 --infodir=DIR info documentation [DATAROOTDIR/info]
107 --mandir=DIR man documentation [DATAROOTDIR/man]
108 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
109 94
110 Build Types: 95 Build Types:
111 --debug add extra compile flags for debug builds 96 --debug add extra compile flags for debug builds
112 --release add extra compile flags for release builds 97 --release add extra compile flags for release builds
113 98
114 __EOF__ 99 __EOF__
100 abort_configure
115 } 101 }
116 102
117 # create temporary directory 103 # create temporary directory
118 TEMP_DIR=".tmp-`uname -n`" 104 TEMP_DIR=".tmp-`uname -n`"
119 rm -Rf "$TEMP_DIR" 105 rm -Rf "$TEMP_DIR"
125 exit 1 111 exit 1
126 fi 112 fi
127 touch "$TEMP_DIR/options" 113 touch "$TEMP_DIR/options"
128 touch "$TEMP_DIR/features" 114 touch "$TEMP_DIR/features"
129 115
130 # define standard variables 116 # config variables
131 # also define standard prefix (this is where we will search for config.site) 117 if true \
132 prefix=/usr 118 ; then
133 exec_prefix= 119 :
134 bindir= 120 if test -z "$RMDIR__initialized__"; then
135 sbindir= 121 RMDIR__initialized__=1
136 libdir= 122 RMDIR='rm -fR'
137 libexecdir= 123 fi
138 datarootdir= 124 if test -z "$MKDIR__initialized__"; then
139 datadir= 125 MKDIR__initialized__=1
140 sysconfdir= 126 MKDIR='mkdir -p'
141 sharedstatedir= 127 fi
142 localstatedir= 128 if test -z "$COPYFILE__initialized__"; then
143 runstatedir= 129 COPYFILE__initialized__=1
144 includedir= 130 COPYFILE='cp'
145 infodir= 131 fi
146 localedir= 132 if test -z "$AR__initialized__"; then
147 mandir= 133 AR__initialized__=1
148 134 AR='ar cr'
149 # custom variables 135 fi
136 fi
150 137
151 # features 138 # features
152 139
153 # 140 #
154 # parse arguments 141 # parse arguments
155 # 142 #
156 BUILD_TYPE="default" 143 BUILD_TYPE="default"
157 for ARG in "$@" 144 for ARG in "$@"
158 do 145 do
159 case "$ARG" in 146 case "$ARG" in
160 "--prefix="*) prefix=${ARG#--prefix=} ;; 147 "--help"*) printhelp ;;
161 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; 148 "--debug") BUILD_TYPE="debug" ;;
162 "--bindir="*) bindir=${ARG#----bindir=} ;; 149 "--release") BUILD_TYPE="release" ;;
163 "--sbindir="*) sbindir=${ARG#--sbindir=} ;;
164 "--libdir="*) libdir=${ARG#--libdir=} ;;
165 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;;
166 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;;
167 "--datadir="*) datadir=${ARG#--datadir=} ;;
168 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;;
169 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
170 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;;
171 "--includedir="*) includedir=${ARG#--includedir=} ;;
172 "--infodir="*) infodir=${ARG#--infodir=} ;;
173 "--mandir"*) mandir=${ARG#--mandir} ;;
174 "--localedir"*) localedir=${ARG#--localedir} ;;
175 "--help"*) printhelp; abort_configure ;;
176 "--debug") BUILD_TYPE="debug" ;;
177 "--release") BUILD_TYPE="release" ;;
178 "-"*) echo "unknown option: $ARG"; abort_configure ;; 150 "-"*) echo "unknown option: $ARG"; abort_configure ;;
179 esac 151 esac
180 done 152 done
153
154 # toolchain detection utilities
155 . make/toolchain.sh
156
157 # check languages
158 lang_c=
159 lang_cpp=
160 if detect_c_compiler ; then
161 lang_c=1
162 fi
181 163
182 164
183 165
184 # set defaults for dir variables 166 # set defaults for dir variables
185 : ${exec_prefix:="$prefix"} 167 : ${exec_prefix:="$prefix"}
187 : ${sbindir:='${exec_prefix}/sbin'} 169 : ${sbindir:='${exec_prefix}/sbin'}
188 : ${libdir:='${exec_prefix}/lib'} 170 : ${libdir:='${exec_prefix}/lib'}
189 : ${libexecdir:='${exec_prefix}/libexec'} 171 : ${libexecdir:='${exec_prefix}/libexec'}
190 : ${datarootdir:='${prefix}/share'} 172 : ${datarootdir:='${prefix}/share'}
191 : ${datadir:='${datarootdir}'} 173 : ${datadir:='${datarootdir}'}
192 : ${sysconfdir:='${prefix}/etc'}
193 : ${sharedstatedir:='${prefix}/com'} 174 : ${sharedstatedir:='${prefix}/com'}
194 : ${localstatedir:='${prefix}/var'} 175 if [ -z "$sysconfdir" ]; then
195 : ${runstatedir:='${localstatedir}/run'} 176 if [ "$prefix" = '/usr' ]; then
177 sysconfdir='/etc'
178 else
179 sysconfdir='${prefix}/etc'
180 fi
181 fi
182 if [ -z "$localstatedir" ]; then
183 if [ "$prefix" = '/usr' ]; then
184 localstatedir='/var'
185 else
186 localstatedir='${prefix}/var'
187 fi
188 fi
189 if [ -z "$runstatedir" ]; then
190 if [ "$prefix" = '/usr' ]; then
191 runstatedir='/var/run'
192 else
193 runstatedir='${prefix}/var'
194 fi
195 fi
196 : ${includedir:='${prefix}/include'} 196 : ${includedir:='${prefix}/include'}
197 : ${infodir:='${datarootdir}/info'} 197 : ${infodir:='${datarootdir}/info'}
198 : ${mandir:='${datarootdir}/man'} 198 : ${mandir:='${datarootdir}/man'}
199 : ${localedir:='${datarootdir}/locale'} 199 : ${localedir:='${datarootdir}/locale'}
200 200
201 # remember the above values and compare them later
202 orig_bindir="$bindir"
203 orig_sbindir="$sbindir"
204 orig_libdir="$libdir"
205 orig_libexecdir="$libexecdir"
206 orig_datarootdir="$datarootdir"
207 orig_datadir="$datadir"
208 orig_sysconfdir="$sysconfdir"
209 orig_sharedstatedir="$sharedstatedir"
210 orig_localstatedir="$localstatedir"
211 orig_runstatedir="$runstatedir"
212 orig_includedir="$includedir"
213 orig_infodir="$infodir"
214 orig_mandir="$mandir"
215 orig_localedir="$localedir"
216 201
217 # check if a config.site exists and load it 202 # check if a config.site exists and load it
203 CONFIG_SITE_OK=0
218 if [ -n "$CONFIG_SITE" ]; then 204 if [ -n "$CONFIG_SITE" ]; then
219 # CONFIG_SITE may contain space separated file names 205 # CONFIG_SITE may contain space separated file names
220 for cs in $CONFIG_SITE; do 206 for cs in $CONFIG_SITE; do
221 printf "loading defaults from $cs... " 207 printf "loading defaults from $cs... "
222 . "$cs" 208 if [ -f "$cs" ]; then
223 echo ok 209 . "$cs"
210 echo ok
211 CONFIG_SITE_OK=1
212 break
213 else
214 echo "not found"
215 fi
224 done 216 done
225 elif [ -f "$prefix/share/config.site" ]; then 217 elif [ -f "$prefix/share/config.site" ]; then
226 printf "loading site defaults... " 218 printf "loading site defaults... "
227 . "$prefix/share/config.site" 219 . "$prefix/share/config.site"
228 echo ok 220 echo ok
221 CONFIG_SITE_OK=1
229 elif [ -f "$prefix/etc/config.site" ]; then 222 elif [ -f "$prefix/etc/config.site" ]; then
230 printf "loading site defaults... " 223 printf "loading site defaults... "
231 . "$prefix/etc/config.site" 224 . "$prefix/etc/config.site"
232 echo ok 225 echo ok
233 else 226 CONFIG_SITE_OK=1
227 fi
228
229 if [ $CONFIG_SITE_OK -eq 0 ]; then
234 # try to detect the correct libdir on our own, except it was changed by the user 230 # try to detect the correct libdir on our own, except it was changed by the user
235 if test "$libdir" = '${exec_prefix}/lib'; then 231 if [ "$libdir" = '${exec_prefix}/lib' ] ; then
236 if [ "$OS" = "SunOS" ]; then 232 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then
237 test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' 233 if [ "$OS" = "SunOS" ]; then
238 else 234 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64'
239 # check if the standard libdir even exists
240 if test -d "${exec_prefix}/lib" ; then
241 :
242 else 235 else
243 # if it does not, maybe a lib32 exists 236 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64'
244 test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
245 fi 237 fi
246 # now check if there is a special 64bit libdir that we should use 238 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then
247 for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do 239 if [ "$OS" = "SunOS" ]; then
248 if [ $ARCH = $i ]; then 240 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32'
249 test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' 241 else
250 break 242 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32'
251 fi 243 fi
252 done
253 fi 244 fi
254 fi 245 fi
255 fi 246 fi
256 247
257 248
258 # generate vars.mk 249 # generate vars.mk
259 cat > "$TEMP_DIR/vars.mk" << __EOF__ 250 cat > "$TEMP_DIR/vars.mk" << __EOF__
260 prefix=$prefix 251 RMDIR=$RMDIR
261 exec_prefix=$exec_prefix 252 MKDIR=$MKDIR
262 bindir=$bindir 253 COPYFILE=$COPYFILE
263 sbindir=$sbindir 254 AR=$AR
264 libdir=$libdir
265 libexecdir=$libexecdir
266 datarootdir=$datarootdir
267 datadir=$datadir
268 sysconfdir=$sysconfdir
269 sharedstatedir=$sharedstatedir
270 localstatedir=$localstatedir
271 runstatedir=$runstatedir
272 includedir=$includedir
273 infodir=$infodir
274 mandir=$mandir
275 localedir=$localedir
276 __EOF__ 255 __EOF__
277 256
278 # toolchain detection utilities
279 . make/toolchain.sh
280 257
281 # 258 #
282 # DEPENDENCIES 259 # DEPENDENCIES
283 # 260 #
284 261
285 # check languages 262
286 lang_c=
287 lang_cpp=
288 if detect_c_compiler ; then
289 lang_c=1
290 fi
291 263
292 # create buffer for make variables required by dependencies 264 # create buffer for make variables required by dependencies
293 echo > "$TEMP_DIR/make.mk" 265 echo > "$TEMP_DIR/make.mk"
294 266
295 test_pkg_config() 267 test_pkg_config()
335 307
336 print_check_msg "$dep_checked_ucx" "no\n" 308 print_check_msg "$dep_checked_ucx" "no\n"
337 dep_checked_ucx=1 309 dep_checked_ucx=1
338 return 0 310 return 0
339 } 311 }
340 dependency_error_tools()
341 {
342 print_check_msg "$dep_checked_tools" "checking for tools... "
343 # dependency tools platform="unix"
344 while true
345 do
346 if notisplatform "unix"; then
347 break
348 fi
349 cat >> $TEMP_DIR/make.mk << __EOF__
350 # Dependency: tools
351 RMDIR=rm -fR
352 MKDIR=mkdir -p
353 COPYFILE=cp
354 AR=ar cr
355 __EOF__
356 print_check_msg "$dep_checked_tools" "yes\n"
357 dep_checked_tools=1
358 return 1
359 done
360
361 print_check_msg "$dep_checked_tools" "no\n"
362 dep_checked_tools=1
363 return 0
364 }
365 312
366 # start collecting dependency information 313 # start collecting dependency information
367 echo > "$TEMP_DIR/flags.mk" 314 echo > "$TEMP_DIR/flags.mk"
368 315
369 DEPENDENCIES_FAILED= 316 DEPENDENCIES_FAILED=
425 372
426 if dependency_error_ucx; then 373 if dependency_error_ucx; then
427 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ucx " 374 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ucx "
428 ERROR=1 375 ERROR=1
429 fi 376 fi
430 if dependency_error_tools; then
431 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED tools "
432 ERROR=1
433 fi
434 377
435 # Features 378 # Features
436 379
437 380
438 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then 381 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
454 abort_configure 397 abort_configure
455 fi 398 fi
456 399
457 echo "configure finished" 400 echo "configure finished"
458 echo 401 echo
459 echo "Toolchain" 402 echo "Toolchain:"
460 echo " name: $TOOLCHAIN_NAME" 403 echo " name: $TOOLCHAIN_NAME"
461 if [ -n "$TOOLCHAIN_CC" ]; then 404 if [ -n "$TOOLCHAIN_CC" ]; then
462 echo " cc: $TOOLCHAIN_CC" 405 echo " cc: $TOOLCHAIN_CC"
463 fi 406 fi
464 if [ -n "$TOOLCHAIN_CXX" ]; then 407 if [ -n "$TOOLCHAIN_CXX" ]; then
469 fi 412 fi
470 if [ -n "$TOOLCHAIN_CSTD" ]; then 413 if [ -n "$TOOLCHAIN_CSTD" ]; then
471 echo " default C std: $TOOLCHAIN_CSTD" 414 echo " default C std: $TOOLCHAIN_CSTD"
472 fi 415 fi
473 echo 416 echo
474 echo "Build Config:" 417 echo "Config:"
475 echo " prefix: $prefix"
476 echo " exec_prefix: $exec_prefix"
477 if [ "$orig_bindir" != "$bindir" ]; then
478 echo " bindir: $bindir"
479 fi
480 if [ "$orig_sbindir" != "$sbindir" ]; then
481 echo " sbindir: $sbindir"
482 fi
483 if [ "$orig_libdir" != "$libdir" ]; then
484 echo " libdir: $libdir"
485 fi
486 if [ "$orig_libexecdir" != "$libexecdir" ]; then
487 echo " libexecdir: $libexecdir"
488 fi
489 if [ "$orig_datarootdir" != "$datarootdir" ]; then
490 echo " datarootdir: $datarootdir"
491 fi
492 if [ "$orig_datadir" != "$datadir" ]; then
493 echo " datadir: $datadir"
494 fi
495 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
496 echo " sysconfdir: $sysconfdir"
497 fi
498 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
499 echo " sharedstatedir: $sharedstatedir"
500 fi
501 if [ "$orig_localstatedir" != "$localstatedir" ]; then
502 echo " localstatedir: $localstatedir"
503 fi
504 if [ "$orig_runstatedir" != "$runstatedir" ]; then
505 echo " runstatedir: $runstatedir"
506 fi
507 if [ "$orig_includedir" != "$includedir" ]; then
508 echo " includedir: $includedir"
509 fi
510 if [ "$orig_infodir" != "$infodir" ]; then
511 echo " infodir: $infodir"
512 fi
513 if [ "$orig_mandir" != "$mandir" ]; then
514 echo " mandir: $mandir"
515 fi
516 if [ "$orig_localedir" != "$localedir" ]; then
517 echo " localedir: $localedir"
518 fi
519 echo 418 echo
520 419
521 # generate the config.mk file 420 # generate the config.mk file
522 pwd=`pwd` 421 pwd=`pwd`
523 cat > "$TEMP_DIR/config.mk" << __EOF__ 422 cat > "$TEMP_DIR/config.mk" << __EOF__

mercurial