| 130 exit 1 |
112 exit 1 |
| 131 fi |
113 fi |
| 132 touch "$TEMP_DIR/options" |
114 touch "$TEMP_DIR/options" |
| 133 touch "$TEMP_DIR/features" |
115 touch "$TEMP_DIR/features" |
| 134 |
116 |
| 135 # define standard variables |
117 # config variables |
| 136 # also define standard prefix (this is where we will search for config.site) |
|
| 137 prefix=/usr |
|
| 138 exec_prefix= |
|
| 139 bindir= |
|
| 140 sbindir= |
|
| 141 libdir= |
|
| 142 libexecdir= |
|
| 143 datarootdir= |
|
| 144 datadir= |
|
| 145 sysconfdir= |
|
| 146 sharedstatedir= |
|
| 147 localstatedir= |
|
| 148 runstatedir= |
|
| 149 includedir= |
|
| 150 infodir= |
|
| 151 localedir= |
|
| 152 mandir= |
|
| 153 |
|
| 154 # custom variables |
|
| 155 |
118 |
| 156 # features |
119 # features |
| 157 |
120 |
| 158 # |
121 # |
| 159 # parse arguments |
122 # parse arguments |
| 160 # |
123 # |
| 161 BUILD_TYPE="default" |
124 BUILD_TYPE="default" |
| 162 for ARG in "$@" |
125 for ARG in "$@" |
| 163 do |
126 do |
| 164 case "$ARG" in |
127 case "$ARG" in |
| 165 "--prefix="*) prefix=${ARG#--prefix=} ;; |
128 "--help"*) printhelp ;; |
| 166 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
129 "--debug") BUILD_TYPE="debug" ;; |
| 167 "--bindir="*) bindir=${ARG#----bindir=} ;; |
130 "--release") BUILD_TYPE="release" ;; |
| 168 "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
|
| 169 "--libdir="*) libdir=${ARG#--libdir=} ;; |
|
| 170 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
|
| 171 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
|
| 172 "--datadir="*) datadir=${ARG#--datadir=} ;; |
|
| 173 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
|
| 174 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
|
| 175 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
|
| 176 "--includedir="*) includedir=${ARG#--includedir=} ;; |
|
| 177 "--infodir="*) infodir=${ARG#--infodir=} ;; |
|
| 178 "--mandir"*) mandir=${ARG#--mandir} ;; |
|
| 179 "--localedir"*) localedir=${ARG#--localedir} ;; |
|
| 180 "--help"*) printhelp; abort_configure ;; |
|
| 181 "--debug") BUILD_TYPE="debug" ;; |
|
| 182 "--release") BUILD_TYPE="release" ;; |
|
| 183 "--enable-static") FEATURE_STATIC=on ;; |
131 "--enable-static") FEATURE_STATIC=on ;; |
| 184 "--disable-static") unset FEATURE_STATIC ;; |
132 "--disable-static") unset FEATURE_STATIC ;; |
| 185 "--enable-asan") FEATURE_ASAN=on ;; |
133 "--enable-asan") FEATURE_ASAN=on ;; |
| 186 "--disable-asan") unset FEATURE_ASAN ;; |
134 "--disable-asan") unset FEATURE_ASAN ;; |
| 187 "--enable-ubsan") FEATURE_UBSAN=on ;; |
135 "--enable-ubsan") FEATURE_UBSAN=on ;; |
| 188 "--disable-ubsan") unset FEATURE_UBSAN ;; |
136 "--disable-ubsan") unset FEATURE_UBSAN ;; |
| 189 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
137 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
| 190 esac |
138 esac |
| 191 done |
139 done |
| 192 |
140 |
| |
141 # toolchain detection utilities |
| |
142 . make/toolchain.sh |
| |
143 |
| |
144 # check languages |
| |
145 lang_c= |
| |
146 lang_cpp= |
| |
147 if detect_cpp_compiler ; then |
| |
148 lang_cpp=1 |
| |
149 fi |
| |
150 |
| 193 |
151 |
| 194 |
152 |
| 195 # set defaults for dir variables |
153 # set defaults for dir variables |
| 196 : ${exec_prefix:="$prefix"} |
154 : ${exec_prefix:="$prefix"} |
| 197 : ${bindir:='${exec_prefix}/bin'} |
155 : ${bindir:='${exec_prefix}/bin'} |
| 198 : ${sbindir:='${exec_prefix}/sbin'} |
156 : ${sbindir:='${exec_prefix}/sbin'} |
| 199 : ${libdir:='${exec_prefix}/lib'} |
157 : ${libdir:='${exec_prefix}/lib'} |
| 200 : ${libexecdir:='${exec_prefix}/libexec'} |
158 : ${libexecdir:='${exec_prefix}/libexec'} |
| 201 : ${datarootdir:='${prefix}/share'} |
159 : ${datarootdir:='${prefix}/share'} |
| 202 : ${datadir:='${datarootdir}'} |
160 : ${datadir:='${datarootdir}'} |
| 203 : ${sysconfdir:='${prefix}/etc'} |
|
| 204 : ${sharedstatedir:='${prefix}/com'} |
161 : ${sharedstatedir:='${prefix}/com'} |
| 205 : ${localstatedir:='${prefix}/var'} |
162 if [ -z "$sysconfdir" ]; then |
| 206 : ${runstatedir:='${localstatedir}/run'} |
163 if [ "$prefix" = '/usr' ]; then |
| |
164 sysconfdir='/etc' |
| |
165 else |
| |
166 sysconfdir='${prefix}/etc' |
| |
167 fi |
| |
168 fi |
| |
169 if [ -z "$localstatedir" ]; then |
| |
170 if [ "$prefix" = '/usr' ]; then |
| |
171 localstatedir='/var' |
| |
172 else |
| |
173 localstatedir='${prefix}/var' |
| |
174 fi |
| |
175 fi |
| |
176 if [ -z "$runstatedir" ]; then |
| |
177 if [ "$prefix" = '/usr' ]; then |
| |
178 runstatedir='/var/run' |
| |
179 else |
| |
180 runstatedir='${prefix}/var' |
| |
181 fi |
| |
182 fi |
| 207 : ${includedir:='${prefix}/include'} |
183 : ${includedir:='${prefix}/include'} |
| 208 : ${infodir:='${datarootdir}/info'} |
184 : ${infodir:='${datarootdir}/info'} |
| 209 : ${mandir:='${datarootdir}/man'} |
185 : ${mandir:='${datarootdir}/man'} |
| 210 : ${localedir:='${datarootdir}/locale'} |
186 : ${localedir:='${datarootdir}/locale'} |
| 211 |
187 |
| 212 # remember the above values and compare them later |
|
| 213 orig_bindir="$bindir" |
|
| 214 orig_sbindir="$sbindir" |
|
| 215 orig_libdir="$libdir" |
|
| 216 orig_libexecdir="$libexecdir" |
|
| 217 orig_datarootdir="$datarootdir" |
|
| 218 orig_datadir="$datadir" |
|
| 219 orig_sysconfdir="$sysconfdir" |
|
| 220 orig_sharedstatedir="$sharedstatedir" |
|
| 221 orig_localstatedir="$localstatedir" |
|
| 222 orig_runstatedir="$runstatedir" |
|
| 223 orig_includedir="$includedir" |
|
| 224 orig_infodir="$infodir" |
|
| 225 orig_mandir="$mandir" |
|
| 226 orig_localedir="$localedir" |
|
| 227 |
188 |
| 228 # check if a config.site exists and load it |
189 # check if a config.site exists and load it |
| |
190 CONFIG_SITE_OK=0 |
| 229 if [ -n "$CONFIG_SITE" ]; then |
191 if [ -n "$CONFIG_SITE" ]; then |
| 230 # CONFIG_SITE may contain space separated file names |
192 # CONFIG_SITE may contain space separated file names |
| 231 for cs in $CONFIG_SITE; do |
193 for cs in $CONFIG_SITE; do |
| 232 printf "loading defaults from $cs... " |
194 printf "loading defaults from $cs... " |
| 233 . "$cs" |
195 if [ -f "$cs" ]; then |
| 234 echo ok |
196 . "$cs" |
| |
197 echo ok |
| |
198 CONFIG_SITE_OK=1 |
| |
199 break |
| |
200 else |
| |
201 echo "not found" |
| |
202 fi |
| 235 done |
203 done |
| 236 elif [ -f "$prefix/share/config.site" ]; then |
204 elif [ -f "$prefix/share/config.site" ]; then |
| 237 printf "loading site defaults... " |
205 printf "loading site defaults... " |
| 238 . "$prefix/share/config.site" |
206 . "$prefix/share/config.site" |
| 239 echo ok |
207 echo ok |
| |
208 CONFIG_SITE_OK=1 |
| 240 elif [ -f "$prefix/etc/config.site" ]; then |
209 elif [ -f "$prefix/etc/config.site" ]; then |
| 241 printf "loading site defaults... " |
210 printf "loading site defaults... " |
| 242 . "$prefix/etc/config.site" |
211 . "$prefix/etc/config.site" |
| 243 echo ok |
212 echo ok |
| 244 else |
213 CONFIG_SITE_OK=1 |
| |
214 fi |
| |
215 |
| |
216 if [ $CONFIG_SITE_OK -eq 0 ]; then |
| 245 # try to detect the correct libdir on our own, except it was changed by the user |
217 # try to detect the correct libdir on our own, except it was changed by the user |
| 246 if test "$libdir" = '${exec_prefix}/lib'; then |
218 if [ "$libdir" = '${exec_prefix}/lib' ] ; then |
| 247 if [ "$OS" = "SunOS" ]; then |
219 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then |
| 248 test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' |
220 if [ "$OS" = "SunOS" ]; then |
| 249 else |
221 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64' |
| 250 # check if the standard libdir even exists |
|
| 251 if test -d "${exec_prefix}/lib" ; then |
|
| 252 : |
|
| 253 else |
222 else |
| 254 # if it does not, maybe a lib32 exists |
223 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' |
| 255 test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32' |
|
| 256 fi |
224 fi |
| 257 # now check if there is a special 64bit libdir that we should use |
225 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then |
| 258 for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do |
226 if [ "$OS" = "SunOS" ]; then |
| 259 if [ $ARCH = $i ]; then |
227 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32' |
| 260 test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' |
228 else |
| 261 break |
229 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32' |
| 262 fi |
230 fi |
| 263 done |
|
| 264 fi |
231 fi |
| 265 fi |
232 fi |
| 266 fi |
233 fi |
| 267 |
234 |
| 268 |
235 |
| 269 # generate vars.mk |
236 # generate vars.mk |
| 270 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
237 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
| 271 prefix=$prefix |
|
| 272 exec_prefix=$exec_prefix |
|
| 273 bindir=$bindir |
|
| 274 sbindir=$sbindir |
|
| 275 libdir=$libdir |
|
| 276 libexecdir=$libexecdir |
|
| 277 datarootdir=$datarootdir |
|
| 278 datadir=$datadir |
|
| 279 sysconfdir=$sysconfdir |
|
| 280 sharedstatedir=$sharedstatedir |
|
| 281 localstatedir=$localstatedir |
|
| 282 runstatedir=$runstatedir |
|
| 283 includedir=$includedir |
|
| 284 infodir=$infodir |
|
| 285 mandir=$mandir |
|
| 286 localedir=$localedir |
|
| 287 __EOF__ |
238 __EOF__ |
| 288 |
239 |
| 289 # toolchain detection utilities |
|
| 290 . make/toolchain.sh |
|
| 291 |
240 |
| 292 # |
241 # |
| 293 # DEPENDENCIES |
242 # DEPENDENCIES |
| 294 # |
243 # |
| 295 |
244 |
| 296 # check languages |
245 |
| 297 lang_c= |
|
| 298 lang_cpp= |
|
| 299 if detect_cpp_compiler ; then |
|
| 300 lang_cpp=1 |
|
| 301 fi |
|
| 302 |
246 |
| 303 # create buffer for make variables required by dependencies |
247 # create buffer for make variables required by dependencies |
| 304 echo > "$TEMP_DIR/make.mk" |
248 echo > "$TEMP_DIR/make.mk" |
| 305 |
249 |
| 306 test_pkg_config() |
250 test_pkg_config() |
| 543 fi |
487 fi |
| 544 if [ -n "$TOOLCHAIN_CSTD" ]; then |
488 if [ -n "$TOOLCHAIN_CSTD" ]; then |
| 545 echo " default C std: $TOOLCHAIN_CSTD" |
489 echo " default C std: $TOOLCHAIN_CSTD" |
| 546 fi |
490 fi |
| 547 echo |
491 echo |
| 548 echo "Build Config:" |
492 echo "Config:" |
| 549 echo " prefix: $prefix" |
|
| 550 echo " exec_prefix: $exec_prefix" |
|
| 551 if [ "$orig_bindir" != "$bindir" ]; then |
|
| 552 echo " bindir: $bindir" |
|
| 553 fi |
|
| 554 if [ "$orig_sbindir" != "$sbindir" ]; then |
|
| 555 echo " sbindir: $sbindir" |
|
| 556 fi |
|
| 557 if [ "$orig_libdir" != "$libdir" ]; then |
|
| 558 echo " libdir: $libdir" |
|
| 559 fi |
|
| 560 if [ "$orig_libexecdir" != "$libexecdir" ]; then |
|
| 561 echo " libexecdir: $libexecdir" |
|
| 562 fi |
|
| 563 if [ "$orig_datarootdir" != "$datarootdir" ]; then |
|
| 564 echo " datarootdir: $datarootdir" |
|
| 565 fi |
|
| 566 if [ "$orig_datadir" != "$datadir" ]; then |
|
| 567 echo " datadir: $datadir" |
|
| 568 fi |
|
| 569 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then |
|
| 570 echo " sysconfdir: $sysconfdir" |
|
| 571 fi |
|
| 572 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then |
|
| 573 echo " sharedstatedir: $sharedstatedir" |
|
| 574 fi |
|
| 575 if [ "$orig_localstatedir" != "$localstatedir" ]; then |
|
| 576 echo " localstatedir: $localstatedir" |
|
| 577 fi |
|
| 578 if [ "$orig_runstatedir" != "$runstatedir" ]; then |
|
| 579 echo " runstatedir: $runstatedir" |
|
| 580 fi |
|
| 581 if [ "$orig_includedir" != "$includedir" ]; then |
|
| 582 echo " includedir: $includedir" |
|
| 583 fi |
|
| 584 if [ "$orig_infodir" != "$infodir" ]; then |
|
| 585 echo " infodir: $infodir" |
|
| 586 fi |
|
| 587 if [ "$orig_mandir" != "$mandir" ]; then |
|
| 588 echo " mandir: $mandir" |
|
| 589 fi |
|
| 590 if [ "$orig_localedir" != "$localedir" ]; then |
|
| 591 echo " localedir: $localedir" |
|
| 592 fi |
|
| 593 echo |
493 echo |
| 594 echo "Features:" |
494 echo "Features:" |
| |
495 printf ' %-16s' 'static:' |
| 595 if [ -n "$FEATURE_STATIC" ]; then |
496 if [ -n "$FEATURE_STATIC" ]; then |
| 596 echo " static: on" |
497 echo 'on' |
| 597 else |
498 else |
| 598 echo " static: off" |
499 echo 'off' |
| 599 fi |
500 fi |
| |
501 printf ' %-16s' 'asan:' |
| 600 if [ -n "$FEATURE_ASAN" ]; then |
502 if [ -n "$FEATURE_ASAN" ]; then |
| 601 echo " asan: on" |
503 echo 'on' |
| 602 else |
504 else |
| 603 echo " asan: off" |
505 echo 'off' |
| 604 fi |
506 fi |
| |
507 printf ' %-16s' 'ubsan:' |
| 605 if [ -n "$FEATURE_UBSAN" ]; then |
508 if [ -n "$FEATURE_UBSAN" ]; then |
| 606 echo " ubsan: on" |
509 echo 'on' |
| 607 else |
510 else |
| 608 echo " ubsan: off" |
511 echo 'off' |
| 609 fi |
512 fi |
| 610 echo |
513 echo |
| 611 |
514 |
| 612 # generate the config.mk file |
515 # generate the config.mk file |
| 613 pwd=`pwd` |
516 pwd=`pwd` |