-?RCS: $Id$
-?RCS:
-?RCS: Copyright (c) 1999 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_ctime_r ctime_r_proto: Inlibc Protochk i_systypes i_time
-?MAKE: -pick add $@ %<
+?MAKE:d_ctime_r ctime_r_proto: Inlibc Protochk i_systypes i_dirent
+?MAKE: -pick add $@ %<
?S:d_ctime_r:
-?S: This variable conditionally defines the HAS_CTIME_R symbol,
-?S: which indicates to the C program that the ctime_r()
-?S: routine is available.
+?S: This variable conditionally defines the HAS_CTIME_R symbol,
+?S: which indicates to the C program that the ctime_r()
+?S: routine is available.
?S:.
?S:ctime_r_proto:
-?S: This variable encodes the prototype of ctime_r.
+?S: This variable encodes the prototype of ctime_r.
?S:.
?C:HAS_CTIME_R:
-?C: This symbol, if defined, indicates that the ctime_r routine
-?C: is available to ctime re-entrantly.
+?C: This symbol, if defined, indicates that the ctime_r routine
+?C: is available to ctime re-entrantly.
?C:.
?C:CTIME_R_PROTO:
-?C: This symbol encodes the prototype of ctime_r.
-?C: 1 int ctime_r(const time_t *, char *);
-?C: 2 char* ctime_r(const time_t *, char *);
-?C: 13 int ctime_r(const time_t *, char *, int);
-?C: 14 char* ctime_r(const time_t *, char *, int);
-?C: The 2 is preferred since it's the SUSv3/POSIX 1001.3-2001 one.
+?C: This symbol encodes the prototype of ctime_r.
?C:.
-?H:#$d_ctime_r HAS_CTIME_R /**/
-?H:#define CTIME_R_PROTO $ctime_r_proto /**/
+?H:#$d_ctime_r HAS_CTIME_R /**/
+?H:#define CTIME_R_PROTO $ctime_r_proto /**/
?H:.
?T:try hdrs
?LINT:set d_ctime_r
+?LINT:set ctime_r_proto
: see if ctime_r exists
set ctime_r d_ctime_r
eval $inlibc
case "$d_ctime_r" in
"$define")
- hdrs="$i_systypes sys/types.h $i_time time.h"
- try='extern char* ctime_r(const time_t *, char *);'
- if ./protochk "$try" $hdrs; then
- echo "Your system has $try"
- ctime_r_proto=2
- else
- try='extern char* ctime_r(const time_t*, char*, int);'
- if ./protochk "$try" $hdrs; then
- echo "Your system has $try"
- ctime_r_proto=14
- else
- try='extern int ctime_r(const time_t*, char*, int);'
- if ./protochk "$try" $hdrs; then
- echo "Your system has $try"
- ctime_r_proto=13
- else
- try='extern int ctime_r(const time_t*, char*);'
- if ./protochk "$try" $hdrs; then
- echo "Your system has $try"
- ctime_r_proto=1
- else
- echo "I do not recognize the prototype of your ctime_r, not using it." >&4
- d_ctime_r="$undef"
- ctime_r_proto=0
- fi
- fi
- fi
- fi
+ hdrs="$i_systypes sys/types.h ${i}_time time.h"
+ case "$ctime_r_proto" in
+ '') try='extern char* ctime_r(const time_t*, char*);'
+ ./protochk "$try" $hdrs && ctime_r_proto=B_SB;
+ ;;
+ esac
+ case "$ctime_r_proto" in
+ '') try='extern char* ctime_r(const time_t*, char*, int);'
+ ./protochk "$try" $hdrs && ctime_r_proto=B_SBI;
+ ;;
+ esac
+ case "$ctime_r_proto" in
+ '') try='extern int ctime_r(const time_t*, char*);'
+ ./protochk "$try" $hdrs && ctime_r_proto=I_SB;
+ ;;
+ esac
+ case "$ctime_r_proto" in
+ '') try='extern int ctime_r(const time_t*, char*, int);'
+ ./protochk "$try" $hdrs && ctime_r_proto=I_SBI;
+ ;;
+ esac
+ case "$ctime_r_proto" in
+ '') d_ctime_r=undef ; echo "Disabling ctime_r, cannot find prototype." ;;
+ * ) ctime_r_proto="REENTRANT_$ctime_r_proto" ; echo "$try" ;;
+ esac
;;
-*) ctime_r_proto=0 ;;
esac