From: Andy Dougherty Date: Tue, 25 Feb 1997 19:13:45 +0000 (-0500) Subject: Sanity check linking with $libs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5c37e92e59bb92e49d5a21017cd6dc066a28ddea;p=p5sagit%2Fp5-mst-13.2.git Sanity check linking with $libs On Tue, 25 Feb 1997, Chip Salzenberg wrote: > According to Andy Dougherty: > > Chip, do you want to put something like this in, or shall I? (I'd > > need to borrow the current sfio unit) > > I'm leery of changing a working Configure, especially because _90's > Configure has patches that haven't been propagated back to the units. Staying leery is probably healthy. Looking at _90's Configure, I see we'd have to change some dependencies to move the sfio sanity checking earlier in the script. I'd probably be inclined to do this by merging stuff into a single unit (right after checking whether sfio is available, check whether it's useful) and giving the whole thing a ?Y:TOP directive. p5p-msgid: private-msgid: --- diff --git a/Configure b/Configure index a6e202c..dc68b19 100755 --- a/Configure +++ b/Configure @@ -5440,6 +5440,95 @@ esac set useperlio eval $setvar +: see if sfio.h is available +set sfio.h i_sfio +eval $inhdr + +: see if sfio library is available +case "$i_sfio" in +$define) + val='' + set sfreserve val + eval $inlibc + ;; +*) + val="$undef" + ;; +esac +: Ok, but do we want to use it. +case "$val" in +$define) + case "$usesfio" in + true|$define|[yY]*) dflt='y';; + *) dflt='n';; + esac + echo "$package can use the sfio library, but it is experimental." + rp="You seem to have sfio available, do you want to try using it?" + . ./myread + case "$ans" in + y|Y) + # If sfio is mis-configured, then the following test program + # might run and exit with 0 status but generate no output!. + # I think it has to do with sfio's use of _exit vs. exit, + # but I don't know for sure. --Andy Dougherty 2/25/97. + echo "Checking if I can use sfio in a simple test program." + $cat > try.c <<'EOM' +#include +main() +{ + printf("42\n"); + exit(0); +} +EOM + echo 42 > try.42 + : Deliberately let user see errors and warnings. + if $cc $optimize $ccflags $ldflags -o try try.c $libs && + ./try > try.out && cmp try.42 try.out ; then + echo Sfio looks ok. >&4 + else + $cat >&4 <<'EOM' + +Help! I can't compile and run the following simple test program: +'EOM' + $cat try.c >&4 + $cat >&4 <<'EOM' + +(This is probably a misconfiguration in your system or libraries, and +you really ought to fix it. In the meantime, I'll just skip sfio.) + +EOM + val=$undef + fi + $rm -f try.c try try.out try.42 + ;; + *) echo "Ok, avoiding sfio this time. I'll use stdio instead." + val="$undef" + ;; + esac + case $val in + $undef) echo Removing sfio from list of libraries to use >&4 + set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'` + shift + libs="$*" + echo "libs = $libs" >&4 + ;; + esac + ;; +*) case "$usesfio" in + true|$define|[yY]*) + echo "Sorry, cannot find sfio on this machine" >&4 + echo "Ignoring your setting of usesfio=$usesfio" >&4 + ;; + esac + ;; +esac +set d_sfio +eval $setvar +case "$d_sfio" in +$define) usesfio='true';; +*) usesfio='false';; +esac + : Check how to convert floats to strings. echo " " echo "Checking for an efficient way to convert floats to strings." @@ -7340,59 +7429,6 @@ eval $inlibc set setsid d_setsid eval $inlibc -: see if sfio.h is available -set sfio.h i_sfio -eval $inhdr - - -: see if sfio library is available -case "$i_sfio" in -$define) - val='' - set sfreserve val - eval $inlibc - ;; -*) - val="$undef" - ;; -esac -: Ok, but do we want to use it. -case "$val" in -$define) - case "$usesfio" in - true|$define|[yY]*) dflt='y';; - *) dflt='n';; - esac - echo "$package can use the sfio library, but it is experimental." - rp="You seem to have sfio available, do you want to try using it?" - . ./myread - case "$ans" in - y|Y) ;; - *) echo "Ok, avoiding sfio this time. I'll use stdio instead." - val="$undef" - : Remove sfio from list of libraries to use - set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'` - shift - libs="$*" - echo "libs = $libs" >&4 - ;; - esac - ;; -*) case "$usesfio" in - true|$define|[yY]*) - echo "Sorry, cannot find sfio on this machine" >&4 - echo "Ignoring your setting of usesfio=$usesfio" >&4 - ;; - esac - ;; -esac -set d_sfio -eval $setvar -case "$d_sfio" in -$define) usesfio='true';; -*) usesfio='false';; -esac - : see if shmctl exists set shmctl d_shmctl eval $inlibc