X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/44a61463ebb36cc87e9a15aa13b95b426e02c7e6..a491ffd38258cab175d7540104c46bb9cdc3f6c0:/Configure diff --git a/Configure b/Configure index 0194d7f..acea1c1 100755 --- a/Configure +++ b/Configure @@ -28,7 +28,7 @@ # Porting/pumpkin.pod. # Generated using [metaconfig 3.5 PL0] -# (with additional metaconfig patches by perlbug@perl.org) +# with additional metaconfig patches from https://github.com/Perl/metaconfig cat >c1$$ <&4 @@ -2394,7 +2401,7 @@ Much effort has been expended to ensure that this shell script will run on any Unix system. If despite that it blows up on yours, your best bet is to edit Configure and run it again. If you can't run Configure for some reason, you'll have to generate a config.sh file by hand. Whatever problems you -have, let me (perlbug@perl.org) know how I blew it. +have, let me (https://github.com/Perl/perl5/issues) know how I blew it. This installation script affects things in two ways: @@ -3363,7 +3370,7 @@ EOM (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4 dflt='' : Half the following guesses are probably wrong... If you have better - : tests or hints, please send them to perlbug@perl.org + : tests or hints, please send them to https://github.com/Perl/perl5/issues : The metaconfig authors would also appreciate a copy... $test -f /irix && osname=irix $test -f /xenix && osname=sco_xenix @@ -3499,6 +3506,9 @@ EOM ;; MiNT) osname=mint ;; + minix) osname=minix + osvers=`$uname -r` + ;; netbsd*) osname=netbsd osvers="$3" ;; @@ -4162,14 +4172,9 @@ EOSC : determine root of directory hierarchy where package will be installed. case "$prefix" in -'') - dflt=`./loc . /usr/local /usr/local /local /opt /usr` +'') dflt=`./loc . /usr/local /usr/local /local /opt /usr` ;; -*?/) - dflt=`echo "$prefix" | sed 's/.$//'` - ;; -*) - dflt="$prefix" +*) dflt="$prefix" ;; esac $cat <try.c for incdir in $locincpth; do warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \ @@ -5455,13 +5469,13 @@ fi case "$hint" in default|recommended) case "$gccversion" in - 1*) dflt="$dflt -fpcc-struct-return" ;; + 1.*) dflt="$dflt -fpcc-struct-return" ;; esac case "$optimize:$DEBUGGING" in *-g*:old) dflt="$dflt -DDEBUGGING";; esac case "$gccversion" in - 2*) if $test -d /etc/conf/kconfig.d && + 2.*) if $test -d /etc/conf/kconfig.d && $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 then # Interactive Systems (ISC) POSIX mode. @@ -5470,7 +5484,7 @@ default|recommended) ;; esac case "$gccversion" in - 1*) ;; + 1.*) ;; 2.[0-8]*) ;; ?*) set strict-aliasing -fno-strict-aliasing eval $checkccflag @@ -5588,7 +5602,7 @@ case "$cppflags" in ;; esac case "$gccversion" in -1*) cppflags="$cppflags -D__GNUC__" +1.*) cppflags="$cppflags -D__GNUC__" esac case "$mips_type" in '');; @@ -5774,7 +5788,7 @@ compile=' mc_file=$1; shift; case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then -echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4; +echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4; exit 1; fi; esac; @@ -7249,7 +7263,7 @@ prefixit='case "$3" in none) eval "tp=\"\$$2\""; case "$tp" in - ""|" ") eval "$1=\"\$$2\"";; + ""|" "|none) eval "$1=\"\$$2\"";; *) eval "$1=";; esac;; esac;; @@ -8103,6 +8117,10 @@ while $test 1 ; do $define|true|[yY]*) dflt='y' ;; + $undef|false|[nN]*) + dflt='n' + dflt_dtrace="" + ;; ?*) dflt='y' dflt_dtrace=$usedtrace @@ -8539,7 +8557,7 @@ EOM if $test "X$sysroot" != X; then case "$gccversion" in '') ;; - *) dflt="$dflt --sysroot $sysroot" ;; + *) dflt="$dflt --sysroot=$sysroot" ;; esac fi @@ -8766,7 +8784,7 @@ case "$shrpdir" in *) $cat >&4 <&4 @@ -10371,15 +10385,15 @@ esac $cat >>try.c < -int checkit(char *expect, char *got) +void checkit(const char *expect, char *got) { if (strcmp(expect, got)) { printf("%s oddity: Expected %s, got %s\n", @@ -10560,6 +10574,7 @@ for xxx_convert in $xxx_list; do fi else echo "$xxx_convert NOT found." >&4 + xxx_convert='' fi done @@ -10737,6 +10752,7 @@ hasproto='varname=$1; func=$2; shift; shift; while $test $# -ge 2; do case "$1" in $define) echo "#include <$2>";; + literal) echo "$2" ;; esac ; shift 2; done > try.c; @@ -11236,6 +11252,34 @@ set d_attribute_warn_unused_result eval $setvar $rm -f attrib* +: Look for GCC-style attribute always_inline +case "$d_attribute_always_inline" in +'') +echo " " +echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4 +$cat >attrib.c <<'EOCP' +#include +static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void); +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 support __attribute__((always_inline))." + val="$undef" + else + echo "Your C compiler supports __attribute__((always_inline))." + val="$define" + fi +else + echo "Your C compiler doesn't seem to understand __attribute__ at all." + val="$undef" +fi +;; +*) val="$d_attribute_always_inline" ;; +esac +set d_attribute_always_inline +eval $setvar +$rm -f attrib* + : see if getpgrp exists set getpgrp d_getpgrp eval $inlibc @@ -11245,6 +11289,7 @@ case "$d_getpgrp" in echo " " echo "Checking to see which flavor of getpgrp is in use..." $cat >try.c < #$i_unistd I_UNISTD #include #ifdef I_UNISTD @@ -11311,6 +11356,7 @@ case "$d_setpgrp" in echo " " echo "Checking to see which flavor of setpgrp is in use..." $cat >try.c < #$i_unistd I_UNISTD #include #ifdef I_UNISTD @@ -12051,27 +12097,6 @@ case "$d_cmsghdr_s" in *) echo "No, it doesn't." ;; esac -: 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 = { 0 }; -} -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 - : see if copysign exists set copysign d_copysign eval $inlibc @@ -14092,9 +14117,11 @@ echo " " echo "Checking if you have a working futimes()" >&4 $cat >try.c < +#include #include #include #include +#include int main () { @@ -15787,7 +15814,7 @@ eval $inlibc echo "Checking to see if you have isless..." >&4 $cat >try.c < -int main() { return isless(0.0); } +int main() { return isless(2.0, 1.0); } EOCP set try if eval $compile; then @@ -15880,27 +15907,24 @@ esac : see if lchown exists echo " " -$cat > try.c <<'EOCP' -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char lchown(); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char lchown(); -int main() { - /* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_lchown) || defined (__stub___lchown) -choke me -#else -lchown(); +$cat > try.c < +#include +#include +#$i_unistd I_UNISTD +#ifdef I_UNISTD +# include #endif -; return 0; } +int main(int argc, char *argv[]) +{ + if (lchown("./try.c", -1, getgid()) == -1) { + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); +} EOCP set try -if eval $compile; then +if eval $compile && ./try; then $echo "lchown() found." >&4 val="$define" else @@ -15909,6 +15933,7 @@ else fi set d_lchown eval $setvar +$rm_try : See if number of significant digits in a double precision number is known echo " " @@ -16153,6 +16178,10 @@ eval $inlibc set malloc_good_size d_malloc_good_size eval $inlibc +: see if malloc_usable_size exists +set malloc_usable_size d_malloc_usable_size +eval $inlibc + : see if mblen exists set mblen d_mblen eval $inlibc @@ -16174,12 +16203,46 @@ set mbtowc d_mbtowc eval $inlibc : see if memmem exists -set memmem d_memmem -eval $inlibc +: We need both a prototype in string.h and the symbol in libc. +echo " " +d_memmem_proto='' +xx1="#$d_gnulibc HAS_GNULIBC" +xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)' +xx3='# define _GNU_SOURCE' +xx4='#endif' +set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h +eval $hasproto +case "$d_memmem_proto" in + define) # see if memmem exists + set memmem d_memmem + eval $inlibc + ;; + *) val=$undef + set d_memmem + eval $setvar + ;; +esac : see if memrchr exists -set memrchr d_memrchr -eval $inlibc +: We need both a prototype in string.h and the symbol in libc. +echo " " +d_memrchr_proto='' +xx1="#$d_gnulibc HAS_GNULIBC" +xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)' +xx3='# define _GNU_SOURCE' +xx4='#endif' +set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h +eval $hasproto +case "$d_memrchr_proto" in + define) # see if memrchr exists + set memrchr d_memrchr + eval $inlibc + ;; + *) val=$undef + set d_memrchr + eval $setvar + ;; +esac : see if mkdir exists set mkdir d_mkdir @@ -17768,14 +17831,188 @@ eval $inlibc set setlinebuf d_setlinebuf eval $inlibc -: see if setlocale exists -set setlocale d_setlocale -eval $inlibc - : see if locale.h is available set locale.h i_locale eval $inhdr +: see if this system has wctype.h +set wctype.h i_wctype +eval $inhdr + +: see if towupper exists +set towupper d_towupper +eval $inlibc + +: check for setlocale function and behavior +$cat <try.c < +#include +#$i_locale I_LOCALE +#ifdef I_LOCALE +# include +#endif +#$i_wctype I_WCTYPE +#ifdef I_WCTYPE +# include +#endif + +int main() { + const char * invalid_name = "\a"; /* This is really invalid! */ + int accepts_any_locale_name = 0; + int has_C_UTF8 = 0; + unsigned char bad_setlocale = 255; + + /* If LC_CTYPE isn't defined the compilation will fail, and locales will be + * disabled. It's hard to imagine an instance where meaningful locale + * handling could be done without LC_CTYPE */ + const char * name = setlocale(LC_CTYPE, "C"); + + if (name == NULL || strcmp(name, "C") != 0) { + exit(bad_setlocale); + } + + name = setlocale(LC_CTYPE, invalid_name); + if (name != NULL) { + + /* Let it pass if it accepts the name but gives back one of the C + * locales */ + if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) { + accepts_any_locale_name = 1; + } + } + + name = setlocale(LC_CTYPE, "C.UTF-8"); + if (name != NULL) { + unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF; + +#$d_towupper HAS_TOWUPPER +#ifdef HAS_TOWUPPER + + /* We assume that if the machine doesn't have the C99 towupper, it + * doesn't have C.UTF-8, even if we successfully changed locales to + * include it. This seems safer even on platforms that didn't accept + * the really invalid name */ + + if (towupper(y_with_diaeresis) == 0x178) { + has_C_UTF8 = 1; + } + +#endif + + } + +#if 0 + + /* Currently unused code to determine if LC_ALL with disparate values uses + * category = value pairs or positional, and to determine the separator + * between the categories. We could add code so that if the separator were + * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about + * every possible ASCII separator would fit in the 5 bits available in the + * exit code. This would not be true in EBCDIC. And then if LC_ALL is + * positional, we probably would want to know the order of the categories. + * Using a file between the C program and the shell script would really be + * require to do that */ +#ifdef LC_ALL + + unsigned char min_separator = ' ' - 1; + unsigned char separator = min_separator; + int uses_name_value_pair_names = 0; + + name = setlocale(LC_ALL, "C"); + if (name == NULL || strcmp(name, "C") != 0) { + exit(bad_setlocale); + } + + if (has_C_UTF8) { + char * pos; + + name = setlocale(LC_CTYPE, "C.UTF-8"); + if (name == NULL) { + exit(bad_setlocale); + } + name = setlocale(LC_ALL, NULL); + if (name == NULL) { + exit(bad_setlocale); + } + + pos = strstr(name, "LC_CTYPE" "=C.UTF-8"); + if (pos != NULL) { + uses_name_value_pair_names = 1; + if (pos == name) { + separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1]; + } + else { + separator = *(pos - 1); + } + } + else { + pos = strstr(name, "C.UTF-8"); + if (pos == NULL) { + /* bad */ + } + else if (pos == name) { + separator = name[sizeof("C.UTF-8") - 1]; + } + else { + separator = *(pos - 1); + } + } + } + +#endif +#endif + + exit( 0 /* (separator - min_separator) << 3 + | uses_name_value_pair_names << 2 + */ + | has_C_UTF8 << 1 + | accepts_any_locale_name); + +} +EOCP +set try +if eval $compile; then + echo "Your system has setlocale()..." >&4 + $run ./try + case $? in + 0) echo "and it seems sane" >&4 + d_setlocale="$define" + d_setlocale_accepts_any_locale_name="$undef" + d_has_C_UTF8="false" + ;; + 1) echo "and it seems sane, but accepts any locale name as valid" >&4 + d_setlocale="$define" + d_setlocale_accepts_any_locale_name="$define" + d_has_C_UTF8="false" + ;; + 2) echo "and it seems sane" >&4 + d_setlocale="$define" + d_setlocale_accepts_any_locale_name="$undef" + d_has_C_UTF8="true" + ;; + 3) echo "and it seems sane, but accepts any locale name as valid" >&4 + d_setlocale="$define" + d_setlocale_accepts_any_locale_name="$define" + d_has_C_UTF8="true" + ;; + *) echo "but it doesn't seem to work, so we won't use it." >&4 + d_setlocale="$undef" + d_setlocale_accepts_any_locale_name="$undef" + d_has_C_UTF8="false" + ;; + esac +else + echo "your system does not have setlocale()" >&4 + d_setlocale="$undef" + d_setlocale_accepts_any_locale_name="$undef" + d_has_C_UTF8="false" +fi +$rm_try + : see if setlocale_r exists set setlocale_r d_setlocale_r eval $inlibc @@ -18788,12 +19025,46 @@ set strftime d_strftime eval $inlibc : see if strlcat exists -set strlcat d_strlcat -eval $inlibc +: We need both a prototype in string.h and the symbol in libc. +echo " " +d_strlcat_proto='' +xx1="#$d_gnulibc HAS_GNULIBC" +xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)' +xx3='# define _GNU_SOURCE' +xx4='#endif' +set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h +eval $hasproto +case "$d_strlcat_proto" in + define) # see if strlcat exists + set strlcat d_strlcat + eval $inlibc + ;; + *) val=$undef + set d_strlcat + eval $setvar + ;; +esac : see if strlcpy exists -set strlcpy d_strlcpy -eval $inlibc +: We need both a prototype in string.h and the symbol in libc. +echo " " +d_strlcpy_proto='' +xx1="#$d_gnulibc HAS_GNULIBC" +xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)' +xx3='# define _GNU_SOURCE' +xx4='#endif' +set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h +eval $hasproto +case "$d_strlcpy_proto" in + define) # see if strlcpy exists + set strlcpy d_strlcpy + eval $inlibc + ;; + *) val=$undef + set d_strlcpy + eval $setvar + ;; +esac : see if strnlen exists set strnlen d_strnlen @@ -18837,9 +19108,9 @@ EOM #define strtoll _strtoll #endif #include -extern long long int strtoll(char *s, char **, int); +#include static int bad = 0; -int check(char *s, long long ell, int een) { +void check(const char *s, long long ell, int een) { long long gll; errno = 0; gll = strtoll(s, 0, 10); @@ -18892,11 +19163,11 @@ case "$d_strtoul" in Checking whether your strtoul() works okay... EOM $cat >try.c <<'EOCP' +#include #include #include -extern unsigned long int strtoul(char *s, char **, int); static int bad = 0; -void check(char *s, unsigned long eul, int een) { +void check(const char *s, unsigned long eul, int een) { unsigned long gul; errno = 0; gul = strtoul(s, 0, 10); @@ -18972,14 +19243,14 @@ case "$d_longlong-$d_strtoull" in Checking whether your strtoull() works okay... EOM $cat >try.c <<'EOCP' +#include #include #ifdef __hpux #define strtoull __strtoull #endif #include -extern unsigned long long int strtoull(char *s, char **, int); static int bad = 0; -int check(char *s, long long eull, int een) { +void check(const char *s, long long eull, int een) { long long gull; errno = 0; gull = strtoull(s, 0, 10); @@ -19029,11 +19300,11 @@ case "$d_strtouq" in Checking whether your strtouq() works okay... EOM $cat >try.c <<'EOCP' +#include #include #include -extern unsigned long long int strtouq(char *s, char **, int); static int bad = 0; -void check(char *s, unsigned long long eull, int een) { +void check(const char *s, unsigned long long eull, int een) { unsigned long long gull; errno = 0; gull = strtouq(s, 0, 10); @@ -19297,6 +19568,10 @@ case "$d_tmpnam_r" in ;; esac +: see if towlower exists +set towlower d_towlower +eval $inlibc + : see if trunc exists set trunc d_trunc eval $inlibc @@ -19650,6 +19925,10 @@ eval $inlibc set waitpid d_waitpid eval $inlibc +: see if wcrtomb exists +set wcrtomb d_wcrtomb +eval $inlibc + : look for wcscmp echo " " $cat >try.c <<'EOCP' @@ -19853,10 +20132,6 @@ $define) echo " " echo "Checking Berkeley DB version ..." >&4 $cat >try.c < #include #$i_stdlib I_STDLIB @@ -19947,10 +20222,6 @@ define) echo " " echo "Checking return type needed for hash for Berkeley DB ..." >&4 $cat >try.c < #include @@ -19991,10 +20262,6 @@ define) echo " " echo "Checking return type needed for prefix for Berkeley DB ..." >&4 cat >try.c < #include @@ -22768,7 +23035,7 @@ M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM -MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS +MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX @@ -22959,7 +23226,7 @@ fi : add -D_FORTIFY_SOURCE if feasible and not already there case "$gccversion" in -[4567].*) case "$optimize$ccflags" in +[456789].*|[1-9][0-9]*) case "$optimize$ccflags" in *-O*) case "$ccflags$cppsymbols" in *_FORTIFY_SOURCE=*) # Don't add it again. echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4 @@ -23812,6 +24079,7 @@ d_asinh='$d_asinh' d_atanh='$d_atanh' d_atolf='$d_atolf' d_atoll='$d_atoll' +d_attribute_always_inline='$d_attribute_always_inline' d_attribute_deprecated='$d_attribute_deprecated' d_attribute_format='$d_attribute_format' d_attribute_malloc='$d_attribute_malloc' @@ -23840,7 +24108,6 @@ d_class='$d_class' d_clearenv='$d_clearenv' d_closedir='$d_closedir' d_cmsghdr_s='$d_cmsghdr_s' -d_const='$d_const' d_copysign='$d_copysign' d_copysignl='$d_copysignl' d_cplusplus='$d_cplusplus' @@ -24003,6 +24270,7 @@ d_gmtime64='$d_gmtime64' d_gmtime_r='$d_gmtime_r' d_gnulibc='$d_gnulibc' d_grpasswd='$d_grpasswd' +d_has_C_UTF8='$d_has_C_UTF8' d_hasmntopt='$d_hasmntopt' d_htonl='$d_htonl' d_hypot='$d_hypot' @@ -24069,6 +24337,7 @@ d_lstat='$d_lstat' d_madvise='$d_madvise' d_malloc_good_size='$d_malloc_good_size' d_malloc_size='$d_malloc_size' +d_malloc_usable_size='$d_malloc_usable_size' d_mblen='$d_mblen' d_mbrlen='$d_mbrlen' d_mbrtowc='$d_mbrtowc' @@ -24190,6 +24459,7 @@ d_sethostent_r='$d_sethostent_r' d_setitimer='$d_setitimer' d_setlinebuf='$d_setlinebuf' d_setlocale='$d_setlocale' +d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name' d_setlocale_r='$d_setlocale_r' d_setnent='$d_setnent' d_setnetent_r='$d_setnetent_r' @@ -24297,6 +24567,8 @@ d_times='$d_times' d_tm_tm_gmtoff='$d_tm_tm_gmtoff' d_tm_tm_zone='$d_tm_tm_zone' d_tmpnam_r='$d_tmpnam_r' +d_towlower='$d_towlower' +d_towupper='$d_towupper' d_trunc='$d_trunc' d_truncate='$d_truncate' d_truncl='$d_truncl' @@ -24325,6 +24597,7 @@ d_voidtty='$d_voidtty' d_vsnprintf='$d_vsnprintf' d_wait4='$d_wait4' d_waitpid='$d_waitpid' +d_wcrtomb='$d_wcrtomb' d_wcscmp='$d_wcscmp' d_wcstombs='$d_wcstombs' d_wcsxfrm='$d_wcsxfrm' @@ -24516,6 +24789,7 @@ i_ustat='$i_ustat' i_utime='$i_utime' i_vfork='$i_vfork' i_wchar='$i_wchar' +i_wctype='$i_wctype' i_xlocale='$i_xlocale' ignore_versioned_solibs='$ignore_versioned_solibs' inc_version_list='$inc_version_list'