This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Better st_ino_size probe in configure.com.
authorCraig A. Berry <craigberry@mac.com>
Fri, 12 Aug 2011 12:51:10 +0000 (07:51 -0500)
committerCraig A. Berry <craigberry@mac.com>
Fri, 12 Aug 2011 12:51:10 +0000 (07:51 -0500)
Follow-up to adf2bd2837.  This is being used for compile-time
comparisons; sizeof may be compile-time, but is apparently not
available before macro substitution, leading to problems like:

....^
%CC-I-IGNOREEXTRA, Spurious token(s) ignored on preprocessor directive line.
at line number 2837 in file MDA0:[SMOKE.blead]pp_sys.c;1

configure.com

index b298ffa..2e41dae 100644 (file)
@@ -5113,6 +5113,33 @@ $   echo4 "I'm disabling large file support."
 $   uselargefiles = "undef"
 $ ENDIF
 $!
+$! Check for st_ino size.
+$!
+$ st_ino_size = 4
+$ OS
+$ WS "#include <sys/stat.h>"
+$ WS "#include <stdio.h>"
+$ WS "#if defined(__DECC) || defined(__DECCXX)"
+$ WS "#include <stdlib.h>
+$ WS "#endif"
+$ WS "int main() {
+$ WS "#''uselargefiles' _LARGEFILE"
+$ WS "#ifdef _LARGEFILE"
+$ WS "    printf(""%d\n"", sizeof(__ino64_t));"
+$ WS "#else"
+$ WS "    printf(""%d\n"", sizeof(unsigned short)*3);"
+$ WS "#endif"
+$ WS "    exit(0);"
+$ WS "}"
+$ CS
+$ GOSUB link_ok
+$ IF link_status .EQ. good_link
+$ THEN
+$   GOSUB just_mcr_it
+$   st_ino_size = tmp
+$ ENDIF
+$ echo "Your st_ino size is ''st_ino_size' bytes."
+$!
 $! Tests for hard link, symbolic links, and 7.3 + CRTL features
 $!
 $  d_lchown = "undef"
@@ -6709,12 +6736,7 @@ $ WC "src='" + src + "'"
 $ WC "ssizetype='int'"
 $ WC "startperl=" + startperl ! This one's special--no enclosing single quotes
 $ WC "static_ext='" + static_ext + "'"
-$ IF uselargefiles .OR. uselargefiles .eqs. "define"
-$ THEN
-$   WC "st_ino_size='sizeof(__ino64_t)'"
-$ ELSE
-$   WC "st_ino_size='(sizeof(unsigned short)*3)'"
-$ ENDIF
+$ WC "st_ino_size='" + st_ino_size + "'"
 $ WC "st_ino_sign='1'"
 $ WC "stdchar='" + stdchar + "'"
 $ WC "stdio_base='((*fp)->_base)'"