From d78f9ffa7317e24a5eaf54a2cf107e6663784159 Mon Sep 17 00:00:00 2001 From: "H.Merijn Brand" Date: Sat, 1 Oct 2011 13:25:30 +0200 Subject: [PATCH] Regen Configure and friends After backporting Nicholas' work and slimming down metaconfig.h --- Configure | 434 +++++++++++++++++++++++++++++------------------------------ config_h.SH | 28 ++-- metaconfig.h | 19 +-- uconfig.h | 30 ++--- 4 files changed, 248 insertions(+), 263 deletions(-) diff --git a/Configure b/Configure index fe2fcc9..1a17a7e 100755 --- a/Configure +++ b/Configure @@ -28,7 +28,7 @@ # See Porting/pumpkin.pod for more information on metaconfig. # -# Generated on Thu Sep 22 17:10:35 CEST 2011 [metaconfig 3.5 PL0] +# Generated on Sat Oct 1 12:33:17 CEST 2011 [metaconfig 3.5 PL0] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <&4 -$cat >try.c <<'EOM' -/* Intentionally a long probe as I'd like to sanity check that the exact - approach is going to work, as thinking it will work, but only having it - part working at runtime is worse than not having it. */ - -#include -#include -#include -#include -#include -#include -#include - -int -main(int argc, char **argv) { - char *buffer; - char *argv_leaf = strrchr(argv[0], '/'); - char *buffer_leaf; - size_t size = 0; - int mib[4]; - - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PATHNAME; - mib[3] = -1; - - if (!argv_leaf) { - fprintf(stderr, "Can't locate / in '%s'\n", argv[0]); - return 1; - } - - if (sysctl(mib, 4, NULL, &size, NULL, 0)) { - perror("sysctl"); - return 2; - } - - if (size < strlen(argv_leaf) + 1) { - fprintf(stderr, "size %lu is too short for a path\n", - (unsigned long) size); - return 3; - } - - if (size > MAXPATHLEN * MAXPATHLEN) { - fprintf(stderr, "size %lu is too long for a path\n", - (unsigned long) size); - return 4; - } - - buffer = malloc(size); - if (!buffer) { - perror("malloc"); - return 5; - } - - if (sysctl(mib, 4, buffer, &size, NULL, 0)) { - perror("sysctl"); - return 6; - } - - if (strlen(buffer) + 1 != size) { - fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n", - (unsigned long)size, (unsigned long)strlen(buffer) + 1); - return 7; - } - - - if (*buffer != '/') { - fprintf(stderr, "Not an absolute path: '%s'\n", buffer); - return 8; - } - - if (strstr(buffer, "/./")) { - fprintf(stderr, "Contains /./: '%s'\n", buffer); - return 9; - } - - if (strstr(buffer, "/../")) { - fprintf(stderr, "Contains /../: '%s'\n", buffer); - return 10; - } - - buffer_leaf = strrchr(buffer, '/'); - if (strcmp(buffer_leaf, argv_leaf) != 0) { - fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer); - return 11; - } - - free(buffer); - - return 0; -} -EOM - -val=$undef -set try -if eval $compile_ok; then - if $run ./try; then - echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4 - val="$define" - else - echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4 - val="$undef" - fi -else - echo "I'm unable to compile the test program." >&4 - echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4 - val="$undef" -fi -$rm_try -set usekernprocpathname -eval $setvar - -: Determine if we can use _NSGetExecutablePath to find executing program -echo " " -echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4 -$cat >try.c <<'EOM' -/* Intentionally a long probe as I'd like to sanity check that the exact - approach is going to work, as thinking it will work, but only having it - part working at runtime is worse than not having it. */ -#include -#include -#include -#include -#include - -int -main(int argc, char **argv) { - char buf[1]; - uint32_t size = sizeof(buf); - int result; - char *buffer; - char *tidied; - char *argv_leaf = strrchr(argv[0], '/'); - char *tidied_leaf; - - if (!argv_leaf) { - fprintf(stderr, "Can't locate / in '%s'\n", argv[0]); - return 1; - } - - _NSGetExecutablePath(buf, &size); - if (size > MAXPATHLEN * MAXPATHLEN) { - fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n", - (unsigned int) size); - return 2; - } - - buffer = malloc(size); - if (!buffer) { - perror("malloc"); - return 3; - } - - result = _NSGetExecutablePath(buffer, &size); - if (result != 0) { - fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n", - result, (unsigned int) size); - return 4; - } - - tidied = realpath(buffer, NULL); - if (!tidied) { - perror("realpath"); - return 5; - } - - free(buffer); - - if (*tidied != '/') { - fprintf(stderr, "Not an absolute path: '%s'\n", tidied); - return 6; - } - - if (strstr(tidied, "/./")) { - fprintf(stderr, "Contains /./: '%s'\n", tidied); - return 7; - } - - if (strstr(tidied, "/../")) { - fprintf(stderr, "Contains /../: '%s'\n", tidied); - return 8; - } - - tidied_leaf = strrchr(tidied, '/'); - if (strcmp(tidied_leaf, argv_leaf) != 0) { - fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied); - return 9; - } - - free(tidied); - - return 0; -} -EOM - -val=$undef -set try -if eval $compile_ok; then - if $run ./try; then - echo "You can use _NSGetExecutablePath to find the executing program." >&4 - val="$define" - else - echo "Nope, _NSGetExecutablePath doesn't work here." >&4 - fi -else - echo "I'm unable to compile the test program." >&4 - echo "I'll assume no _NSGetExecutablePath here." >&4 -fi -$rm_try -set usensgetexecutablepath -eval $setvar - : Check how to flush echo " " $cat >&4 <&4 +$cat >try.c <<'EOM' +/* Intentionally a long probe as I'd like to sanity check that the exact + approach is going to work, as thinking it will work, but only having it + part working at runtime is worse than not having it. */ + +#include +#include +#include +#include +#include +#include +#include + +int +main(int argc, char **argv) { + char *buffer; + char *argv_leaf = strrchr(argv[0], '/'); + char *buffer_leaf; + size_t size = 0; + int mib[4]; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = -1; + + if (!argv_leaf) { + fprintf(stderr, "Can't locate / in '%s'\n", argv[0]); + return 1; + } + + if (sysctl(mib, 4, NULL, &size, NULL, 0)) { + perror("sysctl"); + return 2; + } + + if (size < strlen(argv_leaf) + 1) { + fprintf(stderr, "size %lu is too short for a path\n", + (unsigned long) size); + return 3; + } + + if (size > MAXPATHLEN * MAXPATHLEN) { + fprintf(stderr, "size %lu is too long for a path\n", + (unsigned long) size); + return 4; + } + + buffer = malloc(size); + if (!buffer) { + perror("malloc"); + return 5; + } + + if (sysctl(mib, 4, buffer, &size, NULL, 0)) { + perror("sysctl"); + return 6; + } + + if (strlen(buffer) + 1 != size) { + fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n", + (unsigned long)size, (unsigned long)strlen(buffer) + 1); + return 7; + } + + + if (*buffer != '/') { + fprintf(stderr, "Not an absolute path: '%s'\n", buffer); + return 8; + } + + if (strstr(buffer, "/./")) { + fprintf(stderr, "Contains /./: '%s'\n", buffer); + return 9; + } + + if (strstr(buffer, "/../")) { + fprintf(stderr, "Contains /../: '%s'\n", buffer); + return 10; + } + + buffer_leaf = strrchr(buffer, '/'); + if (strcmp(buffer_leaf, argv_leaf) != 0) { + fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer); + return 11; + } + + free(buffer); + + return 0; +} +EOM + +val=$undef +set try +if eval $compile_ok; then + if $run ./try; then + echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4 + val="$define" + else + echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4 + val="$undef" + fi +else + echo "I'm unable to compile the test program." >&4 + echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4 + val="$undef" +fi +$rm_try +set usekernprocpathname +eval $setvar + +: Determine if we can use _NSGetExecutablePath to find executing program +echo " " +echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4 +$cat >try.c <<'EOM' +/* Intentionally a long probe as I'd like to sanity check that the exact + approach is going to work, as thinking it will work, but only having it + part working at runtime is worse than not having it. */ +#include +#include +#include +#include +#include + +int +main(int argc, char **argv) { + char buf[1]; + uint32_t size = sizeof(buf); + int result; + char *buffer; + char *tidied; + char *argv_leaf = strrchr(argv[0], '/'); + char *tidied_leaf; + + if (!argv_leaf) { + fprintf(stderr, "Can't locate / in '%s'\n", argv[0]); + return 1; + } + + _NSGetExecutablePath(buf, &size); + if (size > MAXPATHLEN * MAXPATHLEN) { + fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n", + (unsigned int) size); + return 2; + } + + buffer = malloc(size); + if (!buffer) { + perror("malloc"); + return 3; + } + + result = _NSGetExecutablePath(buffer, &size); + if (result != 0) { + fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n", + result, (unsigned int) size); + return 4; + } + + tidied = realpath(buffer, NULL); + if (!tidied) { + perror("realpath"); + return 5; + } + + free(buffer); + + if (*tidied != '/') { + fprintf(stderr, "Not an absolute path: '%s'\n", tidied); + return 6; + } + + if (strstr(tidied, "/./")) { + fprintf(stderr, "Contains /./: '%s'\n", tidied); + return 7; + } + + if (strstr(tidied, "/../")) { + fprintf(stderr, "Contains /../: '%s'\n", tidied); + return 8; + } + + tidied_leaf = strrchr(tidied, '/'); + if (strcmp(tidied_leaf, argv_leaf) != 0) { + fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied); + return 9; + } + + free(tidied); + + return 0; +} +EOM + +val=$undef +set try +if eval $compile_ok; then + if $run ./try; then + echo "You can use _NSGetExecutablePath to find the executing program." >&4 + val="$define" + else + echo "Nope, _NSGetExecutablePath doesn't work here." >&4 + fi +else + echo "I'm unable to compile the test program." >&4 + echo "I'll assume no _NSGetExecutablePath here." >&4 +fi +$rm_try +set usensgetexecutablepath +eval $setvar + : Check if site customization support was requested case "$usesitecustomize" in $define|true|[Yy]*) diff --git a/config_h.SH b/config_h.SH index 7b8d31e..879c1d7 100755 --- a/config_h.SH +++ b/config_h.SH @@ -2689,20 +2689,6 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$ebcdic EBCDIC /**/ -/* USE_KERN_PROC_PATHNAME: - * This symbol, if defined, indicates that we can use sysctl with - * KERN_PROC_PATHNAME to get a full path for the executable, and hence - * convert $^X to an absolute path. - */ -#$usekernprocpathname USE_KERN_PROC_PATHNAME /**/ - -/* USE_NSGETEXECUTABLEPATH: - * This symbol, if defined, indicates that we can use _NSGetExecutablePath - * and realpath to get a full path for the executable, and hence convert - * $^X to an absolute path. - */ -#$usensgetexecutablepath USE_NSGETEXECUTABLEPATH /**/ - /* Fpos_t: * This symbol holds the type used to declare file positions in libc. * It can be fpos_t, long, uint, etc... It may be necessary to include @@ -4699,6 +4685,13 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un #$usefaststdio USE_FAST_STDIO /**/ #endif +/* USE_KERN_PROC_PATHNAME: + * This symbol, if defined, indicates that we can use sysctl with + * KERN_PROC_PATHNAME to get a full path for the executable, and hence + * convert $^X to an absolute path. + */ +#$usekernprocpathname USE_KERN_PROC_PATHNAME /**/ + /* USE_LARGE_FILES: * This symbol, if defined, indicates that large file support * should be used when available. @@ -4731,6 +4724,13 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un #$usemultiplicity MULTIPLICITY /**/ #endif +/* USE_NSGETEXECUTABLEPATH: + * This symbol, if defined, indicates that we can use _NSGetExecutablePath + * and realpath to get a full path for the executable, and hence convert + * $^X to an absolute path. + */ +#$usensgetexecutablepath USE_NSGETEXECUTABLEPATH /**/ + /* USE_PERLIO: * This symbol, if defined, indicates that the PerlIO abstraction should * be used throughout. If not defined, stdio should be diff --git a/metaconfig.h b/metaconfig.h index d445b34..0e418f2 100644 --- a/metaconfig.h +++ b/metaconfig.h @@ -11,36 +11,21 @@ * in Configure, this is the way to force them into availability. * * CHARBITS - * GMTIME_MAX - * GMTIME_MIN * HAS_ASCTIME64 * HAS_CTIME64 * HAS_DIFFTIME64 - * HAS_GETADDRINFO - * HAS_GETNAMEINFO * HAS_GMTIME64 - * HAS_INETNTOP - * HAS_INETPTON * HAS_LOCALTIME64 * HAS_MKTIME64 * HAS_PRCTL * HAS_PSEUDOFORK - * HAS_SIN6_SCOPE_ID - * HAS_SOCKADDR_SA_LEN * HAS_TIMEGM * I16SIZE - * I32SIZE * I64SIZE * I8SIZE - * LOCALTIME_MAX - * LOCALTIME_MIN * LOCALTIME_R_NEEDS_TZSET - * ST_INO_SIGN - * ST_INO_SIZE - * U16SIZE - * U32SIZE - * U64SIZE * U8SIZE - * USE_DTRACE + * USE_KERN_PROC_PATHNAME + * USE_NSGETEXECUTABLEPATH * */ diff --git a/uconfig.h b/uconfig.h index c379902..ed09c1d 100644 --- a/uconfig.h +++ b/uconfig.h @@ -2656,20 +2656,6 @@ */ /*#define EBCDIC / **/ -/* USE_KERN_PROC_PATHNAME: - * This symbol, if defined, indicates that we can use sysctl with - * KERN_PROC_PATHNAME to get a full path for the executable, and hence - * convert $^X to an absolute path. - */ -/*#define USE_KERN_PROC_PATHNAME / **/ - -/* USE_NSGETEXECUTABLEPATH: - * This symbol, if defined, indicates that we can use _NSGetExecutablePath - * and realpath to get a full path for the executable, and hence convert - * $^X to an absolute path. - */ -/*#define USE_NSGETEXECUTABLEPATH / **/ - /* Fpos_t: * This symbol holds the type used to declare file positions in libc. * It can be fpos_t, long, uint, etc... It may be necessary to include @@ -4666,6 +4652,13 @@ /*#define USE_FAST_STDIO / **/ #endif +/* USE_KERN_PROC_PATHNAME: + * This symbol, if defined, indicates that we can use sysctl with + * KERN_PROC_PATHNAME to get a full path for the executable, and hence + * convert $^X to an absolute path. + */ +/*#define USE_KERN_PROC_PATHNAME / **/ + /* USE_LARGE_FILES: * This symbol, if defined, indicates that large file support * should be used when available. @@ -4698,6 +4691,13 @@ /*#define MULTIPLICITY / **/ #endif +/* USE_NSGETEXECUTABLEPATH: + * This symbol, if defined, indicates that we can use _NSGetExecutablePath + * and realpath to get a full path for the executable, and hence convert + * $^X to an absolute path. + */ +/*#define USE_NSGETEXECUTABLEPATH / **/ + /* USE_PERLIO: * This symbol, if defined, indicates that the PerlIO abstraction should * be used throughout. If not defined, stdio should be @@ -4718,6 +4718,6 @@ #endif /* Generated from: - * 5b5dacbb00f53ae9b440c79cf6d5c8bbf80a7adfa1db3f3814aa77dc6f461fa7 config_h.SH + * 5978363d841cd8e6e743461b9dfb3d8fd5cfdef099e8e8de43cac45a4170a300 config_h.SH * b5e74633486412bbc4d2a1c3847f3e85b10a86e96fb5d1efb7b8bc885956d746 uconfig.sh * ex: set ro: */ -- 2.7.4