diff options
author | Aaron Crane <arc@cpan.org> | 2017-10-13 09:16:17 +0200 |
---|---|---|
committer | Aaron Crane <arc@cpan.org> | 2017-10-21 16:52:39 +0100 |
commit | dd512de320cc50ddbfc3ce3ee4996367b911d983 (patch) | |
tree | 94b792a5d8f28cbe3b2dc9a096c857845badcbaa /Configure | |
parent | 9d82a2b71ca36a0f03ce4676aab0bada365292a9 (diff) | |
download | perl-dd512de320cc50ddbfc3ce3ee4996367b911d983.tar.gz |
Rely on C89 <stdlib.h>
The Configure changes here were generated using a version of metaconfig
that copies U/modified/i_stdlib.U from dist/U/vaproto.U, and changes it to
unconditionally define the i_stdlib Configure variable. That variable is
used by a large number of other Configure units, so it's not actually
practical to try and remove the relevant unit entirely.
Diffstat (limited to 'Configure')
-rwxr-xr-x | Configure | 203 |
1 files changed, 101 insertions, 102 deletions
@@ -5790,6 +5790,107 @@ mc_file=$1; shift; $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;' +: stub, used only to satisfy other units +i_stdlib='define' + +: check for lengths of integral types +echo " " +case "$intsize" in +'') + echo "Checking to see how big your integers are..." >&4 + $cat >try.c <<EOCP +#include <stdio.h> +#$i_stdlib I_STDLIB +#ifdef I_STDLIB +#include <stdlib.h> +#endif +int main() +{ + printf("intsize=%d;\n", (int)sizeof(int)); + printf("longsize=%d;\n", (int)sizeof(long)); + printf("shortsize=%d;\n", (int)sizeof(short)); + exit(0); +} +EOCP + set try + if eval $compile_ok && $run ./try > /dev/null; then + eval `$run ./try` + echo "Your integers are $intsize bytes long." + echo "Your long integers are $longsize bytes long." + echo "Your short integers are $shortsize bytes long." + else + $cat >&4 <<EOM +! +Help! I can't compile and run the intsize test program: please enlighten me! +(This is probably a misconfiguration in your system or libraries, and +you really ought to fix it. Still, I'll try anyway.) +! +EOM + dflt=4 + rp="What is the size of an integer (in bytes)?" + . ./myread + intsize="$ans" + dflt=$intsize + rp="What is the size of a long integer (in bytes)?" + . ./myread + longsize="$ans" + dflt=2 + rp="What is the size of a short integer (in bytes)?" + . ./myread + shortsize="$ans" + fi + ;; +esac +$rm_try + +: check for long long +echo " " +echo "Checking to see if you have long long..." >&4 +echo 'int main() { long long x = 7; return 0; }' > try.c +set try +if eval $compile; then + val="$define" + echo "You have long long." +else + val="$undef" + echo "You do not have long long." +fi +$rm_try +set d_longlong +eval $setvar + +: check for length of long long +case "${d_longlong}${longlongsize}" in +$define) + echo " " + echo "Checking to see how big your long longs are..." >&4 + $cat >try.c <<'EOCP' +#include <stdio.h> +int main() +{ + printf("%d\n", (int)sizeof(long long)); + return(0); +} +EOCP + set try + if eval $compile_ok; then + longlongsize=`$run ./try` + echo "Your long longs are $longlongsize bytes long." + else + dflt='8' + echo " " + echo "(I can't seem to compile the test program. Guessing...)" + rp="What is the size of a long long (in bytes)?" + . ./myread + longlongsize="$ans" + fi + if $test "X$longsize" = "X$longlongsize"; then + echo "(That isn't any different from an ordinary long.)" + fi + ;; +esac +$rm_try + : determine filename position in cpp output echo " " echo "Computing filename position in cpp output for #include directives..." >&4 @@ -5902,108 +6003,6 @@ do set $yyy; var=$2; eval "was=\$$2"; set $yyy; shift; shift; yyy=$@; done' -: see if stdlib is available -set stdlib.h i_stdlib -eval $inhdr - -: check for lengths of integral types -echo " " -case "$intsize" in -'') - echo "Checking to see how big your integers are..." >&4 - $cat >try.c <<EOCP -#include <stdio.h> -#$i_stdlib I_STDLIB -#ifdef I_STDLIB -#include <stdlib.h> -#endif -int main() -{ - printf("intsize=%d;\n", (int)sizeof(int)); - printf("longsize=%d;\n", (int)sizeof(long)); - printf("shortsize=%d;\n", (int)sizeof(short)); - exit(0); -} -EOCP - set try - if eval $compile_ok && $run ./try > /dev/null; then - eval `$run ./try` - echo "Your integers are $intsize bytes long." - echo "Your long integers are $longsize bytes long." - echo "Your short integers are $shortsize bytes long." - else - $cat >&4 <<EOM -! -Help! I can't compile and run the intsize test program: please enlighten me! -(This is probably a misconfiguration in your system or libraries, and -you really ought to fix it. Still, I'll try anyway.) -! -EOM - dflt=4 - rp="What is the size of an integer (in bytes)?" - . ./myread - intsize="$ans" - dflt=$intsize - rp="What is the size of a long integer (in bytes)?" - . ./myread - longsize="$ans" - dflt=2 - rp="What is the size of a short integer (in bytes)?" - . ./myread - shortsize="$ans" - fi - ;; -esac -$rm_try - -: check for long long -echo " " -echo "Checking to see if you have long long..." >&4 -echo 'int main() { long long x = 7; return 0; }' > try.c -set try -if eval $compile; then - val="$define" - echo "You have long long." -else - val="$undef" - echo "You do not have long long." -fi -$rm_try -set d_longlong -eval $setvar - -: check for length of long long -case "${d_longlong}${longlongsize}" in -$define) - echo " " - echo "Checking to see how big your long longs are..." >&4 - $cat >try.c <<'EOCP' -#include <stdio.h> -int main() -{ - printf("%d\n", (int)sizeof(long long)); - return(0); -} -EOCP - set try - if eval $compile_ok; then - longlongsize=`$run ./try` - echo "Your long longs are $longlongsize bytes long." - else - dflt='8' - echo " " - echo "(I can't seem to compile the test program. Guessing...)" - rp="What is the size of a long long (in bytes)?" - . ./myread - longlongsize="$ans" - fi - if $test "X$longsize" = "X$longlongsize"; then - echo "(That isn't any different from an ordinary long.)" - fi - ;; -esac -$rm_try - : see if inttypes.h is available : we want a real compile instead of Inhdr because some systems : have an inttypes.h which includes non-existent headers |