#! /bin/sh # # If these # comments don't work, trim them. Don't worry about any other # shell scripts, Configure will trim # comments from them for you. # # (If you are trying to port this package to a machine without sh, # I would suggest you have a look at the prototypical config_h.SH file # and edit it to reflect your system. Some packages may include samples # of config.h for certain machines, so you might look for one of those.) # # Yes, you may rip this off to use in other distribution packages. This # script belongs to the public domain and cannot be copyrighted. # # Note: this Configure script was generated automatically. Rather than # working with this copy of Configure, you may wish to get metaconfig. # The dist package (which contains metaconfig) is available via SVN: # svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist # $Id: Configure 12263 2006-11-08 04:08:53Z cbiere $ # # Generated on Wed Nov 8 02:19:11 CET 2006 [metaconfig 3.0 PL70] cat >c1$$ <c2$$ </dev/null` test "$me" || me=$0 ;; esac : Proper separator for the PATH environment variable p_=: : On OS/2 this directory should exist if this is not floppy only system ":-]" if test -d c:/. ; then if test -n "$OS2_SHELL"; then p_=\; PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` elif test -n "$DJGPP"; then case "X${MACHTYPE:-nonesuchmach}" in *cygwin) ;; *) p_=\; ;; esac fi fi : Proper PATH setting paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin" paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" paths="$paths /sbin /usr/sbin /usr/libexec" paths="$paths /system/gnu_library/bin" for p in $paths do case "$p_$PATH$p_" in *$p_$p$p_*) ;; *) test -d $p && PATH=$PATH$p_$p ;; esac done PATH=.$p_$PATH export PATH : shall we be using ksh? inksh='' needksh='' avoidksh='' newsh=/bin/ksh changesh='' if (PATH=.; alias -x) >/dev/null 2>&1; then inksh=true fi if test -f /hp-ux -a -f /bin/ksh; then needksh='to avoid sh bug in "here document" expansion' fi if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then if test X`/usr/bin/uname -v` = X4; then avoidksh="to avoid AIX 4's /bin/sh" newsh=/usr/bin/bsh fi fi if test -f /osf_boot -a -f /usr/sbin/setld; then if test X`/usr/bin/uname -s` = XOSF1; then avoidksh="to avoid Digital UNIX' ksh" newsh=/bin/sh unset BIN_SH fi fi case "$inksh/$needksh" in /[a-z]*) ENV='' changesh=true reason="$needksh" ;; esac case "$inksh/$avoidksh" in true/[a-z]*) changesh=true reason="$avoidksh" ;; esac case "$inksh/$needksh-$avoidksh-" in true/--) cat <&2 </dev/null 2>&1`; then shsharp=true spitshell=cat xcat=/bin/cat test -f $xcat$_exe || xcat=/usr/bin/cat if test ! -f $xcat$_exe; then for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do if test -f $p/cat$_exe; then xcat=$p/cat break fi done if test ! -f $xcat$_exe; then echo "Can't find cat anywhere!" exit 1 fi fi echo "#!$xcat" >sharp $eunicefix sharp chmod +x sharp ./sharp > today 2>/dev/null if test -s today; then sharpbang='#!' else echo "#! $xcat" > sharp $eunicefix sharp chmod +x sharp ./sharp > today 2>/dev/null if test -s today; then sharpbang='#! ' else sharpbang=': use ' fi fi else echo " " echo "Your $sh doesn't grok # comments--I will strip them later on." shsharp=false cd .. echo "exec grep -v '^[ ]*#'" >spitshell chmod +x spitshell $eunicefix spitshell spitshell=`pwd`/spitshell cd UU echo "I presume that if # doesn't work, #! won't work either!" sharpbang=': use ' fi rm -f sharp today : figure out how to guarantee sh startup case "$startsh" in '') startsh=${sharpbang}${sh} ;; *) esac cat >sharp < cmdline.opt <>cmdline.opt < cmdl.opt $arg EOC arg_exp=`cat cmdl.opt` args_exp="$args_exp$args_sep'$arg_exp'" argn=`expr $argn + 1` args_sep=' ' done rm -f cmdl.opt : produce awk script to parse command line options cat >options.awk <<'EOF' BEGIN { optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification len = length(optstr); for (i = 1; i <= len; i++) { c = substr(optstr, i, 1); if (i < len) a = substr(optstr, i + 1, 1); else a = ""; if (a == ":") { arg[c] = 1; i++; } opt[c] = 1; } } { expect = 0; str = $0; if (substr(str, 1, 1) != "-") { printf("'%s'\n", str); next; } len = length($0); for (i = 2; i <= len; i++) { c = substr(str, i, 1); if (!opt[c]) { printf("-%s\n", substr(str, i)); next; } printf("-%s\n", c); if (arg[c]) { if (i < len) printf("'%s'\n", substr(str, i + 1)); else expect = 1; next; } } } END { if (expect) print "?"; } EOF : process the command line options set X `for arg in "$@"; do echo "X$arg"; done | sed -e s/X// | awk -f options.awk` eval "set $*" shift rm -f options.awk : set up default values fastread='' reuseval=false config_sh='' alldone='' error='' silent='' extractsh='' override='' knowitall='' rm -f optdef.sh posthint.sh cat >optdef.sh <&2 error=true fi cd UU shift;; -h) shift; error=true;; -r) shift; reuseval=true;; -s) shift; silent=true; realsilent=true;; -E) shift; alldone=exit;; -K) shift; knowitall=true;; -O) shift; override=true;; -S) shift; silent=true; extractsh=true;; -D) shift case "$1" in *=) echo "$me: use '-U symbol=', not '-D symbol='." >&2 echo "$me: ignoring -D $1" >&2 ;; *=*) echo "$1" | \ sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; *) echo "$1='define'" >> optdef.sh;; esac shift ;; -U) shift case "$1" in *=) echo "$1" >> optdef.sh;; *=*) echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 echo "$me: ignoring -U $1" >&2 ;; *) echo "$1='undef'" >> optdef.sh;; esac shift ;; -A) shift xxx='' yyy="$1" zzz='' uuu=undef case "$yyy" in *=*) zzz=`echo "$yyy"|sed 's!=.*!!'` case "$zzz" in *:*) zzz='' ;; *) xxx=append zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` yyy=`echo "$yyy"|sed 's!=.*!!'` ;; esac ;; esac case "$xxx" in '') case "$yyy" in *:*) xxx=`echo "$yyy"|sed 's!:.*!!'` yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` zzz=`echo "$yyy"|sed 's!^[^=]*=!!'` yyy=`echo "$yyy"|sed 's!=.*!!'` ;; *) xxx=`echo "$yyy"|sed 's!:.*!!'` yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;; esac ;; esac case "$xxx" in append) echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;; clear) echo "$yyy=''" >> posthint.sh ;; define) case "$zzz" in '') zzz=define ;; esac echo "$yyy='$zzz'" >> posthint.sh ;; eval) echo "eval \"$yyy=$zzz\"" >> posthint.sh ;; prepend) echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;; undef) case "$zzz" in '') zzz="$uuu" ;; esac echo "$yyy=$zzz" >> posthint.sh ;; *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;; esac shift ;; -V) echo "$me generated by metaconfig 3.0 PL70." >&2 exit 0;; --) break;; -*) echo "$me: unknown option $1" >&2; shift; error=true;; *) break;; esac done case "$error" in true) cat >&2 <&1 case "$silent" in true) exec 1>/dev/null;; esac : run the defines and the undefines, if any, but leave the file out there... touch optdef.sh . ./optdef.sh : create the posthint manipulation script and leave the file out there... touch posthint.sh : set package name package='gtk-gnutella' first=`echo $package | sed -e 's/^\(.\).*/\1/'` last=`echo $package | sed -e 's/^.\(.*\)/\1/'` case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; esac : script used to emulate mkdir -p cat >mkdirp <>mkdirp <<'EOS' name=$1; create=""; while test $name; do if test ! -d "$name"; then create="$name $create" name=`echo $name | sed -e "s|^[^/]*$||"` name=`echo $name | sed -e "s|\(.*\)/.*|\1|"` else name="" fi done for file in $create; do mkdir $file done EOS chmod +x mkdirp $eunicefix mkdirp : Some greps do not return status, grrr. echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then contains=contains elif grep grimblepritz grimble >/dev/null 2>&1 ; then contains=grep else contains=contains fi rm -f grimble : the following should work in any shell case "$contains" in contains*) echo " " echo "AGH! Grep doesn't return a status. Attempting remedial action." cat >contains <<'EOSS' grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp EOSS chmod +x contains esac : Find the path to the source tree case "$src" in '') case "$0" in */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'` ;; *) src='.';; esac;; esac case "$src" in '') src=/ rsrc=/ ;; /*) rsrc="$src";; *) rsrc="../$src";; esac if test -f $rsrc/Configure && \ $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1 then : found it, so we are ok. else rsrc='' for src in . .. ../.. ../../.. ../../../..; do if test -f ../$src/Configure && \ $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1 then rsrc=../$src break fi done fi case "$rsrc" in '') cat <&4 Sorry, I can't seem to locate the source dir for $package. Please start Configure with an explicit path -- i.e. /some/path/Configure. EOM exit 1 ;; ../.) rsrc='..';; *) echo " " echo "Sources for $package found in \"$src\"." >&4 ;; esac : script used to extract .SH files with variable substitutions cat >extract <>extract <<'EOS' echo "Doing variable substitutions on .SH files..." if test -f "$SRC/MANIFEST"; then set x `awk '{print $1}' <$SRC/MANIFEST | grep '\.SH'` else echo "(Looking for .SH files under the source directory.)" set x `(cd "$SRC"; find . -name "*.SH" -print)` fi shift case $# in 0) set x `(cd "$SRC"; echo *.SH)`; shift;; esac if test ! -f "$SRC/$1"; then shift fi for file in $*; do case "$SRC" in ".") case "$file" in */*) dir=`expr X$file : 'X\(.*\)/'` file=`expr X$file : 'X.*/\(.*\)'` (cd $dir && . ./$file) ;; *) . ./$file ;; esac ;; *) case "$file" in */*) dir=`expr X$file : 'X\(.*\)/'` file=`expr X$file : 'X.*/\(.*\)'` ./mkdirp $dir sh <"$SRC/$dir/$file" ;; *) sh <"$SRC/$file" ;; esac ;; esac done if test -f "$SRC/config_h.SH"; then if test ! -f config.h; then sh <"$SRC/config_h.SH" fi fi EOS : extract files and exit if asked to do so case "$extractsh" in true) case "$realsilent" in true) ;; *) exec 1>&4;; esac case "$config_sh" in '') config_sh='config.sh';; esac echo " " echo "Fetching answers from $config_sh..." cd .. . $config_sh test "$override" && . ./optdef.sh echo " " . UU/extract rm -rf UU echo "Extraction done." exit 0 ;; esac : Eunice requires " " instead of "", can you believe it echo " " : Here we go... echo "Beginning of configuration questions for $package." trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 : first determine how to suppress newline on echo command echo " " echo "Checking echo to see how to suppress newlines..." (echo "hi there\c" ; echo " ") >.echotmp if $contains c .echotmp >/dev/null 2>&1 ; then echo "...using -n." n='-n' c='' else cat <<'EOM' ...using \c EOM n='' c='\c' fi echo $n "The star should be here-->$c" echo '*' rm -f .echotmp : Now test for existence of everything in MANIFEST echo " " if test -f "$rsrc/MANIFEST"; then echo "First let's make sure your kit is complete. Checking..." >&4 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \ (split -l 50 2>/dev/null || split -50) rm -f missing tmppwd=`pwd` for filelist in x??; do (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \ >/dev/null 2>>"$tmppwd/missing") done if test -s missing; then cat missing >&4 cat >&4 <<'EOM' THIS PACKAGE SEEMS TO BE INCOMPLETE. You have the option of continuing the configuration process, despite the distinct possibility that your kit is damaged, by typing 'y'es. If you do, don't blame me if something goes wrong. I advise you to type 'n'o and contact the author (Raphael_Manfredi@pobox.com). EOM echo $n "Continue? [n] $c" >&4 read ans case "$ans" in y*) echo "Continuing..." >&4 rm -f missing ;; *) echo "ABORTING..." >&4 kill $$ ;; esac else echo "Looks good..." fi else echo "There is no MANIFEST file. I hope your kit is complete !" fi rm -f missing x?? : Find the appropriate value for a newline for tr echo " " if test -n "$DJGPP"; then trnl='\012' fi if test X"$trnl" = X; then case "`echo foo | tr '\n' x 2>/dev/null`" in foox) trnl='\n' ;; esac fi if test X"$trnl" = X; then case "`echo foo | tr '\012' x 2>/dev/null`" in foox) trnl='\012' ;; esac fi if test X"$trnl" = X; then case "`echo foo | tr '\r\n' xy 2>/dev/null`" in fooxy) trnl='\n\r' ;; esac fi if test X"$trnl" = X; then cat <&2 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'. EOM exit 1 else echo "We'll use '$trnl' to transliterate a newline." fi : compute the number of columns on the terminal for proper question formatting case "$COLUMNS" in '') COLUMNS='80';; esac : set up the echo used in my read myecho="case \"\$xxxm\" in '') echo $n \"\$rp $c\" >&4;; *) case \"\$rp\" in '') echo $n \"[\$xxxm] $c\";; *) if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then echo \"\$rp\" >&4 echo $n \"[\$xxxm] $c\" >&4 else echo $n \"\$rp [\$xxxm] $c\" >&4 fi ;; esac;; esac" : now set up to do reads with possible shell escape and default assignment cat <myread $startsh xxxm=\$dflt $myecho ans='!' case "\$fastread" in yes) case "\$dflt" in '') ;; *) ans=''; case "\$silent-\$rp" in true-) ;; *) echo " " >&4;; esac;; esac;; *) case "\$silent" in true) case "\$rp" in '') ans='';; esac;; esac;; esac while expr "X\$ans" : "X!" >/dev/null; do read answ set x \$xxxm shift aok=''; eval "ans=\\"\$answ\\"" && aok=y case "\$answ" in "!") sh 1>&4 echo " " $myecho ;; !*) set x \`expr "X\$ans" : "X!\(.*\)\$"\` shift sh 1>&4 -c "\$*" echo " " $myecho ;; "\$ans") case "\$ans" in \\&*) set x \`expr "X\$ans" : "X&\(.*\)\$"\` shift case "\$1" in -d) fastread=yes echo "(OK, I'll run with -d after this question.)" >&4 ;; -*) echo "*** Sorry, \$1 not supported yet." >&4 ;; esac $myecho ans=! ;; esac;; *) case "\$aok" in y) echo "*** Substitution done -- please confirm." xxxm="\$ans" ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\` xxxm="\$ans" ans=! ;; *) echo "*** Error -- try again." ans=! ;; esac $myecho ;; esac case "\$ans\$xxxm\$nostick" in '') ans=! $myecho ;; esac done case "\$ans" in '') ans="\$xxxm";; esac EOSC : create .config dir to save info across Configure sessions test -d ../.config || mkdir ../.config cat >../.config/README </dev/null` case "$user" in '') user=`whoami 2>&1`;; esac if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then firsttime=false echo " " rp='Would you like to see the instructions?' dflt=n . ./myread case "$ans" in [yY]*) ;; *) needman=false;; esac fi if $needman; then cat <>../.config/instruct;; esac fi : find out where common programs are echo " " echo "Locating common programs..." >&4 cat <loc $startsh case \$# in 0) exit 1;; esac thing=\$1 shift dflt=\$1 shift for dir in \$*; do case "\$thing" in .) if test -d \$dir/\$thing; then echo \$dir exit 0 fi ;; *) for thisthing in \$dir/\$thing; do : just loop through to pick last item done if test -f \$thisthing; then echo \$thisthing exit 0 elif test -f \$dir/\$thing.exe; then : on Eunice apparently echo \$dir/\$thing exit 0 fi ;; esac done echo \$dflt exit 1 EOSC chmod +x loc $eunicefix loc loclist=" awk cat chgrp chmod chown cp echo expr grep make mkdir mv rm sed sort touch tr uniq " trylist=" ar bison byacc cpp date egrep gmsgfmt ln msgfmt msgmerge nm nroff test uname xgettext " pth=`echo $PATH | sed -e "s/$p_/ /g"` pth="$pth /lib /usr/lib" for file in $loclist; do eval xxx=\$$file case "$xxx" in /*|?:[\\/]*) if test -f "$xxx"; then : ok else echo "WARNING: no $xxx -- ignoring your setting for $file." >&4 xxx=`./loc $file $file $pth` fi ;; '') xxx=`./loc $file $file $pth`;; *) xxx=`./loc $xxx $xxx $pth`;; esac eval $file=$xxx eval _$file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; ?:[\\/]*) echo $file is in $xxx. ;; *) echo "I don't know where '$file' is, and my life depends on it." >&4 echo "Go find a free implementation or fix your PATH setting!" >&4 exit 1 ;; esac done echo " " echo "Don't worry if any of the following aren't found..." say=offhand for file in $trylist; do eval xxx=\$$file case "$xxx" in /*|?:[\\/]*) if test -f "$xxx"; then : ok else echo "WARNING: no $xxx -- ignoring your setting for $file." >&4 xxx=`./loc $file $file $pth` fi ;; '') xxx=`./loc $file $file $pth`;; *) xxx=`./loc $xxx $xxx $pth`;; esac eval $file=$xxx eval _$file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; ?:[\\/]*) echo $file is in $xxx. ;; *) echo "I don't see $file out there, $say." say=either ;; esac done case "$egrep" in egrep) echo "Substituting grep for egrep." egrep=$grep ;; esac case "$ln" in ln) echo "Substituting cp for ln." ln=$cp ;; esac case "$gmsgfmt" in gmsgfmt) echo "Substituting msgfmt for gmsgfmt." gmsgfmt=$msgfmt _gmsgfmt=$_msgfmt ;; *) if $gmsgfmt --statistics /dev/null >/dev/null 2>&1 && (if $gmsgfmt --statistics /dev/null 2>&1 >/dev/null | \ grep usage >/dev/null; then exit 0; else exit 1; fi) then echo "Your $gmsgfmt is not GNU msgfmt; substituting msgfmt." gmsgfmt=$msgfmt _gmsgfmt=$_msgfmt fi ;; esac case "$xgettext" in xgettext) xgettext=":" _xgettext=":" ;; *) if $xgettext --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && (if $xgettext --omit-header --copyright-holder= \ /dev/null 2>&1 >/dev/null | \ grep usage >/dev/null; then exit 0; else exit 1; fi) then echo "Your $xgettext is not GNU xgettext; ignoring it." xgettext=":" _xgettext=":" elif $xgettext --from-code=UTF-8 /dev/null >/dev/null 2>&1; then : ok else echo "Your $xgettext does not support --from-code; ignoring it." xgettext=":" _xgettext=":" fi ;; esac case "$test" in test) echo "Hopefully test is built into your sh." ;; *) if `sh -c "PATH= test true" >/dev/null 2>&1`; then echo "Using the test built into your sh." test=test _test=test fi ;; esac case "$echo" in echo) echo "Hopefully echo is built into your sh." ;; '') ;; *) echo " " echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 $echo $n "hi there$c" >foo1 echo $n "hi there$c" >foo2 if cmp foo1 foo2 >/dev/null 2>&1; then echo "They are compatible. In fact, they may be identical." else case "$n" in '-n') n='' c='\c';; *) n='-n' c='';; esac cat <$c" $echo "*" fi $rm -f foo1 foo2 ;; esac : script used to emit important warnings cat >warn <msg else cat >msg fi echo "*** WARNING:" >&4 sed -e 's/^/*** /' &4 echo "*** " >&4 cat msg >>config.msg echo " " >>config.msg rm -f msg EOS chmod +x warn $eunicefix warn : generate the trygcc script for later perusal cat <trygcc $startsh EOS cat <<'EOSC' >>trygcc case "$cc" in '') ;; *) $rm -f try try.* $cat >try.c <&4 despair=yes trygcc=yes case "$cc" in *gcc*) trygcc=no ;; esac case "`$cc -v -c try.c 2>&1`" in *gcc*) trygcc=no ;; esac if $test X"$trygcc" = Xyes; then if gcc -o try -c try.c; then echo " " echo "You seem to have a working gcc, though." >&4 rp="Would you like to use it?" dflt=y if $test -f myread; then . ./myread else if $test -f UU/myread; then . ./UU/myread else echo "Cannot find myread, sorry. Aborting." >&2 exit 1 fi fi case "$ans" in [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no; $cat *.cbu >checktmp 2>/dev/null if $contains ccflags checktmp >/dev/null; then ./warn <checkcc $startsh EOS cat <<'EOSC' >>checkcc case "$cc" in '') ;; *) $rm -f try try.* $cat >try.c <&4 fi $cat >&4 < /dev/null 2>&1 && $test -f sym; then echo "Symbolic links are supported." >&4 lns="$ln -s" else echo "Symbolic links are NOT supported." >&4 lns="$ln" fi $rm -f blurfl sym : determine whether symbolic links are supported echo " " case "$lns" in *"ln"*" -s") echo "Checking how to test for symbolic links..." >&4 $lns blurfl sym if $test "X$issymlink" = X; then case "$newsh" in '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;; *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;; esac if test $? = 0; then issymlink="test -h" else echo "Your builtin 'test -h' may be broken." >&4 case "$test" in /*) ;; *) pth=`echo $PATH | sed -e "s/$p_/ /g"` for p in $pth do if test -f "$p/$test"; then test="$p/$test" break fi done ;; esac case "$test" in /*) echo "Trying external '$test -h'." >&4 issymlink="$test -h" if $test ! -h sym >/dev/null 2>&1; then echo "External '$test -h' is broken, too." >&4 issymlink='' fi ;; *) issymlink='' ;; esac fi fi if $test "X$issymlink" = X; then if $test -L sym 2>/dev/null; then issymlink="$test -L" echo "The builtin '$test -L' worked." >&4 fi fi if $test "X$issymlink" != X; then echo "You can test for symbolic links with '$issymlink'." >&4 else echo "I do not know how you can test for symbolic links." >&4 fi $rm -f blurfl sym ;; *) echo "No symbolic links, so not testing for their testing..." >&4 ;; esac : define absolute package source directory case "$src" in /*) pkgsrc=$src;; *) pkgsrc=`cd $rsrc; pwd`;; esac : Duplicate the tree with symbolic links if -Dmksymlinks was supplied case "$mksymlinks" in $define|true|[yY]*) echo " " case "$src" in ''|'.') echo "Cannot create symlinks in the original directory." >&4 exit 1 ;; *) case "$lns:$issymlink" in *"ln"*" -s:"*"test -"?) echo "Creating the symbolic links..." >&4 echo "(First creating the subdirectories...)" >&4 cd .. awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | \ sort -u | while true do read dir test -z "$dir" && break ./UU/mkdirp $dir 2>/dev/null if test -d $dir; then : ok else echo "Failed to create '$dir'. Aborting." >&4 exit 1 fi done echo "(Now creating the symlinks...)" >&4 awk '{print $1}' $src/MANIFEST | while true; do read filename test -z "$filename" && break if test -f $filename; then if $issymlink $filename; then rm -f $filename fi fi if test -f $filename; then echo "$filename already exists, not symlinking." else ln -s $pkgsrc/$filename $filename fi done echo "(Checking current directory...)" >&4 cd UU awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \ (split -l 50 2>/dev/null || split -50) rm -f missing tmppwd=`pwd` for filelist in x??; do (cd ..; ls `cat "$tmppwd/$filelist"` \ >/dev/null 2>>"$tmppwd/missing") done if test -s missing; then echo "Failed duplication of source tree. Aborting." >&4 exit 1 fi ;; *) echo "(I cannot figure out how to do symbolic links, ignoring!)" >&4 ;; esac ;; esac ;; esac : see whether [:lower:] and [:upper:] are supported character classes echo " " case "`echo AbyZ | LC_ALL=C $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in ABYZ) echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 up='[:upper:]' low='[:lower:]' ;; *) # There is a discontinuity in EBCDIC between 'I' and 'J' # (0xc9 and 0xd1), therefore that is a nice testing point. if test "X$up" = X -o "X$low" = X; then case "`echo IJ | LC_ALL=C $tr '[I-J]' '[i-j]' 2>/dev/null`" in ij) up='[A-Z]' low='[a-z]' ;; esac fi if test "X$up" = X -o "X$low" = X; then case "`echo IJ | LC_ALL=C $tr I-J i-j 2>/dev/null`" in ij) up='A-Z' low='a-z' ;; esac fi if test "X$up" = X -o "X$low" = X; then case "`echo IJ | od -x 2>/dev/null`" in *C9D1*|*c9d1*) echo "Hey, this might be EBCDIC." >&4 if test "X$up" = X -o "X$low" = X; then case "`echo IJ | \ LC_ALL=C $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in ij) up='[A-IJ-RS-Z]' low='[a-ij-rs-z]' ;; esac fi if test "X$up" = X -o "X$low" = X; then case "`echo IJ | LC_ALL=C $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in ij) up='A-IJ-RS-Z' low='a-ij-rs-z' ;; esac fi ;; esac fi esac case "`echo IJ | LC_ALL=C $tr \"$up\" \"$low\" 2>/dev/null`" in ij) echo "Using $up and $low to convert case." >&4 ;; *) echo "I don't know how to translate letters from upper to lower case." >&4 echo "Your tr is not acting any way I know of." >&4 exit 1 ;; esac : set up the translation script tr, must be called with ./tr of course cat >tr <&4 exit 1 ;; esac : Determine the name of the machine myuname=`$uname -a 2>/dev/null` $test -z "$myuname" && myuname=`hostname 2>/dev/null` myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` newmyuname="$myuname" $test -f "$uname$_exe" && has_uname=y : Guessing of the OS name -- half the following guesses are probably wrong... : If you have better tests or hints, please send them to the metaconfig : authors and to Raphael_Manfredi@pobox.com $test -f /irix && osname=irix $test -f /xenix && osname=sco_xenix $test -f /dynix && osname=dynix $test -f /dnix && osname=dnix $test -f /lynx.os && osname=lynxos $test -f /unicos && osname=unicos && osvers=`$uname -r` $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r` $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` $test -f /bin/mips && /bin/mips && osname=mips $test -d /NextApps && set X `hostinfo | $grep 'NeXT Mach.*:' | \ $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 $test -d /usr/apollo/bin && osname=apollo $test -f /etc/saf/_sactab && osname=svr4 $test -d /usr/include/minix && osname=minix $test -f /system/gnu_library/bin/ar.pm && osname=vos if $test -d /MachTen -o -d /MachTen_Folder; then osname=machten if $test -x /sbin/version; then osvers=`/sbin/version | $awk '{print $2}' | $sed -e 's/[A-Za-z]$//'` elif $test -x /usr/etc/version; then osvers=`/usr/etc/version | $awk '{print $2}' | $sed -e 's/[A-Za-z]$//'` else osvers="$2.$3" fi fi $test -f /sys/posix.dll && $test -f /usr/bin/what && set X `/usr/bin/what /sys/posix.dll` && $test "$3" = UWIN && osname=uwin && osvers="$5" if $test "X$has_uname" != X; then set X $myuname shift case "$5" in fps*) osname=fps ;; mips*) case "$4" in umips) osname=umips ;; *) osname=mips ;; esac;; [23]100) osname=mips ;; next*) osname=next ;; i386*) tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'` if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then osname='sco' osvers=$tmp elif $test -f /etc/kconfig; then osname=isc if $test "$lns" = "$ln -s"; then osvers=4 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then osvers=3 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then osvers=2 fi fi tmp='' ;; pc*) if $test -n "$DJGPP"; then osname=dos osvers=djgpp fi ;; esac case "$1" in aix) osname=aix tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` case "$tmp" in 'not found') osvers="$4"."$3" ;; '<3240'|'<>3240') osvers=3.2.0 ;; '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; '=3250'|'>3250') osvers=3.2.5 ;; *) osvers=$tmp;; esac ;; bsd386) osname=bsd386 osvers=`$uname -r` ;; cygwin*) osname=cygwin osvers="$3" ;; *dc.osx) osname=dcosx osvers="$3" ;; dnix) osname=dnix osvers="$3" ;; domainos) osname=apollo osvers="$3" ;; dgux) osname=dgux osvers="$3" ;; dynixptx*) osname=dynixptx osvers=`echo "$4"|sed 's/^v//'` ;; freebsd) osname=freebsd osvers="$3" ;; genix) osname=genix ;; hp*) osname=hpux osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'` ;; irix*) osname=irix case "$3" in 4*) osvers=4 ;; 5*) osvers=5 ;; *) osvers="$3" ;; esac ;; linux) osname=linux case "$3" in *) osvers="$3" ;; esac ;; MiNT) osname=mint ;; netbsd*) osname=netbsd osvers="$3" ;; news-os) osvers="$3" case "$3" in 4*) osname=newsos4 ;; *) osname=newsos ;; esac ;; next*) osname=next ;; nonstop-ux) osname=nonstopux ;; openbsd) osname=openbsd osvers="$3" ;; POSIX-BC | posix-bc ) osname=posix-bc osvers="$3" ;; powerux | power_ux | powermax_os | powermaxos | \ powerunix | power_unix) osname=powerux osvers="$3" ;; qnx) osname=qnx osvers="$4" ;; solaris) osname=solaris case "$3" in 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; *) osvers="$3" ;; esac ;; sunos) osname=sunos case "$3" in 5*) osname=solaris osvers=`echo $3 | $sed 's/^5/2/g'` ;; *) osvers="$3" ;; esac ;; titanos) osname=titanos case "$3" in 1*) osvers=1 ;; 2*) osvers=2 ;; 3*) osvers=3 ;; 4*) osvers=4 ;; *) osvers="$3" ;; esac ;; ultrix) osname=ultrix osvers="$3" ;; osf1|mls+) case "$5" in alpha) osname=dec_osf osvers=`sizer -v | awk '{print $3}' | \ ./tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'` case "$osvers" in [1-9].[0-9]*) ;; *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;; esac ;; hp*) osname=hp_osf1 ;; mips) osname=mips_osf1 ;; esac ;; unixware) osname=svr5 osvers="$4" ;; uts) osname=uts osvers="$3" ;; vos) osvers="$3" ;; $2) case "$osname" in *isc*) ;; *freebsd*) ;; svr*) : svr4.x or possibly later case "svr$3" in ${osname}*) osname=svr$3 osvers=$4 ;; esac case "$osname" in svr4.0) : Check for ESIX if $test -f /stand/boot ; then eval `$grep '^INITPROG=[a-z/0-9]*$' /stand/boot` if $test -n "$INITPROG" -a -f "$INITPROG"; then isesix=`strings -a $INITPROG | \ $grep 'ESIX SYSTEM V/386 Release 4.0'` if $test -n "$isesix"; then osname=esix4 fi fi fi ;; esac ;; *) if $test -f /etc/systemid; then osname=sco set `echo $3 | $sed 's/\./ /g'` $4 if $test -f $src/hints/sco_$1_$2_$3.sh; then osvers=$1.$2.$3 elif $test -f $src/hints/sco_$1_$2.sh; then osvers=$1.$2 elif $test -f $src/hints/sco_$1.sh; then osvers=$1 fi else case "$osname" in '') : Still unknown. Probably a generic Sys V. osname="sysv" osvers="$3" ;; esac fi ;; esac ;; *) case "$osname" in '') : Still unknown. Probably a generic BSD. osname="$1" osvers="$3" ;; esac ;; esac else if $test -f /vmunix -a -f $src/hints/news_os.sh; then (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1 if $contains news-os UU/kernel.what >/dev/null 2>&1; then osname=news_os fi $rm -f UU/kernel.what elif $test -d c:/.; then set X $myuname osname=os2 osvers="$5" fi fi : Try to determine whether config.sh was made on this system case "$config_sh" in '') dflt=n case "$knowitall" in '') if test -f ../config.sh; then if $contains myuname= ../config.sh >/dev/null 2>&1; then eval "`$grep myuname= ../config.sh`" fi if test "X$myuname" = "X$newmyuname"; then dflt=y fi fi ;; *) dflt=y;; esac : Get old answers from config file if it was generated on the same system hint=default if $test -f ../config.sh; then echo " " rp="I see a config.sh file. Shall I use it to set the defaults?" . ./myread case "$ans" in n*|N*) echo "OK, I'll ignore it." mv ../config.sh ../config.sh.old myuname="$newmyuname" ;; *) echo "Fetching default answers from your old config.sh file..." >&4 tmp_n="$n" tmp_c="$c" tmp_sh="$sh" . ../config.sh cp ../config.sh . n="$tmp_n" c="$tmp_c" hint=previous ;; esac fi ;; *) echo " " echo "Fetching default answers from $config_sh..." >&4 tmp_n="$n" tmp_c="$c" tmp_sh="$sh" cd .. cp $config_sh config.sh 2>/dev/null chmod +w config.sh . ./config.sh cd UU cp ../config.sh . n="$tmp_n" c="$tmp_c" hint=previous ;; esac case "$sh" in '') sh="$tmp_sh" ;; esac $test "$override" && . ./optdef.sh : Restore computed paths for file in $loclist $trylist; do eval $file="\$_$file" done . ./checkcc case "$targetarch" in '') ;; *) hostarch=$osname osname=`echo $targetarch|sed 's,^[^-]*-,,'` osvers='' ;; esac : Process their -A options . ./posthint.sh : Ask them to confirm the OS name cat << EOM Configure uses the operating system name and version to set some defaults. The default value is probably right if the name rings a bell. Otherwise, since spelling matters for me, either accept the default or answer "none" to leave it blank. EOM case "$osname" in ''|' ') case "$hintfile" in ''|' '|none) dflt=none ;; *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; esac ;; *) dflt="$osname" ;; esac rp="Operating system name?" . ./myread case "$ans" in none) osname='' ;; *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; esac echo " " case "$osvers" in ''|' ') case "$hintfile" in ''|' '|none) dflt=none ;; *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` case "$dflt" in ''|' ') dflt=none ;; esac ;; esac ;; *) dflt="$osvers" ;; esac rp="Operating system version?" . ./myread case "$ans" in none) osvers='' ;; *) osvers="$ans" ;; esac : who configured the system cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1` cf_by=`(logname) 2>/dev/null` case "$cf_by" in "") cf_by=`(whoami) 2>/dev/null` case "$cf_by" in "") cf_by=unknown ;; esac ;; esac : set up the script used to warn in case of inconsistency cat <whoa $startsh EOS cat <<'EOSC' >>whoa dflt=y echo " " echo "*** WHOA THERE!!! ***" >&4 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 rp=" Keep the $hint value?" . ./myread case "$ans" in y) td=$was; tu=$was;; esac EOSC : function used to set '$1' to '$val' setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; case "$val$was" in $define$undef) . ./whoa; eval "$var=\$td";; $undef$define) . ./whoa; eval "$var=\$tu";; *) eval "$var=$val";; esac' : determine whether this is an official build case "$official" in true) dflt=y;; *) dflt=n;; esac $cat <filexp <&2 exit 1 fi case "\$1" in */*) echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` ;; *) echo \$dir ;; esac fi ;; *) echo \$1 ;; esac EOSS chmod +x filexp $eunicefix filexp : now set up to get a file name cat <getfile $startsh EOS cat <<'EOSC' >>getfile tilde='' fullpath='' already='' skip='' none_ok='' exp_file='' nopath_ok='' orig_rp="$rp" orig_dflt="$dflt" case "$gfpth" in '') gfpth='.' ;; esac case "$fn" in *\(*) : getfile will accept an answer from the comma-separated list : enclosed in parentheses even if it does not meet other criteria. expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok fn=`echo $fn | sed 's/(.*)//'` ;; esac case "$fn" in *:*) loc_file=`expr $fn : '.*:\(.*\)'` fn=`expr $fn : '\(.*\):.*'` ;; esac case "$fn" in *~*) tilde=true;; esac case "$fn" in */*) fullpath=true;; esac case "$fn" in *+*) skip=true;; esac case "$fn" in *n*) none_ok=true;; esac case "$fn" in *e*) exp_file=true;; esac case "$fn" in *p*) nopath_ok=true;; esac case "$fn" in *f*) type='File';; *d*) type='Directory';; *l*) type='Locate';; esac what="$type" case "$what" in Locate) what='File';; esac case "$exp_file" in '') case "$d_portable" in "$define") ;; *) exp_file=true;; esac ;; esac cd .. while test "$type"; do redo='' rp="$orig_rp" dflt="$orig_dflt" case "$tilde" in true) rp="$rp (~name ok)";; esac . UU/myread if test -f UU/getfile.ok && \ $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 then value="$ans" ansexp="$ans" break fi case "$ans" in none) value='' ansexp='' case "$none_ok" in true) type='';; esac ;; *) case "$tilde" in '') value="$ans" ansexp="$ans";; *) value=`UU/filexp $ans` case $? in 0) if test "$ans" != "$value"; then echo "(That expands to $value on this system.)" fi ;; *) value="$ans";; esac ansexp="$value" case "$exp_file" in '') value="$ans";; esac ;; esac case "$fullpath" in true) case "$ansexp" in /*) value="$ansexp" ;; [a-zA-Z]:/*) value="$ansexp" ;; *) redo=true case "$already" in true) echo "I shall only accept a full path name, as in /bin/ls." >&4 echo "Use a ! shell escape if you wish to check pathnames." >&4 ;; *) echo "Please give a full path name, starting with slash." >&4 case "$tilde" in true) echo "Note that using ~name is ok provided it expands well." >&4 already=true ;; esac esac ;; esac ;; esac case "$redo" in '') case "$type" in File) for fp in $gfpth; do if test "X$fp" = X.; then pf="$ansexp" else pf="$fp/$ansexp" fi if test -f "$pf"; then type='' elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1 then echo "($value is not a plain file, but that's ok.)" type='' fi if test X"$type" = X; then value="$pf" break fi done ;; Directory) for fp in $gfpth; do if test "X$fp" = X.; then dir="$ans" direxp="$ansexp" else dir="$fp/$ansexp" direxp="$fp/$ansexp" fi if test -d "$direxp"; then type='' value="$dir" break fi done ;; Locate) if test -d "$ansexp"; then echo "(Looking for $loc_file in directory $value.)" value="$value/$loc_file" ansexp="$ansexp/$loc_file" fi if test -f "$ansexp"; then type='' fi case "$nopath_ok" in true) case "$value" in */*) ;; *) echo "Assuming $value will be in people's path." type='' ;; esac ;; esac ;; esac case "$skip" in true) type=''; esac case "$type" in '') ;; *) if test "$fastread" = yes; then dflt=y else dflt=n fi rp="$what $value doesn't exist. Use that name anyway?" . UU/myread dflt='' case "$ans" in y*) type='';; *) echo " ";; esac ;; esac ;; esac ;; esac done cd UU ans="$value" rp="$orig_rp" dflt="$orig_dflt" rm -f getfile.ok test "X$gfpthkeep" != Xy && gfpth="" EOSC : determine root of directory hierarchy where package will be installed. case "$prefix" in '') dflt=`./loc . /usr/local /usr/local /local /opt /usr` ;; *) dflt="$prefix" ;; esac $cat <&4 else echo "AFS does not seem to be running..." >&4 fi : determine where public executables go echo " " set dflt bin bin eval $prefixit fn=d~ rp='Pathname where the public executables will reside?' . ./getfile if $test "X$ansexp" != "X$binexp"; then installbin='' fi bin="$ans" binexp="$ansexp" if $afs; then $cat <&4 else echo "Could not find manual pages in source form." >&4 fi : set the prefixup variable, to restore leading tilda escape prefixup='case "$prefixexp" in "$prefix") ;; *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; esac' : determine where manual pages go set mansrc mansrc none eval $prefixit $cat <bsd echo exit 1 >usg echo exit 1 >v7 echo exit 1 >osf1 echo exit 1 >eunice echo exit 1 >xenix echo exit 1 >venix echo exit 1 >os2 echo exit 1 >gnu echo exit 1 >linux echo exit 1 >dos d_bsd="$undef" d_linux="$undef" d_dos="$undef" d_os2="$undef" $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 then echo "Looks kind of like an OSF/1 system, but we'll see..." echo exit 0 >osf1 elif test `echo abc | $tr a-z A-Z` = Abc ; then xxx=`./loc addbib blurfl $pth` if $test -f $xxx; then echo "Looks kind of like a USG system with BSD features, but we'll see..." echo exit 0 >bsd echo exit 0 >usg else if $contains SIGTSTP foo >/dev/null 2>&1 ; then echo "Looks kind of like an extended USG system, but we'll see..." else echo "Looks kind of like a USG system, but we'll see..." fi echo exit 0 >usg fi elif $contains SIGTSTP foo >/dev/null 2>&1 ; then echo "Looks kind of like a BSD system, but we'll see..." d_bsd="$define" echo exit 0 >bsd elif $rm --version 2>/dev/null >foo; $contains "Free Software Foundation" foo >/dev/null then xxx=`uname` echo exit 0 >gnu echo "Looks kind of like a GNU/$xxx system, but we'll see..." if $test X$xxx = XLinux; then d_linux="$define" echo exit 0 >linux fi else echo "Looks kind of like a Version 7 system, but we'll see..." echo exit 0 >v7 fi case "$eunicefix" in *unixtovms*) $cat <<'EOI' There is, however, a strange, musty smell in the air that reminds me of something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. EOI echo exit 0 >eunice d_eunice="$define" : it so happens the Eunice I know will not run shell scripts in Unix format ;; *) echo " " echo "Congratulations. You aren't running Eunice." d_eunice="$undef" ;; esac case "$p_" in :) ;; *) $cat <<'EOI' I have the feeling something is not exactly right, however...don't tell me... EOI if test -n "$DJGPP"; then case "X${MACHTYPE:-nonesuchmach}" in cygwin) echo "hah!... you're running under Cygwin!";; *) echo "got it... you're running DOS with DJGPP!";; esac echo exit 0 >dos d_dos="$define" else $cat <<'EOI' lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! EOI echo exit 0 >os2 d_os2="$define" fi ;; esac if test -f /xenix; then echo "Actually, this looks more like a XENIX system..." echo exit 0 >xenix d_xenix="$define" else echo " " echo "It's not Xenix..." d_xenix="$undef" fi chmod +x xenix $eunicefix xenix if test -f /venix; then echo "Actually, this looks more like a VENIX system..." echo exit 0 >venix else echo " " if ./xenix; then : null else echo "Nor is it Venix..." fi fi chmod +x bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux $eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux $rm -f foo : What should the include directory be ? echo " " $echo $n "Hmm... $c" dflt='/usr/include' incpath='' mips_type='' if $test -f /bin/mips && /bin/mips; then echo "Looks like a MIPS system..." $cat >usr.c <<'EOCP' #ifdef SYSTYPE_BSD43 /bsd43 #endif EOCP if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then dflt='/bsd43/usr/include' incpath='/bsd43' mips_type='BSD 4.3' else mips_type='System V' fi $rm -f usr.c usr.out echo "and you're compiling with the $mips_type compiler and libraries." xxx_prompt=y echo "exit 0" >mips else echo "Doesn't look like a MIPS system." xxx_prompt=n echo "exit 1" >mips fi chmod +x mips $eunicefix mips case "$usrinc" in '') ;; *) dflt="$usrinc";; esac case "$xxx_prompt" in y) fn=d/ echo " " rp='Where are the include files you want to use?' . ./getfile usrinc="$ans" ;; *) usrinc="$dflt" ;; esac : Set private lib path case "$plibpth" in '') if ./mips; then plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" fi;; esac case "$libpth" in ' ') dlist='';; '') dlist="$loclibpth $plibpth $glibpth";; *) dlist="$libpth";; esac : Now check and see which directories actually exist, avoiding duplicates libpth='' for xxx in $dlist do if $test -d $xxx; then case " $libpth " in *" $xxx "*) ;; *) libpth="$libpth $xxx";; esac fi done $cat <<'EOM' Some systems have incompatible or broken versions of libraries. Among the directories listed in the question below, please remove any you know not to be holding relevant libraries, and add any that are needed. Say "none" for none. EOM case "$libpth" in '') dflt='none';; *) set X $libpth shift dflt=${1+"$@"} ;; esac rp="Directories to use for library searches?" . ./myread case "$ans" in none) libpth=' ';; *) libpth="$ans";; esac : compute shared library extension case "$so" in '') if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then dflt='sl' else dflt='so' fi ;; *) dflt="$so";; esac $cat <&4 $cat >try.c < int main() { #ifdef __GNUC__ #ifdef __VERSION__ printf("%s\n", __VERSION__); #else printf("%s\n", "1"); #endif #endif exit(0); } EOM if $cc -o try $ccflags $ldflags try.c >/dev/null 2>&1; then gccversion=`$run ./try` case "$gccversion" in '') echo "You are not using GNU cc." ;; *) echo "You are using GNU cc $gccversion." ccname=gcc ;; esac else echo " " echo "*** WHOA THERE!!! ***" >&4 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 case "$knowitall" in '') echo " You'd better start hunting for one and let me know about it." >&4 exit 1 ;; esac fi $rm -f try try.* case "$gccversion" in 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; esac case "$gccversion" in '') gccosandvers='' ;; *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'` gccosandvers=`$cc -v 2>&1 | \ $grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"` gccshortvers='' case "$gccosandvers" in $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr $osname$osvers) ;; # looking good $osname*) cat <&4 *** WHOA THERE!!! *** Your gcc has not been compiled for the exact release of your operating system ($gccosandvers versus $osname$osvers). In general it is a good idea to keep gcc synchronized with the operating system because otherwise serious problems may ensue when trying to compile software, like Perl. I'm trying to be optimistic here, though, and will continue. If later during the configuration and build icky compilation problems appear (headerfile conflicts being the most common manifestation), I suggest reinstalling the gcc to match your operating system release. EOM ;; *) gccosandvers='' ;; # failed to parse, better be silent esac ;; esac case "$ccname" in '') ccname="$cc" ;; esac : gcc 3.1 complains about adding -Idirectories that it already knows about, : so we will take those off from locincpth. case "$gccversion" in 3*) echo "main(){}">try.c for incdir in `$cc -v -c try.c 2>&1 | \ sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do locincpth=`echo $locincpth | sed s!$incdir!!` done $rm -f try try.* esac : see how we invoke the C preprocessor echo " " echo "Now, how can we feed standard input to your C preprocessor..." >&4 cat <<'EOT' >testcpp.c #define ABC abc #define XYZ xyz ABC.XYZ EOT cd .. if $test ! -f cppstdin; then echo "$startsh" >cppstdin if $test "X$osname" = "Xaix" -a "X$gccversion" = X; then echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; \ test -s .$$.u && \ awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; \ rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >> cppstdin else echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >>cppstdin fi; else echo "Keeping your $hint cppstdin wrapper." fi chmod 755 cppstdin $eunicefix cppstdin wrapper=`pwd`/cppstdin ok='false' cd UU if $test "X$cppstdin" != "X" && \ $cppstdin $cppminus testcpp.out 2>&1 && \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 then echo "You used to use $cppstdin $cppminus so we'll use that again." case "$cpprun" in '') echo "But let's see if we can live without a wrapper..." ;; *) if $cpprun $cpplast testcpp.out 2>&1 && \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 then echo "(And we'll use $cpprun $cpplast to preprocess directly.)" ok='true' else echo "(However, $cpprun $cpplast does not work, let's see...)" fi ;; esac else case "$cppstdin" in '') ;; *) echo "Good old $cppstdin $cppminus does not seem to be of any help..." ;; esac fi if $ok; then : nothing elif echo 'Maybe "'"$cc"' -E" will work...'; \ $cc -E testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." x_cpp="$cc -E" x_minus=''; elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ $cc -E - testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." x_cpp="$cc -E" x_minus='-'; elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ $cc -P testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yipee, that works!" x_cpp="$cc -P" x_minus=''; elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ $cc -P - testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "At long last!" x_cpp="$cc -P" x_minus='-'; elif echo 'No such luck, maybe "'$cpp'" will work...'; \ $cpp testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "It works!" x_cpp="$cpp" x_minus=''; elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ $cpp - testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, it works! I was beginning to wonder." x_cpp="$cpp" x_minus='-'; elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ $wrapper testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then x_cpp="$wrapper" x_minus='' echo "Eureka!" else dflt='' rp="No dice. I can't find a C preprocessor. Name one:" . ./myread x_cpp="$ans" x_minus='' $x_cpp testcpp.out 2>&1 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "OK, that will do." >&4 else echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 exit 1 fi fi case "$ok" in false) cppstdin="$x_cpp" cppminus="$x_minus" cpprun="$x_cpp" cpplast="$x_minus" set X $x_cpp shift case "$1" in "$cpp") echo "Perhaps can we force $cc -E using a wrapper..." if $wrapper testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 then echo "Yup, we can." cppstdin="$wrapper" cppminus=''; else echo "Nope, we'll have to live without it..." fi ;; esac case "$cpprun" in "$wrapper") cpprun='' cpplast='' ;; esac ;; esac case "$cppstdin" in "$wrapper"|'cppstdin') ;; *) $rm -f $wrapper;; esac $rm -f testcpp.c testcpp.out : determine optimize, if desired, or use for debug flag also case "$optimize" in ' '|$undef) dflt='none';; '') case "$gccversion" in '') dflt='-O';; *) dflt='-O2 -g';; esac ;; *) dflt="$optimize";; esac case "$gccversion" in '') $cat </dev/null 2>&1 then dflt="$dflt -posix" fi ;; esac case "$gccversion" in 1*|2*) dflt="$dflt -Wall";; *) dflt="$dflt -W -Wall -Wformat=2 -Wshadow";; esac ;; esac case "$mips_type" in *BSD*|'') inclwanted="$locincpth $usrinc";; *) inclwanted="$locincpth $inclwanted $usrinc/bsd";; esac for thisincl in $inclwanted; do if $test -d $thisincl; then if $test x$thisincl != x$usrinc; then case "$dflt" in *$thisincl*);; *) dflt="$dflt -I$thisincl";; esac fi fi done inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then xxx=true; elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then xxx=true; else xxx=false; fi; if $xxx; then case "$dflt" in *$2*);; *) dflt="$dflt -D$2";; esac; fi' if ./osf1; then set signal.h __LANGUAGE_C__; eval $inctest else set signal.h LANGUAGE_C; eval $inctest fi case "$hint" in default|recommended) dflt="$ccflags $dflt" ;; *) dflt="$ccflags";; esac case "$dflt" in ''|' ') dflt=none;; esac $cat <&4 set X $cppflags shift cppflags='' $cat >cpp.c <<'EOM' #define BLURFL foo BLURFL xx LFRULB EOM previous='' for flag in $* do case "$flag" in -*) ftry="$flag";; *) ftry="$previous $flag";; esac if $cppstdin -DLFRULB=bar $ftry $cppminus cpp1.out 2>/dev/null && \ $cpprun -DLFRULB=bar $ftry $cpplast cpp2.out 2>/dev/null && \ $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 then cppflags="$cppflags $ftry" previous='' else previous="$flag" fi done set X $cppflags shift cppflags=${1+"$@"} case "$cppflags" in *-*) echo "They appear to be: $cppflags";; esac $rm -f cpp.c cpp?.out ;; esac : flags used in final linking phase case "$ldflags" in '') if ./venix; then dflt='-i -z' else dflt='' fi case "$ccflags" in *-posix*) dflt="$dflt -posix" ;; esac ;; *) dflt="$ldflags";; esac : Try to guess additional flags to pick up local libraries. for thislibdir in $libpth; do case " $loclibpth " in *" $thislibdir "*) case "$dflt " in *"-L$thislibdir "*) ;; *) dflt="$dflt -L$thislibdir" ;; esac ;; esac done case "$dflt" in '') dflt='none' ;; *) set X $dflt; shift; dflt="$@";; esac $cat <&4 set X $cc $optimize $ccflags $ldflags -o try try.c shift $cat >try.msg < try.c <<'EOF' #include int main() { exit(0); } EOF dflt=y if sh -c "$cc $optimize $ccflags $ldflags -o try try.c" >>try.msg 2>&1; then if sh -c './try' >>try.msg 2>&1; then dflt=n else echo "The program compiled OK, but exited with status $?." >>try.msg rp="You have a problem. Shall I abort Configure" dflt=y fi else echo "I can't compile the test program." >>try.msg rp="You have a BIG problem. Shall I abort Configure" dflt=y fi case "$dflt" in y) $cat try.msg >&4 case "$knowitall" in '') echo "(The supplied flags might be incorrect with this C compiler.)" ;; *) dflt=n;; esac echo " " . ./myread case "$ans" in n*|N*) ;; *) echo "Ok. Stopping Configure." >&4 exit 1 ;; esac ;; n) echo "OK, that should do.";; esac $rm -f try try.* core : Looking for optional libraries echo " " echo "Checking for optional libraries..." >&4 case "$libs" in ' '|'') dflt='';; *) dflt="$libs";; esac case "$libswanted" in '') libswanted='c_s';; esac case "$usesocks" in "$define") libswanted="$libswanted socks5 socks5_sh" ;; esac echo "extern char printf(); int main() { printf(); return 0; }" > lt.c libsfound='' libsfiles='' libsdirs='' libspath='' for thisdir in $libpth $xlibpth; do test -d $thisdir && libspath="$libspath $thisdir" done for thislib in $libswanted; do for thisdir in $libspath; do xxx='' if $test ! -f "$xxx" ; then xxx=`ls $thisdir/lib$thislib.$so.[0-9]* 2>/dev/null | $sed -n '1p'` $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=shared fi if test ! -f "$xxx"; then xxx=$thisdir/lib$thislib.$so $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=shared fi if test ! -f "$xxx"; then xxx=$thisdir/lib$thislib$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static fi if test ! -f "$xxx"; then xxx=$thisdir/$thislib$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static fi if test ! -f "$xxx"; then xxx=$thisdir/lib${thislib}_s$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static $test -f "$xxx" && thislib=${thislib}_s fi if test ! -f "$xxx"; then xxx=$thisdir/Slib$thislib$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static fi if $test -f "$xxx"; then if $cc -o lt $ccflags $ldflags lt.c -l$thislib >/dev/null 2>&1; then linkmsg="" else linkmsg=" but I can't link against it" fi case "$libstyle" in shared) echo "Found -l$thislib (shared)$linkmsg." ;; static) echo "Found -l$thislib$linkmsg." ;; *) echo "Found -l$thislib ($libstyle)$linkmsg." ;; esac case " $dflt " in *"-l$thislib "*) ;; *) case "$linkmsg" in '') dflt="$dflt -l$thislib" libsfound="$libsfound $xxx" yyy=`basename $xxx` libsfiles="$libsfiles $yyy" yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"` case " $libsdirs " in *" $yyy "*) ;; *) libsdirs="$libsdirs $yyy" ;; esac ;; esac ;; esac break fi done if $test ! -f "$xxx"; then echo "No -l$thislib." fi done set X $dflt shift dflt="$*" case "$libs" in '') dflt="$dflt";; *) dflt="$libs";; esac case "$dflt" in ' '|'') dflt='none';; esac $rm -f lt.c lt $cat <&4 cat >try.c <<'EOCP' /* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__ alone are insufficient to distinguish different versions, such as 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in libc version 2.1.0. A. Dougherty, June 3, 2002. */ #include int main(void) { #ifdef __GLIBC__ # ifdef __GLIBC_MINOR__ # if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 # include printf("%s\n", gnu_get_libc_version()); # else printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__); # endif # else printf("%d\n", __GLIBC__); # endif return 0; #else return 1; #endif } EOCP set try if eval $compile_ok && $run ./try > glibc.ver; then val="$define" gnulibc_version=`$cat glibc.ver` echo "You are using the GNU C Library version $gnulibc_version" else val="$undef" gnulibc_version='' echo "You are not using the GNU C Library" fi $rm -f try try.* glibc.ver set d_gnulibc eval $setvar : see if nm is to be used to determine whether a symbol is defined or not case "$usenm" in '') dflt='' case "$d_gnulibc" in "$define") echo " " echo "$nm probably won't work on the GNU C Library." >&4 dflt=n ;; esac case "$dflt" in '') if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then echo " " echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4 echo "'nm' won't be sufficient on this system." >&4 dflt=n fi ;; esac case "$dflt" in '') if ./gnu; then echo " " echo "Hmm... A GNU system without a GNU C Library? Weird..." >&4 dflt=n else dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null` if $test $dflt -gt 20; then dflt=y else dflt=n fi fi ;; esac ;; *) case "$usenm" in true|$define) dflt=y;; *) dflt=n;; esac ;; esac $cat < /dev/null 2>&1; then nm_so_opt='--dynamic' fi ;; esac ;; esac : Figure out where the libc is located case "$runnm" in true) : get list of predefined functions in a handy place echo " " case "$libc" in '') libc=unknown case "$libs" in *-lc_s*) libc=`./loc libc_s$_a $libc $libpth` esac ;; esac case "$libs" in '') ;; *) for thislib in $libs; do case "$thislib" in -lc|-lc_s) : Handle C library specially below. ;; -l*) thislib=`echo $thislib | $sed -e 's/^-l//'` if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then : elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then : elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then : elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then : elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then : elif try=`./loc $thislib X $libpth`; $test -f "$try"; then : elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then : else try='' fi libnames="$libnames $try" ;; *) libnames="$libnames $thislib" ;; esac done ;; esac xxx=normal case "$libc" in unknown) set /lib/libc.$so for xxx in $libpth; do $test -r $1 || set $xxx/libc.$so : The messy sed command sorts on library version numbers. $test -r $1 || \ set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \ tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e ' h s/[0-9][0-9]*/0000&/g s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g G s/\n/ /' | \ $sort | $sed -e 's/^.* //'` eval set \$$# done $test -r $1 || set /usr/ccs/lib/libc.$so $test -r $1 || set /lib/libsys_s$_a ;; *) set blurfl ;; esac if $test -r "$1"; then echo "Your (shared) C library seems to be in $1." libc="$1" elif $test -r /lib/libc && $test -r /lib/clib; then echo "Your C library seems to be in both /lib/clib and /lib/libc." xxx=apollo libc='/lib/clib /lib/libc' if $test -r /lib/syslib; then echo "(Your math library is in /lib/syslib.)" libc="$libc /lib/syslib" fi elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then echo "Your C library seems to be in $libc, as you said before." elif $test -r $incpath/usr/lib/libc$_a; then libc=$incpath/usr/lib/libc$_a; echo "Your C library seems to be in $libc. That's fine." elif $test -r /lib/libc$_a; then libc=/lib/libc$_a; echo "Your C library seems to be in $libc. You're normal." else if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then : elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then libnames="$libnames "`./loc clib blurfl/dyick $libpth` elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then : elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then : elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then : else tans=`./loc Llibc$_a blurfl/dyick $xlibpth` fi if $test -r "$tans"; then echo "Your C library seems to be in $tans, of all places." libc=$tans else libc='blurfl' fi fi if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then dflt="$libc" cat < libpath cat >&4 < libnames set X `cat libnames` shift xxx=files case $# in 1) xxx=file; esac echo "Extracting names from the following $xxx for later perusal:" >&4 echo " " $sed 's/^/ /' libnames >&4 echo " " $echo $n "This may take a while...$c" >&4 for file in $*; do case $file in *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;; *) $nm $nm_opt $file 2>/dev/null;; esac done >libc.tmp $echo $n ".$c" $grep fprintf libc.tmp > libc.ptf xscan='eval "libc.list"; $echo $n ".$c" >&4' xrun='eval "libc.list"; echo "done." >&4' xxx='[ADTSIW]' if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun else $nm -p $* 2>/dev/null >libc.tmp $grep fprintf libc.tmp > libc.ptf if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1 then nm_opt='-p' eval $xrun else echo " " echo "$nm didn't seem to work right. Trying $ar instead..." >&4 com='' if $ar t $libc > libc.tmp && \ $contains '^fprintf$' libc.tmp >/dev/null 2>&1 then for thisname in $libnames $libc; do $ar t $thisname >>libc.tmp done $sed -e "s/\\$_o\$//" < libc.tmp > libc.list echo "Ok." >&4 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then for thisname in $libnames $libc; do $ar tv $thisname >>libc.tmp emximp -o tmp.imp $thisname \ 2>/dev/null && \ $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \ < tmp.imp >>libc.tmp $rm -f tmp.imp done $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list echo "Ok." >&4 else echo "$ar didn't seem to work right." >&4 echo "Maybe this is a Cray...trying bld instead..." >&4 if bld t $libc | \ $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list && $test -s libc.list then for thisname in $libnames; do bld t $libnames | \ $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list $ar t $thisname >>libc.tmp done echo "Ok." >&4 else echo "That didn't work either." >&4 echo "No problem, I'll be compiling test programs then..." >&4 runnm=false fi fi fi fi nm_extract="$com" if $test -f /lib/syscalls.exp; then echo " " echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \ /lib/syscalls.exp >>libc.list fi ;; esac $rm -f libnames libpath : is a C symbol defined? csym='tlook=$1; case "$3" in -v) tf=libc.tmp; tc=""; tdc="";; -a) tf=libc.tmp; tc="[0]"; tdc="[]";; *) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";; esac; tx=yes; case "$reuseval-$4" in true-) ;; true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; esac; case "$tx" in yes) case "$runnm" in true) if $contains $tlook $tf >/dev/null 2>&1; then tval=true; else tval=false; fi;; *) echo "extern char $1$tdc; int main() { return &$1$tc + 2; }" > t.c; if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1; then tval=true; else tval=false; fi; $rm -f t t.c;; esac;; *) case "$tval" in $define) tval=true;; *) tval=false;; esac;; esac; eval "$2=$tval"' : define an is-in-libc? function inlibc='echo " "; td=$define; tu=$undef; sym=$1; var=$2; eval "was=\$$2"; tx=yes; case "$reuseval$was" in true) ;; true*) tx=no;; esac; case "$tx" in yes) set $sym tres -f; eval $csym; case "$tres" in true) echo "$sym() found." >&4; case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";; *) echo "$sym() NOT found." >&4; case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";; esac;; *) case "$was" in $define) echo "$sym() found." >&4;; *) echo "$sym() NOT found." >&4;; esac;; esac' : see if gettext exists set gettext d_gettext eval $inlibc : determine filename position in cpp output echo " " echo "Computing filename position in cpp output for #include directives..." >&4 echo '#include ' > foo.c case "$osname" in vos) testaccess=-e cppfilter="tr '\\\\>' '/' |" ;; *) testaccess=-r cppfilter='' ;; esac $cat >fieldn </dev/null | \ $grep '^[ ]*#.*stdio\.h' | \ while read cline; do pos=1 set \$cline while $test \$# -gt 0; do if $test $testaccess \`echo \$1 | $tr -d '"'\`; then echo "\$pos" exit 0 fi shift pos=\`expr \$pos + 1\` done done EOF chmod +x fieldn fieldn=`./fieldn` $rm -f foo.c fieldn case $fieldn in '') pos='???';; 1) pos=first;; 2) pos=second;; 3) pos=third;; *) pos="${fieldn}th";; esac echo "Your cpp writes the filename in the $pos field of the line." : locate header file $cat >findhdr <" > foo\$\$.c $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ $cppfilter $grep "^[ ]*#.*\$wanted" | \ while read cline; do name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` case "\$name" in *[/\\\\]\$wanted) echo "\$name"; exit 1;; *[\\\\/]\$wanted) echo "\$name"; exit 1;; *) exit 2;; esac done status=\$? $rm -f foo\$\$.c if test \$status -eq 1; then exit 0 fi exit 1 EOF chmod +x findhdr $eunicefix findhdr : define an alternate in-header-list? function inhdr='echo " "; td=$define; tu=$undef; yyy=$@; cont=true; xxf="echo \"<\$1> found.\" >&4"; case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; esac; case $# in 4) instead=instead;; *) instead="at last";; esac; while $test "$cont"; do xxx=`./findhdr $1` var=$2; eval "was=\$$2"; if $test "$xxx" && $test -r "$xxx"; then eval $xxf; eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td"; cont=""; else eval $xxnf; eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi; set $yyy; shift; shift; yyy=$@; case $# in 0) cont="";; 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; xxnf="echo \"and I did not find <\$1> either.\" >&4";; *) xxf="echo \"but I found <\$1\> instead.\" >&4"; xxnf="echo \"there is no <\$1>, ...\" >&4";; esac; done; while $test "$yyy"; do set $yyy; var=$2; eval "was=\$$2"; eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; set $yyy; shift; shift; yyy=$@; done' : see if this is a libintl system set libintl.h i_libintl eval $inhdr : determine whether we support NLS echo " " case "$d_nls" in "$define") echo "You have NLS support." >&4 val="$define" ;; *) case "$d_gettext$i_libintl" in "$define$define") echo "You have NLS support." >&4 val="$define" ;; *) echo "I don't see support for NLS here..." >&4 val="$undef" ;; esac ;; esac set d_nls eval $setvar : determine whether to enable NLS echo " " case "$d_nls" in "$undef") echo "I won't enable NLS since you don't have that feature." >&4 val="$undef" ;; *) $cat <&4 $cat >attrib.c <<'EOCP' #include void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn)); EOCP if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then if $contains 'warning' attrib.out >/dev/null 2>&1; then echo "Your C compiler doesn't fully support __attribute__." val="$undef" else echo "Your C compiler supports __attribute__." val="$define" fi else echo "Your C compiler doesn't seem to understand __attribute__ at all." val="$undef" fi set d_attribut eval $setvar $rm -f attrib* : see if bcopy exists set bcopy d_bcopy eval $inlibc : see if bind_textdomain_codeset exists set bind_textdomain_codeset d_bindtxtcode eval $inlibc : check for __builtin_popcount echo " " echo "Checking whether $cc has __builtin_popcount..." >&4 $cat >try.c </dev/null 2>&1; then val="$define" echo "Good, it does." else val="$undef" echo "No, it doesn't but that's okay." fi set d_built_popcount eval $setvar $rm -f try try.c : check for const keyword echo " " echo 'Checking to see if your C compiler knows about "const"...' >&4 $cat >const.c <<'EOCP' typedef struct spug { int drokk; } spug; int main() { const char *foo; const spug y; } EOCP if $cc -c $ccflags const.c >/dev/null 2>&1 ; then val="$define" echo "Yup, it does." else val="$undef" echo "Nope, it doesn't." fi set d_const eval $setvar $rm -f const.c const.o : how can we find information about dbus? echo " " d_dbus="$define" echo "Checking how we can gather information about dbus..." >&4 if pkg-config dbus-1 --cflags >/dev/null 2>&1; then dbusconfig="pkg-config dbus-1" modver=--modversion else echo "You've don't seem to have dbus installed?" >&4 d_dbus="$undef" dbusconfig='false' modver='' fi echo "(I'll use '$dbusconfig' to gather that information.)" dbuscflags="" dbusldflags="" d_dbus="$undef" version=`$dbusconfig $modver` case "$version" in '') ;; *) vint=`echo $version | $awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'` if test 0$vint -lt 03502; then echo "Sorry, you have dbus $version, I need at least 0.35.2." >&4 else echo "Good, you have dbus $version." dbuscflags=`$dbusconfig --cflags` dbusldflags=`$dbusconfig --libs` $cat <<'EOM' D-Bus support allows me to send out messages onto the D-Bus message bus. That way external applications can easily act on certain events that happen, such as a completed download. For more information, see doc/other/dbus-support.txt EOM case "$dbus" in false) dflt=n;; *) dflt=y;; esac rp="Enable D-Bus support" . ./myread case "$ans" in y) dbus=true; d_dbus="$define";; *) dbus=false; d_dbus="$undef";; esac fi ;; esac : can we use /dev/poll? echo " " echo "Checking whether /dev/poll is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include #include int main(void) { static struct pollfd pfds[1]; static struct dvpoll dvp; static int ret; pfds[0].fd |= 1; pfds[0].events |= POLLIN | POLLPRI | POLLOUT | POLLHUP | POLLERR | POLLNVAL; pfds[0].events |= POLLREMOVE; pfds[0].revents |= 1; dvp.dp_timeout |= 1; dvp.dp_nfds |= 1; dvp.dp_fds = pfds; ret |= ioctl(1, DP_POLL, &dvp); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like /dev/poll is usable on your system, good. EOM else echo "Sorry, I will not be using /dev/poll." val="$undef" fi $rm -f try try.c set d_dev_poll eval $setvar : can we use epoll? echo " " echo "Checking whether epoll() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include int main(void) { struct epoll_event ev[1]; int ret, epfd; epfd = epoll_create(1); ev[0].events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLERR | EPOLLHUP | EPOLLET; ev[0].data.ptr = (void *) 0; ev[0].data.fd = 1; ev[0].data.u32 = 1; ev[0].data.u64 = 1; ret = epoll_ctl(epfd, 1, EPOLL_CTL_ADD, &ev[0]); ret = epoll_ctl(epfd, 1, EPOLL_CTL_MOD, &ev[0]); ret = epoll_ctl(epfd, 1, EPOLL_CTL_DEL, &ev[0]); ret = epoll_wait(epfd, &ev[0], 1, -1); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then echo 'It looks like epoll() is usable on your system, good.' else echo 'Sorry, I will not be using epoll().' val="$undef" fi $rm -f try try.c set d_epoll eval $setvar : determine whether to enable fast assertions echo " " case "$d_fast_assert" in "$undef") dflt=n;; *) dflt=y;; esac $cat <try.c <<'EOC' int main() { return 0; } EOC if $cc $ccflags -momit-leaf-frame-pointer $ldflags \ -o try try.c >/dev/null 2>&1 then dflt=y else dflt=n fi $cat <&4 ;; esac ;; *) case "$ccflags" in *-momit-leaf-frame-pointer*) echo "Stripping -momit-leaf-frame-pointer from cc flags." >&4 ccflags=`echo $ccflags | $sed 's/ *-momit-leaf-frame-pointer//'` ;; esac ;; esac ;; esac ;; esac : can we use getaddrinfo? echo " " echo "Checking whether getaddrinfo() can be used ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include #include #include #include int main(void) { struct addrinfo hints, *res; int ret; hints.ai_flags = 1; hints.ai_family = PF_UNSPEC; hints.ai_socktype = 1; hints.ai_protocol = 1; hints.ai_addrlen = (socklen_t) 1; hints.ai_canonname = "canonname"; hints.ai_addr = (struct sockaddr *) 0; hints.ai_next = (struct addrinfo *) 0; ret = getaddrinfo("localhost", "www", &hints, &res); if (0 != ret) { const char *s; s = gai_strerror(ret); (void) s; } if (res) freeaddrinfo(res); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like getaddrinfo() is usable on your system, good. EOM else echo "Sorry, I will not be using getaddrinfo()." val="$undef" fi $rm -f try try.c set d_getaddrinfo eval $setvar : can we use geteuid? echo " " echo "Checking whether geteuid() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include int main(void) { (void) geteuid(); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then echo 'It looks like geteuid() exists on your system, good.' else echo 'Sorry, geteuid() does not seem to exist.' val="$undef" fi $rm -f try try.c set d_geteuid eval $setvar : see if this is a net/if.h system set net/if.h i_netif eval $inhdr : can we use getifaddrs? echo " " echo "Checking whether getifaddrs() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include #ifdef I_NET_IF #include #endif #include int main(void) { struct ifaddrs *ifa0, *ifa; static int ret; ret |= getifaddrs(&ifa0); for (ifa = ifa0; ifa; ifa = ifa->ifa_next) { (void) ifa->ifa_flags; (void) ifa->ifa_addr; (void) ifa->ifa_addr->sa_family; (void) ifa->ifa_netmask; if ((IFF_LOOPBACK | IFF_UP | IFF_RUNNING) & ifa->ifa_flags) break; } freeifaddrs(ifa0); return 0; } EOC case "$i_netif" in "$define") flags='-DI_NET_IF';; esac if $cc $ccflags $flags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like getifaddrs() is usable on your system, good. EOM else echo "Sorry, I will not be using getifaddrs()." val="$undef" fi $rm -f try try.c set d_getifaddrs eval $setvar : see if getinvent exists set getinvent d_getinvent eval $inlibc : see if getdtablesize exists echo " " case "$d_gettblsz" in $define) d_gettblsz="$undef";; $undef) d_gettblsz="$define";; esac if set getdtablesize val -f d_gettblsz; eval $csym; $val; then echo 'getdtablesize() found.' >&4 d_gettblsz="$undef" tablesize='' else echo 'getdtablesize() NOT found...' >&4 if set ulimit val -f; eval $csym; $val; then echo 'Maybe ulimit(4,0) will work...' $cat >nofile.c <<'EOCP' #include #ifdef GETPARAM_H #include #endif int main() { printf("%d %d\n", #ifdef NOFILE NOFILE, #else 0, #endif ulimit(4,0)); exit(0); } EOCP if $cc $ccflags -DGETPARAM_H -o nofile nofile.c $libs >/dev/null 2>&1 \ || $cc $ccflags -o nofile nofile.c $libs >/dev/null 2>&1 ; then set `./nofile` d_gettblsz=$1 d_ulimit4=$2 if $test "$d_ulimit4" -lt 0; then echo "Your ulimit() call doesn't tell me what I want to know." echo "We'll just use NOFILE in this case." nofile=$d_gettblsz d_gettblsz="$define" tablesize='NOFILE' else if $test "$d_gettblsz" -gt 0; then echo "Your system defines NOFILE to be $d_gettblsz, and" >&4 else echo "I had trouble getting NOFILE from your system, but" >&4 fi echo "ulimit returns $d_ulimit4 as the number of available file descriptors." >&4 dflt='y'; echo " " rp='Should I use ulimit to get the number of available file descriptors?' . ./myread case "$ans" in y*) nofile=$d_ulimit4 d_gettblsz="$define" tablesize='ulimit(4, 0L)' echo "Using ulimit(4,0)." ;; *) nofile=$d_gettblsz d_gettblsz="$define" tablesize='NOFILE' echo "Using NOFILE." ;; esac fi else echo "Strange, I couldn't get my test program to compile." echo "We'll just use NOFILE in this case." d_gettblsz="$define" tablesize='NOFILE' nofile='' fi else echo 'Using NOFILE instead.' d_gettblsz="$define" tablesize='NOFILE' nofile='' fi fi $rm -f nofile* : can we use getuid? echo " " echo "Checking whether getuid() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include int main(void) { (void) getuid(); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then echo 'It looks like getuid() exists on your system, good.' else echo 'Sorry, getuid() does not seem to exist.' val="$undef" fi $rm -f try try.c set d_getuid eval $setvar : how can we find information about GNU TLS? echo " " case "$d_gnutls" in "$undef") gnutls="$undef";; *) gnutls="$define";; esac echo "Checking how we can gather information about GNU TLS..." >&4 if pkg-config gnutls --cflags >/dev/null 2>&1; then gnutlsconfig="pkg-config gnutls" modver=--modversion elif libgnutls-config --cflags >/dev/null 2>&1; then gnutlsconfig="libgnutls-config" modver=--version else echo "You've don't seem to have GNU TLS installed?" >&4 gnutlsconfig='false' modver='' fi echo "(I'll use '$gnutlsconfig' to gather that information.)" gnutlscflags="" gnutlsldflags="" version=`$gnutlsconfig $modver` val="$undef" case "$version" in '') ;; *) gnutlscflags=`$gnutlsconfig --cflags` gnutlsldflags=`$gnutlsconfig --libs` vint=`echo $version | $awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'` if test 0$vint -lt 010016; then echo "Sorry, you have GNU TLS $version, I need at least 1.0.16." >&4 else echo "Good, you have GNU TLS $version." $cat <<'EOM' GNU TLS allows encryption of downloads, uploads and Gnutella connections. For more information, see http://www.gnu.org/software/gnutls/. EOM case "$gnutls" in "$define") dflt=y;; *) dflt=n;; esac rp="Enable GNU TLS support" . ./myread case "$ans" in y) val="$define";; *) val="$undef";; esac fi ;; esac set d_gnutls eval $setvar : see if herror exists set herror d_herror eval $inlibc : see if hstrerror exists set hstrerror d_hstrerror eval $inlibc : see if initstate exists set initstate d_initstate eval $inlibc : see if this is a netinet/in.h or sys/in.h system set netinet/in.h i_niin sys/in.h i_sysin eval $inhdr : see if this is a netinet/ip.h system set netinet/ip.h i_niip eval $inhdr : check for IP TOS support echo " " echo "Checking for IP TOS (Type of Service) support..." >&4 case "$i_niin" in "$define") inh=netinet/in.h;; *) case "$i_sysin" in "$define") inh=sys/in.h;; esac ;; esac $cat >iptos < #include <$inh> #if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT) YES #endif EOM $cppstdin $cppflags $cppminus iptos.h val="$undef" if $contains 'YES' iptos.h >/dev/null 2>&1; then val="$define" echo "You have IP TOS support in <$inh>." elif $test "x$i_niip" = "x$define"; then $cat >iptos < #include <$inh> #include #if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT) YES #endif EOM $cppstdin $cppflags $cppminus iptos.h if $contains 'YES' iptos.h >/dev/null 2>&1; then val="$define" echo "You have IP TOS support in ." else echo "Sorry, you seem to be lacking IP TOS support.". fi fi set d_iptos eval $setvar $rm -f iptos iptos.h : determine whether IPv6 can be used echo " " echo "Checking whether IPv6 can be used ..." >&4 d_ipv6="$define" $cat >try.c <<'EOC' #include #include #include #include #include #define STATIC_ASSERT(x) \ do { switch (0) { case ((x) ? 1 : 0): case 0: break; } } while(0) int main(void) { struct sockaddr_storage ss; struct sockaddr_in6 sin6; static struct in6_addr in6; ss.ss_family = PF_INET6; sin6.sin6_family = AF_INET6; sin6.sin6_port = 6346; sin6.sin6_flowinfo = 23UL; sin6.sin6_scope_id = 42UL; sin6.sin6_addr = in6; sin6.sin6_addr.s6_addr[0] = in6.s6_addr[0]; STATIC_ASSERT(AF_INET6 == PF_INET6); STATIC_ASSERT(sizeof in6 == sizeof sin6.sin6_addr); STATIC_ASSERT(16 == sizeof sin6.sin6_addr.s6_addr); STATIC_ASSERT(2 == sizeof sin6.sin6_port); STATIC_ASSERT(4 == sizeof sin6.sin6_flowinfo); STATIC_ASSERT(4 == sizeof sin6.sin6_scope_id); (void) sin6; (void) in6; return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like IPv6 is usable on your system, good. I can enable support for IPv6, but this only makes sense if you have IPv6 connectivity. IPv6 support has 16 bytes overhead for each IP address and also some CPU overhead. EOM case "$ipv6" in false) dflt=n;; *) dflt=y;; esac rp="Enable IPv6 support" . ./myread case "$ans" in y) ipv6=true; d_ipv6="$define";; *) ipv6=false; d_ipv6="$undef";; esac else echo "Sorry, I will not be using IPv6." d_ipv6="$undef" fi $rm -f try try.c : Look for isascii echo " " $cat >isascii.c <<'EOCP' #include #include int main() { int c = 'A'; if (isascii(c)) exit(0); else exit(1); } EOCP if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then echo "isascii() found." >&4 val="$define" else echo "isascii() NOT found." >&4 val="$undef" fi set d_isascii eval $setvar $rm -f isascii* : check whether udata in struct kevent is an integer echo " " $cat << 'EOM' >&4 Checking whether the member "udata" of "struct kevent" is an integer ... EOM $cat >try.c < #include #include int main(void) { static struct kevent ev; ev.udata |= 1; return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' Yes, the member "udata" of "struct kevent" is an integer. EOM val="$define" else $cat <<'EOM' No, the member "udata" of "struct kevent" is no integer. EOM val="$undef" fi $rm -f try.c try set d_kevent_int_udata eval $setvar : can we use kqueue? echo " " echo "Checking whether kqueue() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include #include int main(void) { static struct kevent changes[1], events[1]; static struct timespec ts; static unsigned long filters[] = { EVFILT_READ, EVFILT_WRITE, EVFILT_SIGNAL, EVFILT_PROC, EVFILT_VNODE }; int kq = kqueue(); int fd = 0; unsigned long flags; flags = EV_ADD | EV_ENABLE | EV_ONESHOT; flags &= ~(EV_CLEAR | EV_EOF | EV_ERROR | EV_DISABLE | EV_DELETE); EV_SET(&changes[0], fd, filters[0], flags, 0, 0, 0); kevent(kq, changes, 1, events, 1, &ts); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like kqueue() is usable on your system, good. EOM else echo "Sorry, I will not be using kqueue()." val="$undef" fi $rm -f try try.c set d_kqueue eval $setvar : how can we find information about libxml2? echo " " echo "Checking how we can gather information about libxml2..." >&4 if pkg-config libxml-2.0 --cflags >/dev/null 2>&1; then xmlconfig="pkg-config libxml-2.0" modver=--modversion elif xml2-config --cflags >/dev/null 2>&1; then xmlconfig='xml2-config' modver=--version else echo "You don't seem to have libxml2 installed." xmlconfig='false' modver='' fi case "$xmlconfig" in false) ;; *) echo "(I'll use '$xmlconfig' to gather that information.)";; esac xmlcflags="" xmlldflags="" d_libxml2="$undef" version=`$xmlconfig $modver` case "$version" in '') ;; *) vint=`echo $version | $awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'` if test 0$vint -lt 20419; then echo "Sorry, you have libxml2 $version, I need at least 2.4.19." >&4 else echo "Good, you have libxml2 $version. Enabling XML persistence..." xmlcflags=`$xmlconfig --cflags` xmlldflags=`$xmlconfig --libs` d_libxml2="$define" case " $xmlldflags " in *" -lpthread "*) echo "(Removing unneeded -lpthread from the list of libraries.)" xmlldflags=`echo "$xmlldflags " | $sed -e 's/-lpthread //'` ;; esac fi ;; esac : see if lstat exists set lstat d_lstat eval $inlibc : see if madvise exists set madvise d_madvise eval $inlibc : see if memalign exists set memalign d_memalign eval $inlibc : see if memcpy exists set memcpy d_memcpy eval $inlibc : see if mmap exists set mmap d_mmap eval $inlibc : check for msg_flags in struct msghdr echo " " $cat >&4 << 'EOM' Checking whether "struct msghdr" has a member "msg_flags"... EOM $cat >try.c < #include int main(void) { struct msghdr msg; msg.msg_flags |= 1; return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' Yes, "struct msghdr" has a "msg_flags" member. EOM val="$define" else $cat <<'EOM' No, there's no "msg_flags" in your "struct msghdr". EOM val="$undef" fi $rm -f try.c try set d_msghdr_msg_flags eval $setvar : Initialize h_fcntl h_fcntl=false : Initialize h_sysfile h_sysfile=false : Locate the flags for 'open()' echo " " $cat >open3.c <<'EOCP' #include #ifdef I_FCNTL #include #endif #ifdef I_SYS_FILE #include #endif int main() { if(O_RDONLY); #ifdef O_TRUNC exit(0); #else exit(1); #endif } EOCP : check sys/file.h first to get FREAD on Sun if $test `./findhdr sys/file.h` && \ $cc $cppflags "-DI_SYS_FILE" -o open3 open3.c >/dev/null 2>&1 ; then h_sysfile=true; echo " defines the O_* constants..." >&4 if ./open3; then echo "and you have the 3 argument form of open()." >&4 val="$define" else echo "but not the 3 argument form of open(). Oh, well." >&4 val="$undef" fi elif $test `./findhdr fcntl.h` && \ $cc "-DI_FCNTL" -o open3 open3.c >/dev/null 2>&1 ; then h_fcntl=true; echo " defines the O_* constants..." >&4 if ./open3; then echo "and you have the 3 argument form of open()." >&4 val="$define" else echo "but not the 3 argument form of open(). Oh, well." >&4 val="$undef" fi else val="$undef" ./warn "I can't find the O_* constant definitions! You got problems." fi set d_open3 eval $setvar $rm -f open3* : see if poll exists set poll d_poll eval $inlibc : can we use posix_memalign? echo " " echo "Checking whether posix_memalign() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include int main(void) { int ret = 0; void *p; ret |= posix_memalign(&p, sizeof(void *), 1); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like posix_memalign() is usable on your system, good. EOM else echo "Sorry, I will not be using posix_memalign()." val="$undef" fi $rm -f try try.c set d_posix_memalign eval $setvar : see if pread exists set pread d_pread eval $inlibc : see if preadv exists set preadv d_preadv eval $inlibc : see if pwrite exists set pwrite d_pwrite eval $inlibc : see if pwritev exists set pwritev d_pwritev eval $inlibc : see if random exists set random d_random eval $inlibc : see if getrusage exists set getrusage d_rusage eval $inlibc : can we use SA_INTERRUPT? echo " " echo "Checking whether SA_INTERRUPT is available in ..." >&4 val="$define" $cat >try.c <<'EOC' #include int main(void) { return SA_INTERRUPT + 1; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then echo 'Good, SA_INTERRUPT is defined.' else echo 'Sorry, no SA_INTERRUPT flag, will try to do without it.' val="$undef" fi $rm -f try try.c set d_sa_interrupt eval $setvar : see if sendfile exists set sendfile d_sendfile eval $inlibc : can we use setproctitle? echo " " echo "Checking whether setproctitle() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include int main(void) { setproctitle("%s %d %s %c", "blah", 1, "x", 'X'); return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like setproctitle() is usable on your system, good. EOM else echo "Sorry, I will not be using setproctitle()." val="$undef" fi $rm -f try try.c set d_setproctitle eval $setvar : see if we have sigaction echo " " if set sigaction val -f d_sigaction; eval $csym; $val; then echo 'sigaction() found.' >&4 val="$define" else echo 'sigaction NOT found.' >&4 val="$undef" fi $cat > set.c <<'EOP' #include #include #include int main() { struct sigaction act, oact; } EOP if $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1; then : else echo "But you don't seem to have a useable struct sigaction." >&4 val="$undef" fi set d_sigaction; eval $setvar $rm -f set set$_o set.c : see if sigsetjmp exists echo " " case "$d_sigsetjmp" in '') $cat >set.c <<'EOP' #include sigjmp_buf env; int set = 1; int main() { if (sigsetjmp(env,1)) exit(set); set = 0; siglongjmp(env, 1); exit(1); } EOP if $cc $ccflags $ldflags -o set set.c $libs > /dev/null 2>&1 ; then if ./set >/dev/null 2>&1; then echo "POSIX sigsetjmp found." >&4 val="$define" else $cat >&4 <&4 val="$undef" fi ;; *) val="$d_sigsetjmp" case "$d_sigsetjmp" in $define) echo "POSIX sigsetjmp found." >&4;; $undef) echo "sigsetjmp not found." >&4;; esac ;; esac set d_sigsetjmp eval $setvar $rm -f set.c set : determine whether socker_get is available echo " " echo "Checking whether socker_get() is available..." >&4 val="$define" $cat >try.c <<'EOC' #include int main(void) { int fd; fd = socker_get(1, 2, 3, "", 5); return 0; } EOC sockercflags=`socker-config --cflags 2>/dev/null` sockerldflags=`socker-config --libs 2>/dev/null` if $cc $ccflags $sockercflags $ldflags -o try try.c $sockerldflags \ >/dev/null 2>&1 then echo "Good, you have socker: we'll be able to bind to privileged ports." else echo "Seems like socker is missing: privileged ports won't be usable." >&4 val="$undef" fi $rm -f try try.c set d_socker_get eval $setvar : how can we find information about SQLite? echo " " case "$d_sqlite" in "$undef") sqlite="$undef";; *) sqlite="$define";; esac echo "Checking how we can gather information about SQLite..." >&4 if pkg-config sqlite3 --cflags >/dev/null 2>&1; then sqliteconfig="pkg-config sqlite3" modver=--modversion elif pkg-config sqlite --cflags >/dev/null 2>&1; then sqliteconfig="pkg-config sqlite" modver=--modversion else echo "You've don't seem to have SQLite installed?" >&4 sqliteconfig='false' modver='' fi echo "(I'll use '$sqliteconfig' to gather that information.)" sqlitecflags="" sqliteldflags="" version=`$sqliteconfig $modver` val="$undef" case "$version" in '') ;; *) sqlitecflags=`$sqliteconfig --cflags` sqliteldflags=`$sqliteconfig --libs` vint=`echo $version | $awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'` if test 0$vint -lt 030300; then echo "Sorry, you have SQLite $version, I need at least 3.3.0." >&4 else val="$define" echo "Good, you have SQLite $version." $cat <<'EOM' For more information, see http://www.sqlite.org/. EOM fi esac set d_sqlite eval $setvar : see if srandom exists set srandom d_srandom eval $inlibc : see which of string.h or strings.h is needed echo " " strings=`./findhdr string.h` if $test "$strings" && $test -r "$strings"; then echo "Using instead of ." >&4 val="$define" else val="$undef" strings=`./findhdr strings.h` if $test "$strings" && $test -r "$strings"; then echo "Using instead of ." >&4 else ./warn "No string header found -- You'll surely have problems." fi fi set i_string eval $setvar case "$i_string" in "$undef") strings=`./findhdr strings.h`;; *) strings=`./findhdr string.h`;; esac : index or strchr echo " " if set index val -f; eval $csym; $val; then if set strchr val -f d_strchr; eval $csym; $val; then if $contains strchr "$strings" >/dev/null 2>&1 ; then val="$define" vali="$undef" echo "strchr() found." >&4 else val="$undef" vali="$define" echo "index() found." >&4 fi else val="$undef" vali="$define" echo "index() found." >&4 fi else if set strchr val -f d_strchr; eval $csym; $val; then val="$define" vali="$undef" echo "strchr() found." >&4 else echo "No index() or strchr() found!" >&4 val="$undef" vali="$undef" fi fi set d_strchr; eval $setvar val="$vali" set d_index; eval $setvar : see if strlcat exists set strlcat d_strlcat eval $inlibc : see if strlcpy exists set strlcpy d_strlcpy eval $inlibc : see if sysctl exists set sysctl d_sysctl eval $inlibc : define an is-a-typedef? function typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; case "$inclist" in "") inclist="sys/types.h";; esac; eval "varval=\$$var"; case "$varval" in "") $rm -f temp.c; for inc in $inclist; do echo "#include <$inc>" >>temp.c; done; $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; if $contains $type temp.E >/dev/null 2>&1; then eval "$var=\$type"; else eval "$var=\$def"; fi; $rm -f temp.?;; *) eval "$var=\$varval";; esac' : see if this is a sys/times.h system set sys/times.h i_systimes eval $inhdr : see if times exists echo " " if set times val -f d_times; eval $csym; $val; then echo 'times() found.' >&4 d_times="$define" inc='' case "$i_systimes" in "$define") inc='sys/times.h';; esac set clock_t clocktype long stdio.h sys/types.h $inc eval $typedef dflt="$clocktype" echo " " rp="What type is returned by times() on this system?" . ./myread clocktype="$ans" else echo 'times() NOT found, hope that will do.' >&4 d_times="$undef" clocktype='int' fi : see if we have to deal with yellow pages, now NIS. if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then if $test -f /usr/etc/nibindd; then echo " " echo "I'm fairly confident you're on a NeXT." echo " " rp='Do you get the hosts file via NetInfo?' dflt=y case "$hostcat" in nidump*) ;; '') ;; *) dflt=n;; esac . ./myread case "$ans" in y*) hostcat='nidump hosts .';; *) case "$hostcat" in nidump*) hostcat='';; esac ;; esac fi case "$hostcat" in nidump*) ;; *) case "$hostcat" in *ypcat*) dflt=y;; '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then dflt=y else dflt=n fi;; *) dflt=n;; esac echo " " rp='Are you getting the hosts file via yellow pages?' . ./myread case "$ans" in y*) hostcat='ypcat hosts';; *) hostcat='cat /etc/hosts';; esac ;; esac fi case "$hostcat" in '') hostcat=':' $test -f /etc/hosts && hostcat='cat /etc/hosts';; esac case "$groupcat" in '') groupcat=':' $test -f /etc/group && groupcat='cat /etc/group';; esac case "$passcat" in '') passcat=':' $test -f /etc/passwd && passcat='cat /etc/passwd';; esac : now get the host name echo " " echo "Figuring out host name..." >&4 case "$myhostname" in '') cont=true echo 'Maybe "hostname" will work...' if tans=`sh -c hostname 2>&1` ; then myhostname=$tans phostname=hostname cont='' fi ;; *) cont='';; esac if $test "$cont"; then if ./xenix; then echo 'Oh, dear. Maybe "/etc/systemid" is the key...' if tans=`cat /etc/systemid 2>&1` ; then myhostname=$tans phostname='cat /etc/systemid' echo "Whadyaknow. Xenix always was a bit strange..." cont='' fi elif $test -r /etc/systemid; then echo "(What is a non-Xenix system doing with /etc/systemid?)" fi fi if $test "$cont"; then echo 'No, maybe "uuname -l" will work...' if tans=`sh -c 'uuname -l' 2>&1` ; then myhostname=$tans phostname='uuname -l' else echo 'Strange. Maybe "uname -n" will work...' if tans=`sh -c 'uname -n' 2>&1` ; then myhostname=$tans phostname='uname -n' else echo 'Oh well, maybe I can mine it out of whoami.h...' if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" else case "$myhostname" in '') echo "Does this machine have an identity crisis or something?" phostname='';; *) echo "Well, you said $myhostname before..." phostname='echo $myhostname';; esac fi fi fi fi case "$myhostname" in '') myhostname=noname ;; esac : you do not want to know about this set $myhostname myhostname=$1 : verify guess if $test "$myhostname" ; then dflt=y rp='Your host name appears to be "'$myhostname'".'" Right?" . ./myread case "$ans" in y*) ;; *) myhostname='';; esac fi : bad guess or no guess while $test "X$myhostname" = X ; do dflt='' rp="Please type the (one word) name of your host:" . ./myread myhostname="$ans" done : translate upper to lower if necessary case "$myhostname" in *[A-Z]*) echo "(Normalizing case in your host name)" myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'` ;; esac : a little sanity check here case "$phostname" in '') ;; *) case `$phostname | ./tr '[A-Z]' '[a-z]'` in $myhostname$mydomain|$myhostname) ;; *) case "$phostname" in sed*) echo "(That doesn't agree with your whoami.h file, by the way.)" ;; *) echo "(That doesn't agree with your $phostname command, by the way.)" ;; esac ;; esac ;; esac : see how we will look up host name echo " " if false; then : dummy stub to allow use of elif elif set uname val -f d_uname; eval $csym; $val; then if ./xenix; then $cat <<'EOM' uname() was found, but you're running xenix, and older versions of xenix have a broken uname(). If you don't really know whether your xenix is old enough to have a broken system call, use the default answer. EOM dflt=y case "$d_uname" in "$define") dflt=n;; esac rp='Is your uname() broken?' . ./myread case "$ans" in n*) d_uname="$define"; call=uname;; esac else echo 'uname() found.' >&4 d_uname="$define" call=uname fi fi case "$d_gethname" in '') d_gethname="$undef";; esac case "$d_uname" in '') d_uname="$undef";; esac case "$d_phostname" in '') d_phostname="$undef";; esac : see if usleep exists set usleep d_usleep eval $inlibc : check for volatile keyword echo " " echo 'Checking to see if your C compiler knows about "volatile"...' >&4 $cat >try.c <<'EOCP' int main() { typedef struct _goo_struct goo_struct; goo_struct * volatile goo = ((goo_struct *)0); struct _goo_struct { long long_int; int reg_int; char char_var; }; typedef unsigned short foo_t; char *volatile foo; volatile int bar; volatile foo_t blech; foo = foo; } EOCP if $cc -c $ccflags try.c >/dev/null 2>&1 ; then val="$define" echo "Yup, it does." else val="$undef" echo "Nope, it doesn't." fi set d_volatile eval $setvar $rm -f try.* : see if vsnprintf exists set vsnprintf d_vsnprintf eval $inlibc : preserve RCS keywords in files with variable substitution, grrr Id='$Id' : see if this is a unistd.h system set unistd.h i_unistd eval $inhdr : determine how to compile for large 64-bit file support echo " " echo "Checking whether we need flags for large file support..." >&4 $cat >try.c <<'EOC' #include #ifdef I_UNISTD #include #endif int main(void) { switch (0) { case 0: case (sizeof(off_t) >= 8): break; } return 0; } EOC flags='' large='-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' case "$i_unistd" in "$define") flags='-DI_UNISTD';; esac if $cc $ccflags $flags $ldflags -o try try.c >/dev/null 2>&1; then echo "Selected C flags already provide 64-bit file support." else echo "You're not natively compiling for large file, fixing..." >&4 if $cc $ccflags $flags $large $ldflags -o try try.c >/dev/null 2>&1 then echo "(Adding $large)"; ccflags="$ccflags $large" else echo "(Could not compile the test program, using 32-bit files)" >&4 fi fi : check for alignment requirements echo " " case "$alignbytes" in '') echo "Checking alignment constraints..." >&4 $cat >try.c <<'EOCP' struct foobar { char foo; double bar; } try; int main() { printf("%d\n", (char *)&try.bar - (char *)&try.foo); } EOCP if $cc $ccflags try.c -o try >/dev/null 2>&1; then dflt=`./try` else dflt='8' echo "(I can't seem to compile the test program...)" fi ;; *) dflt="$alignbytes" ;; esac rp="Doubles must be aligned on a how-many-byte boundary?" . ./myread alignbytes="$ans" $rm -f try.c try : how do we catenate cpp tokens here? echo " " echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 cpp_quote='' $cat >cpp_stuff.c <<'EOCP' #define RCAT(a,b)a/**/b #define ACAT(a,b)a ## b RCAT(Rei,ser) ACAT(Cir,cus) EOCP $cppstdin $cppflags $cppminus cpp_stuff.out 2>&1 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then echo "Oh! Smells like ANSI's been here." echo "We can catify or stringify, separately or together!" cpp_stuff=42 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then echo "Ah, yes! The good old days!" cpp_stuff=1 $cat >cpp_stuff.c <<'EOCP' #define SQuoTe(a)"a #define EQuoTe(a)a" #define CAT2(a,b)EQuoTe(SQuoTe(a)b) CAT2(Vic,tory) EOCP $cppstdin $cppflags $cppminus cpp_stuff.out 2>&1 if $contains '"Victory"' cpp_stuff.out >/dev/null 2>&1; then echo "I'll resort to a cute trick to also be able to stringify." cpp_quote='"' else $cat <$$.tmp 2>/dev/null if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then echo "You have int (*signal())() instead of void." >&4 val="$undef" elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then echo "You have void (*signal())() instead of int." >&4 val="$define" elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then echo "You have int (*signal())() instead of void." >&4 val="$undef" else case "$d_voidsig" in '') echo "I can't determine whether signal handler returns void or int..." >&4 dflt=void rp="What type does your signal handler return?" . ./myread case "$ans" in v*) val="$define";; *) val="$undef";; esac;; "$define") echo "As you already told me, signal handler returns void." >&4;; *) echo "As you already told me, signal handler returns int." >&4;; esac fi set d_voidsig eval $setvar case "$d_voidsig" in "$define") signal_t="void";; *) signal_t="int";; esac $rm -f $$.tmp : check for non-blocking I/O stuff case "$h_sysfile" in true) echo "#include " > head.c;; *) case "$h_fcntl" in true) echo "#include " > head.c;; *) echo "#include " > head.c;; esac ;; esac echo " " echo "Figuring out the flag used by open() for non-blocking I/O..." >&4 case "$o_nonblock" in '') $cat head.c > try.c $cat >>try.c <<'EOCP' int main() { #ifdef O_NONBLOCK printf("O_NONBLOCK\n"); exit(0); #endif #ifdef O_NDELAY printf("O_NDELAY\n"); exit(0); #endif #ifdef FNDELAY printf("FNDELAY\n"); exit(0); #endif exit(0); } EOCP if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then o_nonblock=`./try` case "$o_nonblock" in '') echo "I can't figure it out, assuming O_NONBLOCK will do.";; *) echo "Seems like we can use $o_nonblock.";; esac else echo "(I can't compile the test program; pray O_NONBLOCK is right!)" fi ;; *) echo "Using $hint value $o_nonblock.";; esac $rm -f try try.* .out core echo " " echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4 case "$eagain" in '') $cat head.c > try.c $cat >>try.c < #include #include #define MY_O_NONBLOCK $o_nonblock extern int errno; $signal_t blech(x) int x; { exit(3); } EOCP $cat >> try.c <<'EOCP' int main() { int pd[2]; int pu[2]; char buf[1]; char string[100]; pipe(pd); /* Down: child -> parent */ pipe(pu); /* Up: parent -> child */ if (0 != fork()) { int ret; close(pd[1]); /* Parent reads from pd[0] */ close(pu[0]); /* Parent writes (blocking) to pu[1] */ if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK)) exit(1); signal(SIGALRM, blech); alarm(5); if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */ exit(2); sprintf(string, "%d\n", ret); write(2, string, strlen(string)); alarm(0); #ifdef EAGAIN if (errno == EAGAIN) { printf("EAGAIN\n"); goto ok; } #endif #ifdef EWOULDBLOCK if (errno == EWOULDBLOCK) printf("EWOULDBLOCK\n"); #endif ok: write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */ sleep(2); /* Give it time to close our pipe */ alarm(5); ret = read(pd[0], buf, 1); /* Should read EOF */ alarm(0); sprintf(string, "%d\n", ret); write(3, string, strlen(string)); exit(0); } close(pd[0]); /* We write to pd[1] */ close(pu[1]); /* We read from pu[0] */ read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */ close(pd[1]); /* Pipe pd is now fully closed! */ exit(0); /* Bye bye, thank you for playing! */ } EOCP if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then echo "$startsh" >mtry echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry chmod +x mtry ./mtry >/dev/null 2>&1 case $? in 0) eagain=`$cat try.out`;; 1) echo "Could not perform non-blocking setting!";; 2) echo "I did a successful read() for something that was not there!";; 3) echo "Hmm... non-blocking I/O does not seem to be working!";; *) echo "Something terribly wrong happened during testing.";; esac rd_nodata=`$cat try.ret` echo "A read() system call with no data present returns $rd_nodata." case "$rd_nodata" in 0|-1) ;; *) echo "(That's peculiar, fixing that to be -1.)" rd_nodata=-1 ;; esac case "$eagain" in '') echo "Forcing errno EAGAIN on read() with no data available." eagain=EAGAIN ;; *) echo "Your read() sets errno to $eagain when no data is available." ;; esac status=`$cat try.err` case "$status" in 0) echo "And it correctly returns 0 to signal EOF.";; -1) echo "But it also returns -1 to signal EOF, so be careful!";; *) echo "However, your read() returns '$status' on EOF??";; esac val="$define" if test "$status" = "$rd_nodata"; then ./warn "your read() can't distinguish between EOF and no data!" val="$undef" fi else echo "I can't compile the test program--assuming errno EAGAIN will do." eagain=EAGAIN fi set d_eofnblk eval $setvar ;; *) echo "Using $hint value $eagain." echo "Your read() returns $rd_nodata when no data is present." case "$d_eofnblk" in "$define") echo "And you can see EOF because read() returns 0.";; "$undef") echo "But you can't see EOF status from read() returned value.";; *) echo "(Assuming you can't see EOF status from read anyway.)" d_eofnblk=$undef ;; esac ;; esac $rm -f try try.* .out core head.c mtry : derive which glade to use based on the configured GTK+ echo " " case "$gtkversion" in 2) glade=glade-2;; *) glade=glade;; esac echo "Compiling for GTK $gtkversion: we'll use '$glade'." >&4 : how can we find information about glib? echo " " echo "Checking how we can gather information about glib..." >&4 d_glib="$undef" if pkg-config $glibpackage --cflags >/dev/null 2>&1; then glibconfig="pkg-config $glibpackage" modver=--modversion elif glib-config --cflags >/dev/null 2>&1; then glibconfig='glib-config' modver=--version else echo "You've got problems! Do you have glib installed?" >&4 glibconfig='false' modver='' fi echo "(I'll use '$glibconfig' to gather that information.)" glibcflags=`$glibconfig --cflags` glibldflags=`$glibconfig --libs` version=`$glibconfig $modver` echo " " echo "Checking whether glib.h can be compiled against..." $cat >try.c < #ifndef GLIB_MAJOR_VERSION #error "glib.h not found?" EOC case "$d_headless" in "$define") ;; *) $cat >>try.c <>try.c <= 2 #include #endif int main(void) { gpointer p; #if $glibversion >= 2 p = g_object_new(G_TYPE_OBJECT, "blah", (void *) 0); #else p = g_malloc(23); #endif if (!p) return 1; return 0; } EOC if $cc -o try try.c $ccflags $ldflags $glibcflags $glibldflags >/dev/null 2>&1; then d_glib="$define" echo "We'll be using glib version $version." else ./warn "Cannot compile against glib version '$version'" fi $rm -f try try.c : how can we find information about GTK? d_gtk="$undef" case "$d_headless" in "$define") gtkcflags="$glibcflags" gtkldflags="$glibldflags" ;; *) echo " " echo "Checking how we can gather information about GTK+..." >&4 if pkg-config $gtkpackage --cflags >/dev/null 2>&1; then gtkconfig="pkg-config $gtkpackage" modver=--modversion elif gtk-config --cflags >/dev/null 2>&1; then gtkconfig='gtk-config' modver=--version else echo "You've got problems! Do you have GTK+ installed?" >&4 gtkconfig='false' modver='' fi echo "(I'll use '$gtkconfig' to gather that information.)" version=`$gtkconfig $modver` case "$gtkversion" in 1) case "$version" in 1.*) vint=`echo $version | $awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'` if test 0$vint -lt 10210; then echo "Sorry, you have GTK+ $version, I need at least 1.2.10." >&4 exit 1; else echo "OK, you have GTK+ $version" fi ;; *) ./warn "you asked for GTK+ $gtkversion, I found $version";; esac ;; 2) case "$version" in 2.*) vint=`echo $version | $awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'` if test 0$vint -lt 20201; then echo "Sorry, you have GTK+ $version, I need at least 2.2.1." >&4 exit 1; else echo "OK, you have GTK+ $version" fi ;; *) ./warn "you asked for GTK+ $gtkversion, I found $version";; esac ;; *) echo "Sorry, I don't know anything about GTK+ $version." >&4 exit 1 ;; esac gtkcflags=`$gtkconfig --cflags` gtkldflags=`$gtkconfig --libs` missing=false allok=true for flag in "$glibcflags"; do case "$gtkcflags" in *"$flag"*) ;; *) missing=true; break;; esac done if $missing; then echo "(Some glib C flags are missing from GTK+ flags, adding all of them.)" gtkcflags="$gtkcflags $glibcflags" allok=false fi missing=false for flag in "$glibldflags"; do case "$gtkldflags" in *"$flag"*) ;; *) missing=true; break;; esac done if $missing; then echo "(Some glib ld flags are missing from GTK+ flags, adding all of them.)" gtkldflags="$gtkldflags $glibldflags" allok=false fi if $allok; then echo "Good, all the cc and ld flags from glib are included in GTK+ flags." fi ;; esac case "$d_headless" in "$undef") echo "Checking whether Gtk+ can be compiled against..." $cat >try.c < #include #include int main(void) { GtkWidget *window; gpointer p; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (!window) return 1; p = g_malloc(23); if (!p) return 1; return 0; } EOC if $cc -o try try.c $ccflags $ldflags $gtkcflags $gtkldflags >/dev/null 2>&1; then d_gtk="$define" echo "We'll be using Gtk+ version $version." else ./warn "Cannot compile against Gtk+ version '$version'" fi $rm -f try try.c ;; esac : determine our version number echo " " echo "Figuring out my version number..." >&4 $grep '^#define GTA' $rsrc/src/common.h | $grep -v GTA_INTERFACE >ver.c $cat >>ver.c <<'EOM' #include int main() { #if defined(GTA_PATCHLEVEL) && (GTA_PATCHLEVEL != 0) printf("%d.%d.%d%s\n", GTA_VERSION, GTA_SUBVERSION, GTA_PATCHLEVEL, GTA_REVCHAR); #else printf("%d.%d%s\n", GTA_VERSION, GTA_SUBVERSION, GTA_REVCHAR); #endif return 0; } EOM $cc -o ver ver.c gtkgversion=`./ver` echo "(You have version $gtkgversion.)" $rm -f ver.c ver : locate a BSD compatible install program echo " " echo "Looking for a BSD-compatible install program..." >&4 creatdir='' case "$install" in '') tryit='' for dir in $pth; do for file in ginstall installbsd scoinst install; do if $test -f $dir/$file; then tryit="$tryit $dir/$file" fi done done $cat >try.c </dev/null 2>&1; then cp try try.ns strip try >/dev/null 2>&1 else echo "(I can't seem to compile a trivial C program -- bypassing.)" echo "try" >try cp try try.ns fi $cat >tryinst </dev/null 2>&1 if $test -d foo/bar; then creatdir="$prog -d" fi (ls -l d/try >try.ls; ls -l d/try.ns >tryno.ls) 2>/dev/null if (cmp -s d/try try && cmp -s d/try.ns try.ns && \ $contains 'rwxrw-r--' tryno.ls && \ $contains 'rw-r---w-' try.ls) >/dev/null 2>&1 then dflt="$prog" echo "ok, that will do." break fi echo "not good$either." either=' either' $rm -f try*.ls done $rm -rf foo d tryinst try try*.ls try.* case "$dflt" in '') echo "Hopefully, $package comes with its own install script!" dflt='./install' ;; esac ;; *) dflt="$install";; esac $cat <&4 case "$installdir" in '') $mkdir -p foo/bar >/dev/null 2>&1 if $test -d foo/bar; then echo "Great, we can build them using 'mkdir -p'." creatdir='mkdir -p' else case "$creatdir" in '') if eval "$install -d foo/bar"; $test -d foo/bar; then creatdir="install -d" echo "It looks like '$creatdir' will do it for us." fi ;; *) eval "$creatdir foo/bar" >/dev/null 2>&1 if $test -d foo/bar; then echo "Ah! We can use '$creatdir' to do just that." else creatdir='' fi ;; esac fi $rm -rf foo case "$creatdir" in '') echo "Heck! Another ancient system lacking the comfort of modern ones!" echo "You can thank $package for bringing you its own install script!" installdir='./install -d' ;; *) installdir="$creatdir";; esac ;; *) echo "As you already told me, '$installdir' should work.";; esac : see what memory models we can support case "$models" in '') $cat >pdp11.c <<'EOP' int main() { #ifdef pdp11 exit(0); #else exit(1); #endif } EOP case "$cc" in '') modelcc="$cc" ;; *) modelcc="cc" ;; esac ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1 if $test -f pdp11 && ./pdp11 2>/dev/null; then dflt='unsplit split' else tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` case "$tans" in X) dflt='none';; *) if $test -d /lib/small || $test -d /usr/lib/small; then dflt='small' else dflt='' fi if $test -d /lib/medium || $test -d /usr/lib/medium; then dflt="$dflt medium" fi if $test -d /lib/large || $test -d /usr/lib/large; then dflt="$dflt large" fi if $test -d /lib/huge || $test -d /usr/lib/huge; then dflt="$dflt huge" fi esac fi;; *) dflt="$models";; esac $cat </dev/null 2>&1 || \ $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then dflt='-i' else dflt='none' fi;; *) dflt="$split";; esac rp="What flag indicates separate I and D space?" . ./myread tans="$ans" case "$tans" in none) tans='';; esac split="$tans" unsplit='';; *large*|*small*|*medium*|*huge*) case "$models" in *large*) case "$large" in '') dflt='-Ml';; *) dflt="$large";; esac rp="What flag indicates large model?" . ./myread tans="$ans" case "$tans" in none) tans=''; esac large="$tans";; *) large='';; esac case "$models" in *huge*) case "$huge" in '') dflt='-Mh';; *) dflt="$huge";; esac rp="What flag indicates huge model?" . ./myread tans="$ans" case "$tans" in none) tans=''; esac huge="$tans";; *) huge="$large";; esac case "$models" in *medium*) case "$medium" in '') dflt='-Mm';; *) dflt="$medium";; esac rp="What flag indicates medium model?" . ./myread tans="$ans" case "$tans" in none) tans=''; esac medium="$tans";; *) medium="$large";; esac case "$models" in *small*) case "$small" in '') dflt='none';; *) dflt="$small";; esac rp="What flag indicates small model?" . ./myread tans="$ans" case "$tans" in none) tans=''; esac small="$tans";; *) small='';; esac ;; *) ./warn "Unrecognized memory models--you may have to edit Makefile.SH" ;; esac $rm -f pdp11.* pdp11 : check whether make sets MAKE echo " " echo "Checking if your $make program sets \$(MAKE)..." >&4 case "$make_set_make" in '') $sed 's/^X //' > testmake.mak << 'EOF' Xall: X @echo 'maketemp="$(MAKE)"' EOF case "`$make -f testmake.mak 2>/dev/null`" in *maketemp=*) make_set_make='#' ;; *) make_set_make="MAKE=$make" ;; esac $rm -f testmake.mak ;; esac case "$make_set_make" in '#') echo "Yup, it does.";; *) echo "Nope, it doesn't.";; esac : find out how to generate dependencies echo " " echo "Checking how to generate makefile dependencies on your machine..." >&4 toplev=`cd ..;pwd` $cat >dep.c <<'EOCP' #include "dep.h" EOCP $cat >dep.h <<'EOCP' EOCP takeflags='flags="" case "$@" in *--*) for arg do shift case "$arg" in --) break;; *) flags="$flags $arg";; esac done;; esac' case "$mkdep" in '') ;; *) if test -f "$mkdep" && $mkdep dep.c >dep.out 2>/dev/null && $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 then echo "$mkdep works." case "$mkdep" in "$pkgsrc/mkdep");; *) echo "(copying it to $pkgsrc)" cp $mkdep $pkgsrc/mkdep 2>/dev/null if $pkgsrc/mkdep dep.c >dep.out 2>/dev/null && $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1; then mkdep=$pkgsrc/mkdep else echo "Hmm... The copy failed or something... Guessing again..." mkdep= fi ;; esac else mkdep= fi esac case "$mkdep" in '') $spitshell > ../mkdep </dev/null done exit 0 EOM mkdep=$toplev/mkdep chmod +x $mkdep $eunicefix $mkdep if $mkdep dep.c >dep.out 2>/dev/null && $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 then echo "Looks like we can use $cpp -M." else mkdep= fi ;; esac case "$mkdep" in '') $spitshell > ../mkdep </dev/null done exit 0 EOM mkdep=$toplev/mkdep chmod +x $mkdep $eunicefix $mkdep if $mkdep dep.c >dep.out 2>/dev/null && $contains "dep$_o: dep.h" dep.out >/dev/null 2>&1 then echo "Looks like we can use $cc -MM." else mkdep= fi ;; esac case "$mkdep" in '') $spitshell >../mkdep </dev/null | \\ $sed -e '/^# *[0-9]/!d' \\ -e 's/^.*"\(.*\)".*\$/'\$filebase'$_o: \1/' \\ -e 's|: \./|: |' \\ -e 's|: *$|: '\$srcfile'|' | \\ $grep -v '^#' | $sort | $uniq done exit 0 EOS mkdep=$toplev/mkdep chmod +x $mkdep $eunicefix $mkdep if $mkdep dep.c >dep.out 2>/dev/null && $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 then echo "A shell script using $cpp does the trick." else echo "$cpp doesn't seem to be any use at all." $spitshell >../mkdep </ d' \\ -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\ -e "s/\\.c:/$_o:/p" > /tmp/mkdep\$\$ IFS=': ' while read file dep; do for dir in \$inc; do if $test -f "\$dir/\$dep"; then dep="\$dir/\$dep" break fi done echo "\$file: \$dep" | $sed -e 's,: \./,: ,' done dep.out 2>/dev/null && $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 then cat << EOM I can use a script with grep instead, but it will make some incorrect dependencies, since it doesn't understand about conditional compilation. Moreover, some dependencies may be missing, because scanning won't be a recursive process. If you have a program which generates makefile dependencies, you may want to use it. If not, you can use the script and edit the Makefile by hand if you need to. EOM else mkdep= cat << EOM I can't seem to generate makefile dependencies at all! Perhaps you have a program that does? If you don't, you might look at the mkdep script to see if you can create one which works. EOM fi fi esac echo " " dflt="$mkdep" fn=f~/ rp="Name of program to make makefile dependencies?" . ./getfile mkdep="$ans" $rm -f dep.c dep.h dep$_o dep.out : check whether msgmerge supports --update echo " " echo "Let's see whether your $msgmerge supports the --update flag..." >&4 $msgmerge --help | $grep -- --update >msghelp if $contains update msghelp >/dev/null 2>&1; then echo "Good, it does." msgmerge_update="$msgmerge --update" else echo "Sorry, it does not: we'll try to do without it." msgmerge_update=":" fi $rm -f msghelp : Cruising for prototypes echo " " echo "Checking out function prototypes..." >&4 $cat >prototype.c <<'EOCP' main(int argc, char *argv[]) { exit(0);} EOCP if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then echo "Your C compiler appears to support function prototypes." val="$define" else echo "Your C compiler doesn't seem to understand function prototypes." val="$undef" fi set prototype eval $setvar $rm -f prototype* : see if ar generates random libraries by itself echo " " echo "Checking how to generate random libraries on your machine..." >&4 echo 'int bar1() { return bar2(); }' > bar1.c echo 'int bar2() { return 2; }' > bar2.c $cat > foo.c <<'EOP' int main() { printf("%d\n", bar1()); exit(0); } EOP $cc $ccflags -c bar1.c >/dev/null 2>&1 $cc $ccflags -c bar2.c >/dev/null 2>&1 $cc $ccflags -c foo.c >/dev/null 2>&1 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 && ./foobar >/dev/null 2>&1; then echo "ar appears to generate random libraries itself." orderlib=false ranlib=":" elif $ar ts bar$_a >/dev/null 2>&1 && $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 && ./foobar >/dev/null 2>&1; then echo "a table of contents needs to be added with 'ar ts'." orderlib=false ranlib="$ar ts" else case "$ranlib" in :) ranlib='';; '') ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin` $test -f $ranlib || ranlib='' ;; esac if $test -n "$ranlib"; then echo "your system has '$ranlib'; we'll use that." orderlib=false else echo "your system doesn't seem to support random libraries" echo "so we'll use lorder and tsort to order the libraries." orderlib=true ranlib=":" fi fi $rm -f foo* bar* : check for void type echo " " echo "Checking to see how well your C compiler groks the void type..." >&4 $cat >flags <try.c <<'EOCP' #if TRY & 1 void sub() { #else sub() { #endif extern void moo(); /* function returning void */ void (*goo)(); /* ptr to func returning void */ #if TRY & 8 void *hue; /* generic ptr */ #endif #if TRY & 2 void (*foo[10])(); #endif #if TRY & 4 if(goo == moo) { exit(0); } #endif exit(0); } int main() { sub(); } EOCP if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then voidflags=$defvoidused echo "Good. It appears to support void to the level $package wants." if $contains warning .out >/dev/null 2>&1; then echo "However, you might get some warnings that look like this:" $sed -e 's/^/ /' .out fi else echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4 $cat >&4 flags $rm -f flags if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then echo "It supports 1..." if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then echo "It also supports 2..." if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then voidflags=7 echo "And it supports 4 but not 8 definitely." else echo "It doesn't support 4..." if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then voidflags=11 echo "But it supports 8." else voidflags=3 echo "Neither does it support 8." fi fi else echo "It does not support 2..." if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then voidflags=13 echo "But it supports 4 and 8." else if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then voidflags=5 echo "And it supports 4 but has not heard about 8." else echo "However it supports 8 but not 4." fi fi fi else echo "There is no support at all for void." voidflags=0 fi fi esac case "$voidflags" in "$defvoidused") echo "Good. I already know it supports void to the level $package wants." ;; *) dflt="$voidflags"; test -f flags && $cat flags rp="Your void support flags add up to what?" . ./myread voidflags="$ans" ;; esac $rm -f try.* .out flags : determine compiler compiler echo " " comp='yacc' if $test -f "$byacc$_exe"; then comp="byacc or $comp" fi if $test -f "$bison$_exe"; then comp="$comp or bison -y" fi case "$yacc" in '') yacc=`./loc yacc yacc $pth` if $test -f "$yacc$_exe"; then dflt='yacc' elif $test -f "$byacc$_exe"; then dflt='byacc' elif $test -f "$bison$_exe"; then dflt='bison' else dflt='' fi ;; *) dflt="$yacc";; esac rp="Which compiler compiler ($comp) shall I use?" . ./myread yacc="$ans" case "$yacc" in *bis*) case "$yacc" in *-y*) ;; *) yacc="$yacc -y" echo "(Adding -y option to bison to get yacc-compatible behaviour.)" ;; esac ;; esac : see if we need extra yacc flags dflt="$yaccflags" case "$dflt" in '') dflt=none;; esac $cat < found." >&4 else val="$undef" if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then echo " found." >&4 echo " " else xinc=`./findhdr sys/ndir.h` fi echo " NOT found." >&4 fi set i_dirent eval $setvar : see if this is a sys/file.h system val='' set sys/file.h val eval $inhdr : do we need to include sys/file.h ? case "$val" in "$define") echo " " if $h_sysfile; then val="$define" echo "We'll be including ." >&4 else val="$undef" echo "We won't be including ." >&4 fi ;; *) h_sysfile=false ;; esac set i_sysfile eval $setvar : see if fcntl.h is there val='' set fcntl.h val eval $inhdr : see if we can include fcntl.h case "$val" in "$define") echo " " if $h_fcntl; then val="$define" echo "We'll be including ." >&4 else val="$undef" if $h_sysfile; then echo "We don't need to include if we include ." >&4 else echo "We won't be including ." >&4 fi fi ;; *) h_fcntl=false val="$undef" ;; esac set i_fcntl eval $setvar : see if this is a ifaddrs.h system set ifaddrs.h i_ifaddrs eval $inhdr : see if this is a inttypes.h system set inttypes.h i_inttypes eval $inhdr : see if this is a invent.h system set invent.h i_invent eval $inhdr : see if this is a langinfo system set langinfo.h i_langinfo eval $inhdr : see if this is a libcharset system set libcharset.h i_libcharset eval $inhdr : see if this is a netdb.h system set netdb.h i_netdb eval $inhdr : see if this is a pwd.h system set pwd.h i_pwd eval $inhdr case "$i_pwd" in $define) xxx=`./findhdr pwd.h` $cppstdin $cppflags $cppminus < $xxx >$$.h if $contains 'pw_quota' $$.h >/dev/null 2>&1; then val="$define" else val="$undef" fi set d_pwquota eval $setvar if $contains 'pw_age' $$.h >/dev/null 2>&1; then val="$define" else val="$undef" fi set d_pwage eval $setvar if $contains 'pw_change' $$.h >/dev/null 2>&1; then val="$define" else val="$undef" fi set d_pwchange eval $setvar if $contains 'pw_class' $$.h >/dev/null 2>&1; then val="$define" else val="$undef" fi set d_pwclass eval $setvar if $contains 'pw_expire' $$.h >/dev/null 2>&1; then val="$define" else val="$undef" fi set d_pwexpire eval $setvar if $contains 'pw_comment' $$.h >/dev/null 2>&1; then val="$define" else val="$undef" fi set d_pwcomment eval $setvar $rm -f $$.h ;; *) val="$undef"; set d_pwquota; eval $setvar set d_pwage; eval $setvar set d_pwchange; eval $setvar set d_pwclass; eval $setvar set d_pwexpire; eval $setvar set d_pwcomment; eval $setvar ;; esac : see if regex is available set regex.h i_regex eval $inhdr : see if stdarg is available echo " " if $test `./findhdr stdarg.h`; then echo " found." >&4 valstd="$define" else echo " NOT found." >&4 valstd="$undef" fi : see if varags is available echo " " if $test `./findhdr varargs.h`; then echo " found." >&4 else echo " NOT found, but that's ok (I hope)." >&4 fi : set up the varargs testing programs $cat > varargs.c < #endif #ifdef I_VARARGS #include #endif #ifdef I_STDARG int f(char *p, ...) #else int f(va_alist) va_dcl #endif { va_list ap; #ifndef I_STDARG char *p; #endif #ifdef I_STDARG va_start(ap,p); #else va_start(ap); p = va_arg(ap, char *); #endif va_end(ap); } EOP $cat > varargs </dev/null 2>&1; then echo "true" else echo "false" fi $rm -f varargs$_o EOP chmod +x varargs : now check which varargs header should be included echo " " i_varhdr='' case "$valstd" in "$define") if `./varargs I_STDARG`; then val='stdarg.h' elif `./varargs I_VARARGS`; then val='varargs.h' fi ;; *) if `./varargs I_VARARGS`; then val='varargs.h' fi ;; esac case "$val" in '') ./warn "I could not find the definition for va_dcl... You have problems..." val="$undef"; set i_stdarg; eval $setvar val="$undef"; set i_varargs; eval $setvar ;; *) set i_varhdr eval $setvar case "$i_varhdr" in stdarg.h) val="$define"; set i_stdarg; eval $setvar val="$undef"; set i_varargs; eval $setvar ;; varargs.h) val="$undef"; set i_stdarg; eval $setvar val="$define"; set i_varargs; eval $setvar ;; esac echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;; esac $rm -f varargs* : see if stdlib is available set stdlib.h i_stdlib eval $inhdr : see if sys/mman.h has to be included set sys/mman.h i_sysmman eval $inhdr : see if this is a sys/param system set sys/param.h i_sysparam eval $inhdr : see if sys/resource.h has to be included set sys/resource.h i_sysresrc eval $inhdr : see if this is a sys/sendfile system set sys/sendfile.h i_syssendfile eval $inhdr : see if this is a sys/socket.h system set sys/socket.h i_syssock eval $inhdr : see if sys/stat.h is available set sys/stat.h i_sysstat eval $inhdr : see if this is a sys/sysctl system set sys/sysctl.h i_syssysctl eval $inhdr : see if we should include time.h, sys/time.h, or both echo " " echo "Testing to see if we should include , or both." >&4 $echo $n "I'm now running the test program...$c" $cat >try.c <<'EOCP' #include #ifdef I_TIME #include #endif #ifdef I_SYSTIME #ifdef SYSTIMEKERNEL #define KERNEL #endif #include #endif #ifdef I_SYSSELECT #include #endif int main() { struct tm foo; #ifdef S_TIMEVAL struct timeval bar; #endif #ifdef S_TIMEZONE struct timezone tzp; #endif if (foo.tm_sec == foo.tm_sec) exit(0); #ifdef S_TIMEVAL if (bar.tv_sec == bar.tv_sec) exit(0); #endif exit(1); } EOCP flags='' for s_timezone in '-DS_TIMEZONE' ''; do sysselect='' for s_timeval in '-DS_TIMEVAL' ''; do for i_systimek in '' '-DSYSTIMEKERNEL'; do for i_time in '' '-DI_TIME'; do for i_systime in '-DI_SYSTIME' ''; do case "$flags" in '') $echo $n ".$c" if $cc $ccflags \ $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ -o try try.c >/dev/null 2>&1 ; then set X $i_time $i_systime $i_systimek $sysselect $s_timeval shift flags="$*" echo " " $echo $n "Succeeded with $flags$c" fi ;; esac done done done done done timeincl='' echo " " case "$flags" in *SYSTIMEKERNEL*) i_systimek="$define" timeincl=`./findhdr sys/time.h` echo "We'll include with KERNEL defined." >&4;; *) i_systimek="$undef";; esac case "$flags" in *I_TIME*) i_time="$define" timeincl=`./findhdr time.h`" $timeincl" echo "We'll include ." >&4;; *) i_time="$undef";; esac case "$flags" in *I_SYSTIME*) i_systime="$define" timeincl=`./findhdr sys/time.h`" $timeincl" echo "We'll include ." >&4;; *) i_systime="$undef";; esac $rm -f try.c try : see if sys/types.h has to be included set sys/types.h i_systypes eval $inhdr : see if this is a sys/un.h system set sys/un.h i_sysun eval $inhdr : see if this is a sys/utsname system set sys/utsname.h i_sysutsname eval $inhdr : see if deflate exists set deflate d_deflate eval $inlibc : see if inflate exists set inflate d_inflate eval $inlibc : see if this is a zlib.h system set zlib.h i_zlib eval $inhdr : determine whether sendfile works with 64-bit file support echo " " case "$i_syssendfile" in "$define") echo "Checking whether we can use sendfile() with large file support..." >&4 $cat >try.c <<'EOC' #include int main(void) { return 0; } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1; then echo "It looks like we can use sendfile()." else echo "Sorry, I'll have to disable sendfile()." i_syssendfile="$undef" d_sendfile="$undef" fi $rm -f try try.c ;; *) echo "No , sendfile() should be safe with large files." >&4 ;; esac : check whether -mieee should be used flag='-mieee' echo " " echo "Checking whether $flag should be used..." >&4 $cat >try.c <<'EOC' int main(void) { #if defined(__GNUC__) && (defined(_alpha) || defined(__alpha__)) return 0; #else switch (sizeof(int[-23])) { case 1: case 1: } #endif } EOC if $cc $ccflags $ldflags -o try try.c >/dev/null 2>&1 then $rm -f try if $cc $ccflags $flag $ldflags -o try try.c >/dev/null 2>&1 then echo "(Adding $flag)"; ccflags="$ccflags $flag" fi fi $rm -f try try.c : end of configuration questions echo " " echo "End of configuration questions." glib_used=glib-${glibversion}.x frontend="GTK1" case "$gtkversion" in 2) frontend="GTK2";; esac case "$d_headless" in "$define") frontend="none";; esac dbus=no case "$d_dbus" in "$define") dbus=yes;; esac ipv6=no case "$d_ipv6" in "$define") ipv6=yes;; esac case " $libs " in *" -lz "*) case "$i_zlib$d_deflate$d_inflate" in "$define$define$define") zlib=yes;; esac ;; esac gnutls=no case "$d_gnutls" in "$define") gnutls=yes;; esac remote=no if $remotectrl; then remote=yes; fi nls=no case "$d_enablenls" in "$define") nls=yes;; esac fastassert=no case "$d_fast_assert" in "$define") fastassert=yes;; esac sqlite=no case "$d_sqlite" in "$define") sqlite=yes;; esac $cat >&4 <&4 bailout=yes ;; esac case "$d_libxml2" in "$undef") echo 'ERROR: You need libxml2 (http://www.xmlsoft.org/) to compile Gtk-Gnutella.' >&4 bailout=yes ;; esac if [ "$zlib" != yes ]; then echo 'ERROR: You need zlib (http://www.zlib.net/) to compile Gtk-Gnutella.' >&4 bailout=yes fi if [ "$frontend" != none ]; then case "$d_gtk" in "$undef") echo 'ERROR: Cannot compile against Gtk+.' >&4 bailout=yes ;; esac fi if [ "$bailout" != no ]; then exit 1 fi : back to where it started if test -d ../UU; then cd .. fi : configuration may be unconditionally patched via a 'config.arch' file if $test -f config.arch; then echo "I see a config.arch file, loading it." >&4 . ./config.arch fi : configuration may be patched via a 'config.over' file if $test -f config.over; then echo " " dflt=y rp='I see a config.over file. Do you wish to load it?' . UU/myread case "$ans" in n*) echo "OK, I'll ignore it.";; *) . ./config.over echo "Configuration override changes have been loaded." ;; esac fi : in case they want portability, strip down executable paths case "$d_portable" in "$define") echo " " echo "Stripping down executable paths..." >&4 xsed=$sed for file in $loclist $trylist; do eval sfile="\$$file" sfile=`echo $sfile | $xsed -e 's,.*/\(.*\),\1,'` eval $file="$sfile" done ;; esac : create config.sh file echo " " echo "Creating config.sh..." >&4 $spitshell <config.sh $startsh # # This file was produced by running the Configure script. It holds all the # definitions figured out by Configure. Should you modify one of these values, # do not forget to propagate your changes by running "Configure -der". You may # instead choose to run each of the .SH files by yourself, or "Configure -S". # # Package name : $package # Source directory : $src # Configuration time: $cf_time # Configured by : $cf_by # Target system : $myuname EOT $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh $spitshell <>config.sh Author='$Author' Date='$Date' Header='$Header' Id='$Id' Locker='$Locker' Log='$Log' RCSfile='$RCSfile' Revision='$Revision' Source='$Source' State='$State' _a='$_a' _exe='$_exe' _o='$_o' afs='$afs' afsroot='$afsroot' alignbytes='$alignbytes' aphostname='$aphostname' ar='$ar' archobjs='$archobjs' awk='$awk' bash='$bash' bin='$bin' binexp='$binexp' bison='$bison' byacc='$byacc' c='$c' cat='$cat' cc='$cc' ccflags='$ccflags' ccname='$ccname' ccversion='$ccversion' cf_by='$cf_by' cf_time='$cf_time' chgrp='$chgrp' chmod='$chmod' chown='$chown' clocktype='$clocktype' comm='$comm' compress='$compress' contains='$contains' cp='$cp' cpio='$cpio' cpp='$cpp' cpp_quote='$cpp_quote' cpp_stuff='$cpp_stuff' cppflags='$cppflags' cpplast='$cpplast' cppminus='$cppminus' cpprun='$cpprun' cppstdin='$cppstdin' csh='$csh' d_attribut='$d_attribut' d_bcopy='$d_bcopy' d_bindtxtcode='$d_bindtxtcode' d_bsd='$d_bsd' d_built_popcount='$d_built_popcount' d_const='$d_const' d_dbus='$d_dbus' d_deflate='$d_deflate' d_dev_poll='$d_dev_poll' d_dirnamlen='$d_dirnamlen' d_dos='$d_dos' d_enablenls='$d_enablenls' d_eofnblk='$d_eofnblk' d_epoll='$d_epoll' d_eunice='$d_eunice' d_fast_assert='$d_fast_assert' d_getaddrinfo='$d_getaddrinfo' d_geteuid='$d_geteuid' d_gethname='$d_gethname' d_getifaddrs='$d_getifaddrs' d_getinvent='$d_getinvent' d_gettblsz='$d_gettblsz' d_gettext='$d_gettext' d_getuid='$d_getuid' d_glib='$d_glib' d_gnulibc='$d_gnulibc' d_gnutls='$d_gnutls' d_gtk='$d_gtk' d_headless='$d_headless' d_herror='$d_herror' d_hstrerror='$d_hstrerror' d_index='$d_index' d_inflate='$d_inflate' d_initstate='$d_initstate' d_iptos='$d_iptos' d_ipv6='$d_ipv6' d_isascii='$d_isascii' d_kevent_int_udata='$d_kevent_int_udata' d_kqueue='$d_kqueue' d_libxml2='$d_libxml2' d_linux='$d_linux' d_lstat='$d_lstat' d_madvise='$d_madvise' d_memalign='$d_memalign' d_memcpy='$d_memcpy' d_mmap='$d_mmap' d_msghdr_msg_flags='$d_msghdr_msg_flags' d_nls='$d_nls' d_official='$d_official' d_open3='$d_open3' d_os2='$d_os2' d_phostname='$d_phostname' d_poll='$d_poll' d_portable='$d_portable' d_posix_memalign='$d_posix_memalign' d_pread='$d_pread' d_preadv='$d_preadv' d_pwage='$d_pwage' d_pwchange='$d_pwchange' d_pwclass='$d_pwclass' d_pwcomment='$d_pwcomment' d_pwexpire='$d_pwexpire' d_pwquota='$d_pwquota' d_pwrite='$d_pwrite' d_pwritev='$d_pwritev' d_random='$d_random' d_remotectrl='$d_remotectrl' d_rusage='$d_rusage' d_sa_interrupt='$d_sa_interrupt' d_sendfile='$d_sendfile' d_setproctitle='$d_setproctitle' d_sigaction='$d_sigaction' d_sigsetjmp='$d_sigsetjmp' d_socker_get='$d_socker_get' d_sqlite='$d_sqlite' d_srandom='$d_srandom' d_strchr='$d_strchr' d_strlcat='$d_strlcat' d_strlcpy='$d_strlcpy' d_sysctl='$d_sysctl' d_times='$d_times' d_uname='$d_uname' d_useglib1='$d_useglib1' d_useglib2='$d_useglib2' d_usegtk1='$d_usegtk1' d_usegtk2='$d_usegtk2' d_usleep='$d_usleep' d_voidsig='$d_voidsig' d_volatile='$d_volatile' d_vsnprintf='$d_vsnprintf' d_xenix='$d_xenix' date='$date' dbuscflags='$dbuscflags' dbusconfig='$dbusconfig' dbusldflags='$dbusldflags' defvoidused='$defvoidused' direntrytype='$direntrytype' eagain='$eagain' echo='$echo' egrep='$egrep' emacs='$emacs' enablenls='$enablenls' eunicefix='$eunicefix' expr='$expr' find='$find' firstmakefile='$firstmakefile' flex='$flex' from='$from' gcc='$gcc' gccosandvers='$gccosandvers' gccversion='$gccversion' glade='$glade' glibcflags='$glibcflags' glibconfig='$glibconfig' glibldflags='$glibldflags' glibpackage='$glibpackage' glibpth='$glibpth' glibversion='$glibversion' gmsgfmt='$gmsgfmt' gnulibc_version='$gnulibc_version' gnutlscflags='$gnutlscflags' gnutlsconfig='$gnutlsconfig' gnutlsldflags='$gnutlsldflags' grep='$grep' groupcat='$groupcat' gtkcflags='$gtkcflags' gtkconfig='$gtkconfig' gtkgversion='$gtkgversion' gtkldflags='$gtkldflags' gtkpackage='$gtkpackage' gtkversion='$gtkversion' gzip='$gzip' h_fcntl='$h_fcntl' h_sysfile='$h_sysfile' hint='$hint' hostcat='$hostcat' huge='$huge' i_arpainet='$i_arpainet' i_dirent='$i_dirent' i_fcntl='$i_fcntl' i_ifaddrs='$i_ifaddrs' i_inttypes='$i_inttypes' i_invent='$i_invent' i_langinfo='$i_langinfo' i_libcharset='$i_libcharset' i_libintl='$i_libintl' i_netdb='$i_netdb' i_netif='$i_netif' i_niin='$i_niin' i_niip='$i_niip' i_pwd='$i_pwd' i_regex='$i_regex' i_stdarg='$i_stdarg' i_stdlib='$i_stdlib' i_string='$i_string' i_sysfile='$i_sysfile' i_sysin='$i_sysin' i_sysmman='$i_sysmman' i_sysparam='$i_sysparam' i_sysresrc='$i_sysresrc' i_syssendfile='$i_syssendfile' i_syssock='$i_syssock' i_sysstat='$i_sysstat' i_syssysctl='$i_syssysctl' i_systime='$i_systime' i_systimek='$i_systimek' i_systimes='$i_systimes' i_systypes='$i_systypes' i_sysun='$i_sysun' i_sysutsname='$i_sysutsname' i_time='$i_time' i_unistd='$i_unistd' i_varargs='$i_varargs' i_varhdr='$i_varhdr' i_zlib='$i_zlib' incpath='$incpath' inews='$inews' install='$install' installbin='$installbin' installdir='$installdir' installmansrc='$installmansrc' installprivlib='$installprivlib' issymlink='$issymlink' ksh='$ksh' large='$large' ldflags='$ldflags' less='$less' libc='$libc' libnames='$libnames' libpth='$libpth' libs='$libs' libscheck='$libscheck' libsdirs='$libsdirs' libsfiles='$libsfiles' libsfound='$libsfound' libspath='$libspath' line='$line' lint='$lint' lkflags='$lkflags' ln='$ln' lns='$lns' locale='$locale' localeexp='$localeexp' locincpth='$locincpth' loclibpth='$loclibpth' lp='$lp' lpr='$lpr' ls='$ls' mail='$mail' mailx='$mailx' make='$make' make_set_make='$make_set_make' manext='$manext' mansrc='$mansrc' mansrcexp='$mansrcexp' medium='$medium' mips_type='$mips_type' mkdep='$mkdep' mkdir='$mkdir' models='$models' more='$more' msgfmt='$msgfmt' msgmerge='$msgmerge' msgmerge_update='$msgmerge_update' mv='$mv' mydomain='$mydomain' myhostname='$myhostname' myuname='$myuname' n='$n' nm='$nm' nm_opt='$nm_opt' nm_so_opt='$nm_so_opt' nofile='$nofile' nroff='$nroff' o_nonblock='$o_nonblock' official='$official' optimize='$optimize' orderlib='$orderlib' osname='$osname' osvers='$osvers' package='$package' passcat='$passcat' perl='$perl' pg='$pg' phostname='$phostname' pkgsrc='$pkgsrc' plibpth='$plibpth' pmake='$pmake' pr='$pr' prefix='$prefix' prefixexp='$prefixexp' privlib='$privlib' privlibexp='$privlibexp' prototype='$prototype' ranlib='$ranlib' rd_nodata='$rd_nodata' remotectrl='$remotectrl' rm='$rm' rmail='$rmail' run='$run' runnm='$runnm' sed='$sed' sendmail='$sendmail' sh='$sh' shar='$shar' sharpbang='$sharpbang' shsharp='$shsharp' signal_t='$signal_t' sleep='$sleep' smail='$smail' small='$small' so='$so' sockercflags='$sockercflags' sockerldflags='$sockerldflags' sort='$sort' spackage='$spackage' spitshell='$spitshell' split='$split' sqlitecflags='$sqlitecflags' sqliteconfig='$sqliteconfig' sqliteldflags='$sqliteldflags' src='$src' startsh='$startsh' strings='$strings' submit='$submit' sysman='$sysman' tablesize='$tablesize' tail='$tail' tar='$tar' targetarch='$targetarch' tbl='$tbl' test='$test' timeincl='$timeincl' to='$to' touch='$touch' tr='$tr' trnl='$trnl' troff='$troff' uname='$uname' uniq='$uniq' usecrosscompile='$usecrosscompile' usenm='$usenm' usrinc='$usrinc' uuname='$uuname' vi='$vi' voidflags='$voidflags' xgettext='$xgettext' xlibpth='$xlibpth' xmlcflags='$xmlcflags' xmlconfig='$xmlconfig' xmlldflags='$xmlldflags' yacc='$yacc' yaccflags='$yaccflags' zcat='$zcat' zip='$zip' EOT : add special variables $test -f $src/patchlevel.h && \ awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh echo "CONFIG=true" >>config.sh : propagate old symbols if $test -f UU/config.sh; then UU/oldconfig.sh $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \ config.sh config.sh UU/oldconfig.sh |\ $sort | $uniq -u >UU/oldsyms set X `cat UU/oldsyms` shift case $# in 0) ;; *) cat <>config.sh for sym in `cat UU/oldsyms`; do echo " Propagating $hint variable "'$'"$sym..." eval 'tmp="$'"${sym}"'"' echo "$tmp" | \ sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh done ;; esac fi : Finish up by extracting the .SH files case "$alldone" in exit) $rm -rf UU echo "Extraction done." exit 0 ;; cont) ;; '') dflt='' nostick=true $cat <&4 -c "$ans";; esac ;; esac : if this fails, just run all the .SH files by hand . ./config.sh echo " " exec 1>&4 pwd=`pwd` . ./UU/extract cd "$pwd" if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then dflt=y case "$silent" in true) ;; *) $cat < makedepend.out &" It can take a while, so you might not want to run it right now. EOM ;; esac rp="Run $make depend now?" . UU/myread case "$ans" in y*) $make depend && echo "Now you must run '$make'." ;; *) echo "You must run '$make depend' then '$make'." ;; esac elif test -f [Mm]akefile; then echo " " echo "Now you must run a $make." else echo "Configure done." fi if $test -f Policy.sh; then $cat <&4 fi $rm -f kit*isdone ark*isdone $rm -rf UU : End of Configure