?RCS: $Id$ ?RCS: ?RCS: Copyright (c) 2000 Jarkko Hietaniemi ?RCS: ?RCS: You may distribute under the terms of either the GNU General Public ?RCS: License or the Artistic License, as specified in the README file. ?RCS: ?MAKE:d_strtoll: Inlibc d_longlong Compile cat run ?MAKE: -pick add $@ %< ?S:d_strtoll: ?S: This variable conditionally defines the HAS_STRTOLL symbol, which ?S: indicates to the C program that the strtoll() routine is available. ?S:. ?C:HAS_STRTOLL: ?C: This symbol, if defined, indicates that the strtoll routine is ?C: available to convert strings to long longs. ?C:. ?H:#$d_strtoll HAS_STRTOLL /**/ ?H:. ?T:yyy ?F:!try : see if strtoll exists set strtoll d_strtoll eval $inlibc case "$d_longlong-$d_strtoll" in "$define-$define") $cat <try.c <<'EOCP' #include #ifdef __hpux #define strtoll __strtoll #endif #ifdef __EMX__ #define strtoll _strtoll #endif #include extern long long int strtoll(char *s, char **, int); static int bad = 0; int check(char *s, long long ell, int een) { long long gll; errno = 0; gll = strtoll(s, 0, 10); if (!((gll == ell) && (errno == een))) bad++; } int main() { check(" 1", 1LL, 0); check(" 0", 0LL, 0); check("-1", -1LL, 0); check("-9223372036854775808", -9223372036854775808LL, 0); check("-9223372036854775808", -9223372036854775808LL, 0); check(" 9223372036854775807", 9223372036854775807LL, 0); check("-9223372036854775808", -9223372036854775808LL, 0); check(" 9223372036854775808", 9223372036854775807LL, ERANGE); check("-9223372036854775809", -9223372036854775808LL, ERANGE); if (!bad) printf("ok\n"); } EOCP set try if eval $compile; then yyy=`$run ./try` case "$yyy" in ok) echo "Your strtoll() seems to be working okay." ;; *) cat <&4 Your strtoll() doesn't seem to be working okay. EOM d_strtoll="$undef" ;; esac else echo "(I can't seem to compile the test program--assuming it doesn't)" d_strtoll="$undef" fi ;; esac