configure (21715B)
1 #!/bin/sh 2 3 cd `dirname "$0"` 4 . package/info 5 6 # Helper functions 7 8 usage () { 9 cat <<EOF 10 Usage: $0 [OPTION]... [TARGET] 11 12 Defaults for the options are specified in brackets. 13 14 System types: 15 --target=TARGET configure to run on target TARGET [detected] 16 --host=TARGET same as --target 17 18 Installation directories: 19 --prefix=PREFIX main installation prefix [/] 20 21 Fine tuning of the installation directories: 22 --dynlibdir=DIR shared library files [PREFIX/lib] 23 --libdir=DIR static library files [PREFIX/lib/$package] 24 --includedir=DIR include files for the C compiler [PREFIX/include] 25 --sysconfdir=DIR global configuration files [PREFIX/etc] 26 --sysdepdir=DIR sysdeps directory [PREFIX/lib/$package/sysdeps] 27 28 If no --prefix option is given, by default libdir will be /usr/lib/$package, 29 includedir will be /usr/include and sysdepdir will be /usr/lib/$package/sysdeps. 30 31 Dependencies: 32 --with-include=DIR add DIR to the list of searched directories for headers 33 --with-lib=DIR add DIR to the list of searched directories for static libraries 34 --with-dynlib=DIR add DIR to the list of searched directories for shared libraries 35 36 Optional features: 37 --disable-shared do not build shared libraries [enabled] 38 --disable-static do not build static libraries [enabled] 39 --disable-all-pic do not build static libraries as PIC [enabled] 40 --enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled] 41 42 $package options: 43 --disable-ipv6 do not build IPv6 support [enabled] 44 --enable-iopause-select prefer select() over poll() for iopause implementation [disabled] 45 --enable-tai-clock assume the system clock is TAI-10 instead of UTC [disabled] 46 --with-default-path=PATH default executable search path [/usr/bin:/bin] 47 48 Sysdeps autodetection override: 49 --with-sysdep-K=V assume sysdep K has the value V [autodetected] 50 51 List of mandatory sysdeps for cross-compiling: 52 devurandom (yes|no): =yes if you have a working /dev/urandom 53 posixspawnearlyreturn (yes|no): =yes if you have an old glibc or otherwise bad posix_spawn 54 EOF 55 exit 0 56 } 57 58 # If your system does not have printf, you can comment this, but it is 59 # generally not a good idea to use echo. 60 # See http://etalabs.net/sh_tricks.html 61 echo () { 62 IFS=' ' 63 printf %s\\n "$*" 64 } 65 66 echon () { 67 IFS=' ' 68 printf %s "$*" 69 } 70 71 quote () { 72 tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; } 73 $1 74 EOF 75 echo "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#" -e "s|\*/|* /|g" 76 } 77 78 fail () { 79 echo "$*" 1>&2 80 exit 1 81 } 82 83 fnmatch () { 84 eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" 85 } 86 87 cmdexists () { 88 type "$1" >/dev/null 2>&1 89 } 90 91 trycc () { 92 test -z "$CC_AUTO" && cmdexists "$1" && CC_AUTO="$*" 93 } 94 95 stripdir () { 96 while eval "fnmatch '*/' \"\${$1}\"" ; do 97 eval "$1=\${$1%/}" 98 done 99 } 100 101 tryflag () { 102 echo "Checking whether compiler accepts $2 ..." 103 echo "typedef int x;" > "$tmpc" 104 if $CC_AUTO $CPPFLAGS_POST $CFLAGS_POST "$2" -c -o "$tmpo" "$tmpc" >/dev/null 2>&1 ; then 105 echo " ... yes" 106 eval "$1=\"\${$1} \$2\"" 107 eval "$1=\${$1# }" 108 return 0 109 else 110 echo " ... no" 111 return 1 112 fi 113 } 114 115 tryldflag () { 116 echo "Checking whether linker accepts $2 ..." 117 echo "typedef int x;" > "$tmpc" 118 if $CC_AUTO $CPPFLAGS_POST $CFLAGS_POST $LDFLAGS_POST -nostdlib "$2" -o "$tmpe" "$tmpc" >/dev/null 2>&1 ; then 119 echo " ... yes" 120 eval "$1=\"\${$1} \$2\"" 121 eval "$1=\${$1# }" 122 return 0 123 else 124 echo " ... no" 125 return 1 126 fi 127 } 128 129 # Sysdeps determination functions 130 131 iscached () 132 { 133 if test -r "$tmps" && grep -q "^${1}: " "$tmps" ; then 134 grep "^${1}: " "$tmps" | tail -n 1 | 135 { 136 IFS=' ' 137 read -r k v ldlibs 138 if test -n "$ldlibs" ; then 139 echo " ... user-provided: $v with linker args: $ldlibs" 140 echo "$ldlibs" >&3 141 else 142 echo " ... user-provided: $v" 143 fi 144 echo "${1}: $v" >> "$sysdeps/sysdeps" 145 return 0 ; 146 } 147 else 148 return 1 ; 149 fi 150 } 151 152 choose () { 153 what="$1" 154 name="$2" 155 echo "Checking whether system has $3..." 156 if iscached "$name" ; then return ; fi 157 shift 3 158 libs="$*" 159 r=true 160 case "$what" in 161 *c*) $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -o "$tmpo" -c src/sysdeps/try$name.c 2>/dev/null || r=false ;; 162 esac 163 if $r ; then 164 case "$what" in 165 *l*) $CC_AUTO $CFLAGS_AUTO $CFLAGS $CFLAGS_POST $LDFLAGS_AUTO $LDFLAGS $LDFLAGS_POST -o try$name "$tmpo" $libs 2>/dev/null || r=false ;; 166 esac 167 fi 168 if $r ; then 169 case "$what" in 170 *r*) if test -n "$cross" ; then 171 rm -f try$name 172 fail "$0: sysdep $name cannot be autodetected when cross-compiling. Please manually provide a value with the --with-sysdep-${name}=yes|no|... option." 173 fi 174 ./try$name >/dev/null 2>&1 ; r=$? 175 case "$r" in 176 111) fail "$0: test crashed, aborting." ;; 177 0) r=true ;; 178 *) r=false ;; 179 esac 180 esac 181 fi 182 rm -f try$name 183 if $r ; then 184 echo "$name: yes" >> $sysdeps/sysdeps 185 echo " ... yes" 186 else 187 echo "$name: no" >> $sysdeps/sysdeps 188 echo " ... no" 189 fi 190 } 191 192 trybasic () { 193 $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -o "$tmpo" -c "$1" 2>/dev/null 194 } 195 196 tryendianness () { 197 echo "Checking endianness..." 198 if iscached endianness ; then return ; fi 199 for i in endian.h sys/endian.h machine/endian.h sys/machine.h ; do 200 cat > "$tmpc" <<EOF 201 #undef _POSIX_C_SOURCE 202 #undef _XOPEN_SOURCE 203 #ifndef _BSD_SOURCE 204 #define _BSD_SOURCE 205 #endif 206 #ifndef _GNU_SOURCE 207 #define _GNU_SOURCE 208 #endif 209 #ifndef _DEFAULT_SOURCE 210 #define _DEFAULT_SOURCE 211 #endif 212 #include <$i> 213 int a = LITTLE_ENDIAN ; 214 int b = BIG_ENDIAN ; 215 int c = BYTE_ORDER ; 216 EOF 217 trybasic "$tmpc" || continue 218 for j in little big pdp ; do 219 k=`echo $j | tr '[:lower:]' '[:upper:]'` 220 cat > "$tmpc" <<EOF 221 #undef _POSIX_C_SOURCE 222 #undef _XOPEN_SOURCE 223 #ifndef _BSD_SOURCE 224 #define _BSD_SOURCE 225 #endif 226 #ifndef _GNU_SOURCE 227 #define _GNU_SOURCE 228 #endif 229 #ifndef _DEFAULT_SOURCE 230 #define _DEFAULT_SOURCE 231 #endif 232 #include <$i> 233 int a[BYTE_ORDER == ${k}_ENDIAN ? 1 : -1] ; 234 EOF 235 if trybasic "$tmpc" ; then 236 echo "endianness: $j" >> "$sysdeps/sysdeps" 237 echo " ... $j" 238 rm -f "$tmpc" 239 return 240 fi 241 done 242 rm -f "$tmpc" 243 fail "$0: error: unable to determine endianness according to $i" 244 done 245 246 for j in little big ; do 247 k=`echo $j | tr '[:lower:]' '[:upper:]'` 248 cat > "$tmpc" <<EOF 249 #include <sys/isa_defs.h> 250 int a = _${k}_ENDIAN +1 ; 251 EOF 252 if trybasic "$tmpc" ; then 253 echo "endianness: $j" >> "$sysdeps/sysdeps" 254 echo " ... $j" 255 rm -f "$tmpc" 256 return 257 fi 258 done 259 rm -f "$tmpc" 260 fail "$0: error: unable to determine endianness: no suitable endian.h found" 261 } 262 263 trysigned () { 264 cat > "$tmpc" <<EOF 265 #include <sys/types.h> 266 int a[($1)-1 < 0 ? 1 : -1] ; 267 EOF 268 trybasic "$tmpc" 269 r=$? 270 rm -f "$tmpc" 271 return $r 272 } 273 274 trysizes () { 275 t="$1" ; shift 276 for arg ; do 277 cat > "$tmpc" <<EOF 278 #include <sys/types.h> 279 int a[sizeof($t) == $arg ? 1 : -1] ; 280 EOF 281 if trybasic "$tmpc" ; then 282 rm -f "$tmpc" 283 echo "$arg" 284 return 285 fi 286 done 287 rm -f "$tmpc" 288 fail "$0: error: unable to determine the size of $t on the target" 289 } 290 291 trystdtype () { 292 t="$1" ; shift 293 iscached "sizeofu$t" || { echon "sizeofu${t}: " ; trysizes "$t" "$@" ; } >> "$sysdeps/sysdeps" 294 } 295 296 trytypes () { 297 echo "Checking size and signedness of standard types..." 298 trystdtype short 2 4 299 trystdtype int 4 8 2 300 trystdtype long 8 4 301 for t in size uid gid pid time dev ino ; do 302 iscached "signed$t" || { echon "signed${t}: " ; if trysigned "${t}_t" ; then echo "yes" ; else echo "no" ; fi ; } >> "$sysdeps/sysdeps" 303 iscached "sizeof$t" || { echon "sizeof${t}: " ; trysizes "${t}_t" 4 8 2 ; } >> "$sysdeps/sysdeps" 304 done 305 echo " ... done" 306 } 307 308 detectlibs () { 309 args= 310 name=$1 311 shift 312 if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -c -o try$name.o src/sysdeps/try$name.c 2>/dev/null ; then 313 until $CC_AUTO $CFLAGS_AUTO $CFLAGS $CFLAGS_POST $LDFLAGS_AUTO $LDFLAGS $LDFLAGS_POST -o "$tmpe" try$name.o $args 2>/dev/null ; do 314 if test -z "$*" ; then 315 rm -f try$name.o 316 return 1 317 fi 318 args="$args $1" 319 shift 320 done 321 echo ${args# } 322 rm -f try$name.o 323 return 0 324 else 325 return 1 326 fi 327 } 328 329 trylibs () { 330 name="$1" 331 libvar="$2"_lib 332 libfile="$2".lib 333 echo "Checking whether system has $3..." 334 shift 3 335 if { args=`iscached $name 3>&1 1>&4 4>&-` ; } 4>&1 ; then : 336 elif args=`detectlibs "$name" "$@"` ; then 337 echo "${name}: yes" >> "${sysdeps}/sysdeps" 338 if test -z "$args" ; then 339 echo " ... yes" 340 else 341 echo " ... yes, with linker args: $args" 342 fi 343 else 344 echo "${name}: no" >> ${sysdeps}/sysdeps 345 echo " ... no" 346 fi 347 eval "${libvar}=\"$args\"" 348 echo "$args" > "${sysdeps}/$libfile" 349 } 350 351 352 # The script starts HERE. 353 354 # Initialize variables 355 CC_AUTO= 356 CPPFLAGS_AUTO="-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -Isrc/include" 357 CPPFLAGS_POST="$CPPFLAGS" 358 CPPFLAGS= 359 CFLAGS_AUTO="-pipe -Wall" 360 CFLAGS_POST="$CFLAGS" 361 CFLAGS="-O2" 362 LDFLAGS_AUTO= 363 LDFLAGS_POST="$LDFLAGS" 364 LDFLAGS= 365 LDFLAGS_NOSHARED= 366 LDFLAGS_SHARED=-shared 367 prefix= 368 dynlibdir='$prefix/lib' 369 libdir='$prefix/lib/$package' 370 includedir='$prefix/include' 371 sysconfdir='$prefix/etc' 372 sysdepdir='$prefix/lib/$package/sysdeps' 373 sysdeplist= 374 shared=true 375 static=true 376 allpic=true 377 slashpackage=false 378 ipv6=true 379 select=false 380 taiclock=false 381 ddefaultpath=/usr/bin:/bin 382 defaultpath=$ddefaultpath 383 dpathorig=true 384 sproot= 385 home= 386 exthome= 387 addincpath='' 388 addlibspath='' 389 addlibdpath='' 390 vpaths='' 391 vpathd='' 392 build= 393 394 # Parse command line 395 for arg ; do 396 case "$arg" in 397 --help) usage ;; 398 --prefix=*) prefix=${arg#*=} ;; 399 --dynlibdir=*) dynlibdir=${arg#*=} ;; 400 --libdir=*) libdir=${arg#*=} ;; 401 --includedir=*) includedir=${arg#*=} ;; 402 --sysconfdir=*) sysconfdir=${arg#*=} ;; 403 --sysdepdir=*) sysdepdir=${arg#*=} ;; 404 --with-include=*) var=${arg#*=} ; stripdir var ; addincpath="$addincpath -I$var" ;; 405 --with-lib=*) var=${arg#*=} ; stripdir var ; addlibspath="$addlibspath -L$var" ; vpaths="$vpaths $var" ;; 406 --with-dynlib=*) var=${arg#*=} ; stripdir var ; addlibdpath="$addlibdpath -L$var" ; vpathd="$vpathd $var" ;; 407 --enable-shared|--enable-shared=yes) shared=true ;; 408 --disable-shared|--enable-shared=no) shared=false ;; 409 --enable-static|--enable-static=yes) static=true ;; 410 --disable-static|--enable-static=no) static=false ;; 411 --enable-all-pic|--enable-all-pic=yes) allpic=true ;; 412 --disable-all-pic|--enable-all-pic=no) allpic=false ;; 413 --enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;; 414 --enable-slashpackage) sproot= ; slashpackage=true ;; 415 --disable-slashpackage) sproot= ; slashpackage=false ;; 416 --enable-ipv6|--enable-ipv6=yes) ipv6=true ;; 417 --disable-ipv6|--enable-ipv6=no) ipv6=false ;; 418 --enable-iopause-select|--enable-iopause-select=yes) select=true ;; 419 --disable-iopause-select|--enable-iopause-select=no) select=false ;; 420 --enable-tai-clock|--enable-tai-clock=yes) taiclock=true ;; 421 --disable-tai-clock|--enable-tai-clock=no) taiclock=false ;; 422 --enable-monotonic|--enable-monotonic=yes) echo "$0: warning: --enable-monotonic is now obsolete" 1>&2 ;; 423 --disable-monotonic|--enable-monotonic=no) ;; 424 --with-default-path=*) defaultpath=${arg#*=} ; dpathorig=false ;; 425 --without-default-path) defaultpath=$ddefaultpath ; dpathorig=true ;; 426 --with-sysdep-*=*) sysdeplist="$sysdeplist ${arg#--with-sysdep-}" ;; 427 --without-sysdep-*) sysdeplist="$sysdeplist ${arg#--without-sysdep-}=no" ;; 428 --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; 429 --host=*|--target=*) target=${arg#*=} ;; 430 --build=*) build=${arg#*=} ;; 431 -* ) echo "$0: unknown option $arg" ;; 432 *=*) eval "${arg%%=*}=\${arg#*=}" ;; 433 *) target=$arg ;; 434 esac 435 done 436 437 # Add /usr in the default default case 438 if test -z "$prefix" ; then 439 if test "$libdir" = '$prefix/lib/$package' ; then 440 libdir=/usr/lib/$package 441 fi 442 if test "$includedir" = '$prefix/include' ; then 443 includedir=/usr/include 444 fi 445 if test "$sysdepdir" = '$prefix/lib/$package/sysdeps' ; then 446 sysdepdir=/usr/lib/$package/sysdeps 447 fi 448 fi 449 450 # Expand installation directories 451 stripdir prefix 452 for i in exec_prefix dynlibdir libdir includedir sysconfdir sysdepdir sysdepspre sproot ; do 453 eval tmp=\${$i} 454 eval $i=$tmp 455 stripdir $i 456 done 457 458 # Set slashpackage values 459 if $slashpackage ; then 460 home=${sproot}/package/${category}/${package}-${version} 461 exthome=${sproot}/package/${category}/${package} 462 sysdepdir=${home}/sysdeps 463 binprefix=${home}/command 464 extbinprefix=${exthome}/command 465 dynlibdir=${home}/library.so 466 libdir=${home}/library 467 includedir=${home}/include 468 if $dpathorig ; then 469 if echo $defaultpath | tr : '\n' | grep -q '^/command$' ; then : ; else 470 defaultpath="/command:$defaultpath" 471 fi 472 fi 473 fi 474 475 # Get usable temp filenames 476 i=0 477 set -C 478 while test "$i" -lt 50 ; do 479 i=$(($i+1)) 480 tmpc="./tmp-configure-$$-$PPID-$i.c" 481 tmpo="./tmp-configure-$$-$PPID-$i.o" 482 tmpe="./tmp-configure-$$-$PPID-$i.tmp" 483 tmps="./tmp-configure-$$-$PPID-$i.sysdeps" 484 2>|/dev/null > "$tmpc" && break 485 2>|/dev/null > "$tmpo" && break 486 2>|/dev/null > "$tmpe" && break 487 2>|/dev/null > "$tmps" && break 488 done 489 if test "$i" -gt 50 ; then 490 fail "$0: cannot create temporary files" 491 fi 492 set +C 493 trap 'rm -f "$tmpc" "$tmpo" "$tmpe" "$tmps"' EXIT ABRT INT QUIT TERM HUP 494 495 # Preprocess user-provided sysdeps 496 rm -f "$tmps" 497 if test -n "$sysdeplist" ; then 498 :> "$tmps" 499 for i in $sysdeplist ; do 500 k=${i%%=*} 501 echo ${i#*=} | sed 's/,/ /g' | 502 { 503 read v extras 504 if test -z "$k" || test -z "$v" ; then fail "$0: invalid user-provided sysdep: $i" ; fi 505 if test "$v" = "true" ; then v=yes 506 elif test "$v" = "false" ; then v=no 507 fi 508 if grep -q -e "^${k}: " "$tmps" ; then 509 grep -v -e "^${k}: " "$tmps" > "$tmpe" 510 mv -f "$tmpe" "$tmps" 511 fi 512 if test -n "$extras" ; then 513 echo "${k}: $v $extras" 514 else 515 echo "${k}: $v" 516 fi >> "$tmps" 517 } 518 done 519 fi 520 521 # Find a C compiler to use 522 if test -n "$target" && test x${build} != x${target} ; then 523 cross=${target}- 524 else 525 cross= 526 fi 527 echo "Checking for C compiler..." 528 trycc ${CC} 529 if test -n "$CC_AUTO" ; then 530 b=`basename "$CC"` 531 adjust_cross=false 532 if test "$b" != "$CC" ; then 533 adjust_cross=true 534 echo "$0: warning: compiler $CC is declared with its own path. If it's not accessible via PATH, you will need to pass AR, RANLIB and STRIP make variables to the make invocation." 1>&2 535 fi 536 if test -n "$cross" ; then 537 if test "$b" = "${b##$cross}" ; then 538 echo "$0: warning: compiler $CC is declared as a cross-compiler for target $target but does not start with prefix ${cross}" 1>&2 539 elif $adjust_cross ; then 540 cross=`dirname "$CC"`/"$cross" 541 fi 542 fi 543 fi 544 trycc ${cross}gcc 545 trycc ${cross}clang 546 trycc ${cross}cc 547 test -n "$CC_AUTO" || fail "$0: cannot find a C compiler" 548 echo " ... $CC_AUTO" 549 echo "Checking whether C compiler works... " 550 echo "typedef int x;" > "$tmpc" 551 if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -c -o "$tmpo" "$tmpc" 2>"$tmpe" ; then 552 echo " ... yes" 553 else 554 echo " ... no. Compiler output follows:" 555 cat < "$tmpe" 556 exit 1 557 fi 558 559 echo "Checking target system type..." 560 if test -z "$target" ; then 561 if test -n "$build" ; then 562 target=$build ; 563 else 564 target=$($CC_AUTO -dumpmachine 2>/dev/null) || target=unknown 565 fi 566 fi 567 echo " ... $target" 568 569 # Produce automatic compilation flags 570 if $allpic ; then 571 tryflag CPPFLAGS_AUTO -fPIC 572 fi 573 tryflag CFLAGS_AUTO -std=c99 574 tryflag CFLAGS -fomit-frame-pointer 575 tryflag CFLAGS_AUTO -fno-exceptions 576 tryflag CFLAGS_AUTO -fno-unwind-tables 577 tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables 578 tryflag CPPFLAGS_AUTO -Werror=implicit-function-declaration 579 tryflag CPPFLAGS_AUTO -Werror=implicit-int 580 tryflag CPPFLAGS_AUTO -Werror=pointer-sign 581 tryflag CPPFLAGS_AUTO -Werror=pointer-arith 582 tryflag CPPFLAGS_AUTO -Wno-unused-value 583 tryflag CPPFLAGS_AUTO -Wno-parentheses 584 tryflag CFLAGS_AUTO -ffunction-sections 585 tryflag CFLAGS_AUTO -fdata-sections 586 tryldflag LDFLAGS_AUTO -Wl,--as-needed 587 tryldflag LDFLAGS_AUTO -Wl,--sort-section=alignment 588 tryldflag LDFLAGS_AUTO -Wl,--sort-common 589 if $shared ; then 590 tryldflag LDFLAGS -Wl,--hash-style=both 591 fi 592 593 # And now, determine a big fat batch of sysdeps. 594 595 sysdeps=sysdeps.cfg 596 mkdir -p $sysdeps 597 echo "$target" > $sysdeps/target 598 :> "$sysdeps/sysdeps" 599 600 util_lib= 601 echo > $sysdeps/util.lib 602 603 echo 'Checking required linker flags for socket functions...' 604 socket_lib=`detectlibs lsock -lsocket -lnsl` || fail "$0: unable to determine required linker flags for socket functions" 605 if test -n "$socket_lib" ; then 606 echo " ... $socket_lib" 607 else 608 echo " ... none" 609 fi 610 echo "$socket_lib" > $sysdeps/socket.lib 611 612 trylibs clockrt sysclock 'clock_gettime()' -lrt 613 choose cl clockmon CLOCK_MONOTONIC $sysclock_lib 614 choose cl clockboot CLOCK_BOOTTIME $sysclock_lib 615 trylibs posixspawn spawn 'posix_spawn()' -lrt 616 trylibs timer timer 'timer_create()' -lrt 617 trylibs pthread pthread 'pthread support' -lpthread -lrt 618 619 tryendianness 620 trytypes 621 choose cl accept4 'accept4()' 622 choose c cmsgcloexec 'MSG_CMSG_CLOEXEC' 623 choose cl dirfd 'dirfd()' 624 choose cl fdopendir 'fdopendir()' 625 choose cl eventfd 'eventfd()' 626 choose cl flock 'flock()' 627 choose cl getpeereid 'getpeereid()' 628 choose cl sopeercred 'SO_PEERCRED' 629 choose cl getpeerucred 'getpeerucred()' 630 choose cl ipv6 'IPv6 support' $socket_lib 631 choose c msgdontwait 'MSG_DONTWAIT' 632 choose c ocloexec 'O_CLOEXEC' 633 choose c odirectory 'O_DIRECTORY' 634 choose cl openat 'openat()' 635 choose cl linkat 'linkat()' 636 choose cl memmem 'memmem()' 637 choose cl pipe2 'pipe2()' 638 choose cl ppoll 'ppoll()' 639 choose cl revoke 'revoke()' 640 choose cl sendfile 'sendfile()' 641 choose cl setgroups 'setgroups()' 642 choose cl settimeofday 'settimeofday()' 643 choose cl signalfd 'signalfd()' 644 choose cl splice 'splice()' 645 choose c statim 'st.st_atim' 646 choose c statimespec 'st.st_atimespec' 647 choose cl strcasestr 'strcasestr()' 648 choose c strnlen 'strnlen()' 649 choose c uint64t 'uint64_t' 650 choose cl waitid 'waitid()' 651 choose cl futimens 'futimens()' 652 choose cl futimes 'futimes()' 653 choose cl arc4random 'arc4random()' 654 choose cl arc4random_addrandom 'arc4random_addrandom()' 655 choose cl itimer 'setitimer()' 656 choose cl namespaces 'namespaces' 657 choose cl nsgetparent 'NS_GET_PARENT' 658 choose cl explicit_bzero 'explicit_bzero()' 659 choose cl getrandom 'getrandom()' 660 choose cl grndinsecure 'GRND_INSECURE' 661 choose cl chroot 'chroot()' 662 choose cl posixspawnsetsid 'POSIX_SPAWN_SETSID' $spawn_lib 663 choose cl posixspawnsetsidnp 'POSIX_SPAWN_SETSID_NP' $spawn_lib 664 choose cl posixspawnchdir 'posix_spawn_file_actions_addchdir()' $spawn_lib 665 choose cl posixspawnchdirnp 'posix_spawn_file_actions_addchdir_np()' $spawn_lib 666 667 # Here are the evil irreducible run-time sysdeps. 668 choose clr devurandom '/dev/urandom' 669 choose clr posixspawnearlyreturn 'posix_spawn() return early' $spawn_lib 670 671 672 # Finally, produce config.mak and config.h 673 674 rm -f "$tmps" 675 echo "Creating config.mak..." 676 cmdline=$(quote "$0") 677 for i ; do cmdline="$cmdline $(quote "$i")" ; done 678 exec 3>&1 1>config.mak 679 cat << EOF 680 # This file was generated by: 681 # $cmdline 682 # Any changes made here will be lost if configure is re-run. 683 684 target := $target 685 package := $package 686 prefix := $prefix 687 sysconfdir := $sysconfdir 688 sysdepdir := $sysdepdir 689 dynlibdir := $dynlibdir 690 libdir := $libdir 691 includedir := $includedir 692 sysdeps := $sysdeps 693 version := $version 694 sproot := $sproot 695 home := $home 696 exthome := ${exthome} 697 ipv6 := ${ipv6} 698 SPAWN_LIB := ${spawn_lib} 699 SOCKET_LIB := ${socket_lib} 700 SYSCLOCK_LIB := ${sysclock_lib} 701 TIMER_LIB := ${timer_lib} 702 UTIL_LIB := ${util_lib} 703 CC := ${CC_AUTO} 704 CPPFLAGS_AUTO := $CPPFLAGS_AUTO 705 CPPFLAGS := $CPPFLAGS $CPPFLAGS_POST 706 CFLAGS_AUTO := $CFLAGS_AUTO 707 CFLAGS := $CFLAGS $CFLAGS_POST 708 LDFLAGS_AUTO := $LDFLAGS_AUTO 709 LDFLAGS := $LDFLAGS $LDFLAGS_POST 710 LDFLAGS_NOSHARED := $LDFLAGS_NOSHARED 711 LDFLAGS_SHARED := $LDFLAGS_SHARED 712 CROSS_COMPILE := ${cross} 713 EOF 714 if test -n "$vpaths" ; then 715 echo "vpath lib%a$vpaths" 716 fi 717 if test -n "$vpathd" ; then 718 echo "vpath lib%.so$vpathd" 719 fi 720 721 if $static ; then 722 echo "STATIC_LIBS := libskarnet.a.xyzzy" 723 else 724 echo "STATIC_LIBS :=" 725 fi 726 if $shared ; then 727 echo "SHARED_LIBS := libskarnet.so.xyzzy" 728 else 729 echo "SHARED_LIBS :=" 730 fi 731 if $allpic ; then 732 echo "STATIC_LIBS_ARE_PIC := 1" 733 else 734 echo "STATIC_LIBS_ARE_PIC :=" 735 fi 736 737 exec 1>&3 3>&- 738 echo " ... done." 739 740 echo "Creating src/include/${package}/config.h..." 741 mkdir -p -m 0755 src/include/${package} 742 exec 3>&1 1> src/include/${package}/config.h 743 cat <<EOF 744 /* ISC license. */ 745 746 /* Generated by: $cmdline */ 747 748 #ifndef ${package_macro_name}_CONFIG_H 749 #define ${package_macro_name}_CONFIG_H 750 751 #define ${package_macro_name}_VERSION "$version" 752 #define ${package_macro_name}_DEFAULTPATH "$defaultpath" 753 #define ${package_macro_name}_ETC "$sysconfdir" 754 #define ${package_macro_name}_SPROOT "$sproot" 755 #define ${package_macro_name}_HOME "$home" 756 EOF 757 if $taiclock ; then 758 echo "#define ${package_macro_name}_FLAG_CLOCKISTAI" 759 else 760 echo "#undef ${package_macro_name}_FLAG_CLOCKISTAI" 761 fi 762 if $ipv6 ; then 763 echo "#define ${package_macro_name}_FLAG_WANTIPV6" 764 else 765 echo "#undef ${package_macro_name}_FLAG_WANTIPV6" 766 fi 767 if $select ; then 768 echo "#define ${package_macro_name}_FLAG_PREFERSELECT" 769 else 770 echo "#undef ${package_macro_name}_FLAG_PREFERSELECT" 771 fi 772 773 echo 774 echo "#endif" 775 exec 1>&3 3>&- 776 echo " ... done."