Codebase list nfdump / upstream/1.5.7
Imported Upstream version 1.5.7 Erik Wenzel 15 years ago
32 changed file(s) with 3712 addition(s) and 2563 deletion(s). Raw diff Collapse all Expand all
0 2008-02-22
1 - Add icmp type/code decoding
2 - Add proper icmp v9 decoding
3 - Fix memory leaks in -e auto expire mode in nfcapd.
4 - Fix somee potential dead locks with file locking, when expiring
5 - Fix multicast bug in nfreplay
6 - Add hostname lookup for IP addresses in filter.
7
08 2007-10-15 stable-1.5.6
19 - Fix odd CISCO behaviour for ICMP type/code in src port.
210 - Add fast LZO1X-1 compression option (-z) for output file.
3131 #
3232 # $Author: peter $
3333 #
34 # $Id: Makefile.in 95 2007-10-15 06:05:26Z peter $
34 # $Id: Makefile.in 97 2008-02-21 09:50:02Z peter $
3535 #
3636
3737 srcdir = .
4949 PREFIX = $(DESTDIR)/$(prefix)
5050 MANDIR = $(DESTDIR)/@mandir@
5151 COMMON_OBJ = minilzo.o nffile.o nf_common.o util.o flist.o panonymizer.o rijndael.o @FTS_OBJ@
52 FILTER_OBJ = grammar.o scanner.o nftree.o ipconv.o
52 FILTER_OBJ = grammar.o scanner.o nftree.o ipconv.o
5353 NFDUMP_OBJ = nfdump.o $(COMMON_OBJ) $(FILTER_OBJ) nfstat.o nfprof.o
5454 NFRPLY_OBJ = nfreplay.o $(COMMON_OBJ) $(FILTER_OBJ) nfprof.o nfnet.o netflow_v9.o netflow_v5_v7.o
5555 NFPROF_OBJ = nfprofile.o profile.o nfstatfile.o $(COMMON_OBJ) $(FILTER_OBJ)
6161 OBJECTS = nfcapd nfdump nfreplay nfexpire nftest nfgen @opt_objects@
6262 INCS = @FT_INCLUDES@
6363 LIBS = @LIBS@
64 RRD_LIBS = @RRD_LIBS@
6465 FT_LIBS = -lft -lz
6566 FT_LDFLAGS = @FT_LDFLAGS@
6667 WARNINGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn
8687 $(CC) $(CFLAGS) $(INCS) -o $@ $(NFDUMP_OBJ) $(LDFLAGS) $(LIBS)
8788
8889 nfprofile: $(NFPROF_OBJ)
89 $(CC) $(CFLAGS) $(INCS) -o $@ $(NFPROF_OBJ) $(LDFLAGS) $(LIBS)
90 $(CC) $(CFLAGS) $(INCS) -o $@ $(NFPROF_OBJ) $(LDFLAGS) $(LIBS) $(RRD_LIBS)
9091
9192 nfreplay: $(NFRPLY_OBJ)
9293 $(CC) $(CFLAGS) $(INCS) -o $@ $(NFRPLY_OBJ) $(LDFLAGS) $(LIBS)
2727 *
2828 * $Author: peter $
2929 *
30 * $Id: bookkeeper.c 92 2007-08-24 12:10:24Z peter $
30 * $Id: bookkeeper.c 97 2008-02-21 09:50:02Z peter $
3131 *
32 * $LastChangedRevision: 92 $
32 * $LastChangedRevision: 97 $
3333 *
3434 *
3535 */
364364 }
365365
366366 bookkeeper_list_entry = &bookkeeper_list;
367 while ( *bookkeeper_list_entry != NULL )
367 while ( *bookkeeper_list_entry != NULL && (*bookkeeper_list_entry)->bookkeeper != NULL )
368368 bookkeeper_list_entry = &((*bookkeeper_list_entry)->next);
369369
370 (*bookkeeper_list_entry) = (bookkeeper_list_t *)malloc(sizeof(bookkeeper_list_t));
371 if ( !*bookkeeper_list_entry ) {
372 LogError("malloc() error in %s line %d: %s", __FILE__, __LINE__, strerror(errno) );
373 return ERR_FAILED;
374 }
375 memset((void *)*bookkeeper_list_entry, 0, sizeof(bookkeeper_list_t));
370 // allocate new slot, else use unused slot
371 if ( *bookkeeper_list_entry == NULL ) {
372 (*bookkeeper_list_entry) = (bookkeeper_list_t *)malloc(sizeof(bookkeeper_list_t));
373 if ( !*bookkeeper_list_entry ) {
374 LogError("malloc() error in %s line %d: %s", __FILE__, __LINE__, strerror(errno) );
375 return ERR_FAILED;
376 }
377 memset((void *)*bookkeeper_list_entry, 0, sizeof(bookkeeper_list_t));
378 }
376379
377380 (*bookkeeper_list_entry)->shm_id = shm_id;
378381 (*bookkeeper_list_entry)->sem_id = sem_id;
406409 bookkeeper = NULL;
407410
408411 if ( destroy == 0 ) {
412 // Entry no longer valid
413 bookkeeper_list_entry->bookkeeper = NULL;
414 bookkeeper_list_entry->shm_id = 0;
415 bookkeeper_list_entry->sem_id = 0;
409416 return;
410417 }
411418
77
88 /* Define to 1 if you have the <arpa/inet.h> header file. */
99 #undef HAVE_ARPA_INET_H
10
11 /* Define to 1 if you have the <arpa/nameser.h> header file. */
12 #undef HAVE_ARPA_NAMESER_H
1013
1114 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
1215 */
3639 /* Define to 1 if you have the `nsl' library (-lnsl). */
3740 #undef HAVE_LIBNSL
3841
39 /* Define to 1 if you have the `rrd' library (-lrrd). */
40 #undef HAVE_LIBRRD
41
42 /* Define to 1 if you have the `socket' library (-lsocket). */
42 /* Define to 1 if you have the `resolv' library (-lresolv). */
43 #undef HAVE_LIBRESOLV
44
45 /* */
4346 #undef HAVE_LIBSOCKET
4447
4548 /* Define to 1 if you have the `z' library (-lz). */
6467 /* Define to 1 if you have the `memset' function. */
6568 #undef HAVE_MEMSET
6669
70 /* Define to 1 if you have the <nameser8_compat.h> header file. */
71 #undef HAVE_NAMESER8_COMPAT_H
72
6773 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
6874 #undef HAVE_NDIR_H
75
76 /* Define to 1 if you have the <netdb.h> header file. */
77 #undef HAVE_NETDB_H
6978
7079 /* Define to 1 if you have the <netinet/in.h> header file. */
7180 #undef HAVE_NETINET_IN_H
7382 /* Define to 1 if your system has a GNU libc compatible `realloc' function,
7483 and to 0 otherwise. */
7584 #undef HAVE_REALLOC
85
86 /* Define to 1 if you have the <resolv.h> header file. */
87 #undef HAVE_RESOLV_H
7688
7789 /* Define to 1 if you have the <rrd.h> header file. */
7890 #undef HAVE_RRD_H
+2845
-2163
configure less more
00 #! /bin/sh
1 # From configure.in Revision: 92 .
1 # From configure.in Revision: 95 .
22 # Guess values for system-dependent variables and create Makefiles.
33 # Generated by GNU Autoconf 2.59 for nfdump 1.5.5.
44 #
311311 # include <unistd.h>
312312 #endif"
313313
314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT YACC LEX LEXLIB LEX_OUTPUT_ROOT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP opt_objects FT_INCLUDES FT_LDFLAGS LFLAGS FTS_OBJ LIBOBJS HA_HAVE_SCANDIR LTLIBOBJS'
314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT YACC LEX LEXLIB LEX_OUTPUT_ROOT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RRD_LIBS CPP EGREP opt_objects FT_INCLUDES FT_LDFLAGS LFLAGS FTS_OBJ LIBOBJS HA_HAVE_SCANDIR LTLIBOBJS'
315315 ac_subst_files=''
316316
317317 # Initialize some variables set by options.
44864486 if test "${enable_nfprofile+set}" = set; then
44874487 enableval="$enable_nfprofile"
44884488
4489
4490 echo "$as_me:$LINENO: checking for rrd_update in -lrrd" >&5
4489 echo "$as_me:$LINENO: checking for rrd_update in -lrrd" >&5
44914490 echo $ECHO_N "checking for rrd_update in -lrrd... $ECHO_C" >&6
44924491 if test "${ac_cv_lib_rrd_rrd_update+set}" = set; then
44934492 echo $ECHO_N "(cached) $ECHO_C" >&6
45524551 echo "$as_me:$LINENO: result: $ac_cv_lib_rrd_rrd_update" >&5
45534552 echo "${ECHO_T}$ac_cv_lib_rrd_rrd_update" >&6
45544553 if test $ac_cv_lib_rrd_rrd_update = yes; then
4555 cat >>confdefs.h <<_ACEOF
4554
4555 cat >>config.h <<_ACEOF
45564556 #define HAVE_LIBRRD 1
45574557 _ACEOF
4558
4559 LIBS="-lrrd $LIBS"
4558 RRD_LIBS="-lrrd"
4559
4560
45604561
45614562 else
45624563 { { echo "$as_me:$LINENO: error: Can not link librrd. Please specify --with-rrdpath=.. configure failed! " >&5
57235724 fi
57245725
57255726
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736 for ac_header in arpa/inet.h fcntl.h netinet/in.h fts.h stdint.h stdlib.h string.h sys/socket.h syslog.h unistd.h iso/limits_iso.h
5727 for ac_header in nameser8_compat.h
57375728 do
57385729 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
57395730 if eval "test \"\${$as_ac_Header+set}\" = set"; then
58845875
58855876
58865877
5887 if test "$ac_cv_header_fts_h" != yes; then
5888 FTS_OBJ=fts_compat.o
5889 fi
5890
5891
5892 # Checks for typedefs, structures, and compiler characteristics.
5893 echo "$as_me:$LINENO: checking for void *" >&5
5894 echo $ECHO_N "checking for void *... $ECHO_C" >&6
5895 if test "${ac_cv_type_void_p+set}" = set; then
5896 echo $ECHO_N "(cached) $ECHO_C" >&6
5897 else
5898 cat >conftest.$ac_ext <<_ACEOF
5899 /* confdefs.h. */
5900 _ACEOF
5901 cat confdefs.h >>conftest.$ac_ext
5902 cat >>conftest.$ac_ext <<_ACEOF
5903 /* end confdefs.h. */
5904 $ac_includes_default
5905 int
5906 main ()
5907 {
5908 if ((void * *) 0)
5909 return 0;
5910 if (sizeof (void *))
5911 return 0;
5912 ;
5913 return 0;
5914 }
5915 _ACEOF
5916 rm -f conftest.$ac_objext
5917 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
5918 (eval $ac_compile) 2>conftest.er1
5919 ac_status=$?
5920 grep -v '^ *+' conftest.er1 >conftest.err
5921 rm -f conftest.er1
5922 cat conftest.err >&5
5923 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5924 (exit $ac_status); } &&
5925 { ac_try='test -z "$ac_c_werror_flag"
5926 || test ! -s conftest.err'
5927 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5928 (eval $ac_try) 2>&5
5929 ac_status=$?
5930 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5931 (exit $ac_status); }; } &&
5932 { ac_try='test -s conftest.$ac_objext'
5933 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5934 (eval $ac_try) 2>&5
5935 ac_status=$?
5936 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5937 (exit $ac_status); }; }; then
5938 ac_cv_type_void_p=yes
5939 else
5940 echo "$as_me: failed program was:" >&5
5941 sed 's/^/| /' conftest.$ac_ext >&5
5942
5943 ac_cv_type_void_p=no
5944 fi
5945 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
5946 fi
5947 echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5
5948 echo "${ECHO_T}$ac_cv_type_void_p" >&6
5949
5950 echo "$as_me:$LINENO: checking size of void *" >&5
5951 echo $ECHO_N "checking size of void *... $ECHO_C" >&6
5952 if test "${ac_cv_sizeof_void_p+set}" = set; then
5953 echo $ECHO_N "(cached) $ECHO_C" >&6
5954 else
5955 if test "$ac_cv_type_void_p" = yes; then
5956 # The cast to unsigned long works around a bug in the HP C Compiler
5957 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
5958 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
5959 # This bug is HP SR number 8606223364.
5960 if test "$cross_compiling" = yes; then
5961 # Depending upon the size, compute the lo and hi bounds.
5962 cat >conftest.$ac_ext <<_ACEOF
5963 /* confdefs.h. */
5964 _ACEOF
5965 cat confdefs.h >>conftest.$ac_ext
5966 cat >>conftest.$ac_ext <<_ACEOF
5967 /* end confdefs.h. */
5968 $ac_includes_default
5969 int
5970 main ()
5971 {
5972 static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)];
5973 test_array [0] = 0
5974
5975 ;
5976 return 0;
5977 }
5978 _ACEOF
5979 rm -f conftest.$ac_objext
5980 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
5981 (eval $ac_compile) 2>conftest.er1
5982 ac_status=$?
5983 grep -v '^ *+' conftest.er1 >conftest.err
5984 rm -f conftest.er1
5985 cat conftest.err >&5
5986 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5987 (exit $ac_status); } &&
5988 { ac_try='test -z "$ac_c_werror_flag"
5989 || test ! -s conftest.err'
5990 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5991 (eval $ac_try) 2>&5
5992 ac_status=$?
5993 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5994 (exit $ac_status); }; } &&
5995 { ac_try='test -s conftest.$ac_objext'
5996 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
5997 (eval $ac_try) 2>&5
5998 ac_status=$?
5999 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6000 (exit $ac_status); }; }; then
6001 ac_lo=0 ac_mid=0
6002 while :; do
6003 cat >conftest.$ac_ext <<_ACEOF
6004 /* confdefs.h. */
6005 _ACEOF
6006 cat confdefs.h >>conftest.$ac_ext
6007 cat >>conftest.$ac_ext <<_ACEOF
6008 /* end confdefs.h. */
6009 $ac_includes_default
6010 int
6011 main ()
6012 {
6013 static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
6014 test_array [0] = 0
6015
6016 ;
6017 return 0;
6018 }
6019 _ACEOF
6020 rm -f conftest.$ac_objext
6021 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6022 (eval $ac_compile) 2>conftest.er1
6023 ac_status=$?
6024 grep -v '^ *+' conftest.er1 >conftest.err
6025 rm -f conftest.er1
6026 cat conftest.err >&5
6027 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6028 (exit $ac_status); } &&
6029 { ac_try='test -z "$ac_c_werror_flag"
6030 || test ! -s conftest.err'
6031 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6032 (eval $ac_try) 2>&5
6033 ac_status=$?
6034 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6035 (exit $ac_status); }; } &&
6036 { ac_try='test -s conftest.$ac_objext'
6037 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6038 (eval $ac_try) 2>&5
6039 ac_status=$?
6040 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6041 (exit $ac_status); }; }; then
6042 ac_hi=$ac_mid; break
6043 else
6044 echo "$as_me: failed program was:" >&5
6045 sed 's/^/| /' conftest.$ac_ext >&5
6046
6047 ac_lo=`expr $ac_mid + 1`
6048 if test $ac_lo -le $ac_mid; then
6049 ac_lo= ac_hi=
6050 break
6051 fi
6052 ac_mid=`expr 2 '*' $ac_mid + 1`
6053 fi
6054 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6055 done
6056 else
6057 echo "$as_me: failed program was:" >&5
6058 sed 's/^/| /' conftest.$ac_ext >&5
6059
6060 cat >conftest.$ac_ext <<_ACEOF
6061 /* confdefs.h. */
6062 _ACEOF
6063 cat confdefs.h >>conftest.$ac_ext
6064 cat >>conftest.$ac_ext <<_ACEOF
6065 /* end confdefs.h. */
6066 $ac_includes_default
6067 int
6068 main ()
6069 {
6070 static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)];
6071 test_array [0] = 0
6072
6073 ;
6074 return 0;
6075 }
6076 _ACEOF
6077 rm -f conftest.$ac_objext
6078 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6079 (eval $ac_compile) 2>conftest.er1
6080 ac_status=$?
6081 grep -v '^ *+' conftest.er1 >conftest.err
6082 rm -f conftest.er1
6083 cat conftest.err >&5
6084 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6085 (exit $ac_status); } &&
6086 { ac_try='test -z "$ac_c_werror_flag"
6087 || test ! -s conftest.err'
6088 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6089 (eval $ac_try) 2>&5
6090 ac_status=$?
6091 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6092 (exit $ac_status); }; } &&
6093 { ac_try='test -s conftest.$ac_objext'
6094 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6095 (eval $ac_try) 2>&5
6096 ac_status=$?
6097 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6098 (exit $ac_status); }; }; then
6099 ac_hi=-1 ac_mid=-1
6100 while :; do
6101 cat >conftest.$ac_ext <<_ACEOF
6102 /* confdefs.h. */
6103 _ACEOF
6104 cat confdefs.h >>conftest.$ac_ext
6105 cat >>conftest.$ac_ext <<_ACEOF
6106 /* end confdefs.h. */
6107 $ac_includes_default
6108 int
6109 main ()
6110 {
6111 static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)];
6112 test_array [0] = 0
6113
6114 ;
6115 return 0;
6116 }
6117 _ACEOF
6118 rm -f conftest.$ac_objext
6119 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6120 (eval $ac_compile) 2>conftest.er1
6121 ac_status=$?
6122 grep -v '^ *+' conftest.er1 >conftest.err
6123 rm -f conftest.er1
6124 cat conftest.err >&5
6125 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6126 (exit $ac_status); } &&
6127 { ac_try='test -z "$ac_c_werror_flag"
6128 || test ! -s conftest.err'
6129 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6130 (eval $ac_try) 2>&5
6131 ac_status=$?
6132 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6133 (exit $ac_status); }; } &&
6134 { ac_try='test -s conftest.$ac_objext'
6135 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6136 (eval $ac_try) 2>&5
6137 ac_status=$?
6138 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6139 (exit $ac_status); }; }; then
6140 ac_lo=$ac_mid; break
6141 else
6142 echo "$as_me: failed program was:" >&5
6143 sed 's/^/| /' conftest.$ac_ext >&5
6144
6145 ac_hi=`expr '(' $ac_mid ')' - 1`
6146 if test $ac_mid -le $ac_hi; then
6147 ac_lo= ac_hi=
6148 break
6149 fi
6150 ac_mid=`expr 2 '*' $ac_mid`
6151 fi
6152 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6153 done
6154 else
6155 echo "$as_me: failed program was:" >&5
6156 sed 's/^/| /' conftest.$ac_ext >&5
6157
6158 ac_lo= ac_hi=
6159 fi
6160 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6161 fi
6162 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6163 # Binary search between lo and hi bounds.
6164 while test "x$ac_lo" != "x$ac_hi"; do
6165 ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
6166 cat >conftest.$ac_ext <<_ACEOF
6167 /* confdefs.h. */
6168 _ACEOF
6169 cat confdefs.h >>conftest.$ac_ext
6170 cat >>conftest.$ac_ext <<_ACEOF
6171 /* end confdefs.h. */
6172 $ac_includes_default
6173 int
6174 main ()
6175 {
6176 static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
6177 test_array [0] = 0
6178
6179 ;
6180 return 0;
6181 }
6182 _ACEOF
6183 rm -f conftest.$ac_objext
6184 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6185 (eval $ac_compile) 2>conftest.er1
6186 ac_status=$?
6187 grep -v '^ *+' conftest.er1 >conftest.err
6188 rm -f conftest.er1
6189 cat conftest.err >&5
6190 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6191 (exit $ac_status); } &&
6192 { ac_try='test -z "$ac_c_werror_flag"
6193 || test ! -s conftest.err'
6194 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6195 (eval $ac_try) 2>&5
6196 ac_status=$?
6197 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6198 (exit $ac_status); }; } &&
6199 { ac_try='test -s conftest.$ac_objext'
6200 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6201 (eval $ac_try) 2>&5
6202 ac_status=$?
6203 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6204 (exit $ac_status); }; }; then
6205 ac_hi=$ac_mid
6206 else
6207 echo "$as_me: failed program was:" >&5
6208 sed 's/^/| /' conftest.$ac_ext >&5
6209
6210 ac_lo=`expr '(' $ac_mid ')' + 1`
6211 fi
6212 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6213 done
6214 case $ac_lo in
6215 ?*) ac_cv_sizeof_void_p=$ac_lo;;
6216 '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
6217 See \`config.log' for more details." >&5
6218 echo "$as_me: error: cannot compute sizeof (void *), 77
6219 See \`config.log' for more details." >&2;}
6220 { (exit 1); exit 1; }; } ;;
6221 esac
6222 else
6223 if test "$cross_compiling" = yes; then
6224 { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
6225 See \`config.log' for more details." >&5
6226 echo "$as_me: error: cannot run test program while cross compiling
6227 See \`config.log' for more details." >&2;}
6228 { (exit 1); exit 1; }; }
6229 else
6230 cat >conftest.$ac_ext <<_ACEOF
6231 /* confdefs.h. */
6232 _ACEOF
6233 cat confdefs.h >>conftest.$ac_ext
6234 cat >>conftest.$ac_ext <<_ACEOF
6235 /* end confdefs.h. */
6236 $ac_includes_default
6237 long longval () { return (long) (sizeof (void *)); }
6238 unsigned long ulongval () { return (long) (sizeof (void *)); }
6239 #include <stdio.h>
6240 #include <stdlib.h>
6241 int
6242 main ()
6243 {
6244
6245 FILE *f = fopen ("conftest.val", "w");
6246 if (! f)
6247 exit (1);
6248 if (((long) (sizeof (void *))) < 0)
6249 {
6250 long i = longval ();
6251 if (i != ((long) (sizeof (void *))))
6252 exit (1);
6253 fprintf (f, "%ld\n", i);
6254 }
6255 else
6256 {
6257 unsigned long i = ulongval ();
6258 if (i != ((long) (sizeof (void *))))
6259 exit (1);
6260 fprintf (f, "%lu\n", i);
6261 }
6262 exit (ferror (f) || fclose (f) != 0);
6263
6264 ;
6265 return 0;
6266 }
6267 _ACEOF
6268 rm -f conftest$ac_exeext
6269 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
6270 (eval $ac_link) 2>&5
6271 ac_status=$?
6272 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6273 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
6274 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6275 (eval $ac_try) 2>&5
6276 ac_status=$?
6277 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6278 (exit $ac_status); }; }; then
6279 ac_cv_sizeof_void_p=`cat conftest.val`
6280 else
6281 echo "$as_me: program exited with status $ac_status" >&5
6282 echo "$as_me: failed program was:" >&5
6283 sed 's/^/| /' conftest.$ac_ext >&5
6284
6285 ( exit $ac_status )
6286 { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
6287 See \`config.log' for more details." >&5
6288 echo "$as_me: error: cannot compute sizeof (void *), 77
6289 See \`config.log' for more details." >&2;}
6290 { (exit 1); exit 1; }; }
6291 fi
6292 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
6293 fi
6294 fi
6295 rm -f conftest.val
6296 else
6297 ac_cv_sizeof_void_p=0
6298 fi
6299 fi
6300 echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
6301 echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6
6302 cat >>confdefs.h <<_ACEOF
6303 #define SIZEOF_VOID_P $ac_cv_sizeof_void_p
6304 _ACEOF
6305
6306
6307
6308 echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
6309 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
6310 if test "${ac_cv_c_const+set}" = set; then
6311 echo $ECHO_N "(cached) $ECHO_C" >&6
6312 else
6313 cat >conftest.$ac_ext <<_ACEOF
6314 /* confdefs.h. */
6315 _ACEOF
6316 cat confdefs.h >>conftest.$ac_ext
6317 cat >>conftest.$ac_ext <<_ACEOF
6318 /* end confdefs.h. */
6319
6320 int
6321 main ()
6322 {
6323 /* FIXME: Include the comments suggested by Paul. */
6324 #ifndef __cplusplus
6325 /* Ultrix mips cc rejects this. */
6326 typedef int charset[2];
6327 const charset x;
6328 /* SunOS 4.1.1 cc rejects this. */
6329 char const *const *ccp;
6330 char **p;
6331 /* NEC SVR4.0.2 mips cc rejects this. */
6332 struct point {int x, y;};
6333 static struct point const zero = {0,0};
6334 /* AIX XL C 1.02.0.0 rejects this.
6335 It does not let you subtract one const X* pointer from another in
6336 an arm of an if-expression whose if-part is not a constant
6337 expression */
6338 const char *g = "string";
6339 ccp = &g + (g ? g-g : 0);
6340 /* HPUX 7.0 cc rejects these. */
6341 ++ccp;
6342 p = (char**) ccp;
6343 ccp = (char const *const *) p;
6344 { /* SCO 3.2v4 cc rejects this. */
6345 char *t;
6346 char const *s = 0 ? (char *) 0 : (char const *) 0;
6347
6348 *t++ = 0;
6349 }
6350 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
6351 int x[] = {25, 17};
6352 const int *foo = &x[0];
6353 ++foo;
6354 }
6355 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
6356 typedef const int *iptr;
6357 iptr p = 0;
6358 ++p;
6359 }
6360 { /* AIX XL C 1.02.0.0 rejects this saying
6361 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
6362 struct s { int j; const int *ap[3]; };
6363 struct s *b; b->j = 5;
6364 }
6365 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
6366 const int foo = 10;
6367 }
6368 #endif
6369
6370 ;
6371 return 0;
6372 }
6373 _ACEOF
6374 rm -f conftest.$ac_objext
6375 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6376 (eval $ac_compile) 2>conftest.er1
6377 ac_status=$?
6378 grep -v '^ *+' conftest.er1 >conftest.err
6379 rm -f conftest.er1
6380 cat conftest.err >&5
6381 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6382 (exit $ac_status); } &&
6383 { ac_try='test -z "$ac_c_werror_flag"
6384 || test ! -s conftest.err'
6385 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6386 (eval $ac_try) 2>&5
6387 ac_status=$?
6388 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6389 (exit $ac_status); }; } &&
6390 { ac_try='test -s conftest.$ac_objext'
6391 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6392 (eval $ac_try) 2>&5
6393 ac_status=$?
6394 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6395 (exit $ac_status); }; }; then
6396 ac_cv_c_const=yes
6397 else
6398 echo "$as_me: failed program was:" >&5
6399 sed 's/^/| /' conftest.$ac_ext >&5
6400
6401 ac_cv_c_const=no
6402 fi
6403 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6404 fi
6405 echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
6406 echo "${ECHO_T}$ac_cv_c_const" >&6
6407 if test $ac_cv_c_const = no; then
6408
6409 cat >>confdefs.h <<\_ACEOF
6410 #define const
6411 _ACEOF
6412
6413 fi
6414
6415 echo "$as_me:$LINENO: checking for inline" >&5
6416 echo $ECHO_N "checking for inline... $ECHO_C" >&6
6417 if test "${ac_cv_c_inline+set}" = set; then
6418 echo $ECHO_N "(cached) $ECHO_C" >&6
6419 else
6420 ac_cv_c_inline=no
6421 for ac_kw in inline __inline__ __inline; do
6422 cat >conftest.$ac_ext <<_ACEOF
6423 /* confdefs.h. */
6424 _ACEOF
6425 cat confdefs.h >>conftest.$ac_ext
6426 cat >>conftest.$ac_ext <<_ACEOF
6427 /* end confdefs.h. */
6428 #ifndef __cplusplus
6429 typedef int foo_t;
6430 static $ac_kw foo_t static_foo () {return 0; }
6431 $ac_kw foo_t foo () {return 0; }
6432 #endif
6433
6434 _ACEOF
6435 rm -f conftest.$ac_objext
6436 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6437 (eval $ac_compile) 2>conftest.er1
6438 ac_status=$?
6439 grep -v '^ *+' conftest.er1 >conftest.err
6440 rm -f conftest.er1
6441 cat conftest.err >&5
6442 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6443 (exit $ac_status); } &&
6444 { ac_try='test -z "$ac_c_werror_flag"
6445 || test ! -s conftest.err'
6446 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6447 (eval $ac_try) 2>&5
6448 ac_status=$?
6449 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6450 (exit $ac_status); }; } &&
6451 { ac_try='test -s conftest.$ac_objext'
6452 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6453 (eval $ac_try) 2>&5
6454 ac_status=$?
6455 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6456 (exit $ac_status); }; }; then
6457 ac_cv_c_inline=$ac_kw; break
6458 else
6459 echo "$as_me: failed program was:" >&5
6460 sed 's/^/| /' conftest.$ac_ext >&5
6461
6462 fi
6463 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6464 done
6465
6466 fi
6467 echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
6468 echo "${ECHO_T}$ac_cv_c_inline" >&6
6469
6470
6471 case $ac_cv_c_inline in
6472 inline | yes) ;;
6473 *)
6474 case $ac_cv_c_inline in
6475 no) ac_val=;;
6476 *) ac_val=$ac_cv_c_inline;;
6477 esac
6478 cat >>confdefs.h <<_ACEOF
6479 #ifndef __cplusplus
6480 #define inline $ac_val
6481 #endif
6482 _ACEOF
6483 ;;
6484 esac
6485
6486 echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
6487 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
6488 if test "${ac_cv_c_bigendian+set}" = set; then
6489 echo $ECHO_N "(cached) $ECHO_C" >&6
6490 else
6491 # See if sys/param.h defines the BYTE_ORDER macro.
6492 cat >conftest.$ac_ext <<_ACEOF
6493 /* confdefs.h. */
6494 _ACEOF
6495 cat confdefs.h >>conftest.$ac_ext
6496 cat >>conftest.$ac_ext <<_ACEOF
6497 /* end confdefs.h. */
6498 #include <sys/types.h>
6499 #include <sys/param.h>
6500
6501 int
6502 main ()
6503 {
6504 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
6505 bogus endian macros
6506 #endif
6507
6508 ;
6509 return 0;
6510 }
6511 _ACEOF
6512 rm -f conftest.$ac_objext
6513 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6514 (eval $ac_compile) 2>conftest.er1
6515 ac_status=$?
6516 grep -v '^ *+' conftest.er1 >conftest.err
6517 rm -f conftest.er1
6518 cat conftest.err >&5
6519 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6520 (exit $ac_status); } &&
6521 { ac_try='test -z "$ac_c_werror_flag"
6522 || test ! -s conftest.err'
6523 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6524 (eval $ac_try) 2>&5
6525 ac_status=$?
6526 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6527 (exit $ac_status); }; } &&
6528 { ac_try='test -s conftest.$ac_objext'
6529 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6530 (eval $ac_try) 2>&5
6531 ac_status=$?
6532 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6533 (exit $ac_status); }; }; then
6534 # It does; now see whether it defined to BIG_ENDIAN or not.
6535 cat >conftest.$ac_ext <<_ACEOF
6536 /* confdefs.h. */
6537 _ACEOF
6538 cat confdefs.h >>conftest.$ac_ext
6539 cat >>conftest.$ac_ext <<_ACEOF
6540 /* end confdefs.h. */
6541 #include <sys/types.h>
6542 #include <sys/param.h>
6543
6544 int
6545 main ()
6546 {
6547 #if BYTE_ORDER != BIG_ENDIAN
6548 not big endian
6549 #endif
6550
6551 ;
6552 return 0;
6553 }
6554 _ACEOF
6555 rm -f conftest.$ac_objext
6556 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6557 (eval $ac_compile) 2>conftest.er1
6558 ac_status=$?
6559 grep -v '^ *+' conftest.er1 >conftest.err
6560 rm -f conftest.er1
6561 cat conftest.err >&5
6562 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6563 (exit $ac_status); } &&
6564 { ac_try='test -z "$ac_c_werror_flag"
6565 || test ! -s conftest.err'
6566 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6567 (eval $ac_try) 2>&5
6568 ac_status=$?
6569 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6570 (exit $ac_status); }; } &&
6571 { ac_try='test -s conftest.$ac_objext'
6572 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6573 (eval $ac_try) 2>&5
6574 ac_status=$?
6575 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6576 (exit $ac_status); }; }; then
6577 ac_cv_c_bigendian=yes
6578 else
6579 echo "$as_me: failed program was:" >&5
6580 sed 's/^/| /' conftest.$ac_ext >&5
6581
6582 ac_cv_c_bigendian=no
6583 fi
6584 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6585 else
6586 echo "$as_me: failed program was:" >&5
6587 sed 's/^/| /' conftest.$ac_ext >&5
6588
6589 # It does not; compile a test program.
6590 if test "$cross_compiling" = yes; then
6591 # try to guess the endianness by grepping values into an object file
6592 ac_cv_c_bigendian=unknown
6593 cat >conftest.$ac_ext <<_ACEOF
6594 /* confdefs.h. */
6595 _ACEOF
6596 cat confdefs.h >>conftest.$ac_ext
6597 cat >>conftest.$ac_ext <<_ACEOF
6598 /* end confdefs.h. */
6599 short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
6600 short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
6601 void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
6602 short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
6603 short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
6604 void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
6605 int
6606 main ()
6607 {
6608 _ascii (); _ebcdic ();
6609 ;
6610 return 0;
6611 }
6612 _ACEOF
6613 rm -f conftest.$ac_objext
6614 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6615 (eval $ac_compile) 2>conftest.er1
6616 ac_status=$?
6617 grep -v '^ *+' conftest.er1 >conftest.err
6618 rm -f conftest.er1
6619 cat conftest.err >&5
6620 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6621 (exit $ac_status); } &&
6622 { ac_try='test -z "$ac_c_werror_flag"
6623 || test ! -s conftest.err'
6624 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6625 (eval $ac_try) 2>&5
6626 ac_status=$?
6627 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6628 (exit $ac_status); }; } &&
6629 { ac_try='test -s conftest.$ac_objext'
6630 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6631 (eval $ac_try) 2>&5
6632 ac_status=$?
6633 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6634 (exit $ac_status); }; }; then
6635 if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
6636 ac_cv_c_bigendian=yes
6637 fi
6638 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
6639 if test "$ac_cv_c_bigendian" = unknown; then
6640 ac_cv_c_bigendian=no
6641 else
6642 # finding both strings is unlikely to happen, but who knows?
6643 ac_cv_c_bigendian=unknown
6644 fi
6645 fi
6646 else
6647 echo "$as_me: failed program was:" >&5
6648 sed 's/^/| /' conftest.$ac_ext >&5
6649
6650 fi
6651 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6652 else
6653 cat >conftest.$ac_ext <<_ACEOF
6654 /* confdefs.h. */
6655 _ACEOF
6656 cat confdefs.h >>conftest.$ac_ext
6657 cat >>conftest.$ac_ext <<_ACEOF
6658 /* end confdefs.h. */
6659 int
6660 main ()
6661 {
6662 /* Are we little or big endian? From Harbison&Steele. */
6663 union
6664 {
6665 long l;
6666 char c[sizeof (long)];
6667 } u;
6668 u.l = 1;
6669 exit (u.c[sizeof (long) - 1] == 1);
6670 }
6671 _ACEOF
6672 rm -f conftest$ac_exeext
6673 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
6674 (eval $ac_link) 2>&5
6675 ac_status=$?
6676 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6677 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
6678 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6679 (eval $ac_try) 2>&5
6680 ac_status=$?
6681 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6682 (exit $ac_status); }; }; then
6683 ac_cv_c_bigendian=no
6684 else
6685 echo "$as_me: program exited with status $ac_status" >&5
6686 echo "$as_me: failed program was:" >&5
6687 sed 's/^/| /' conftest.$ac_ext >&5
6688
6689 ( exit $ac_status )
6690 ac_cv_c_bigendian=yes
6691 fi
6692 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
6693 fi
6694 fi
6695 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6696 fi
6697 echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
6698 echo "${ECHO_T}$ac_cv_c_bigendian" >&6
6699 case $ac_cv_c_bigendian in
6700 yes)
6701
6702 cat >>confdefs.h <<\_ACEOF
6703 #define WORDS_BIGENDIAN 1
6704 _ACEOF
6705 ;;
6706 no)
6707 ;;
6708 *)
6709 { { echo "$as_me:$LINENO: error: unknown endianness
6710 presetting ac_cv_c_bigendian=no (or yes) will help" >&5
6711 echo "$as_me: error: unknown endianness
6712 presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
6713 { (exit 1); exit 1; }; } ;;
6714 esac
6715
6716 echo "$as_me:$LINENO: checking for pid_t" >&5
6717 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
6718 if test "${ac_cv_type_pid_t+set}" = set; then
6719 echo $ECHO_N "(cached) $ECHO_C" >&6
6720 else
6721 cat >conftest.$ac_ext <<_ACEOF
6722 /* confdefs.h. */
6723 _ACEOF
6724 cat confdefs.h >>conftest.$ac_ext
6725 cat >>conftest.$ac_ext <<_ACEOF
6726 /* end confdefs.h. */
6727 $ac_includes_default
6728 int
6729 main ()
6730 {
6731 if ((pid_t *) 0)
6732 return 0;
6733 if (sizeof (pid_t))
6734 return 0;
6735 ;
6736 return 0;
6737 }
6738 _ACEOF
6739 rm -f conftest.$ac_objext
6740 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6741 (eval $ac_compile) 2>conftest.er1
6742 ac_status=$?
6743 grep -v '^ *+' conftest.er1 >conftest.err
6744 rm -f conftest.er1
6745 cat conftest.err >&5
6746 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6747 (exit $ac_status); } &&
6748 { ac_try='test -z "$ac_c_werror_flag"
6749 || test ! -s conftest.err'
6750 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6751 (eval $ac_try) 2>&5
6752 ac_status=$?
6753 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6754 (exit $ac_status); }; } &&
6755 { ac_try='test -s conftest.$ac_objext'
6756 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6757 (eval $ac_try) 2>&5
6758 ac_status=$?
6759 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6760 (exit $ac_status); }; }; then
6761 ac_cv_type_pid_t=yes
6762 else
6763 echo "$as_me: failed program was:" >&5
6764 sed 's/^/| /' conftest.$ac_ext >&5
6765
6766 ac_cv_type_pid_t=no
6767 fi
6768 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6769 fi
6770 echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
6771 echo "${ECHO_T}$ac_cv_type_pid_t" >&6
6772 if test $ac_cv_type_pid_t = yes; then
6773 :
6774 else
6775
6776 cat >>confdefs.h <<_ACEOF
6777 #define pid_t int
6778 _ACEOF
6779
6780 fi
6781
6782 echo "$as_me:$LINENO: checking for size_t" >&5
6783 echo $ECHO_N "checking for size_t... $ECHO_C" >&6
6784 if test "${ac_cv_type_size_t+set}" = set; then
6785 echo $ECHO_N "(cached) $ECHO_C" >&6
6786 else
6787 cat >conftest.$ac_ext <<_ACEOF
6788 /* confdefs.h. */
6789 _ACEOF
6790 cat confdefs.h >>conftest.$ac_ext
6791 cat >>conftest.$ac_ext <<_ACEOF
6792 /* end confdefs.h. */
6793 $ac_includes_default
6794 int
6795 main ()
6796 {
6797 if ((size_t *) 0)
6798 return 0;
6799 if (sizeof (size_t))
6800 return 0;
6801 ;
6802 return 0;
6803 }
6804 _ACEOF
6805 rm -f conftest.$ac_objext
6806 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6807 (eval $ac_compile) 2>conftest.er1
6808 ac_status=$?
6809 grep -v '^ *+' conftest.er1 >conftest.err
6810 rm -f conftest.er1
6811 cat conftest.err >&5
6812 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6813 (exit $ac_status); } &&
6814 { ac_try='test -z "$ac_c_werror_flag"
6815 || test ! -s conftest.err'
6816 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6817 (eval $ac_try) 2>&5
6818 ac_status=$?
6819 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6820 (exit $ac_status); }; } &&
6821 { ac_try='test -s conftest.$ac_objext'
6822 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6823 (eval $ac_try) 2>&5
6824 ac_status=$?
6825 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6826 (exit $ac_status); }; }; then
6827 ac_cv_type_size_t=yes
6828 else
6829 echo "$as_me: failed program was:" >&5
6830 sed 's/^/| /' conftest.$ac_ext >&5
6831
6832 ac_cv_type_size_t=no
6833 fi
6834 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6835 fi
6836 echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
6837 echo "${ECHO_T}$ac_cv_type_size_t" >&6
6838 if test $ac_cv_type_size_t = yes; then
6839 :
6840 else
6841
6842 cat >>confdefs.h <<_ACEOF
6843 #define size_t unsigned
6844 _ACEOF
6845
6846 fi
6847
6848 echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
6849 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
6850 if test "${ac_cv_struct_tm+set}" = set; then
6851 echo $ECHO_N "(cached) $ECHO_C" >&6
6852 else
6853 cat >conftest.$ac_ext <<_ACEOF
6854 /* confdefs.h. */
6855 _ACEOF
6856 cat confdefs.h >>conftest.$ac_ext
6857 cat >>conftest.$ac_ext <<_ACEOF
6858 /* end confdefs.h. */
6859 #include <sys/types.h>
6860 #include <time.h>
6861
6862 int
6863 main ()
6864 {
6865 struct tm *tp; tp->tm_sec;
6866 ;
6867 return 0;
6868 }
6869 _ACEOF
6870 rm -f conftest.$ac_objext
6871 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6872 (eval $ac_compile) 2>conftest.er1
6873 ac_status=$?
6874 grep -v '^ *+' conftest.er1 >conftest.err
6875 rm -f conftest.er1
6876 cat conftest.err >&5
6877 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6878 (exit $ac_status); } &&
6879 { ac_try='test -z "$ac_c_werror_flag"
6880 || test ! -s conftest.err'
6881 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6882 (eval $ac_try) 2>&5
6883 ac_status=$?
6884 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6885 (exit $ac_status); }; } &&
6886 { ac_try='test -s conftest.$ac_objext'
6887 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6888 (eval $ac_try) 2>&5
6889 ac_status=$?
6890 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6891 (exit $ac_status); }; }; then
6892 ac_cv_struct_tm=time.h
6893 else
6894 echo "$as_me: failed program was:" >&5
6895 sed 's/^/| /' conftest.$ac_ext >&5
6896
6897 ac_cv_struct_tm=sys/time.h
6898 fi
6899 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6900 fi
6901 echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
6902 echo "${ECHO_T}$ac_cv_struct_tm" >&6
6903 if test $ac_cv_struct_tm = sys/time.h; then
6904
6905 cat >>confdefs.h <<\_ACEOF
6906 #define TM_IN_SYS_TIME 1
6907 _ACEOF
6908
6909 fi
6910
6911 echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
6912 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6
6913 if test "${ac_cv_header_stdbool_h+set}" = set; then
6914 echo $ECHO_N "(cached) $ECHO_C" >&6
6915 else
6916 cat >conftest.$ac_ext <<_ACEOF
6917 /* confdefs.h. */
6918 _ACEOF
6919 cat confdefs.h >>conftest.$ac_ext
6920 cat >>conftest.$ac_ext <<_ACEOF
6921 /* end confdefs.h. */
6922
6923 #include <stdbool.h>
6924 #ifndef bool
6925 # error bool is not defined
6926 #endif
6927 #ifndef false
6928 # error false is not defined
6929 #endif
6930 #if false
6931 # error false is not 0
6932 #endif
6933 #ifndef true
6934 # error true is not defined
6935 #endif
6936 #if true != 1
6937 # error true is not 1
6938 #endif
6939 #ifndef __bool_true_false_are_defined
6940 # error __bool_true_false_are_defined is not defined
6941 #endif
6942
6943 struct s { _Bool s: 1; _Bool t; } s;
6944
6945 char a[true == 1 ? 1 : -1];
6946 char b[false == 0 ? 1 : -1];
6947 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
6948 char d[(bool) -0.5 == true ? 1 : -1];
6949 bool e = &s;
6950 char f[(_Bool) -0.0 == false ? 1 : -1];
6951 char g[true];
6952 char h[sizeof (_Bool)];
6953 char i[sizeof s.t];
6954
6955 int
6956 main ()
6957 {
6958 return !a + !b + !c + !d + !e + !f + !g + !h + !i;
6959 ;
6960 return 0;
6961 }
6962 _ACEOF
6963 rm -f conftest.$ac_objext
6964 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6965 (eval $ac_compile) 2>conftest.er1
6966 ac_status=$?
6967 grep -v '^ *+' conftest.er1 >conftest.err
6968 rm -f conftest.er1
6969 cat conftest.err >&5
6970 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6971 (exit $ac_status); } &&
6972 { ac_try='test -z "$ac_c_werror_flag"
6973 || test ! -s conftest.err'
6974 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6975 (eval $ac_try) 2>&5
6976 ac_status=$?
6977 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6978 (exit $ac_status); }; } &&
6979 { ac_try='test -s conftest.$ac_objext'
6980 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6981 (eval $ac_try) 2>&5
6982 ac_status=$?
6983 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6984 (exit $ac_status); }; }; then
6985 ac_cv_header_stdbool_h=yes
6986 else
6987 echo "$as_me: failed program was:" >&5
6988 sed 's/^/| /' conftest.$ac_ext >&5
6989
6990 ac_cv_header_stdbool_h=no
6991 fi
6992 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6993 fi
6994 echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
6995 echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6
6996 echo "$as_me:$LINENO: checking for _Bool" >&5
6997 echo $ECHO_N "checking for _Bool... $ECHO_C" >&6
6998 if test "${ac_cv_type__Bool+set}" = set; then
6999 echo $ECHO_N "(cached) $ECHO_C" >&6
7000 else
7001 cat >conftest.$ac_ext <<_ACEOF
7002 /* confdefs.h. */
7003 _ACEOF
7004 cat confdefs.h >>conftest.$ac_ext
7005 cat >>conftest.$ac_ext <<_ACEOF
7006 /* end confdefs.h. */
7007 $ac_includes_default
7008 int
7009 main ()
7010 {
7011 if ((_Bool *) 0)
7012 return 0;
7013 if (sizeof (_Bool))
7014 return 0;
7015 ;
7016 return 0;
7017 }
7018 _ACEOF
7019 rm -f conftest.$ac_objext
7020 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7021 (eval $ac_compile) 2>conftest.er1
7022 ac_status=$?
7023 grep -v '^ *+' conftest.er1 >conftest.err
7024 rm -f conftest.er1
7025 cat conftest.err >&5
7026 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7027 (exit $ac_status); } &&
7028 { ac_try='test -z "$ac_c_werror_flag"
7029 || test ! -s conftest.err'
7030 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7031 (eval $ac_try) 2>&5
7032 ac_status=$?
7033 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7034 (exit $ac_status); }; } &&
7035 { ac_try='test -s conftest.$ac_objext'
7036 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7037 (eval $ac_try) 2>&5
7038 ac_status=$?
7039 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7040 (exit $ac_status); }; }; then
7041 ac_cv_type__Bool=yes
7042 else
7043 echo "$as_me: failed program was:" >&5
7044 sed 's/^/| /' conftest.$ac_ext >&5
7045
7046 ac_cv_type__Bool=no
7047 fi
7048 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7049 fi
7050 echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
7051 echo "${ECHO_T}$ac_cv_type__Bool" >&6
7052 if test $ac_cv_type__Bool = yes; then
7053
7054 cat >>confdefs.h <<_ACEOF
7055 #define HAVE__BOOL 1
7056 _ACEOF
7057
7058
7059 fi
7060
7061 if test $ac_cv_header_stdbool_h = yes; then
7062
7063 cat >>confdefs.h <<\_ACEOF
7064 #define HAVE_STDBOOL_H 1
7065 _ACEOF
7066
7067 fi
7068
7069
7070 # Checks for library functions.
7071 echo "$as_me:$LINENO: checking whether closedir returns void" >&5
7072 echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6
7073 if test "${ac_cv_func_closedir_void+set}" = set; then
7074 echo $ECHO_N "(cached) $ECHO_C" >&6
7075 else
7076 if test "$cross_compiling" = yes; then
7077 ac_cv_func_closedir_void=yes
7078 else
7079 cat >conftest.$ac_ext <<_ACEOF
7080 /* confdefs.h. */
7081 _ACEOF
7082 cat confdefs.h >>conftest.$ac_ext
7083 cat >>conftest.$ac_ext <<_ACEOF
7084 /* end confdefs.h. */
7085 $ac_includes_default
7086 #include <$ac_header_dirent>
7087 #ifndef __cplusplus
7088 int closedir ();
7089 #endif
7090
7091 int
7092 main ()
7093 {
7094 exit (closedir (opendir (".")) != 0);
7095 ;
7096 return 0;
7097 }
7098 _ACEOF
7099 rm -f conftest$ac_exeext
7100 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
7101 (eval $ac_link) 2>&5
7102 ac_status=$?
7103 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7104 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
7105 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7106 (eval $ac_try) 2>&5
7107 ac_status=$?
7108 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7109 (exit $ac_status); }; }; then
7110 ac_cv_func_closedir_void=no
7111 else
7112 echo "$as_me: program exited with status $ac_status" >&5
7113 echo "$as_me: failed program was:" >&5
7114 sed 's/^/| /' conftest.$ac_ext >&5
7115
7116 ( exit $ac_status )
7117 ac_cv_func_closedir_void=yes
7118 fi
7119 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
7120 fi
7121 fi
7122 echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
7123 echo "${ECHO_T}$ac_cv_func_closedir_void" >&6
7124 if test $ac_cv_func_closedir_void = yes; then
7125
7126 cat >>confdefs.h <<\_ACEOF
7127 #define CLOSEDIR_VOID 1
7128 _ACEOF
7129
7130 fi
7131
7132
7133
7134 for ac_header in unistd.h vfork.h
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887 for ac_header in arpa/inet.h fcntl.h netinet/in.h fts.h stdint.h stdlib.h string.h sys/socket.h syslog.h unistd.h iso/limits_iso.h
71355888 do
71365889 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
71375890 if eval "test \"\${$as_ac_Header+set}\" = set"; then
72826035
72836036
72846037
7285 for ac_func in fork vfork
6038
6039
6040
6041
6042 for ac_header in sys/types.h netinet/in.h arpa/nameser.h netdb.h resolv.h
72866043 do
7287 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
7288 echo "$as_me:$LINENO: checking for $ac_func" >&5
7289 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
7290 if eval "test \"\${$as_ac_var+set}\" = set"; then
6044 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
6045 echo "$as_me:$LINENO: checking for $ac_header" >&5
6046 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
6047 if eval "test \"\${$as_ac_Header+set}\" = set"; then
72916048 echo $ECHO_N "(cached) $ECHO_C" >&6
72926049 else
72936050 cat >conftest.$ac_ext <<_ACEOF
72966053 cat confdefs.h >>conftest.$ac_ext
72976054 cat >>conftest.$ac_ext <<_ACEOF
72986055 /* end confdefs.h. */
7299 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
7300 For example, HP-UX 11i <limits.h> declares gettimeofday. */
7301 #define $ac_func innocuous_$ac_func
7302
7303 /* System header to define __stub macros and hopefully few prototypes,
7304 which can conflict with char $ac_func (); below.
7305 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
7306 <limits.h> exists even on freestanding compilers. */
7307
7308 #ifdef __STDC__
7309 # include <limits.h>
7310 #else
7311 # include <assert.h>
6056 #ifdef HAVE_SYS_TYPES_H
6057 # include <sys/types.h>
73126058 #endif
7313
7314 #undef $ac_func
7315
7316 /* Override any gcc2 internal prototype to avoid an error. */
7317 #ifdef __cplusplus
7318 extern "C"
7319 {
6059 #ifdef HAVE_NETINET_IN_H
6060 # include <netinet/in.h> /* inet_ functions / structs */
73206061 #endif
7321 /* We use char because int might match the return type of a gcc2
7322 builtin and then its argument prototype would still apply. */
7323 char $ac_func ();
7324 /* The GNU C library defines this for functions which it implements
7325 to always fail with ENOSYS. Some functions are actually named
7326 something starting with __ and the normal name is an alias. */
7327 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
7328 choke me
7329 #else
7330 char (*f) () = $ac_func;
6062 #ifdef HAVE_ARPA_NAMESER_H
6063 # include <arpa/nameser.h> /* DNS HEADER struct */
73316064 #endif
7332 #ifdef __cplusplus
7333 }
6065 #ifdef HAVE_NETDB_H
6066 # include <netdb.h>
73346067 #endif
73356068
7336 int
7337 main ()
7338 {
7339 return f != $ac_func;
7340 ;
7341 return 0;
7342 }
7343 _ACEOF
7344 rm -f conftest.$ac_objext conftest$ac_exeext
7345 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
7346 (eval $ac_link) 2>conftest.er1
6069 #include <$ac_header>
6070 _ACEOF
6071 rm -f conftest.$ac_objext
6072 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6073 (eval $ac_compile) 2>conftest.er1
73476074 ac_status=$?
73486075 grep -v '^ *+' conftest.er1 >conftest.err
73496076 rm -f conftest.er1
73576084 ac_status=$?
73586085 echo "$as_me:$LINENO: \$? = $ac_status" >&5
73596086 (exit $ac_status); }; } &&
7360 { ac_try='test -s conftest$ac_exeext'
7361 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7362 (eval $ac_try) 2>&5
7363 ac_status=$?
7364 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7365 (exit $ac_status); }; }; then
7366 eval "$as_ac_var=yes"
6087 { ac_try='test -s conftest.$ac_objext'
6088 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6089 (eval $ac_try) 2>&5
6090 ac_status=$?
6091 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6092 (exit $ac_status); }; }; then
6093 eval "$as_ac_Header=yes"
73676094 else
73686095 echo "$as_me: failed program was:" >&5
73696096 sed 's/^/| /' conftest.$ac_ext >&5
73706097
7371 eval "$as_ac_var=no"
7372 fi
7373 rm -f conftest.err conftest.$ac_objext \
7374 conftest$ac_exeext conftest.$ac_ext
7375 fi
7376 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
7377 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
7378 if test `eval echo '${'$as_ac_var'}'` = yes; then
6098 eval "$as_ac_Header=no"
6099 fi
6100 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6101 fi
6102 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
6103 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
6104 if test `eval echo '${'$as_ac_Header'}'` = yes; then
73796105 cat >>confdefs.h <<_ACEOF
7380 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7381 _ACEOF
7382
7383 fi
6106 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6107 _ACEOF
6108
6109 fi
6110
73846111 done
73856112
7386 if test "x$ac_cv_func_fork" = xyes; then
7387 echo "$as_me:$LINENO: checking for working fork" >&5
7388 echo $ECHO_N "checking for working fork... $ECHO_C" >&6
7389 if test "${ac_cv_func_fork_works+set}" = set; then
6113
6114
6115 if test "$ac_cv_header_fts_h" != yes; then
6116 FTS_OBJ=fts_compat.o
6117 fi
6118
6119
6120
6121 # Checks for typedefs, structures, and compiler characteristics.
6122 echo "$as_me:$LINENO: checking for void *" >&5
6123 echo $ECHO_N "checking for void *... $ECHO_C" >&6
6124 if test "${ac_cv_type_void_p+set}" = set; then
73906125 echo $ECHO_N "(cached) $ECHO_C" >&6
73916126 else
6127 cat >conftest.$ac_ext <<_ACEOF
6128 /* confdefs.h. */
6129 _ACEOF
6130 cat confdefs.h >>conftest.$ac_ext
6131 cat >>conftest.$ac_ext <<_ACEOF
6132 /* end confdefs.h. */
6133 $ac_includes_default
6134 int
6135 main ()
6136 {
6137 if ((void * *) 0)
6138 return 0;
6139 if (sizeof (void *))
6140 return 0;
6141 ;
6142 return 0;
6143 }
6144 _ACEOF
6145 rm -f conftest.$ac_objext
6146 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6147 (eval $ac_compile) 2>conftest.er1
6148 ac_status=$?
6149 grep -v '^ *+' conftest.er1 >conftest.err
6150 rm -f conftest.er1
6151 cat conftest.err >&5
6152 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6153 (exit $ac_status); } &&
6154 { ac_try='test -z "$ac_c_werror_flag"
6155 || test ! -s conftest.err'
6156 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6157 (eval $ac_try) 2>&5
6158 ac_status=$?
6159 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6160 (exit $ac_status); }; } &&
6161 { ac_try='test -s conftest.$ac_objext'
6162 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6163 (eval $ac_try) 2>&5
6164 ac_status=$?
6165 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6166 (exit $ac_status); }; }; then
6167 ac_cv_type_void_p=yes
6168 else
6169 echo "$as_me: failed program was:" >&5
6170 sed 's/^/| /' conftest.$ac_ext >&5
6171
6172 ac_cv_type_void_p=no
6173 fi
6174 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6175 fi
6176 echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5
6177 echo "${ECHO_T}$ac_cv_type_void_p" >&6
6178
6179 echo "$as_me:$LINENO: checking size of void *" >&5
6180 echo $ECHO_N "checking size of void *... $ECHO_C" >&6
6181 if test "${ac_cv_sizeof_void_p+set}" = set; then
6182 echo $ECHO_N "(cached) $ECHO_C" >&6
6183 else
6184 if test "$ac_cv_type_void_p" = yes; then
6185 # The cast to unsigned long works around a bug in the HP C Compiler
6186 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
6187 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
6188 # This bug is HP SR number 8606223364.
73926189 if test "$cross_compiling" = yes; then
7393 ac_cv_func_fork_works=cross
7394 else
6190 # Depending upon the size, compute the lo and hi bounds.
6191 cat >conftest.$ac_ext <<_ACEOF
6192 /* confdefs.h. */
6193 _ACEOF
6194 cat confdefs.h >>conftest.$ac_ext
6195 cat >>conftest.$ac_ext <<_ACEOF
6196 /* end confdefs.h. */
6197 $ac_includes_default
6198 int
6199 main ()
6200 {
6201 static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)];
6202 test_array [0] = 0
6203
6204 ;
6205 return 0;
6206 }
6207 _ACEOF
6208 rm -f conftest.$ac_objext
6209 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6210 (eval $ac_compile) 2>conftest.er1
6211 ac_status=$?
6212 grep -v '^ *+' conftest.er1 >conftest.err
6213 rm -f conftest.er1
6214 cat conftest.err >&5
6215 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6216 (exit $ac_status); } &&
6217 { ac_try='test -z "$ac_c_werror_flag"
6218 || test ! -s conftest.err'
6219 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6220 (eval $ac_try) 2>&5
6221 ac_status=$?
6222 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6223 (exit $ac_status); }; } &&
6224 { ac_try='test -s conftest.$ac_objext'
6225 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6226 (eval $ac_try) 2>&5
6227 ac_status=$?
6228 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6229 (exit $ac_status); }; }; then
6230 ac_lo=0 ac_mid=0
6231 while :; do
6232 cat >conftest.$ac_ext <<_ACEOF
6233 /* confdefs.h. */
6234 _ACEOF
6235 cat confdefs.h >>conftest.$ac_ext
6236 cat >>conftest.$ac_ext <<_ACEOF
6237 /* end confdefs.h. */
6238 $ac_includes_default
6239 int
6240 main ()
6241 {
6242 static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
6243 test_array [0] = 0
6244
6245 ;
6246 return 0;
6247 }
6248 _ACEOF
6249 rm -f conftest.$ac_objext
6250 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6251 (eval $ac_compile) 2>conftest.er1
6252 ac_status=$?
6253 grep -v '^ *+' conftest.er1 >conftest.err
6254 rm -f conftest.er1
6255 cat conftest.err >&5
6256 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6257 (exit $ac_status); } &&
6258 { ac_try='test -z "$ac_c_werror_flag"
6259 || test ! -s conftest.err'
6260 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6261 (eval $ac_try) 2>&5
6262 ac_status=$?
6263 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6264 (exit $ac_status); }; } &&
6265 { ac_try='test -s conftest.$ac_objext'
6266 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6267 (eval $ac_try) 2>&5
6268 ac_status=$?
6269 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6270 (exit $ac_status); }; }; then
6271 ac_hi=$ac_mid; break
6272 else
6273 echo "$as_me: failed program was:" >&5
6274 sed 's/^/| /' conftest.$ac_ext >&5
6275
6276 ac_lo=`expr $ac_mid + 1`
6277 if test $ac_lo -le $ac_mid; then
6278 ac_lo= ac_hi=
6279 break
6280 fi
6281 ac_mid=`expr 2 '*' $ac_mid + 1`
6282 fi
6283 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6284 done
6285 else
6286 echo "$as_me: failed program was:" >&5
6287 sed 's/^/| /' conftest.$ac_ext >&5
6288
6289 cat >conftest.$ac_ext <<_ACEOF
6290 /* confdefs.h. */
6291 _ACEOF
6292 cat confdefs.h >>conftest.$ac_ext
6293 cat >>conftest.$ac_ext <<_ACEOF
6294 /* end confdefs.h. */
6295 $ac_includes_default
6296 int
6297 main ()
6298 {
6299 static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)];
6300 test_array [0] = 0
6301
6302 ;
6303 return 0;
6304 }
6305 _ACEOF
6306 rm -f conftest.$ac_objext
6307 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6308 (eval $ac_compile) 2>conftest.er1
6309 ac_status=$?
6310 grep -v '^ *+' conftest.er1 >conftest.err
6311 rm -f conftest.er1
6312 cat conftest.err >&5
6313 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6314 (exit $ac_status); } &&
6315 { ac_try='test -z "$ac_c_werror_flag"
6316 || test ! -s conftest.err'
6317 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6318 (eval $ac_try) 2>&5
6319 ac_status=$?
6320 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6321 (exit $ac_status); }; } &&
6322 { ac_try='test -s conftest.$ac_objext'
6323 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6324 (eval $ac_try) 2>&5
6325 ac_status=$?
6326 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6327 (exit $ac_status); }; }; then
6328 ac_hi=-1 ac_mid=-1
6329 while :; do
6330 cat >conftest.$ac_ext <<_ACEOF
6331 /* confdefs.h. */
6332 _ACEOF
6333 cat confdefs.h >>conftest.$ac_ext
6334 cat >>conftest.$ac_ext <<_ACEOF
6335 /* end confdefs.h. */
6336 $ac_includes_default
6337 int
6338 main ()
6339 {
6340 static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)];
6341 test_array [0] = 0
6342
6343 ;
6344 return 0;
6345 }
6346 _ACEOF
6347 rm -f conftest.$ac_objext
6348 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6349 (eval $ac_compile) 2>conftest.er1
6350 ac_status=$?
6351 grep -v '^ *+' conftest.er1 >conftest.err
6352 rm -f conftest.er1
6353 cat conftest.err >&5
6354 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6355 (exit $ac_status); } &&
6356 { ac_try='test -z "$ac_c_werror_flag"
6357 || test ! -s conftest.err'
6358 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6359 (eval $ac_try) 2>&5
6360 ac_status=$?
6361 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6362 (exit $ac_status); }; } &&
6363 { ac_try='test -s conftest.$ac_objext'
6364 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6365 (eval $ac_try) 2>&5
6366 ac_status=$?
6367 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6368 (exit $ac_status); }; }; then
6369 ac_lo=$ac_mid; break
6370 else
6371 echo "$as_me: failed program was:" >&5
6372 sed 's/^/| /' conftest.$ac_ext >&5
6373
6374 ac_hi=`expr '(' $ac_mid ')' - 1`
6375 if test $ac_mid -le $ac_hi; then
6376 ac_lo= ac_hi=
6377 break
6378 fi
6379 ac_mid=`expr 2 '*' $ac_mid`
6380 fi
6381 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6382 done
6383 else
6384 echo "$as_me: failed program was:" >&5
6385 sed 's/^/| /' conftest.$ac_ext >&5
6386
6387 ac_lo= ac_hi=
6388 fi
6389 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6390 fi
6391 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6392 # Binary search between lo and hi bounds.
6393 while test "x$ac_lo" != "x$ac_hi"; do
6394 ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
73956395 cat >conftest.$ac_ext <<_ACEOF
7396 /* By Ruediger Kuhlmann. */
7397 #include <sys/types.h>
7398 #if HAVE_UNISTD_H
7399 # include <unistd.h>
7400 #endif
7401 /* Some systems only have a dummy stub for fork() */
7402 int main ()
7403 {
7404 if (fork() < 0)
7405 exit (1);
7406 exit (0);
7407 }
6396 /* confdefs.h. */
6397 _ACEOF
6398 cat confdefs.h >>conftest.$ac_ext
6399 cat >>conftest.$ac_ext <<_ACEOF
6400 /* end confdefs.h. */
6401 $ac_includes_default
6402 int
6403 main ()
6404 {
6405 static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
6406 test_array [0] = 0
6407
6408 ;
6409 return 0;
6410 }
6411 _ACEOF
6412 rm -f conftest.$ac_objext
6413 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6414 (eval $ac_compile) 2>conftest.er1
6415 ac_status=$?
6416 grep -v '^ *+' conftest.er1 >conftest.err
6417 rm -f conftest.er1
6418 cat conftest.err >&5
6419 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6420 (exit $ac_status); } &&
6421 { ac_try='test -z "$ac_c_werror_flag"
6422 || test ! -s conftest.err'
6423 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6424 (eval $ac_try) 2>&5
6425 ac_status=$?
6426 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6427 (exit $ac_status); }; } &&
6428 { ac_try='test -s conftest.$ac_objext'
6429 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6430 (eval $ac_try) 2>&5
6431 ac_status=$?
6432 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6433 (exit $ac_status); }; }; then
6434 ac_hi=$ac_mid
6435 else
6436 echo "$as_me: failed program was:" >&5
6437 sed 's/^/| /' conftest.$ac_ext >&5
6438
6439 ac_lo=`expr '(' $ac_mid ')' + 1`
6440 fi
6441 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6442 done
6443 case $ac_lo in
6444 ?*) ac_cv_sizeof_void_p=$ac_lo;;
6445 '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
6446 See \`config.log' for more details." >&5
6447 echo "$as_me: error: cannot compute sizeof (void *), 77
6448 See \`config.log' for more details." >&2;}
6449 { (exit 1); exit 1; }; } ;;
6450 esac
6451 else
6452 if test "$cross_compiling" = yes; then
6453 { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
6454 See \`config.log' for more details." >&5
6455 echo "$as_me: error: cannot run test program while cross compiling
6456 See \`config.log' for more details." >&2;}
6457 { (exit 1); exit 1; }; }
6458 else
6459 cat >conftest.$ac_ext <<_ACEOF
6460 /* confdefs.h. */
6461 _ACEOF
6462 cat confdefs.h >>conftest.$ac_ext
6463 cat >>conftest.$ac_ext <<_ACEOF
6464 /* end confdefs.h. */
6465 $ac_includes_default
6466 long longval () { return (long) (sizeof (void *)); }
6467 unsigned long ulongval () { return (long) (sizeof (void *)); }
6468 #include <stdio.h>
6469 #include <stdlib.h>
6470 int
6471 main ()
6472 {
6473
6474 FILE *f = fopen ("conftest.val", "w");
6475 if (! f)
6476 exit (1);
6477 if (((long) (sizeof (void *))) < 0)
6478 {
6479 long i = longval ();
6480 if (i != ((long) (sizeof (void *))))
6481 exit (1);
6482 fprintf (f, "%ld\n", i);
6483 }
6484 else
6485 {
6486 unsigned long i = ulongval ();
6487 if (i != ((long) (sizeof (void *))))
6488 exit (1);
6489 fprintf (f, "%lu\n", i);
6490 }
6491 exit (ferror (f) || fclose (f) != 0);
6492
6493 ;
6494 return 0;
6495 }
74086496 _ACEOF
74096497 rm -f conftest$ac_exeext
74106498 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
74176505 ac_status=$?
74186506 echo "$as_me:$LINENO: \$? = $ac_status" >&5
74196507 (exit $ac_status); }; }; then
7420 ac_cv_func_fork_works=yes
6508 ac_cv_sizeof_void_p=`cat conftest.val`
74216509 else
74226510 echo "$as_me: program exited with status $ac_status" >&5
74236511 echo "$as_me: failed program was:" >&5
74246512 sed 's/^/| /' conftest.$ac_ext >&5
74256513
74266514 ( exit $ac_status )
7427 ac_cv_func_fork_works=no
6515 { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
6516 See \`config.log' for more details." >&5
6517 echo "$as_me: error: cannot compute sizeof (void *), 77
6518 See \`config.log' for more details." >&2;}
6519 { (exit 1); exit 1; }; }
74286520 fi
74296521 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
74306522 fi
74316523 fi
7432 echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
7433 echo "${ECHO_T}$ac_cv_func_fork_works" >&6
7434
7435 else
7436 ac_cv_func_fork_works=$ac_cv_func_fork
7437 fi
7438 if test "x$ac_cv_func_fork_works" = xcross; then
7439 case $host in
7440 *-*-amigaos* | *-*-msdosdjgpp*)
7441 # Override, as these systems have only a dummy fork() stub
7442 ac_cv_func_fork_works=no
7443 ;;
7444 *)
7445 ac_cv_func_fork_works=yes
7446 ;;
7447 esac
7448 { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
7449 echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
7450 fi
7451 ac_cv_func_vfork_works=$ac_cv_func_vfork
7452 if test "x$ac_cv_func_vfork" = xyes; then
7453 echo "$as_me:$LINENO: checking for working vfork" >&5
7454 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
7455 if test "${ac_cv_func_vfork_works+set}" = set; then
6524 rm -f conftest.val
6525 else
6526 ac_cv_sizeof_void_p=0
6527 fi
6528 fi
6529 echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
6530 echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6
6531 cat >>confdefs.h <<_ACEOF
6532 #define SIZEOF_VOID_P $ac_cv_sizeof_void_p
6533 _ACEOF
6534
6535
6536
6537 echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
6538 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
6539 if test "${ac_cv_c_const+set}" = set; then
74566540 echo $ECHO_N "(cached) $ECHO_C" >&6
74576541 else
7458 if test "$cross_compiling" = yes; then
7459 ac_cv_func_vfork_works=cross
7460 else
74616542 cat >conftest.$ac_ext <<_ACEOF
74626543 /* confdefs.h. */
74636544 _ACEOF
74646545 cat confdefs.h >>conftest.$ac_ext
74656546 cat >>conftest.$ac_ext <<_ACEOF
74666547 /* end confdefs.h. */
7467 /* Thanks to Paul Eggert for this test. */
7468 #include <stdio.h>
7469 #include <stdlib.h>
7470 #include <sys/types.h>
7471 #include <sys/stat.h>
7472 #include <sys/wait.h>
7473 #if HAVE_UNISTD_H
7474 # include <unistd.h>
7475 #endif
7476 #if HAVE_VFORK_H
7477 # include <vfork.h>
7478 #endif
7479 /* On some sparc systems, changes by the child to local and incoming
7480 argument registers are propagated back to the parent. The compiler
7481 is told about this with #include <vfork.h>, but some compilers
7482 (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
7483 static variable whose address is put into a register that is
7484 clobbered by the vfork. */
7485 static void
7486 #ifdef __cplusplus
7487 sparc_address_test (int arg)
7488 # else
7489 sparc_address_test (arg) int arg;
7490 #endif
7491 {
7492 static pid_t child;
7493 if (!child) {
7494 child = vfork ();
7495 if (child < 0) {
7496 perror ("vfork");
7497 _exit(2);
7498 }
7499 if (!child) {
7500 arg = getpid();
7501 write(-1, "", 0);
7502 _exit (arg);
7503 }
7504 }
7505 }
75066548
75076549 int
75086550 main ()
75096551 {
7510 pid_t parent = getpid ();
7511 pid_t child;
7512
7513 sparc_address_test (0);
7514
7515 child = vfork ();
7516
7517 if (child == 0) {
7518 /* Here is another test for sparc vfork register problems. This
7519 test uses lots of local variables, at least as many local
7520 variables as main has allocated so far including compiler
7521 temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
7522 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
7523 reuse the register of parent for one of the local variables,
7524 since it will think that parent can't possibly be used any more
7525 in this routine. Assigning to the local variable will thus
7526 munge parent in the parent process. */
7527 pid_t
7528 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
7529 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
7530 /* Convince the compiler that p..p7 are live; otherwise, it might
7531 use the same hardware register for all 8 local variables. */
7532 if (p != p1 || p != p2 || p != p3 || p != p4
7533 || p != p5 || p != p6 || p != p7)
7534 _exit(1);
7535
7536 /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
7537 from child file descriptors. If the child closes a descriptor
7538 before it execs or exits, this munges the parent's descriptor
7539 as well. Test for this by closing stdout in the child. */
7540 _exit(close(fileno(stdout)) != 0);
7541 } else {
7542 int status;
7543 struct stat st;
7544
7545 while (wait(&status) != child)
7546 ;
7547 exit(
7548 /* Was there some problem with vforking? */
7549 child < 0
7550
7551 /* Did the child fail? (This shouldn't happen.) */
7552 || status
7553
7554 /* Did the vfork/compiler bug occur? */
7555 || parent != getpid()
7556
7557 /* Did the file descriptor bug occur? */
7558 || fstat(fileno(stdout), &st) != 0
7559 );
6552 /* FIXME: Include the comments suggested by Paul. */
6553 #ifndef __cplusplus
6554 /* Ultrix mips cc rejects this. */
6555 typedef int charset[2];
6556 const charset x;
6557 /* SunOS 4.1.1 cc rejects this. */
6558 char const *const *ccp;
6559 char **p;
6560 /* NEC SVR4.0.2 mips cc rejects this. */
6561 struct point {int x, y;};
6562 static struct point const zero = {0,0};
6563 /* AIX XL C 1.02.0.0 rejects this.
6564 It does not let you subtract one const X* pointer from another in
6565 an arm of an if-expression whose if-part is not a constant
6566 expression */
6567 const char *g = "string";
6568 ccp = &g + (g ? g-g : 0);
6569 /* HPUX 7.0 cc rejects these. */
6570 ++ccp;
6571 p = (char**) ccp;
6572 ccp = (char const *const *) p;
6573 { /* SCO 3.2v4 cc rejects this. */
6574 char *t;
6575 char const *s = 0 ? (char *) 0 : (char const *) 0;
6576
6577 *t++ = 0;
75606578 }
6579 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
6580 int x[] = {25, 17};
6581 const int *foo = &x[0];
6582 ++foo;
6583 }
6584 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
6585 typedef const int *iptr;
6586 iptr p = 0;
6587 ++p;
6588 }
6589 { /* AIX XL C 1.02.0.0 rejects this saying
6590 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
6591 struct s { int j; const int *ap[3]; };
6592 struct s *b; b->j = 5;
6593 }
6594 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
6595 const int foo = 10;
6596 }
6597 #endif
6598
6599 ;
6600 return 0;
6601 }
6602 _ACEOF
6603 rm -f conftest.$ac_objext
6604 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6605 (eval $ac_compile) 2>conftest.er1
6606 ac_status=$?
6607 grep -v '^ *+' conftest.er1 >conftest.err
6608 rm -f conftest.er1
6609 cat conftest.err >&5
6610 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6611 (exit $ac_status); } &&
6612 { ac_try='test -z "$ac_c_werror_flag"
6613 || test ! -s conftest.err'
6614 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6615 (eval $ac_try) 2>&5
6616 ac_status=$?
6617 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6618 (exit $ac_status); }; } &&
6619 { ac_try='test -s conftest.$ac_objext'
6620 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6621 (eval $ac_try) 2>&5
6622 ac_status=$?
6623 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6624 (exit $ac_status); }; }; then
6625 ac_cv_c_const=yes
6626 else
6627 echo "$as_me: failed program was:" >&5
6628 sed 's/^/| /' conftest.$ac_ext >&5
6629
6630 ac_cv_c_const=no
6631 fi
6632 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6633 fi
6634 echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
6635 echo "${ECHO_T}$ac_cv_c_const" >&6
6636 if test $ac_cv_c_const = no; then
6637
6638 cat >>confdefs.h <<\_ACEOF
6639 #define const
6640 _ACEOF
6641
6642 fi
6643
6644 echo "$as_me:$LINENO: checking for inline" >&5
6645 echo $ECHO_N "checking for inline... $ECHO_C" >&6
6646 if test "${ac_cv_c_inline+set}" = set; then
6647 echo $ECHO_N "(cached) $ECHO_C" >&6
6648 else
6649 ac_cv_c_inline=no
6650 for ac_kw in inline __inline__ __inline; do
6651 cat >conftest.$ac_ext <<_ACEOF
6652 /* confdefs.h. */
6653 _ACEOF
6654 cat confdefs.h >>conftest.$ac_ext
6655 cat >>conftest.$ac_ext <<_ACEOF
6656 /* end confdefs.h. */
6657 #ifndef __cplusplus
6658 typedef int foo_t;
6659 static $ac_kw foo_t static_foo () {return 0; }
6660 $ac_kw foo_t foo () {return 0; }
6661 #endif
6662
6663 _ACEOF
6664 rm -f conftest.$ac_objext
6665 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6666 (eval $ac_compile) 2>conftest.er1
6667 ac_status=$?
6668 grep -v '^ *+' conftest.er1 >conftest.err
6669 rm -f conftest.er1
6670 cat conftest.err >&5
6671 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6672 (exit $ac_status); } &&
6673 { ac_try='test -z "$ac_c_werror_flag"
6674 || test ! -s conftest.err'
6675 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6676 (eval $ac_try) 2>&5
6677 ac_status=$?
6678 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6679 (exit $ac_status); }; } &&
6680 { ac_try='test -s conftest.$ac_objext'
6681 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6682 (eval $ac_try) 2>&5
6683 ac_status=$?
6684 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6685 (exit $ac_status); }; }; then
6686 ac_cv_c_inline=$ac_kw; break
6687 else
6688 echo "$as_me: failed program was:" >&5
6689 sed 's/^/| /' conftest.$ac_ext >&5
6690
6691 fi
6692 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6693 done
6694
6695 fi
6696 echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
6697 echo "${ECHO_T}$ac_cv_c_inline" >&6
6698
6699
6700 case $ac_cv_c_inline in
6701 inline | yes) ;;
6702 *)
6703 case $ac_cv_c_inline in
6704 no) ac_val=;;
6705 *) ac_val=$ac_cv_c_inline;;
6706 esac
6707 cat >>confdefs.h <<_ACEOF
6708 #ifndef __cplusplus
6709 #define inline $ac_val
6710 #endif
6711 _ACEOF
6712 ;;
6713 esac
6714
6715 echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
6716 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
6717 if test "${ac_cv_c_bigendian+set}" = set; then
6718 echo $ECHO_N "(cached) $ECHO_C" >&6
6719 else
6720 # See if sys/param.h defines the BYTE_ORDER macro.
6721 cat >conftest.$ac_ext <<_ACEOF
6722 /* confdefs.h. */
6723 _ACEOF
6724 cat confdefs.h >>conftest.$ac_ext
6725 cat >>conftest.$ac_ext <<_ACEOF
6726 /* end confdefs.h. */
6727 #include <sys/types.h>
6728 #include <sys/param.h>
6729
6730 int
6731 main ()
6732 {
6733 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
6734 bogus endian macros
6735 #endif
6736
6737 ;
6738 return 0;
6739 }
6740 _ACEOF
6741 rm -f conftest.$ac_objext
6742 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6743 (eval $ac_compile) 2>conftest.er1
6744 ac_status=$?
6745 grep -v '^ *+' conftest.er1 >conftest.err
6746 rm -f conftest.er1
6747 cat conftest.err >&5
6748 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6749 (exit $ac_status); } &&
6750 { ac_try='test -z "$ac_c_werror_flag"
6751 || test ! -s conftest.err'
6752 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6753 (eval $ac_try) 2>&5
6754 ac_status=$?
6755 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6756 (exit $ac_status); }; } &&
6757 { ac_try='test -s conftest.$ac_objext'
6758 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6759 (eval $ac_try) 2>&5
6760 ac_status=$?
6761 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6762 (exit $ac_status); }; }; then
6763 # It does; now see whether it defined to BIG_ENDIAN or not.
6764 cat >conftest.$ac_ext <<_ACEOF
6765 /* confdefs.h. */
6766 _ACEOF
6767 cat confdefs.h >>conftest.$ac_ext
6768 cat >>conftest.$ac_ext <<_ACEOF
6769 /* end confdefs.h. */
6770 #include <sys/types.h>
6771 #include <sys/param.h>
6772
6773 int
6774 main ()
6775 {
6776 #if BYTE_ORDER != BIG_ENDIAN
6777 not big endian
6778 #endif
6779
6780 ;
6781 return 0;
6782 }
6783 _ACEOF
6784 rm -f conftest.$ac_objext
6785 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6786 (eval $ac_compile) 2>conftest.er1
6787 ac_status=$?
6788 grep -v '^ *+' conftest.er1 >conftest.err
6789 rm -f conftest.er1
6790 cat conftest.err >&5
6791 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6792 (exit $ac_status); } &&
6793 { ac_try='test -z "$ac_c_werror_flag"
6794 || test ! -s conftest.err'
6795 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6796 (eval $ac_try) 2>&5
6797 ac_status=$?
6798 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6799 (exit $ac_status); }; } &&
6800 { ac_try='test -s conftest.$ac_objext'
6801 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6802 (eval $ac_try) 2>&5
6803 ac_status=$?
6804 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6805 (exit $ac_status); }; }; then
6806 ac_cv_c_bigendian=yes
6807 else
6808 echo "$as_me: failed program was:" >&5
6809 sed 's/^/| /' conftest.$ac_ext >&5
6810
6811 ac_cv_c_bigendian=no
6812 fi
6813 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6814 else
6815 echo "$as_me: failed program was:" >&5
6816 sed 's/^/| /' conftest.$ac_ext >&5
6817
6818 # It does not; compile a test program.
6819 if test "$cross_compiling" = yes; then
6820 # try to guess the endianness by grepping values into an object file
6821 ac_cv_c_bigendian=unknown
6822 cat >conftest.$ac_ext <<_ACEOF
6823 /* confdefs.h. */
6824 _ACEOF
6825 cat confdefs.h >>conftest.$ac_ext
6826 cat >>conftest.$ac_ext <<_ACEOF
6827 /* end confdefs.h. */
6828 short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
6829 short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
6830 void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
6831 short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
6832 short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
6833 void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
6834 int
6835 main ()
6836 {
6837 _ascii (); _ebcdic ();
6838 ;
6839 return 0;
6840 }
6841 _ACEOF
6842 rm -f conftest.$ac_objext
6843 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6844 (eval $ac_compile) 2>conftest.er1
6845 ac_status=$?
6846 grep -v '^ *+' conftest.er1 >conftest.err
6847 rm -f conftest.er1
6848 cat conftest.err >&5
6849 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6850 (exit $ac_status); } &&
6851 { ac_try='test -z "$ac_c_werror_flag"
6852 || test ! -s conftest.err'
6853 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6854 (eval $ac_try) 2>&5
6855 ac_status=$?
6856 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6857 (exit $ac_status); }; } &&
6858 { ac_try='test -s conftest.$ac_objext'
6859 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6860 (eval $ac_try) 2>&5
6861 ac_status=$?
6862 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6863 (exit $ac_status); }; }; then
6864 if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
6865 ac_cv_c_bigendian=yes
6866 fi
6867 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
6868 if test "$ac_cv_c_bigendian" = unknown; then
6869 ac_cv_c_bigendian=no
6870 else
6871 # finding both strings is unlikely to happen, but who knows?
6872 ac_cv_c_bigendian=unknown
6873 fi
6874 fi
6875 else
6876 echo "$as_me: failed program was:" >&5
6877 sed 's/^/| /' conftest.$ac_ext >&5
6878
6879 fi
6880 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6881 else
6882 cat >conftest.$ac_ext <<_ACEOF
6883 /* confdefs.h. */
6884 _ACEOF
6885 cat confdefs.h >>conftest.$ac_ext
6886 cat >>conftest.$ac_ext <<_ACEOF
6887 /* end confdefs.h. */
6888 int
6889 main ()
6890 {
6891 /* Are we little or big endian? From Harbison&Steele. */
6892 union
6893 {
6894 long l;
6895 char c[sizeof (long)];
6896 } u;
6897 u.l = 1;
6898 exit (u.c[sizeof (long) - 1] == 1);
75616899 }
75626900 _ACEOF
75636901 rm -f conftest$ac_exeext
75716909 ac_status=$?
75726910 echo "$as_me:$LINENO: \$? = $ac_status" >&5
75736911 (exit $ac_status); }; }; then
7574 ac_cv_func_vfork_works=yes
6912 ac_cv_c_bigendian=no
75756913 else
75766914 echo "$as_me: program exited with status $ac_status" >&5
75776915 echo "$as_me: failed program was:" >&5
75786916 sed 's/^/| /' conftest.$ac_ext >&5
75796917
75806918 ( exit $ac_status )
7581 ac_cv_func_vfork_works=no
6919 ac_cv_c_bigendian=yes
75826920 fi
75836921 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
75846922 fi
75856923 fi
7586 echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
7587 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
7588
7589 fi;
7590 if test "x$ac_cv_func_fork_works" = xcross; then
7591 ac_cv_func_vfork_works=$ac_cv_func_vfork
7592 { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
7593 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
7594 fi
7595
7596 if test "x$ac_cv_func_vfork_works" = xyes; then
6924 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6925 fi
6926 echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
6927 echo "${ECHO_T}$ac_cv_c_bigendian" >&6
6928 case $ac_cv_c_bigendian in
6929 yes)
75976930
75986931 cat >>confdefs.h <<\_ACEOF
7599 #define HAVE_WORKING_VFORK 1
7600 _ACEOF
7601
7602 else
6932 #define WORDS_BIGENDIAN 1
6933 _ACEOF
6934 ;;
6935 no)
6936 ;;
6937 *)
6938 { { echo "$as_me:$LINENO: error: unknown endianness
6939 presetting ac_cv_c_bigendian=no (or yes) will help" >&5
6940 echo "$as_me: error: unknown endianness
6941 presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
6942 { (exit 1); exit 1; }; } ;;
6943 esac
6944
6945 echo "$as_me:$LINENO: checking for pid_t" >&5
6946 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
6947 if test "${ac_cv_type_pid_t+set}" = set; then
6948 echo $ECHO_N "(cached) $ECHO_C" >&6
6949 else
6950 cat >conftest.$ac_ext <<_ACEOF
6951 /* confdefs.h. */
6952 _ACEOF
6953 cat confdefs.h >>conftest.$ac_ext
6954 cat >>conftest.$ac_ext <<_ACEOF
6955 /* end confdefs.h. */
6956 $ac_includes_default
6957 int
6958 main ()
6959 {
6960 if ((pid_t *) 0)
6961 return 0;
6962 if (sizeof (pid_t))
6963 return 0;
6964 ;
6965 return 0;
6966 }
6967 _ACEOF
6968 rm -f conftest.$ac_objext
6969 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6970 (eval $ac_compile) 2>conftest.er1
6971 ac_status=$?
6972 grep -v '^ *+' conftest.er1 >conftest.err
6973 rm -f conftest.er1
6974 cat conftest.err >&5
6975 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6976 (exit $ac_status); } &&
6977 { ac_try='test -z "$ac_c_werror_flag"
6978 || test ! -s conftest.err'
6979 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6980 (eval $ac_try) 2>&5
6981 ac_status=$?
6982 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6983 (exit $ac_status); }; } &&
6984 { ac_try='test -s conftest.$ac_objext'
6985 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6986 (eval $ac_try) 2>&5
6987 ac_status=$?
6988 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6989 (exit $ac_status); }; }; then
6990 ac_cv_type_pid_t=yes
6991 else
6992 echo "$as_me: failed program was:" >&5
6993 sed 's/^/| /' conftest.$ac_ext >&5
6994
6995 ac_cv_type_pid_t=no
6996 fi
6997 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6998 fi
6999 echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
7000 echo "${ECHO_T}$ac_cv_type_pid_t" >&6
7001 if test $ac_cv_type_pid_t = yes; then
7002 :
7003 else
7004
7005 cat >>confdefs.h <<_ACEOF
7006 #define pid_t int
7007 _ACEOF
7008
7009 fi
7010
7011 echo "$as_me:$LINENO: checking for size_t" >&5
7012 echo $ECHO_N "checking for size_t... $ECHO_C" >&6
7013 if test "${ac_cv_type_size_t+set}" = set; then
7014 echo $ECHO_N "(cached) $ECHO_C" >&6
7015 else
7016 cat >conftest.$ac_ext <<_ACEOF
7017 /* confdefs.h. */
7018 _ACEOF
7019 cat confdefs.h >>conftest.$ac_ext
7020 cat >>conftest.$ac_ext <<_ACEOF
7021 /* end confdefs.h. */
7022 $ac_includes_default
7023 int
7024 main ()
7025 {
7026 if ((size_t *) 0)
7027 return 0;
7028 if (sizeof (size_t))
7029 return 0;
7030 ;
7031 return 0;
7032 }
7033 _ACEOF
7034 rm -f conftest.$ac_objext
7035 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7036 (eval $ac_compile) 2>conftest.er1
7037 ac_status=$?
7038 grep -v '^ *+' conftest.er1 >conftest.err
7039 rm -f conftest.er1
7040 cat conftest.err >&5
7041 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7042 (exit $ac_status); } &&
7043 { ac_try='test -z "$ac_c_werror_flag"
7044 || test ! -s conftest.err'
7045 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7046 (eval $ac_try) 2>&5
7047 ac_status=$?
7048 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7049 (exit $ac_status); }; } &&
7050 { ac_try='test -s conftest.$ac_objext'
7051 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7052 (eval $ac_try) 2>&5
7053 ac_status=$?
7054 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7055 (exit $ac_status); }; }; then
7056 ac_cv_type_size_t=yes
7057 else
7058 echo "$as_me: failed program was:" >&5
7059 sed 's/^/| /' conftest.$ac_ext >&5
7060
7061 ac_cv_type_size_t=no
7062 fi
7063 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7064 fi
7065 echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
7066 echo "${ECHO_T}$ac_cv_type_size_t" >&6
7067 if test $ac_cv_type_size_t = yes; then
7068 :
7069 else
7070
7071 cat >>confdefs.h <<_ACEOF
7072 #define size_t unsigned
7073 _ACEOF
7074
7075 fi
7076
7077 echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
7078 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
7079 if test "${ac_cv_struct_tm+set}" = set; then
7080 echo $ECHO_N "(cached) $ECHO_C" >&6
7081 else
7082 cat >conftest.$ac_ext <<_ACEOF
7083 /* confdefs.h. */
7084 _ACEOF
7085 cat confdefs.h >>conftest.$ac_ext
7086 cat >>conftest.$ac_ext <<_ACEOF
7087 /* end confdefs.h. */
7088 #include <sys/types.h>
7089 #include <time.h>
7090
7091 int
7092 main ()
7093 {
7094 struct tm *tp; tp->tm_sec;
7095 ;
7096 return 0;
7097 }
7098 _ACEOF
7099 rm -f conftest.$ac_objext
7100 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7101 (eval $ac_compile) 2>conftest.er1
7102 ac_status=$?
7103 grep -v '^ *+' conftest.er1 >conftest.err
7104 rm -f conftest.er1
7105 cat conftest.err >&5
7106 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7107 (exit $ac_status); } &&
7108 { ac_try='test -z "$ac_c_werror_flag"
7109 || test ! -s conftest.err'
7110 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7111 (eval $ac_try) 2>&5
7112 ac_status=$?
7113 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7114 (exit $ac_status); }; } &&
7115 { ac_try='test -s conftest.$ac_objext'
7116 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7117 (eval $ac_try) 2>&5
7118 ac_status=$?
7119 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7120 (exit $ac_status); }; }; then
7121 ac_cv_struct_tm=time.h
7122 else
7123 echo "$as_me: failed program was:" >&5
7124 sed 's/^/| /' conftest.$ac_ext >&5
7125
7126 ac_cv_struct_tm=sys/time.h
7127 fi
7128 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7129 fi
7130 echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
7131 echo "${ECHO_T}$ac_cv_struct_tm" >&6
7132 if test $ac_cv_struct_tm = sys/time.h; then
76037133
76047134 cat >>confdefs.h <<\_ACEOF
7605 #define vfork fork
7606 _ACEOF
7607
7608 fi
7609 if test "x$ac_cv_func_fork_works" = xyes; then
7135 #define TM_IN_SYS_TIME 1
7136 _ACEOF
7137
7138 fi
7139
7140 echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
7141 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6
7142 if test "${ac_cv_header_stdbool_h+set}" = set; then
7143 echo $ECHO_N "(cached) $ECHO_C" >&6
7144 else
7145 cat >conftest.$ac_ext <<_ACEOF
7146 /* confdefs.h. */
7147 _ACEOF
7148 cat confdefs.h >>conftest.$ac_ext
7149 cat >>conftest.$ac_ext <<_ACEOF
7150 /* end confdefs.h. */
7151
7152 #include <stdbool.h>
7153 #ifndef bool
7154 # error bool is not defined
7155 #endif
7156 #ifndef false
7157 # error false is not defined
7158 #endif
7159 #if false
7160 # error false is not 0
7161 #endif
7162 #ifndef true
7163 # error true is not defined
7164 #endif
7165 #if true != 1
7166 # error true is not 1
7167 #endif
7168 #ifndef __bool_true_false_are_defined
7169 # error __bool_true_false_are_defined is not defined
7170 #endif
7171
7172 struct s { _Bool s: 1; _Bool t; } s;
7173
7174 char a[true == 1 ? 1 : -1];
7175 char b[false == 0 ? 1 : -1];
7176 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
7177 char d[(bool) -0.5 == true ? 1 : -1];
7178 bool e = &s;
7179 char f[(_Bool) -0.0 == false ? 1 : -1];
7180 char g[true];
7181 char h[sizeof (_Bool)];
7182 char i[sizeof s.t];
7183
7184 int
7185 main ()
7186 {
7187 return !a + !b + !c + !d + !e + !f + !g + !h + !i;
7188 ;
7189 return 0;
7190 }
7191 _ACEOF
7192 rm -f conftest.$ac_objext
7193 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7194 (eval $ac_compile) 2>conftest.er1
7195 ac_status=$?
7196 grep -v '^ *+' conftest.er1 >conftest.err
7197 rm -f conftest.er1
7198 cat conftest.err >&5
7199 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7200 (exit $ac_status); } &&
7201 { ac_try='test -z "$ac_c_werror_flag"
7202 || test ! -s conftest.err'
7203 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7204 (eval $ac_try) 2>&5
7205 ac_status=$?
7206 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7207 (exit $ac_status); }; } &&
7208 { ac_try='test -s conftest.$ac_objext'
7209 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7210 (eval $ac_try) 2>&5
7211 ac_status=$?
7212 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7213 (exit $ac_status); }; }; then
7214 ac_cv_header_stdbool_h=yes
7215 else
7216 echo "$as_me: failed program was:" >&5
7217 sed 's/^/| /' conftest.$ac_ext >&5
7218
7219 ac_cv_header_stdbool_h=no
7220 fi
7221 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7222 fi
7223 echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
7224 echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6
7225 echo "$as_me:$LINENO: checking for _Bool" >&5
7226 echo $ECHO_N "checking for _Bool... $ECHO_C" >&6
7227 if test "${ac_cv_type__Bool+set}" = set; then
7228 echo $ECHO_N "(cached) $ECHO_C" >&6
7229 else
7230 cat >conftest.$ac_ext <<_ACEOF
7231 /* confdefs.h. */
7232 _ACEOF
7233 cat confdefs.h >>conftest.$ac_ext
7234 cat >>conftest.$ac_ext <<_ACEOF
7235 /* end confdefs.h. */
7236 $ac_includes_default
7237 int
7238 main ()
7239 {
7240 if ((_Bool *) 0)
7241 return 0;
7242 if (sizeof (_Bool))
7243 return 0;
7244 ;
7245 return 0;
7246 }
7247 _ACEOF
7248 rm -f conftest.$ac_objext
7249 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7250 (eval $ac_compile) 2>conftest.er1
7251 ac_status=$?
7252 grep -v '^ *+' conftest.er1 >conftest.err
7253 rm -f conftest.er1
7254 cat conftest.err >&5
7255 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7256 (exit $ac_status); } &&
7257 { ac_try='test -z "$ac_c_werror_flag"
7258 || test ! -s conftest.err'
7259 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7260 (eval $ac_try) 2>&5
7261 ac_status=$?
7262 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7263 (exit $ac_status); }; } &&
7264 { ac_try='test -s conftest.$ac_objext'
7265 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7266 (eval $ac_try) 2>&5
7267 ac_status=$?
7268 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7269 (exit $ac_status); }; }; then
7270 ac_cv_type__Bool=yes
7271 else
7272 echo "$as_me: failed program was:" >&5
7273 sed 's/^/| /' conftest.$ac_ext >&5
7274
7275 ac_cv_type__Bool=no
7276 fi
7277 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7278 fi
7279 echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
7280 echo "${ECHO_T}$ac_cv_type__Bool" >&6
7281 if test $ac_cv_type__Bool = yes; then
7282
7283 cat >>confdefs.h <<_ACEOF
7284 #define HAVE__BOOL 1
7285 _ACEOF
7286
7287
7288 fi
7289
7290 if test $ac_cv_header_stdbool_h = yes; then
76107291
76117292 cat >>confdefs.h <<\_ACEOF
7612 #define HAVE_WORKING_FORK 1
7613 _ACEOF
7614
7615 fi
7616
7617
7618 for ac_header in stdlib.h
7293 #define HAVE_STDBOOL_H 1
7294 _ACEOF
7295
7296 fi
7297
7298
7299 # Checks for library functions.
7300 echo "$as_me:$LINENO: checking whether closedir returns void" >&5
7301 echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6
7302 if test "${ac_cv_func_closedir_void+set}" = set; then
7303 echo $ECHO_N "(cached) $ECHO_C" >&6
7304 else
7305 if test "$cross_compiling" = yes; then
7306 ac_cv_func_closedir_void=yes
7307 else
7308 cat >conftest.$ac_ext <<_ACEOF
7309 /* confdefs.h. */
7310 _ACEOF
7311 cat confdefs.h >>conftest.$ac_ext
7312 cat >>conftest.$ac_ext <<_ACEOF
7313 /* end confdefs.h. */
7314 $ac_includes_default
7315 #include <$ac_header_dirent>
7316 #ifndef __cplusplus
7317 int closedir ();
7318 #endif
7319
7320 int
7321 main ()
7322 {
7323 exit (closedir (opendir (".")) != 0);
7324 ;
7325 return 0;
7326 }
7327 _ACEOF
7328 rm -f conftest$ac_exeext
7329 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
7330 (eval $ac_link) 2>&5
7331 ac_status=$?
7332 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7333 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
7334 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7335 (eval $ac_try) 2>&5
7336 ac_status=$?
7337 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7338 (exit $ac_status); }; }; then
7339 ac_cv_func_closedir_void=no
7340 else
7341 echo "$as_me: program exited with status $ac_status" >&5
7342 echo "$as_me: failed program was:" >&5
7343 sed 's/^/| /' conftest.$ac_ext >&5
7344
7345 ( exit $ac_status )
7346 ac_cv_func_closedir_void=yes
7347 fi
7348 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
7349 fi
7350 fi
7351 echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
7352 echo "${ECHO_T}$ac_cv_func_closedir_void" >&6
7353 if test $ac_cv_func_closedir_void = yes; then
7354
7355 cat >>confdefs.h <<\_ACEOF
7356 #define CLOSEDIR_VOID 1
7357 _ACEOF
7358
7359 fi
7360
7361
7362
7363 for ac_header in unistd.h vfork.h
76197364 do
76207365 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
76217366 if eval "test \"\${$as_ac_Header+set}\" = set"; then
77647509
77657510 done
77667511
7767 echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
7768 echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
7769 if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
7512
7513
7514 for ac_func in fork vfork
7515 do
7516 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
7517 echo "$as_me:$LINENO: checking for $ac_func" >&5
7518 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
7519 if eval "test \"\${$as_ac_var+set}\" = set"; then
77707520 echo $ECHO_N "(cached) $ECHO_C" >&6
77717521 else
7772 if test "$cross_compiling" = yes; then
7773 ac_cv_func_malloc_0_nonnull=no
7774 else
77757522 cat >conftest.$ac_ext <<_ACEOF
77767523 /* confdefs.h. */
77777524 _ACEOF
77787525 cat confdefs.h >>conftest.$ac_ext
77797526 cat >>conftest.$ac_ext <<_ACEOF
77807527 /* end confdefs.h. */
7781 #if STDC_HEADERS || HAVE_STDLIB_H
7782 # include <stdlib.h>
7528 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
7529 For example, HP-UX 11i <limits.h> declares gettimeofday. */
7530 #define $ac_func innocuous_$ac_func
7531
7532 /* System header to define __stub macros and hopefully few prototypes,
7533 which can conflict with char $ac_func (); below.
7534 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
7535 <limits.h> exists even on freestanding compilers. */
7536
7537 #ifdef __STDC__
7538 # include <limits.h>
77837539 #else
7784 char *malloc ();
7540 # include <assert.h>
7541 #endif
7542
7543 #undef $ac_func
7544
7545 /* Override any gcc2 internal prototype to avoid an error. */
7546 #ifdef __cplusplus
7547 extern "C"
7548 {
7549 #endif
7550 /* We use char because int might match the return type of a gcc2
7551 builtin and then its argument prototype would still apply. */
7552 char $ac_func ();
7553 /* The GNU C library defines this for functions which it implements
7554 to always fail with ENOSYS. Some functions are actually named
7555 something starting with __ and the normal name is an alias. */
7556 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
7557 choke me
7558 #else
7559 char (*f) () = $ac_func;
7560 #endif
7561 #ifdef __cplusplus
7562 }
77857563 #endif
77867564
77877565 int
77887566 main ()
77897567 {
7790 exit (malloc (0) ? 0 : 1);
7568 return f != $ac_func;
77917569 ;
77927570 return 0;
77937571 }
7572 _ACEOF
7573 rm -f conftest.$ac_objext conftest$ac_exeext
7574 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
7575 (eval $ac_link) 2>conftest.er1
7576 ac_status=$?
7577 grep -v '^ *+' conftest.er1 >conftest.err
7578 rm -f conftest.er1
7579 cat conftest.err >&5
7580 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7581 (exit $ac_status); } &&
7582 { ac_try='test -z "$ac_c_werror_flag"
7583 || test ! -s conftest.err'
7584 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7585 (eval $ac_try) 2>&5
7586 ac_status=$?
7587 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7588 (exit $ac_status); }; } &&
7589 { ac_try='test -s conftest$ac_exeext'
7590 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7591 (eval $ac_try) 2>&5
7592 ac_status=$?
7593 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7594 (exit $ac_status); }; }; then
7595 eval "$as_ac_var=yes"
7596 else
7597 echo "$as_me: failed program was:" >&5
7598 sed 's/^/| /' conftest.$ac_ext >&5
7599
7600 eval "$as_ac_var=no"
7601 fi
7602 rm -f conftest.err conftest.$ac_objext \
7603 conftest$ac_exeext conftest.$ac_ext
7604 fi
7605 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
7606 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
7607 if test `eval echo '${'$as_ac_var'}'` = yes; then
7608 cat >>confdefs.h <<_ACEOF
7609 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7610 _ACEOF
7611
7612 fi
7613 done
7614
7615 if test "x$ac_cv_func_fork" = xyes; then
7616 echo "$as_me:$LINENO: checking for working fork" >&5
7617 echo $ECHO_N "checking for working fork... $ECHO_C" >&6
7618 if test "${ac_cv_func_fork_works+set}" = set; then
7619 echo $ECHO_N "(cached) $ECHO_C" >&6
7620 else
7621 if test "$cross_compiling" = yes; then
7622 ac_cv_func_fork_works=cross
7623 else
7624 cat >conftest.$ac_ext <<_ACEOF
7625 /* By Ruediger Kuhlmann. */
7626 #include <sys/types.h>
7627 #if HAVE_UNISTD_H
7628 # include <unistd.h>
7629 #endif
7630 /* Some systems only have a dummy stub for fork() */
7631 int main ()
7632 {
7633 if (fork() < 0)
7634 exit (1);
7635 exit (0);
7636 }
77947637 _ACEOF
77957638 rm -f conftest$ac_exeext
77967639 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
78037646 ac_status=$?
78047647 echo "$as_me:$LINENO: \$? = $ac_status" >&5
78057648 (exit $ac_status); }; }; then
7806 ac_cv_func_malloc_0_nonnull=yes
7649 ac_cv_func_fork_works=yes
78077650 else
78087651 echo "$as_me: program exited with status $ac_status" >&5
78097652 echo "$as_me: failed program was:" >&5
78107653 sed 's/^/| /' conftest.$ac_ext >&5
78117654
78127655 ( exit $ac_status )
7813 ac_cv_func_malloc_0_nonnull=no
7656 ac_cv_func_fork_works=no
78147657 fi
78157658 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
78167659 fi
78177660 fi
7818 echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
7819 echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
7820 if test $ac_cv_func_malloc_0_nonnull = yes; then
7821
7822 cat >>confdefs.h <<\_ACEOF
7823 #define HAVE_MALLOC 1
7824 _ACEOF
7825
7826 else
7827 cat >>confdefs.h <<\_ACEOF
7828 #define HAVE_MALLOC 0
7829 _ACEOF
7830
7831 case $LIBOBJS in
7832 "malloc.$ac_objext" | \
7833 *" malloc.$ac_objext" | \
7834 "malloc.$ac_objext "* | \
7835 *" malloc.$ac_objext "* ) ;;
7836 *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
7837 esac
7838
7839
7840 cat >>confdefs.h <<\_ACEOF
7841 #define malloc rpl_malloc
7842 _ACEOF
7843
7844 fi
7845
7846
7847
7848 echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
7849 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
7850 if test "${ac_cv_header_time+set}" = set; then
7661 echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
7662 echo "${ECHO_T}$ac_cv_func_fork_works" >&6
7663
7664 else
7665 ac_cv_func_fork_works=$ac_cv_func_fork
7666 fi
7667 if test "x$ac_cv_func_fork_works" = xcross; then
7668 case $host in
7669 *-*-amigaos* | *-*-msdosdjgpp*)
7670 # Override, as these systems have only a dummy fork() stub
7671 ac_cv_func_fork_works=no
7672 ;;
7673 *)
7674 ac_cv_func_fork_works=yes
7675 ;;
7676 esac
7677 { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
7678 echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
7679 fi
7680 ac_cv_func_vfork_works=$ac_cv_func_vfork
7681 if test "x$ac_cv_func_vfork" = xyes; then
7682 echo "$as_me:$LINENO: checking for working vfork" >&5
7683 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
7684 if test "${ac_cv_func_vfork_works+set}" = set; then
78517685 echo $ECHO_N "(cached) $ECHO_C" >&6
78527686 else
7687 if test "$cross_compiling" = yes; then
7688 ac_cv_func_vfork_works=cross
7689 else
78537690 cat >conftest.$ac_ext <<_ACEOF
78547691 /* confdefs.h. */
78557692 _ACEOF
78567693 cat confdefs.h >>conftest.$ac_ext
78577694 cat >>conftest.$ac_ext <<_ACEOF
78587695 /* end confdefs.h. */
7696 /* Thanks to Paul Eggert for this test. */
7697 #include <stdio.h>
7698 #include <stdlib.h>
78597699 #include <sys/types.h>
7860 #include <sys/time.h>
7861 #include <time.h>
7700 #include <sys/stat.h>
7701 #include <sys/wait.h>
7702 #if HAVE_UNISTD_H
7703 # include <unistd.h>
7704 #endif
7705 #if HAVE_VFORK_H
7706 # include <vfork.h>
7707 #endif
7708 /* On some sparc systems, changes by the child to local and incoming
7709 argument registers are propagated back to the parent. The compiler
7710 is told about this with #include <vfork.h>, but some compilers
7711 (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
7712 static variable whose address is put into a register that is
7713 clobbered by the vfork. */
7714 static void
7715 #ifdef __cplusplus
7716 sparc_address_test (int arg)
7717 # else
7718 sparc_address_test (arg) int arg;
7719 #endif
7720 {
7721 static pid_t child;
7722 if (!child) {
7723 child = vfork ();
7724 if (child < 0) {
7725 perror ("vfork");
7726 _exit(2);
7727 }
7728 if (!child) {
7729 arg = getpid();
7730 write(-1, "", 0);
7731 _exit (arg);
7732 }
7733 }
7734 }
78627735
78637736 int
78647737 main ()
78657738 {
7866 if ((struct tm *) 0)
7867 return 0;
7868 ;
7869 return 0;
7870 }
7871 _ACEOF
7872 rm -f conftest.$ac_objext
7873 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7874 (eval $ac_compile) 2>conftest.er1
7875 ac_status=$?
7876 grep -v '^ *+' conftest.er1 >conftest.err
7877 rm -f conftest.er1
7878 cat conftest.err >&5
7879 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7880 (exit $ac_status); } &&
7881 { ac_try='test -z "$ac_c_werror_flag"
7882 || test ! -s conftest.err'
7883 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7884 (eval $ac_try) 2>&5
7885 ac_status=$?
7886 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7887 (exit $ac_status); }; } &&
7888 { ac_try='test -s conftest.$ac_objext'
7889 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7890 (eval $ac_try) 2>&5
7891 ac_status=$?
7892 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7893 (exit $ac_status); }; }; then
7894 ac_cv_header_time=yes
7895 else
7896 echo "$as_me: failed program was:" >&5
7897 sed 's/^/| /' conftest.$ac_ext >&5
7898
7899 ac_cv_header_time=no
7900 fi
7901 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7902 fi
7903 echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
7904 echo "${ECHO_T}$ac_cv_header_time" >&6
7905 if test $ac_cv_header_time = yes; then
7739 pid_t parent = getpid ();
7740 pid_t child;
7741
7742 sparc_address_test (0);
7743
7744 child = vfork ();
7745
7746 if (child == 0) {
7747 /* Here is another test for sparc vfork register problems. This
7748 test uses lots of local variables, at least as many local
7749 variables as main has allocated so far including compiler
7750 temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
7751 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
7752 reuse the register of parent for one of the local variables,
7753 since it will think that parent can't possibly be used any more
7754 in this routine. Assigning to the local variable will thus
7755 munge parent in the parent process. */
7756 pid_t
7757 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
7758 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
7759 /* Convince the compiler that p..p7 are live; otherwise, it might
7760 use the same hardware register for all 8 local variables. */
7761 if (p != p1 || p != p2 || p != p3 || p != p4
7762 || p != p5 || p != p6 || p != p7)
7763 _exit(1);
7764
7765 /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
7766 from child file descriptors. If the child closes a descriptor
7767 before it execs or exits, this munges the parent's descriptor
7768 as well. Test for this by closing stdout in the child. */
7769 _exit(close(fileno(stdout)) != 0);
7770 } else {
7771 int status;
7772 struct stat st;
7773
7774 while (wait(&status) != child)
7775 ;
7776 exit(
7777 /* Was there some problem with vforking? */
7778 child < 0
7779
7780 /* Did the child fail? (This shouldn't happen.) */
7781 || status
7782
7783 /* Did the vfork/compiler bug occur? */
7784 || parent != getpid()
7785
7786 /* Did the file descriptor bug occur? */
7787 || fstat(fileno(stdout), &st) != 0
7788 );
7789 }
7790 }
7791 _ACEOF
7792 rm -f conftest$ac_exeext
7793 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
7794 (eval $ac_link) 2>&5
7795 ac_status=$?
7796 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7797 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
7798 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7799 (eval $ac_try) 2>&5
7800 ac_status=$?
7801 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7802 (exit $ac_status); }; }; then
7803 ac_cv_func_vfork_works=yes
7804 else
7805 echo "$as_me: program exited with status $ac_status" >&5
7806 echo "$as_me: failed program was:" >&5
7807 sed 's/^/| /' conftest.$ac_ext >&5
7808
7809 ( exit $ac_status )
7810 ac_cv_func_vfork_works=no
7811 fi
7812 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
7813 fi
7814 fi
7815 echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
7816 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
7817
7818 fi;
7819 if test "x$ac_cv_func_fork_works" = xcross; then
7820 ac_cv_func_vfork_works=$ac_cv_func_vfork
7821 { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
7822 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
7823 fi
7824
7825 if test "x$ac_cv_func_vfork_works" = xyes; then
79067826
79077827 cat >>confdefs.h <<\_ACEOF
7908 #define TIME_WITH_SYS_TIME 1
7909 _ACEOF
7910
7911 fi
7912
7913
7914
7915
7916 for ac_header in stdlib.h sys/time.h unistd.h
7828 #define HAVE_WORKING_VFORK 1
7829 _ACEOF
7830
7831 else
7832
7833 cat >>confdefs.h <<\_ACEOF
7834 #define vfork fork
7835 _ACEOF
7836
7837 fi
7838 if test "x$ac_cv_func_fork_works" = xyes; then
7839
7840 cat >>confdefs.h <<\_ACEOF
7841 #define HAVE_WORKING_FORK 1
7842 _ACEOF
7843
7844 fi
7845
7846
7847 for ac_header in stdlib.h
79177848 do
79187849 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
79197850 if eval "test \"\${$as_ac_Header+set}\" = set"; then
80627993
80637994 done
80647995
8065
8066 for ac_func in alarm
8067 do
8068 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8069 echo "$as_me:$LINENO: checking for $ac_func" >&5
8070 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
8071 if eval "test \"\${$as_ac_var+set}\" = set"; then
7996 echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
7997 echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
7998 if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
80727999 echo $ECHO_N "(cached) $ECHO_C" >&6
80738000 else
8001 if test "$cross_compiling" = yes; then
8002 ac_cv_func_malloc_0_nonnull=no
8003 else
80748004 cat >conftest.$ac_ext <<_ACEOF
80758005 /* confdefs.h. */
80768006 _ACEOF
80778007 cat confdefs.h >>conftest.$ac_ext
80788008 cat >>conftest.$ac_ext <<_ACEOF
80798009 /* end confdefs.h. */
8080 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
8081 For example, HP-UX 11i <limits.h> declares gettimeofday. */
8082 #define $ac_func innocuous_$ac_func
8083
8084 /* System header to define __stub macros and hopefully few prototypes,
8085 which can conflict with char $ac_func (); below.
8086 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
8087 <limits.h> exists even on freestanding compilers. */
8088
8089 #ifdef __STDC__
8090 # include <limits.h>
8010 #if STDC_HEADERS || HAVE_STDLIB_H
8011 # include <stdlib.h>
80918012 #else
8092 # include <assert.h>
8093 #endif
8094
8095 #undef $ac_func
8096
8097 /* Override any gcc2 internal prototype to avoid an error. */
8098 #ifdef __cplusplus
8099 extern "C"
8100 {
8101 #endif
8102 /* We use char because int might match the return type of a gcc2
8103 builtin and then its argument prototype would still apply. */
8104 char $ac_func ();
8105 /* The GNU C library defines this for functions which it implements
8106 to always fail with ENOSYS. Some functions are actually named
8107 something starting with __ and the normal name is an alias. */
8108 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
8109 choke me
8110 #else
8111 char (*f) () = $ac_func;
8112 #endif
8113 #ifdef __cplusplus
8114 }
8013 char *malloc ();
81158014 #endif
81168015
81178016 int
81188017 main ()
81198018 {
8120 return f != $ac_func;
8019 exit (malloc (0) ? 0 : 1);
81218020 ;
81228021 return 0;
81238022 }
81248023 _ACEOF
8125 rm -f conftest.$ac_objext conftest$ac_exeext
8024 rm -f conftest$ac_exeext
81268025 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8127 (eval $ac_link) 2>conftest.er1
8026 (eval $ac_link) 2>&5
8027 ac_status=$?
8028 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8029 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8030 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8031 (eval $ac_try) 2>&5
8032 ac_status=$?
8033 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8034 (exit $ac_status); }; }; then
8035 ac_cv_func_malloc_0_nonnull=yes
8036 else
8037 echo "$as_me: program exited with status $ac_status" >&5
8038 echo "$as_me: failed program was:" >&5
8039 sed 's/^/| /' conftest.$ac_ext >&5
8040
8041 ( exit $ac_status )
8042 ac_cv_func_malloc_0_nonnull=no
8043 fi
8044 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8045 fi
8046 fi
8047 echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
8048 echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
8049 if test $ac_cv_func_malloc_0_nonnull = yes; then
8050
8051 cat >>confdefs.h <<\_ACEOF
8052 #define HAVE_MALLOC 1
8053 _ACEOF
8054
8055 else
8056 cat >>confdefs.h <<\_ACEOF
8057 #define HAVE_MALLOC 0
8058 _ACEOF
8059
8060 case $LIBOBJS in
8061 "malloc.$ac_objext" | \
8062 *" malloc.$ac_objext" | \
8063 "malloc.$ac_objext "* | \
8064 *" malloc.$ac_objext "* ) ;;
8065 *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
8066 esac
8067
8068
8069 cat >>confdefs.h <<\_ACEOF
8070 #define malloc rpl_malloc
8071 _ACEOF
8072
8073 fi
8074
8075
8076
8077 echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
8078 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
8079 if test "${ac_cv_header_time+set}" = set; then
8080 echo $ECHO_N "(cached) $ECHO_C" >&6
8081 else
8082 cat >conftest.$ac_ext <<_ACEOF
8083 /* confdefs.h. */
8084 _ACEOF
8085 cat confdefs.h >>conftest.$ac_ext
8086 cat >>conftest.$ac_ext <<_ACEOF
8087 /* end confdefs.h. */
8088 #include <sys/types.h>
8089 #include <sys/time.h>
8090 #include <time.h>
8091
8092 int
8093 main ()
8094 {
8095 if ((struct tm *) 0)
8096 return 0;
8097 ;
8098 return 0;
8099 }
8100 _ACEOF
8101 rm -f conftest.$ac_objext
8102 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8103 (eval $ac_compile) 2>conftest.er1
81288104 ac_status=$?
81298105 grep -v '^ *+' conftest.er1 >conftest.err
81308106 rm -f conftest.er1
81388114 ac_status=$?
81398115 echo "$as_me:$LINENO: \$? = $ac_status" >&5
81408116 (exit $ac_status); }; } &&
8141 { ac_try='test -s conftest$ac_exeext'
8142 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8143 (eval $ac_try) 2>&5
8144 ac_status=$?
8145 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8146 (exit $ac_status); }; }; then
8147 eval "$as_ac_var=yes"
8117 { ac_try='test -s conftest.$ac_objext'
8118 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8119 (eval $ac_try) 2>&5
8120 ac_status=$?
8121 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8122 (exit $ac_status); }; }; then
8123 ac_cv_header_time=yes
81488124 else
81498125 echo "$as_me: failed program was:" >&5
81508126 sed 's/^/| /' conftest.$ac_ext >&5
81518127
8152 eval "$as_ac_var=no"
8153 fi
8154 rm -f conftest.err conftest.$ac_objext \
8155 conftest$ac_exeext conftest.$ac_ext
8156 fi
8157 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
8158 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
8159 if test `eval echo '${'$as_ac_var'}'` = yes; then
8160 cat >>confdefs.h <<_ACEOF
8161 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8162 _ACEOF
8163
8164 fi
8165 done
8166
8167 echo "$as_me:$LINENO: checking for working mktime" >&5
8168 echo $ECHO_N "checking for working mktime... $ECHO_C" >&6
8169 if test "${ac_cv_func_working_mktime+set}" = set; then
8170 echo $ECHO_N "(cached) $ECHO_C" >&6
8171 else
8172 if test "$cross_compiling" = yes; then
8173 ac_cv_func_working_mktime=no
8174 else
8175 cat >conftest.$ac_ext <<_ACEOF
8176 /* confdefs.h. */
8177 _ACEOF
8178 cat confdefs.h >>conftest.$ac_ext
8179 cat >>conftest.$ac_ext <<_ACEOF
8180 /* end confdefs.h. */
8181 /* Test program from Paul Eggert and Tony Leneis. */
8182 #if TIME_WITH_SYS_TIME
8183 # include <sys/time.h>
8184 # include <time.h>
8185 #else
8186 # if HAVE_SYS_TIME_H
8187 # include <sys/time.h>
8188 # else
8189 # include <time.h>
8190 # endif
8191 #endif
8192
8193 #if HAVE_STDLIB_H
8194 # include <stdlib.h>
8195 #endif
8196
8197 #if HAVE_UNISTD_H
8198 # include <unistd.h>
8199 #endif
8200
8201 #if !HAVE_ALARM
8202 # define alarm(X) /* empty */
8203 #endif
8204
8205 /* Work around redefinition to rpl_putenv by other config tests. */
8206 #undef putenv
8207
8208 static time_t time_t_max;
8209 static time_t time_t_min;
8210
8211 /* Values we'll use to set the TZ environment variable. */
8212 static char *tz_strings[] = {
8213 (char *) 0, "TZ=GMT0", "TZ=JST-9",
8214 "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
8215 };
8216 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
8217
8218 /* Fail if mktime fails to convert a date in the spring-forward gap.
8219 Based on a problem report from Andreas Jaeger. */
8220 static void
8221 spring_forward_gap ()
8222 {
8223 /* glibc (up to about 1998-10-07) failed this test. */
8224 struct tm tm;
8225
8226 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
8227 instead of "TZ=America/Vancouver" in order to detect the bug even
8228 on systems that don't support the Olson extension, or don't have the
8229 full zoneinfo tables installed. */
8230 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
8231
8232 tm.tm_year = 98;
8233 tm.tm_mon = 3;
8234 tm.tm_mday = 5;
8235 tm.tm_hour = 2;
8236 tm.tm_min = 0;
8237 tm.tm_sec = 0;
8238 tm.tm_isdst = -1;
8239 if (mktime (&tm) == (time_t)-1)
8240 exit (1);
8241 }
8242
8243 static void
8244 mktime_test1 (now)
8245 time_t now;
8246 {
8247 struct tm *lt;
8248 if ((lt = localtime (&now)) && mktime (lt) != now)
8249 exit (1);
8250 }
8251
8252 static void
8253 mktime_test (now)
8254 time_t now;
8255 {
8256 mktime_test1 (now);
8257 mktime_test1 ((time_t) (time_t_max - now));
8258 mktime_test1 ((time_t) (time_t_min + now));
8259 }
8260
8261 static void
8262 irix_6_4_bug ()
8263 {
8264 /* Based on code from Ariel Faigon. */
8265 struct tm tm;
8266 tm.tm_year = 96;
8267 tm.tm_mon = 3;
8268 tm.tm_mday = 0;
8269 tm.tm_hour = 0;
8270 tm.tm_min = 0;
8271 tm.tm_sec = 0;
8272 tm.tm_isdst = -1;
8273 mktime (&tm);
8274 if (tm.tm_mon != 2 || tm.tm_mday != 31)
8275 exit (1);
8276 }
8277
8278 static void
8279 bigtime_test (j)
8280 int j;
8281 {
8282 struct tm tm;
8283 time_t now;
8284 tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
8285 now = mktime (&tm);
8286 if (now != (time_t) -1)
8287 {
8288 struct tm *lt = localtime (&now);
8289 if (! (lt
8290 && lt->tm_year == tm.tm_year
8291 && lt->tm_mon == tm.tm_mon
8292 && lt->tm_mday == tm.tm_mday
8293 && lt->tm_hour == tm.tm_hour
8294 && lt->tm_min == tm.tm_min
8295 && lt->tm_sec == tm.tm_sec
8296 && lt->tm_yday == tm.tm_yday
8297 && lt->tm_wday == tm.tm_wday
8298 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
8299 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
8300 exit (1);
8301 }
8302 }
8303
8304 int
8305 main ()
8306 {
8307 time_t t, delta;
8308 int i, j;
8309
8310 /* This test makes some buggy mktime implementations loop.
8311 Give up after 60 seconds; a mktime slower than that
8312 isn't worth using anyway. */
8313 alarm (60);
8314
8315 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
8316 continue;
8317 time_t_max--;
8318 if ((time_t) -1 < 0)
8319 for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
8320 continue;
8321 delta = time_t_max / 997; /* a suitable prime number */
8322 for (i = 0; i < N_STRINGS; i++)
8323 {
8324 if (tz_strings[i])
8325 putenv (tz_strings[i]);
8326
8327 for (t = 0; t <= time_t_max - delta; t += delta)
8328 mktime_test (t);
8329 mktime_test ((time_t) 1);
8330 mktime_test ((time_t) (60 * 60));
8331 mktime_test ((time_t) (60 * 60 * 24));
8332
8333 for (j = 1; 0 < j; j *= 2)
8334 bigtime_test (j);
8335 bigtime_test (j - 1);
8336 }
8337 irix_6_4_bug ();
8338 spring_forward_gap ();
8339 exit (0);
8340 }
8341 _ACEOF
8342 rm -f conftest$ac_exeext
8343 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8344 (eval $ac_link) 2>&5
8345 ac_status=$?
8346 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8347 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8348 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8349 (eval $ac_try) 2>&5
8350 ac_status=$?
8351 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8352 (exit $ac_status); }; }; then
8353 ac_cv_func_working_mktime=yes
8354 else
8355 echo "$as_me: program exited with status $ac_status" >&5
8356 echo "$as_me: failed program was:" >&5
8357 sed 's/^/| /' conftest.$ac_ext >&5
8358
8359 ( exit $ac_status )
8360 ac_cv_func_working_mktime=no
8361 fi
8362 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8363 fi
8364 fi
8365 echo "$as_me:$LINENO: result: $ac_cv_func_working_mktime" >&5
8366 echo "${ECHO_T}$ac_cv_func_working_mktime" >&6
8367 if test $ac_cv_func_working_mktime = no; then
8368 case $LIBOBJS in
8369 "mktime.$ac_objext" | \
8370 *" mktime.$ac_objext" | \
8371 "mktime.$ac_objext "* | \
8372 *" mktime.$ac_objext "* ) ;;
8373 *) LIBOBJS="$LIBOBJS mktime.$ac_objext" ;;
8374 esac
8375
8376 fi
8377
8378
8379 for ac_header in stdlib.h
8128 ac_cv_header_time=no
8129 fi
8130 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
8131 fi
8132 echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
8133 echo "${ECHO_T}$ac_cv_header_time" >&6
8134 if test $ac_cv_header_time = yes; then
8135
8136 cat >>confdefs.h <<\_ACEOF
8137 #define TIME_WITH_SYS_TIME 1
8138 _ACEOF
8139
8140 fi
8141
8142
8143
8144
8145 for ac_header in stdlib.h sys/time.h unistd.h
83808146 do
83818147 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
83828148 if eval "test \"\${$as_ac_Header+set}\" = set"; then
85258291
85268292 done
85278293
8528 echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
8529 echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6
8530 if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
8531 echo $ECHO_N "(cached) $ECHO_C" >&6
8532 else
8533 if test "$cross_compiling" = yes; then
8534 ac_cv_func_realloc_0_nonnull=no
8535 else
8536 cat >conftest.$ac_ext <<_ACEOF
8537 /* confdefs.h. */
8538 _ACEOF
8539 cat confdefs.h >>conftest.$ac_ext
8540 cat >>conftest.$ac_ext <<_ACEOF
8541 /* end confdefs.h. */
8542 #if STDC_HEADERS || HAVE_STDLIB_H
8543 # include <stdlib.h>
8544 #else
8545 char *realloc ();
8546 #endif
8547
8548 int
8549 main ()
8550 {
8551 exit (realloc (0, 0) ? 0 : 1);
8552 ;
8553 return 0;
8554 }
8555 _ACEOF
8556 rm -f conftest$ac_exeext
8557 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8558 (eval $ac_link) 2>&5
8559 ac_status=$?
8560 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8561 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8562 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8563 (eval $ac_try) 2>&5
8564 ac_status=$?
8565 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8566 (exit $ac_status); }; }; then
8567 ac_cv_func_realloc_0_nonnull=yes
8568 else
8569 echo "$as_me: program exited with status $ac_status" >&5
8570 echo "$as_me: failed program was:" >&5
8571 sed 's/^/| /' conftest.$ac_ext >&5
8572
8573 ( exit $ac_status )
8574 ac_cv_func_realloc_0_nonnull=no
8575 fi
8576 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8577 fi
8578 fi
8579 echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
8580 echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6
8581 if test $ac_cv_func_realloc_0_nonnull = yes; then
8582
8583 cat >>confdefs.h <<\_ACEOF
8584 #define HAVE_REALLOC 1
8585 _ACEOF
8586
8587 else
8588 cat >>confdefs.h <<\_ACEOF
8589 #define HAVE_REALLOC 0
8590 _ACEOF
8591
8592 case $LIBOBJS in
8593 "realloc.$ac_objext" | \
8594 *" realloc.$ac_objext" | \
8595 "realloc.$ac_objext "* | \
8596 *" realloc.$ac_objext "* ) ;;
8597 *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;;
8598 esac
8599
8600
8601 cat >>confdefs.h <<\_ACEOF
8602 #define realloc rpl_realloc
8603 _ACEOF
8604
8605 fi
8606
8607
8608
8609 echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
8610 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6
8611 if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
8612 echo $ECHO_N "(cached) $ECHO_C" >&6
8613 else
8614 rm -f conftest.sym conftest.file
8615 echo >conftest.file
8616 if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
8617 if test "$cross_compiling" = yes; then
8618 ac_cv_func_lstat_dereferences_slashed_symlink=no
8619 else
8620 cat >conftest.$ac_ext <<_ACEOF
8621 /* confdefs.h. */
8622 _ACEOF
8623 cat confdefs.h >>conftest.$ac_ext
8624 cat >>conftest.$ac_ext <<_ACEOF
8625 /* end confdefs.h. */
8626 $ac_includes_default
8627 int
8628 main ()
8629 {
8630 struct stat sbuf;
8631 /* Linux will dereference the symlink and fail.
8632 That is better in the sense that it means we will not
8633 have to compile and use the lstat wrapper. */
8634 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
8635 ;
8636 return 0;
8637 }
8638 _ACEOF
8639 rm -f conftest$ac_exeext
8640 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8641 (eval $ac_link) 2>&5
8642 ac_status=$?
8643 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8644 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8645 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8646 (eval $ac_try) 2>&5
8647 ac_status=$?
8648 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8649 (exit $ac_status); }; }; then
8650 ac_cv_func_lstat_dereferences_slashed_symlink=yes
8651 else
8652 echo "$as_me: program exited with status $ac_status" >&5
8653 echo "$as_me: failed program was:" >&5
8654 sed 's/^/| /' conftest.$ac_ext >&5
8655
8656 ( exit $ac_status )
8657 ac_cv_func_lstat_dereferences_slashed_symlink=no
8658 fi
8659 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8660 fi
8661 else
8662 # If the `ln -s' command failed, then we probably don't even
8663 # have an lstat function.
8664 ac_cv_func_lstat_dereferences_slashed_symlink=no
8665 fi
8666 rm -f conftest.sym conftest.file
8667
8668 fi
8669 echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
8670 echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6
8671
8672 test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
8673
8674 cat >>confdefs.h <<_ACEOF
8675 #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
8676 _ACEOF
8677
8678
8679 if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
8680 case $LIBOBJS in
8681 "lstat.$ac_objext" | \
8682 *" lstat.$ac_objext" | \
8683 "lstat.$ac_objext "* | \
8684 *" lstat.$ac_objext "* ) ;;
8685 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
8686 esac
8687
8688 fi
8689
8690 echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
8691 echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6
8692 if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
8693 echo $ECHO_N "(cached) $ECHO_C" >&6
8694 else
8695 if test "$cross_compiling" = yes; then
8696 ac_cv_func_stat_empty_string_bug=yes
8697 else
8698 cat >conftest.$ac_ext <<_ACEOF
8699 /* confdefs.h. */
8700 _ACEOF
8701 cat confdefs.h >>conftest.$ac_ext
8702 cat >>conftest.$ac_ext <<_ACEOF
8703 /* end confdefs.h. */
8704 $ac_includes_default
8705 int
8706 main ()
8707 {
8708 struct stat sbuf;
8709 exit (stat ("", &sbuf) ? 1 : 0);
8710 ;
8711 return 0;
8712 }
8713 _ACEOF
8714 rm -f conftest$ac_exeext
8715 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8716 (eval $ac_link) 2>&5
8717 ac_status=$?
8718 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8719 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8720 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8721 (eval $ac_try) 2>&5
8722 ac_status=$?
8723 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8724 (exit $ac_status); }; }; then
8725 ac_cv_func_stat_empty_string_bug=yes
8726 else
8727 echo "$as_me: program exited with status $ac_status" >&5
8728 echo "$as_me: failed program was:" >&5
8729 sed 's/^/| /' conftest.$ac_ext >&5
8730
8731 ( exit $ac_status )
8732 ac_cv_func_stat_empty_string_bug=no
8733 fi
8734 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8735 fi
8736 fi
8737 echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
8738 echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6
8739 if test $ac_cv_func_stat_empty_string_bug = yes; then
8740 case $LIBOBJS in
8741 "stat.$ac_objext" | \
8742 *" stat.$ac_objext" | \
8743 "stat.$ac_objext "* | \
8744 *" stat.$ac_objext "* ) ;;
8745 *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;;
8746 esac
8747
8748
8749 cat >>confdefs.h <<_ACEOF
8750 #define HAVE_STAT_EMPTY_STRING_BUG 1
8751 _ACEOF
8752
8753 fi
8754
8755
8756 for ac_func in strftime
8294
8295 for ac_func in alarm
87578296 do
87588297 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
87598298 echo "$as_me:$LINENO: checking for $ac_func" >&5
88518390 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
88528391 _ACEOF
88538392
8854 else
8855 # strftime is in -lintl on SCO UNIX.
8856 echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
8857 echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6
8858 if test "${ac_cv_lib_intl_strftime+set}" = set; then
8393 fi
8394 done
8395
8396 echo "$as_me:$LINENO: checking for working mktime" >&5
8397 echo $ECHO_N "checking for working mktime... $ECHO_C" >&6
8398 if test "${ac_cv_func_working_mktime+set}" = set; then
88598399 echo $ECHO_N "(cached) $ECHO_C" >&6
88608400 else
8861 ac_check_lib_save_LIBS=$LIBS
8862 LIBS="-lintl $LIBS"
8863 cat >conftest.$ac_ext <<_ACEOF
8864 /* confdefs.h. */
8865 _ACEOF
8866 cat confdefs.h >>conftest.$ac_ext
8867 cat >>conftest.$ac_ext <<_ACEOF
8868 /* end confdefs.h. */
8869
8870 /* Override any gcc2 internal prototype to avoid an error. */
8871 #ifdef __cplusplus
8872 extern "C"
8401 if test "$cross_compiling" = yes; then
8402 ac_cv_func_working_mktime=no
8403 else
8404 cat >conftest.$ac_ext <<_ACEOF
8405 /* confdefs.h. */
8406 _ACEOF
8407 cat confdefs.h >>conftest.$ac_ext
8408 cat >>conftest.$ac_ext <<_ACEOF
8409 /* end confdefs.h. */
8410 /* Test program from Paul Eggert and Tony Leneis. */
8411 #if TIME_WITH_SYS_TIME
8412 # include <sys/time.h>
8413 # include <time.h>
8414 #else
8415 # if HAVE_SYS_TIME_H
8416 # include <sys/time.h>
8417 # else
8418 # include <time.h>
8419 # endif
88738420 #endif
8874 /* We use char because int might match the return type of a gcc2
8875 builtin and then its argument prototype would still apply. */
8876 char strftime ();
8421
8422 #if HAVE_STDLIB_H
8423 # include <stdlib.h>
8424 #endif
8425
8426 #if HAVE_UNISTD_H
8427 # include <unistd.h>
8428 #endif
8429
8430 #if !HAVE_ALARM
8431 # define alarm(X) /* empty */
8432 #endif
8433
8434 /* Work around redefinition to rpl_putenv by other config tests. */
8435 #undef putenv
8436
8437 static time_t time_t_max;
8438 static time_t time_t_min;
8439
8440 /* Values we'll use to set the TZ environment variable. */
8441 static char *tz_strings[] = {
8442 (char *) 0, "TZ=GMT0", "TZ=JST-9",
8443 "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
8444 };
8445 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
8446
8447 /* Fail if mktime fails to convert a date in the spring-forward gap.
8448 Based on a problem report from Andreas Jaeger. */
8449 static void
8450 spring_forward_gap ()
8451 {
8452 /* glibc (up to about 1998-10-07) failed this test. */
8453 struct tm tm;
8454
8455 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
8456 instead of "TZ=America/Vancouver" in order to detect the bug even
8457 on systems that don't support the Olson extension, or don't have the
8458 full zoneinfo tables installed. */
8459 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
8460
8461 tm.tm_year = 98;
8462 tm.tm_mon = 3;
8463 tm.tm_mday = 5;
8464 tm.tm_hour = 2;
8465 tm.tm_min = 0;
8466 tm.tm_sec = 0;
8467 tm.tm_isdst = -1;
8468 if (mktime (&tm) == (time_t)-1)
8469 exit (1);
8470 }
8471
8472 static void
8473 mktime_test1 (now)
8474 time_t now;
8475 {
8476 struct tm *lt;
8477 if ((lt = localtime (&now)) && mktime (lt) != now)
8478 exit (1);
8479 }
8480
8481 static void
8482 mktime_test (now)
8483 time_t now;
8484 {
8485 mktime_test1 (now);
8486 mktime_test1 ((time_t) (time_t_max - now));
8487 mktime_test1 ((time_t) (time_t_min + now));
8488 }
8489
8490 static void
8491 irix_6_4_bug ()
8492 {
8493 /* Based on code from Ariel Faigon. */
8494 struct tm tm;
8495 tm.tm_year = 96;
8496 tm.tm_mon = 3;
8497 tm.tm_mday = 0;
8498 tm.tm_hour = 0;
8499 tm.tm_min = 0;
8500 tm.tm_sec = 0;
8501 tm.tm_isdst = -1;
8502 mktime (&tm);
8503 if (tm.tm_mon != 2 || tm.tm_mday != 31)
8504 exit (1);
8505 }
8506
8507 static void
8508 bigtime_test (j)
8509 int j;
8510 {
8511 struct tm tm;
8512 time_t now;
8513 tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
8514 now = mktime (&tm);
8515 if (now != (time_t) -1)
8516 {
8517 struct tm *lt = localtime (&now);
8518 if (! (lt
8519 && lt->tm_year == tm.tm_year
8520 && lt->tm_mon == tm.tm_mon
8521 && lt->tm_mday == tm.tm_mday
8522 && lt->tm_hour == tm.tm_hour
8523 && lt->tm_min == tm.tm_min
8524 && lt->tm_sec == tm.tm_sec
8525 && lt->tm_yday == tm.tm_yday
8526 && lt->tm_wday == tm.tm_wday
8527 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
8528 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
8529 exit (1);
8530 }
8531 }
8532
88778533 int
88788534 main ()
88798535 {
8880 strftime ();
8881 ;
8882 return 0;
8883 }
8884 _ACEOF
8885 rm -f conftest.$ac_objext conftest$ac_exeext
8536 time_t t, delta;
8537 int i, j;
8538
8539 /* This test makes some buggy mktime implementations loop.
8540 Give up after 60 seconds; a mktime slower than that
8541 isn't worth using anyway. */
8542 alarm (60);
8543
8544 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
8545 continue;
8546 time_t_max--;
8547 if ((time_t) -1 < 0)
8548 for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
8549 continue;
8550 delta = time_t_max / 997; /* a suitable prime number */
8551 for (i = 0; i < N_STRINGS; i++)
8552 {
8553 if (tz_strings[i])
8554 putenv (tz_strings[i]);
8555
8556 for (t = 0; t <= time_t_max - delta; t += delta)
8557 mktime_test (t);
8558 mktime_test ((time_t) 1);
8559 mktime_test ((time_t) (60 * 60));
8560 mktime_test ((time_t) (60 * 60 * 24));
8561
8562 for (j = 1; 0 < j; j *= 2)
8563 bigtime_test (j);
8564 bigtime_test (j - 1);
8565 }
8566 irix_6_4_bug ();
8567 spring_forward_gap ();
8568 exit (0);
8569 }
8570 _ACEOF
8571 rm -f conftest$ac_exeext
88868572 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8887 (eval $ac_link) 2>conftest.er1
8573 (eval $ac_link) 2>&5
8574 ac_status=$?
8575 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8576 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8577 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8578 (eval $ac_try) 2>&5
8579 ac_status=$?
8580 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8581 (exit $ac_status); }; }; then
8582 ac_cv_func_working_mktime=yes
8583 else
8584 echo "$as_me: program exited with status $ac_status" >&5
8585 echo "$as_me: failed program was:" >&5
8586 sed 's/^/| /' conftest.$ac_ext >&5
8587
8588 ( exit $ac_status )
8589 ac_cv_func_working_mktime=no
8590 fi
8591 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8592 fi
8593 fi
8594 echo "$as_me:$LINENO: result: $ac_cv_func_working_mktime" >&5
8595 echo "${ECHO_T}$ac_cv_func_working_mktime" >&6
8596 if test $ac_cv_func_working_mktime = no; then
8597 case $LIBOBJS in
8598 "mktime.$ac_objext" | \
8599 *" mktime.$ac_objext" | \
8600 "mktime.$ac_objext "* | \
8601 *" mktime.$ac_objext "* ) ;;
8602 *) LIBOBJS="$LIBOBJS mktime.$ac_objext" ;;
8603 esac
8604
8605 fi
8606
8607
8608 for ac_header in stdlib.h
8609 do
8610 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
8611 if eval "test \"\${$as_ac_Header+set}\" = set"; then
8612 echo "$as_me:$LINENO: checking for $ac_header" >&5
8613 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8614 if eval "test \"\${$as_ac_Header+set}\" = set"; then
8615 echo $ECHO_N "(cached) $ECHO_C" >&6
8616 fi
8617 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8618 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8619 else
8620 # Is the header compilable?
8621 echo "$as_me:$LINENO: checking $ac_header usability" >&5
8622 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
8623 cat >conftest.$ac_ext <<_ACEOF
8624 /* confdefs.h. */
8625 _ACEOF
8626 cat confdefs.h >>conftest.$ac_ext
8627 cat >>conftest.$ac_ext <<_ACEOF
8628 /* end confdefs.h. */
8629 $ac_includes_default
8630 #include <$ac_header>
8631 _ACEOF
8632 rm -f conftest.$ac_objext
8633 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
8634 (eval $ac_compile) 2>conftest.er1
88888635 ac_status=$?
88898636 grep -v '^ *+' conftest.er1 >conftest.err
88908637 rm -f conftest.er1
88988645 ac_status=$?
88998646 echo "$as_me:$LINENO: \$? = $ac_status" >&5
89008647 (exit $ac_status); }; } &&
8901 { ac_try='test -s conftest$ac_exeext'
8902 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8903 (eval $ac_try) 2>&5
8904 ac_status=$?
8905 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8906 (exit $ac_status); }; }; then
8907 ac_cv_lib_intl_strftime=yes
8648 { ac_try='test -s conftest.$ac_objext'
8649 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8650 (eval $ac_try) 2>&5
8651 ac_status=$?
8652 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8653 (exit $ac_status); }; }; then
8654 ac_header_compiler=yes
89088655 else
89098656 echo "$as_me: failed program was:" >&5
89108657 sed 's/^/| /' conftest.$ac_ext >&5
89118658
8912 ac_cv_lib_intl_strftime=no
8913 fi
8914 rm -f conftest.err conftest.$ac_objext \
8915 conftest$ac_exeext conftest.$ac_ext
8916 LIBS=$ac_check_lib_save_LIBS
8917 fi
8918 echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
8919 echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6
8920 if test $ac_cv_lib_intl_strftime = yes; then
8659 ac_header_compiler=no
8660 fi
8661 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
8662 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
8663 echo "${ECHO_T}$ac_header_compiler" >&6
8664
8665 # Is the header present?
8666 echo "$as_me:$LINENO: checking $ac_header presence" >&5
8667 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
8668 cat >conftest.$ac_ext <<_ACEOF
8669 /* confdefs.h. */
8670 _ACEOF
8671 cat confdefs.h >>conftest.$ac_ext
8672 cat >>conftest.$ac_ext <<_ACEOF
8673 /* end confdefs.h. */
8674 #include <$ac_header>
8675 _ACEOF
8676 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
8677 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
8678 ac_status=$?
8679 grep -v '^ *+' conftest.er1 >conftest.err
8680 rm -f conftest.er1
8681 cat conftest.err >&5
8682 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8683 (exit $ac_status); } >/dev/null; then
8684 if test -s conftest.err; then
8685 ac_cpp_err=$ac_c_preproc_warn_flag
8686 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
8687 else
8688 ac_cpp_err=
8689 fi
8690 else
8691 ac_cpp_err=yes
8692 fi
8693 if test -z "$ac_cpp_err"; then
8694 ac_header_preproc=yes
8695 else
8696 echo "$as_me: failed program was:" >&5
8697 sed 's/^/| /' conftest.$ac_ext >&5
8698
8699 ac_header_preproc=no
8700 fi
8701 rm -f conftest.err conftest.$ac_ext
8702 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
8703 echo "${ECHO_T}$ac_header_preproc" >&6
8704
8705 # So? What about this header?
8706 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
8707 yes:no: )
8708 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
8709 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
8710 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
8711 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
8712 ac_header_preproc=yes
8713 ;;
8714 no:yes:* )
8715 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
8716 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
8717 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
8718 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
8719 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
8720 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
8721 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
8722 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
8723 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
8724 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
8725 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
8726 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
8727 (
8728 cat <<\_ASBOX
8729 ## ----------------------------------- ##
8730 ## Report this to peter.haag@switch.ch ##
8731 ## ----------------------------------- ##
8732 _ASBOX
8733 ) |
8734 sed "s/^/$as_me: WARNING: /" >&2
8735 ;;
8736 esac
8737 echo "$as_me:$LINENO: checking for $ac_header" >&5
8738 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
8739 if eval "test \"\${$as_ac_Header+set}\" = set"; then
8740 echo $ECHO_N "(cached) $ECHO_C" >&6
8741 else
8742 eval "$as_ac_Header=\$ac_header_preproc"
8743 fi
8744 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
8745 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
8746
8747 fi
8748 if test `eval echo '${'$as_ac_Header'}'` = yes; then
8749 cat >>confdefs.h <<_ACEOF
8750 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8751 _ACEOF
8752
8753 fi
8754
8755 done
8756
8757 echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
8758 echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6
8759 if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
8760 echo $ECHO_N "(cached) $ECHO_C" >&6
8761 else
8762 if test "$cross_compiling" = yes; then
8763 ac_cv_func_realloc_0_nonnull=no
8764 else
8765 cat >conftest.$ac_ext <<_ACEOF
8766 /* confdefs.h. */
8767 _ACEOF
8768 cat confdefs.h >>conftest.$ac_ext
8769 cat >>conftest.$ac_ext <<_ACEOF
8770 /* end confdefs.h. */
8771 #if STDC_HEADERS || HAVE_STDLIB_H
8772 # include <stdlib.h>
8773 #else
8774 char *realloc ();
8775 #endif
8776
8777 int
8778 main ()
8779 {
8780 exit (realloc (0, 0) ? 0 : 1);
8781 ;
8782 return 0;
8783 }
8784 _ACEOF
8785 rm -f conftest$ac_exeext
8786 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8787 (eval $ac_link) 2>&5
8788 ac_status=$?
8789 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8790 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8791 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8792 (eval $ac_try) 2>&5
8793 ac_status=$?
8794 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8795 (exit $ac_status); }; }; then
8796 ac_cv_func_realloc_0_nonnull=yes
8797 else
8798 echo "$as_me: program exited with status $ac_status" >&5
8799 echo "$as_me: failed program was:" >&5
8800 sed 's/^/| /' conftest.$ac_ext >&5
8801
8802 ( exit $ac_status )
8803 ac_cv_func_realloc_0_nonnull=no
8804 fi
8805 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8806 fi
8807 fi
8808 echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
8809 echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6
8810 if test $ac_cv_func_realloc_0_nonnull = yes; then
8811
8812 cat >>confdefs.h <<\_ACEOF
8813 #define HAVE_REALLOC 1
8814 _ACEOF
8815
8816 else
89218817 cat >>confdefs.h <<\_ACEOF
8922 #define HAVE_STRFTIME 1
8923 _ACEOF
8924
8925 LIBS="-lintl $LIBS"
8926 fi
8927
8928 fi
8929 done
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939 for ac_func in inet_ntoa socket strchr strdup strerror strrchr strstr scandir
8818 #define HAVE_REALLOC 0
8819 _ACEOF
8820
8821 case $LIBOBJS in
8822 "realloc.$ac_objext" | \
8823 *" realloc.$ac_objext" | \
8824 "realloc.$ac_objext "* | \
8825 *" realloc.$ac_objext "* ) ;;
8826 *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;;
8827 esac
8828
8829
8830 cat >>confdefs.h <<\_ACEOF
8831 #define realloc rpl_realloc
8832 _ACEOF
8833
8834 fi
8835
8836
8837
8838 echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
8839 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6
8840 if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
8841 echo $ECHO_N "(cached) $ECHO_C" >&6
8842 else
8843 rm -f conftest.sym conftest.file
8844 echo >conftest.file
8845 if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
8846 if test "$cross_compiling" = yes; then
8847 ac_cv_func_lstat_dereferences_slashed_symlink=no
8848 else
8849 cat >conftest.$ac_ext <<_ACEOF
8850 /* confdefs.h. */
8851 _ACEOF
8852 cat confdefs.h >>conftest.$ac_ext
8853 cat >>conftest.$ac_ext <<_ACEOF
8854 /* end confdefs.h. */
8855 $ac_includes_default
8856 int
8857 main ()
8858 {
8859 struct stat sbuf;
8860 /* Linux will dereference the symlink and fail.
8861 That is better in the sense that it means we will not
8862 have to compile and use the lstat wrapper. */
8863 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
8864 ;
8865 return 0;
8866 }
8867 _ACEOF
8868 rm -f conftest$ac_exeext
8869 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8870 (eval $ac_link) 2>&5
8871 ac_status=$?
8872 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8873 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8874 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8875 (eval $ac_try) 2>&5
8876 ac_status=$?
8877 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8878 (exit $ac_status); }; }; then
8879 ac_cv_func_lstat_dereferences_slashed_symlink=yes
8880 else
8881 echo "$as_me: program exited with status $ac_status" >&5
8882 echo "$as_me: failed program was:" >&5
8883 sed 's/^/| /' conftest.$ac_ext >&5
8884
8885 ( exit $ac_status )
8886 ac_cv_func_lstat_dereferences_slashed_symlink=no
8887 fi
8888 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8889 fi
8890 else
8891 # If the `ln -s' command failed, then we probably don't even
8892 # have an lstat function.
8893 ac_cv_func_lstat_dereferences_slashed_symlink=no
8894 fi
8895 rm -f conftest.sym conftest.file
8896
8897 fi
8898 echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
8899 echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6
8900
8901 test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
8902
8903 cat >>confdefs.h <<_ACEOF
8904 #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
8905 _ACEOF
8906
8907
8908 if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
8909 case $LIBOBJS in
8910 "lstat.$ac_objext" | \
8911 *" lstat.$ac_objext" | \
8912 "lstat.$ac_objext "* | \
8913 *" lstat.$ac_objext "* ) ;;
8914 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
8915 esac
8916
8917 fi
8918
8919 echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
8920 echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6
8921 if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
8922 echo $ECHO_N "(cached) $ECHO_C" >&6
8923 else
8924 if test "$cross_compiling" = yes; then
8925 ac_cv_func_stat_empty_string_bug=yes
8926 else
8927 cat >conftest.$ac_ext <<_ACEOF
8928 /* confdefs.h. */
8929 _ACEOF
8930 cat confdefs.h >>conftest.$ac_ext
8931 cat >>conftest.$ac_ext <<_ACEOF
8932 /* end confdefs.h. */
8933 $ac_includes_default
8934 int
8935 main ()
8936 {
8937 struct stat sbuf;
8938 exit (stat ("", &sbuf) ? 1 : 0);
8939 ;
8940 return 0;
8941 }
8942 _ACEOF
8943 rm -f conftest$ac_exeext
8944 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
8945 (eval $ac_link) 2>&5
8946 ac_status=$?
8947 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8948 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
8949 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
8950 (eval $ac_try) 2>&5
8951 ac_status=$?
8952 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8953 (exit $ac_status); }; }; then
8954 ac_cv_func_stat_empty_string_bug=yes
8955 else
8956 echo "$as_me: program exited with status $ac_status" >&5
8957 echo "$as_me: failed program was:" >&5
8958 sed 's/^/| /' conftest.$ac_ext >&5
8959
8960 ( exit $ac_status )
8961 ac_cv_func_stat_empty_string_bug=no
8962 fi
8963 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8964 fi
8965 fi
8966 echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
8967 echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6
8968 if test $ac_cv_func_stat_empty_string_bug = yes; then
8969 case $LIBOBJS in
8970 "stat.$ac_objext" | \
8971 *" stat.$ac_objext" | \
8972 "stat.$ac_objext "* | \
8973 *" stat.$ac_objext "* ) ;;
8974 *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;;
8975 esac
8976
8977
8978 cat >>confdefs.h <<_ACEOF
8979 #define HAVE_STAT_EMPTY_STRING_BUG 1
8980 _ACEOF
8981
8982 fi
8983
8984
8985 for ac_func in strftime
89408986 do
89418987 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
89428988 echo "$as_me:$LINENO: checking for $ac_func" >&5
90349080 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
90359081 _ACEOF
90369082
9083 else
9084 # strftime is in -lintl on SCO UNIX.
9085 echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
9086 echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6
9087 if test "${ac_cv_lib_intl_strftime+set}" = set; then
9088 echo $ECHO_N "(cached) $ECHO_C" >&6
9089 else
9090 ac_check_lib_save_LIBS=$LIBS
9091 LIBS="-lintl $LIBS"
9092 cat >conftest.$ac_ext <<_ACEOF
9093 /* confdefs.h. */
9094 _ACEOF
9095 cat confdefs.h >>conftest.$ac_ext
9096 cat >>conftest.$ac_ext <<_ACEOF
9097 /* end confdefs.h. */
9098
9099 /* Override any gcc2 internal prototype to avoid an error. */
9100 #ifdef __cplusplus
9101 extern "C"
9102 #endif
9103 /* We use char because int might match the return type of a gcc2
9104 builtin and then its argument prototype would still apply. */
9105 char strftime ();
9106 int
9107 main ()
9108 {
9109 strftime ();
9110 ;
9111 return 0;
9112 }
9113 _ACEOF
9114 rm -f conftest.$ac_objext conftest$ac_exeext
9115 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9116 (eval $ac_link) 2>conftest.er1
9117 ac_status=$?
9118 grep -v '^ *+' conftest.er1 >conftest.err
9119 rm -f conftest.er1
9120 cat conftest.err >&5
9121 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9122 (exit $ac_status); } &&
9123 { ac_try='test -z "$ac_c_werror_flag"
9124 || test ! -s conftest.err'
9125 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9126 (eval $ac_try) 2>&5
9127 ac_status=$?
9128 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9129 (exit $ac_status); }; } &&
9130 { ac_try='test -s conftest$ac_exeext'
9131 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9132 (eval $ac_try) 2>&5
9133 ac_status=$?
9134 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9135 (exit $ac_status); }; }; then
9136 ac_cv_lib_intl_strftime=yes
9137 else
9138 echo "$as_me: failed program was:" >&5
9139 sed 's/^/| /' conftest.$ac_ext >&5
9140
9141 ac_cv_lib_intl_strftime=no
9142 fi
9143 rm -f conftest.err conftest.$ac_objext \
9144 conftest$ac_exeext conftest.$ac_ext
9145 LIBS=$ac_check_lib_save_LIBS
9146 fi
9147 echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
9148 echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6
9149 if test $ac_cv_lib_intl_strftime = yes; then
9150 cat >>confdefs.h <<\_ACEOF
9151 #define HAVE_STRFTIME 1
9152 _ACEOF
9153
9154 LIBS="-lintl $LIBS"
9155 fi
9156
90379157 fi
90389158 done
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168 for ac_func in inet_ntoa socket strchr strdup strerror strrchr strstr scandir
9169 do
9170 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
9171 echo "$as_me:$LINENO: checking for $ac_func" >&5
9172 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
9173 if eval "test \"\${$as_ac_var+set}\" = set"; then
9174 echo $ECHO_N "(cached) $ECHO_C" >&6
9175 else
9176 cat >conftest.$ac_ext <<_ACEOF
9177 /* confdefs.h. */
9178 _ACEOF
9179 cat confdefs.h >>conftest.$ac_ext
9180 cat >>conftest.$ac_ext <<_ACEOF
9181 /* end confdefs.h. */
9182 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
9183 For example, HP-UX 11i <limits.h> declares gettimeofday. */
9184 #define $ac_func innocuous_$ac_func
9185
9186 /* System header to define __stub macros and hopefully few prototypes,
9187 which can conflict with char $ac_func (); below.
9188 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
9189 <limits.h> exists even on freestanding compilers. */
9190
9191 #ifdef __STDC__
9192 # include <limits.h>
9193 #else
9194 # include <assert.h>
9195 #endif
9196
9197 #undef $ac_func
9198
9199 /* Override any gcc2 internal prototype to avoid an error. */
9200 #ifdef __cplusplus
9201 extern "C"
9202 {
9203 #endif
9204 /* We use char because int might match the return type of a gcc2
9205 builtin and then its argument prototype would still apply. */
9206 char $ac_func ();
9207 /* The GNU C library defines this for functions which it implements
9208 to always fail with ENOSYS. Some functions are actually named
9209 something starting with __ and the normal name is an alias. */
9210 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
9211 choke me
9212 #else
9213 char (*f) () = $ac_func;
9214 #endif
9215 #ifdef __cplusplus
9216 }
9217 #endif
9218
9219 int
9220 main ()
9221 {
9222 return f != $ac_func;
9223 ;
9224 return 0;
9225 }
9226 _ACEOF
9227 rm -f conftest.$ac_objext conftest$ac_exeext
9228 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9229 (eval $ac_link) 2>conftest.er1
9230 ac_status=$?
9231 grep -v '^ *+' conftest.er1 >conftest.err
9232 rm -f conftest.er1
9233 cat conftest.err >&5
9234 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9235 (exit $ac_status); } &&
9236 { ac_try='test -z "$ac_c_werror_flag"
9237 || test ! -s conftest.err'
9238 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9239 (eval $ac_try) 2>&5
9240 ac_status=$?
9241 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9242 (exit $ac_status); }; } &&
9243 { ac_try='test -s conftest$ac_exeext'
9244 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9245 (eval $ac_try) 2>&5
9246 ac_status=$?
9247 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9248 (exit $ac_status); }; }; then
9249 eval "$as_ac_var=yes"
9250 else
9251 echo "$as_me: failed program was:" >&5
9252 sed 's/^/| /' conftest.$ac_ext >&5
9253
9254 eval "$as_ac_var=no"
9255 fi
9256 rm -f conftest.err conftest.$ac_objext \
9257 conftest$ac_exeext conftest.$ac_ext
9258 fi
9259 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
9260 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
9261 if test `eval echo '${'$as_ac_var'}'` = yes; then
9262 cat >>confdefs.h <<_ACEOF
9263 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
9264 _ACEOF
9265
9266 fi
9267 done
9268
9269
9270 echo "$as_me:$LINENO: checking for res_search in -lsocket" >&5
9271 echo $ECHO_N "checking for res_search in -lsocket... $ECHO_C" >&6
9272 if test "${ac_cv_lib_socket_res_search+set}" = set; then
9273 echo $ECHO_N "(cached) $ECHO_C" >&6
9274 else
9275 ac_check_lib_save_LIBS=$LIBS
9276 LIBS="-lsocket $LIBS"
9277 cat >conftest.$ac_ext <<_ACEOF
9278 /* confdefs.h. */
9279 _ACEOF
9280 cat confdefs.h >>conftest.$ac_ext
9281 cat >>conftest.$ac_ext <<_ACEOF
9282 /* end confdefs.h. */
9283
9284 /* Override any gcc2 internal prototype to avoid an error. */
9285 #ifdef __cplusplus
9286 extern "C"
9287 #endif
9288 /* We use char because int might match the return type of a gcc2
9289 builtin and then its argument prototype would still apply. */
9290 char res_search ();
9291 int
9292 main ()
9293 {
9294 res_search ();
9295 ;
9296 return 0;
9297 }
9298 _ACEOF
9299 rm -f conftest.$ac_objext conftest$ac_exeext
9300 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9301 (eval $ac_link) 2>conftest.er1
9302 ac_status=$?
9303 grep -v '^ *+' conftest.er1 >conftest.err
9304 rm -f conftest.er1
9305 cat conftest.err >&5
9306 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9307 (exit $ac_status); } &&
9308 { ac_try='test -z "$ac_c_werror_flag"
9309 || test ! -s conftest.err'
9310 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9311 (eval $ac_try) 2>&5
9312 ac_status=$?
9313 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9314 (exit $ac_status); }; } &&
9315 { ac_try='test -s conftest$ac_exeext'
9316 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9317 (eval $ac_try) 2>&5
9318 ac_status=$?
9319 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9320 (exit $ac_status); }; }; then
9321 ac_cv_lib_socket_res_search=yes
9322 else
9323 echo "$as_me: failed program was:" >&5
9324 sed 's/^/| /' conftest.$ac_ext >&5
9325
9326 ac_cv_lib_socket_res_search=no
9327 fi
9328 rm -f conftest.err conftest.$ac_objext \
9329 conftest$ac_exeext conftest.$ac_ext
9330 LIBS=$ac_check_lib_save_LIBS
9331 fi
9332 echo "$as_me:$LINENO: result: $ac_cv_lib_socket_res_search" >&5
9333 echo "${ECHO_T}$ac_cv_lib_socket_res_search" >&6
9334 if test $ac_cv_lib_socket_res_search = yes; then
9335
9336
9337 echo "$as_me:$LINENO: checking for dn_skipname in -lresolv" >&5
9338 echo $ECHO_N "checking for dn_skipname in -lresolv... $ECHO_C" >&6
9339 if test "${ac_cv_lib_resolv_dn_skipname+set}" = set; then
9340 echo $ECHO_N "(cached) $ECHO_C" >&6
9341 else
9342 ac_check_lib_save_LIBS=$LIBS
9343 LIBS="-lresolv $LIBS"
9344 cat >conftest.$ac_ext <<_ACEOF
9345 /* confdefs.h. */
9346 _ACEOF
9347 cat confdefs.h >>conftest.$ac_ext
9348 cat >>conftest.$ac_ext <<_ACEOF
9349 /* end confdefs.h. */
9350
9351 /* Override any gcc2 internal prototype to avoid an error. */
9352 #ifdef __cplusplus
9353 extern "C"
9354 #endif
9355 /* We use char because int might match the return type of a gcc2
9356 builtin and then its argument prototype would still apply. */
9357 char dn_skipname ();
9358 int
9359 main ()
9360 {
9361 dn_skipname ();
9362 ;
9363 return 0;
9364 }
9365 _ACEOF
9366 rm -f conftest.$ac_objext conftest$ac_exeext
9367 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9368 (eval $ac_link) 2>conftest.er1
9369 ac_status=$?
9370 grep -v '^ *+' conftest.er1 >conftest.err
9371 rm -f conftest.er1
9372 cat conftest.err >&5
9373 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9374 (exit $ac_status); } &&
9375 { ac_try='test -z "$ac_c_werror_flag"
9376 || test ! -s conftest.err'
9377 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9378 (eval $ac_try) 2>&5
9379 ac_status=$?
9380 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9381 (exit $ac_status); }; } &&
9382 { ac_try='test -s conftest$ac_exeext'
9383 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9384 (eval $ac_try) 2>&5
9385 ac_status=$?
9386 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9387 (exit $ac_status); }; }; then
9388 ac_cv_lib_resolv_dn_skipname=yes
9389 else
9390 echo "$as_me: failed program was:" >&5
9391 sed 's/^/| /' conftest.$ac_ext >&5
9392
9393 ac_cv_lib_resolv_dn_skipname=no
9394 fi
9395 rm -f conftest.err conftest.$ac_objext \
9396 conftest$ac_exeext conftest.$ac_ext
9397 LIBS=$ac_check_lib_save_LIBS
9398 fi
9399 echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_dn_skipname" >&5
9400 echo "${ECHO_T}$ac_cv_lib_resolv_dn_skipname" >&6
9401 if test $ac_cv_lib_resolv_dn_skipname = yes; then
9402 cat >>confdefs.h <<_ACEOF
9403 #define HAVE_LIBRESOLV 1
9404 _ACEOF
9405
9406 LIBS="-lresolv $LIBS"
9407
9408 fi
9409
9410
9411 echo "$as_me:$LINENO: checking for __dn_skipname in -lresolv" >&5
9412 echo $ECHO_N "checking for __dn_skipname in -lresolv... $ECHO_C" >&6
9413 if test "${ac_cv_lib_resolv___dn_skipname+set}" = set; then
9414 echo $ECHO_N "(cached) $ECHO_C" >&6
9415 else
9416 ac_check_lib_save_LIBS=$LIBS
9417 LIBS="-lresolv $LIBS"
9418 cat >conftest.$ac_ext <<_ACEOF
9419 /* confdefs.h. */
9420 _ACEOF
9421 cat confdefs.h >>conftest.$ac_ext
9422 cat >>conftest.$ac_ext <<_ACEOF
9423 /* end confdefs.h. */
9424
9425 /* Override any gcc2 internal prototype to avoid an error. */
9426 #ifdef __cplusplus
9427 extern "C"
9428 #endif
9429 /* We use char because int might match the return type of a gcc2
9430 builtin and then its argument prototype would still apply. */
9431 char __dn_skipname ();
9432 int
9433 main ()
9434 {
9435 __dn_skipname ();
9436 ;
9437 return 0;
9438 }
9439 _ACEOF
9440 rm -f conftest.$ac_objext conftest$ac_exeext
9441 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9442 (eval $ac_link) 2>conftest.er1
9443 ac_status=$?
9444 grep -v '^ *+' conftest.er1 >conftest.err
9445 rm -f conftest.er1
9446 cat conftest.err >&5
9447 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9448 (exit $ac_status); } &&
9449 { ac_try='test -z "$ac_c_werror_flag"
9450 || test ! -s conftest.err'
9451 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9452 (eval $ac_try) 2>&5
9453 ac_status=$?
9454 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9455 (exit $ac_status); }; } &&
9456 { ac_try='test -s conftest$ac_exeext'
9457 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9458 (eval $ac_try) 2>&5
9459 ac_status=$?
9460 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9461 (exit $ac_status); }; }; then
9462 ac_cv_lib_resolv___dn_skipname=yes
9463 else
9464 echo "$as_me: failed program was:" >&5
9465 sed 's/^/| /' conftest.$ac_ext >&5
9466
9467 ac_cv_lib_resolv___dn_skipname=no
9468 fi
9469 rm -f conftest.err conftest.$ac_objext \
9470 conftest$ac_exeext conftest.$ac_ext
9471 LIBS=$ac_check_lib_save_LIBS
9472 fi
9473 echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___dn_skipname" >&5
9474 echo "${ECHO_T}$ac_cv_lib_resolv___dn_skipname" >&6
9475 if test $ac_cv_lib_resolv___dn_skipname = yes; then
9476 cat >>confdefs.h <<_ACEOF
9477 #define HAVE_LIBRESOLV 1
9478 _ACEOF
9479
9480 LIBS="-lresolv $LIBS"
9481
9482 fi
9483
9484 LIBS="$LIBS -lsocket"
9485
9486 cat >>confdefs.h <<\_ACEOF
9487 #define HAVE_LIBSOCKET 1
9488 _ACEOF
9489
9490 else
9491
9492 echo "$as_me:$LINENO: checking for res_search in -lresolv" >&5
9493 echo $ECHO_N "checking for res_search in -lresolv... $ECHO_C" >&6
9494 if test "${ac_cv_lib_resolv_res_search+set}" = set; then
9495 echo $ECHO_N "(cached) $ECHO_C" >&6
9496 else
9497 ac_check_lib_save_LIBS=$LIBS
9498 LIBS="-lresolv $LIBS"
9499 cat >conftest.$ac_ext <<_ACEOF
9500 /* confdefs.h. */
9501 _ACEOF
9502 cat confdefs.h >>conftest.$ac_ext
9503 cat >>conftest.$ac_ext <<_ACEOF
9504 /* end confdefs.h. */
9505
9506 /* Override any gcc2 internal prototype to avoid an error. */
9507 #ifdef __cplusplus
9508 extern "C"
9509 #endif
9510 /* We use char because int might match the return type of a gcc2
9511 builtin and then its argument prototype would still apply. */
9512 char res_search ();
9513 int
9514 main ()
9515 {
9516 res_search ();
9517 ;
9518 return 0;
9519 }
9520 _ACEOF
9521 rm -f conftest.$ac_objext conftest$ac_exeext
9522 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9523 (eval $ac_link) 2>conftest.er1
9524 ac_status=$?
9525 grep -v '^ *+' conftest.er1 >conftest.err
9526 rm -f conftest.er1
9527 cat conftest.err >&5
9528 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9529 (exit $ac_status); } &&
9530 { ac_try='test -z "$ac_c_werror_flag"
9531 || test ! -s conftest.err'
9532 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9533 (eval $ac_try) 2>&5
9534 ac_status=$?
9535 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9536 (exit $ac_status); }; } &&
9537 { ac_try='test -s conftest$ac_exeext'
9538 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9539 (eval $ac_try) 2>&5
9540 ac_status=$?
9541 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9542 (exit $ac_status); }; }; then
9543 ac_cv_lib_resolv_res_search=yes
9544 else
9545 echo "$as_me: failed program was:" >&5
9546 sed 's/^/| /' conftest.$ac_ext >&5
9547
9548 ac_cv_lib_resolv_res_search=no
9549 fi
9550 rm -f conftest.err conftest.$ac_objext \
9551 conftest$ac_exeext conftest.$ac_ext
9552 LIBS=$ac_check_lib_save_LIBS
9553 fi
9554 echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_search" >&5
9555 echo "${ECHO_T}$ac_cv_lib_resolv_res_search" >&6
9556 if test $ac_cv_lib_resolv_res_search = yes; then
9557
9558 LIBS="$LIBS -lresolv"
9559
9560 cat >>confdefs.h <<\_ACEOF
9561 #define HAVE_LIBRESOLV 1
9562 _ACEOF
9563
9564
9565 else
9566
9567
9568 echo "$as_me:$LINENO: checking for dn_skipname in -lresolv" >&5
9569 echo $ECHO_N "checking for dn_skipname in -lresolv... $ECHO_C" >&6
9570 if test "${ac_cv_lib_resolv_dn_skipname+set}" = set; then
9571 echo $ECHO_N "(cached) $ECHO_C" >&6
9572 else
9573 ac_check_lib_save_LIBS=$LIBS
9574 LIBS="-lresolv $LIBS"
9575 cat >conftest.$ac_ext <<_ACEOF
9576 /* confdefs.h. */
9577 _ACEOF
9578 cat confdefs.h >>conftest.$ac_ext
9579 cat >>conftest.$ac_ext <<_ACEOF
9580 /* end confdefs.h. */
9581
9582 /* Override any gcc2 internal prototype to avoid an error. */
9583 #ifdef __cplusplus
9584 extern "C"
9585 #endif
9586 /* We use char because int might match the return type of a gcc2
9587 builtin and then its argument prototype would still apply. */
9588 char dn_skipname ();
9589 int
9590 main ()
9591 {
9592 dn_skipname ();
9593 ;
9594 return 0;
9595 }
9596 _ACEOF
9597 rm -f conftest.$ac_objext conftest$ac_exeext
9598 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9599 (eval $ac_link) 2>conftest.er1
9600 ac_status=$?
9601 grep -v '^ *+' conftest.er1 >conftest.err
9602 rm -f conftest.er1
9603 cat conftest.err >&5
9604 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9605 (exit $ac_status); } &&
9606 { ac_try='test -z "$ac_c_werror_flag"
9607 || test ! -s conftest.err'
9608 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9609 (eval $ac_try) 2>&5
9610 ac_status=$?
9611 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9612 (exit $ac_status); }; } &&
9613 { ac_try='test -s conftest$ac_exeext'
9614 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9615 (eval $ac_try) 2>&5
9616 ac_status=$?
9617 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9618 (exit $ac_status); }; }; then
9619 ac_cv_lib_resolv_dn_skipname=yes
9620 else
9621 echo "$as_me: failed program was:" >&5
9622 sed 's/^/| /' conftest.$ac_ext >&5
9623
9624 ac_cv_lib_resolv_dn_skipname=no
9625 fi
9626 rm -f conftest.err conftest.$ac_objext \
9627 conftest$ac_exeext conftest.$ac_ext
9628 LIBS=$ac_check_lib_save_LIBS
9629 fi
9630 echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_dn_skipname" >&5
9631 echo "${ECHO_T}$ac_cv_lib_resolv_dn_skipname" >&6
9632 if test $ac_cv_lib_resolv_dn_skipname = yes; then
9633 cat >>confdefs.h <<_ACEOF
9634 #define HAVE_LIBRESOLV 1
9635 _ACEOF
9636
9637 LIBS="-lresolv $LIBS"
9638
9639 fi
9640
9641
9642 echo "$as_me:$LINENO: checking for __dn_skipname in -lresolv" >&5
9643 echo $ECHO_N "checking for __dn_skipname in -lresolv... $ECHO_C" >&6
9644 if test "${ac_cv_lib_resolv___dn_skipname+set}" = set; then
9645 echo $ECHO_N "(cached) $ECHO_C" >&6
9646 else
9647 ac_check_lib_save_LIBS=$LIBS
9648 LIBS="-lresolv $LIBS"
9649 cat >conftest.$ac_ext <<_ACEOF
9650 /* confdefs.h. */
9651 _ACEOF
9652 cat confdefs.h >>conftest.$ac_ext
9653 cat >>conftest.$ac_ext <<_ACEOF
9654 /* end confdefs.h. */
9655
9656 /* Override any gcc2 internal prototype to avoid an error. */
9657 #ifdef __cplusplus
9658 extern "C"
9659 #endif
9660 /* We use char because int might match the return type of a gcc2
9661 builtin and then its argument prototype would still apply. */
9662 char __dn_skipname ();
9663 int
9664 main ()
9665 {
9666 __dn_skipname ();
9667 ;
9668 return 0;
9669 }
9670 _ACEOF
9671 rm -f conftest.$ac_objext conftest$ac_exeext
9672 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9673 (eval $ac_link) 2>conftest.er1
9674 ac_status=$?
9675 grep -v '^ *+' conftest.er1 >conftest.err
9676 rm -f conftest.er1
9677 cat conftest.err >&5
9678 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9679 (exit $ac_status); } &&
9680 { ac_try='test -z "$ac_c_werror_flag"
9681 || test ! -s conftest.err'
9682 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9683 (eval $ac_try) 2>&5
9684 ac_status=$?
9685 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9686 (exit $ac_status); }; } &&
9687 { ac_try='test -s conftest$ac_exeext'
9688 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9689 (eval $ac_try) 2>&5
9690 ac_status=$?
9691 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9692 (exit $ac_status); }; }; then
9693 ac_cv_lib_resolv___dn_skipname=yes
9694 else
9695 echo "$as_me: failed program was:" >&5
9696 sed 's/^/| /' conftest.$ac_ext >&5
9697
9698 ac_cv_lib_resolv___dn_skipname=no
9699 fi
9700 rm -f conftest.err conftest.$ac_objext \
9701 conftest$ac_exeext conftest.$ac_ext
9702 LIBS=$ac_check_lib_save_LIBS
9703 fi
9704 echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___dn_skipname" >&5
9705 echo "${ECHO_T}$ac_cv_lib_resolv___dn_skipname" >&6
9706 if test $ac_cv_lib_resolv___dn_skipname = yes; then
9707 cat >>confdefs.h <<_ACEOF
9708 #define HAVE_LIBRESOLV 1
9709 _ACEOF
9710
9711 LIBS="-lresolv $LIBS"
9712
9713 fi
9714
9715
9716 fi
9717
9718
9719 fi
90399720
90409721
90419722 # lzo compression requirements
1346314144 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
1346414145 s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
1346514146 s,@INSTALL_DATA@,$INSTALL_DATA,;t t
14147 s,@RRD_LIBS@,$RRD_LIBS,;t t
1346614148 s,@CPP@,$CPP,;t t
1346714149 s,@EGREP@,$EGREP,;t t
1346814150 s,@opt_objects@,$opt_objects,;t t
11 # Process this file with autoconf to produce a configure script.
22
33 AC_PREREQ(2.59)
4 AC_REVISION($Revision: 95 $)dnl
4 AC_REVISION($Revision: 97 $)dnl
55 AC_INIT(nfdump, 1.5.5, peter.haag@switch.ch)
66 AC_CONFIG_SRCDIR([grammar.y])
77 AC_CONFIG_HEADER([config.h])
102102 AC_ARG_ENABLE(nfprofile,
103103 [ --enable-nfprofile Build nfprofile used by NfSen; default is NO],
104104 [
105 AC_CHECK_LIB(rrd, rrd_update,, AC_MSG_ERROR(Can not link librrd. Please specify --with-rrdpath=.. configure failed! ))
105 AC_CHECK_LIB(rrd, rrd_update,[
106 cat >>config.h <<_ACEOF
107 #define HAVE_LIBRRD 1
108 _ACEOF
109 RRD_LIBS="-lrrd"
110 AC_SUBST(RRD_LIBS)
111 ]
112 , AC_MSG_ERROR(Can not link librrd. Please specify --with-rrdpath=.. configure failed! ))
106113 AC_CHECK_HEADERS([rrd.h])
107114 if test "$ac_cv_header_rrd_h" = yes; then
108115 opt_objects="$opt_objects nfprofile"
144151 # Checks for header files.
145152 AC_HEADER_DIRENT
146153 AC_HEADER_STDC
154 AC_CHECK_HEADERS([nameser8_compat.h])
147155 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h fts.h stdint.h stdlib.h string.h sys/socket.h syslog.h unistd.h iso/limits_iso.h])
156
157 AC_CHECK_HEADERS(sys/types.h netinet/in.h arpa/nameser.h netdb.h resolv.h,
158 [], [],
159 [[#ifdef HAVE_SYS_TYPES_H
160 # include <sys/types.h>
161 #endif
162 #ifdef HAVE_NETINET_IN_H
163 # include <netinet/in.h> /* inet_ functions / structs */
164 #endif
165 #ifdef HAVE_ARPA_NAMESER_H
166 # include <arpa/nameser.h> /* DNS HEADER struct */
167 #endif
168 #ifdef HAVE_NETDB_H
169 # include <netdb.h>
170 #endif]])
148171
149172
150173 if test "$ac_cv_header_fts_h" != yes; then
151174 FTS_OBJ=fts_compat.o
152175 fi
153176 AC_SUBST(FTS_OBJ)
177
154178
155179 # Checks for typedefs, structures, and compiler characteristics.
156180 AC_CHECK_SIZEOF(void *)
172196 AC_FUNC_STAT
173197 AC_FUNC_STRFTIME
174198 AC_CHECK_FUNCS(inet_ntoa socket strchr strdup strerror strrchr strstr scandir)
199
200 dnl The res_search may be in libsocket as well, and if it is
201 dnl make sure to check for dn_skipname in libresolv, or if res_search
202 dnl is in neither of these libs, still check for dn_skipname in libresolv
203 AC_CHECK_LIB(socket, res_search, [
204 AC_CHECK_LIB(resolv, dn_skipname)
205 AC_CHECK_LIB(resolv, __dn_skipname)
206 LIBS="$LIBS -lsocket"
207 AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
208 AC_CHECK_LIB(resolv, res_search, [
209 LIBS="$LIBS -lresolv"
210 AC_DEFINE(HAVE_LIBRESOLV,1,[ ])
211 ], [
212 AC_CHECK_LIB(resolv, dn_skipname)
213 AC_CHECK_LIB(resolv, __dn_skipname)
214 ])
215 ])
175216
176217 # lzo compression requirements
177218 AC_CHECK_TYPE(ptrdiff_t, long)
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: expire.c 92 2007-08-24 12:10:24Z peter $
32 * $Id: expire.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 92 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
324324 uint64_t sizelimit, num_expired;
325325 int done, size_done, lifetime_done, dir_files;
326326 char *const path[] = { dir, NULL };
327 char *expire_timelimit = "";
327 char *expire_timelimit = NULL;
328328 time_t now = time(NULL);
329329
330330 dir_files = 0;
418418 // expire time-wise if needed
419419 // this part of the code is executed only when size-wise is fullfilled
420420 if ( !lifetime_done ) {
421 if ( strcmp(p, expire_timelimit) < 0 ) {
421 if ( expire_timelimit && strcmp(p, expire_timelimit) < 0 ) {
422422 if ( unlink(ftsent->fts_path) == 0 ) {
423423 dirstat->filesize -= 512 * ftsent->fts_statp->st_blocks;
424424 num_expired++;
479479 dirstat->first = dirstat->last = time(NULL);
480480 dirstat->status = FORCE_REBUILD;
481481 }
482
483 free(expire_timelimit);
482484
483485 } // End of ExpireDir
484486
0 /* $Id: fts_compat.c 92 2007-08-24 12:10:24Z peter $ */
0 /* $Id: fts_compat.c 97 2008-02-21 09:50:02Z peter $ */
11 /* TNFTPD ORIGINAL: libnetbsd/fts_open.c */
22
33 /* $TNFTPPD: fts_open.c,v 1.4 2003/12/17 01:42:45 lukem Exp $ */
390390 /* Move to the next node on this level. */
391391 next: tmp = p;
392392 if ((p = p->fts_link) != NULL) {
393
393394 free(tmp);
394395
395396 /*
942943 {
943944 FTSENT *p;
944945
945 #if defined(ALIGNBYTES) && defined(ALIGN)
946
946 #define ALIGNBYTES (sizeof(int) - 1)
947 #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
948
947949 size_t len;
948950 /*
949951 * The file name is a variable length array and no stat structure is
962964 if (!ISSET(FTS_NOSTAT))
963965 p->fts_statp =
964966 (struct STAT *)ALIGN((u_long)(p->fts_name + namelen + 2));
965 #else
966 if ((p = malloc(sizeof(FTSENT) + namelen)) == NULL)
967 return (NULL);
968
969 if (!ISSET(FTS_NOSTAT))
970 if ((p->fts_statp = malloc(sizeof(struct STAT))) == NULL) {
971 free(p);
972 return (NULL);
973 }
974 #endif
975967
976968 /* Copy the name plus the trailing NULL. */
977969 memmove(p->fts_name, name, namelen + 1);
997989 while ((p = head) != NULL) {
998990 head = head->fts_link;
999991
1000 #if !defined(ALIGNBYTES) || !defined(ALIGN)
1001 if (p->fts_statp)
1002 free(p->fts_statp);
1003 #endif
1004992 free(p);
1005993 }
1006994 }
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: grammar.y 95 2007-10-15 06:05:26Z peter $
32 * $Id: grammar.y 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 95 $
34 * $LastChangedRevision: 97 $
3535 *
3636 *
3737 *
6565 */
6666 static void yyerror(char *msg);
6767
68 static uint32_t ChainHosts(uint64_t *hostlist, int num_records, int type);
69
6870 enum { SOURCE = 1, DESTINATION, SOURCE_AND_DESTINATION, SOURCE_OR_DESTINATION };
6971
7072
7173 /* var defs */
7274 extern int lineno;
7375 extern char *yytext;
76 extern uint64_t *IPstack;
7477 extern uint32_t StartNode;
7578 extern uint16_t Extended;
7679 extern int (*FilterEngine)(uint32_t *);
7780
81 static uint32_t num_ip;
7882
7983 %}
80
8184
8285 %union {
8386 uint64_t value;
8689 void *list;
8790 }
8891
89 %token ANY IP IF IDENT TOS FLAGS HOST NET PORT IN OUT SRC DST EQ LT GT
90 %token NUMBER IPSTRING ALPHA_FLAGS PROTOSTR PORTNUM ICMPTYPE AS PACKETS BYTES PPS BPS BPP DURATION
92 %token ANY IP IF IDENT TOS FLAGS PROTO HOSTNAME NET PORT IN OUT SRC DST EQ LT GT
93 %token NUMBER STRING IDENT ALPHA_FLAGS PROTOSTR PORTNUM ICMP_TYPE ICMP_CODE AS PACKETS BYTES PPS BPS BPP DURATION
9194 %token IPV4 IPV6
9295 %token NOT END
93 %type <value> expr NUMBER PORTNUM ICMPTYPE
94 %type <s> IPSTRING IDENT ALPHA_FLAGS PROTOSTR
95 %type <param> dqual inout term comp scale
96 %type <value> expr NUMBER PORTNUM ICMP_TYPE ICMP_CODE
97 %type <s> STRING IDENT ALPHA_FLAGS PROTOSTR
98 %type <param> dqual inout term comp
9699 %type <list> iplist ullist
97100
98101 %left '+' OR
110113 $$.self = NewBlock(OffsetProto, 0, 0, CMP_EQ, FUNC_NONE, NULL );
111114 }
112115
113 | IDENT {
114 uint32_t index = AddIdent($1);
116 | IDENT STRING {
117 if ( !ScreenIdentString($2) ) {
118 yyerror("Illegal ident string");
119 YYABORT;
120 }
121
122 uint32_t index = AddIdent($2);
115123 $$.self = NewBlock(0, 0, index, CMP_IDENT, FUNC_NONE, NULL );
116124 }
117125
125133 (1LL << ShiftRecordFlags) & MaskRecordFlags, CMP_EQ, FUNC_NONE, NULL);
126134 }
127135
128 | PROTOSTR {
136 | PROTO NUMBER {
129137 int64_t proto;
130 char *s = $1;
131 while ( *s && isdigit((int)s[0]) ) s++;
132 if ( *s ) // alpha string for protocol
133 proto = Proto_num($1);
134 else
135 proto = atoi($1);
138 proto = $2;
136139
137140 if ( proto > 255 ) {
138141 yyerror("Protocol number > 255");
143146 YYABORT;
144147 }
145148 $$.self = NewBlock(OffsetProto, MaskProto, (proto << ShiftProto) & MaskProto, CMP_EQ, FUNC_NONE, NULL);
146 }
147
148 | PACKETS comp NUMBER scale {
149 $$.self = NewBlock(OffsetPackets, MaskPackets, $3 * $4.scale, $2.comp, FUNC_NONE, NULL);
150 }
151
152 | BYTES comp NUMBER scale {
153 $$.self = NewBlock(OffsetBytes, MaskBytes, $3 * $4.scale , $2.comp, FUNC_NONE, NULL);
154 }
155
156 | PPS comp NUMBER scale {
157 $$.self = NewBlock(0, AnyMask, $3 * $4.scale , $2.comp, FUNC_PPS, NULL);
158 }
159
160 | BPS comp NUMBER scale {
161 $$.self = NewBlock(0, AnyMask, $3 * $4.scale , $2.comp, FUNC_BPS, NULL);
162 }
163
164 | BPP comp NUMBER scale {
165 $$.self = NewBlock(0, AnyMask, $3 * $4.scale , $2.comp, FUNC_BPP, NULL);
149
150 }
151
152 | PROTO STRING {
153 int64_t proto;
154 proto = Proto_num($2);
155
156 if ( proto > 255 ) {
157 yyerror("Protocol number > 255");
158 YYABORT;
159 }
160 if ( proto < 0 ) {
161 yyerror("Unknown protocol");
162 YYABORT;
163 }
164 $$.self = NewBlock(OffsetProto, MaskProto, (proto << ShiftProto) & MaskProto, CMP_EQ, FUNC_NONE, NULL);
165 }
166
167 | PACKETS comp NUMBER {
168 $$.self = NewBlock(OffsetPackets, MaskPackets, $3, $2.comp, FUNC_NONE, NULL);
169 }
170
171 | BYTES comp NUMBER {
172 $$.self = NewBlock(OffsetBytes, MaskBytes, $3, $2.comp, FUNC_NONE, NULL);
173 }
174
175 | PPS comp NUMBER {
176 $$.self = NewBlock(0, AnyMask, $3, $2.comp, FUNC_PPS, NULL);
177 }
178
179 | BPS comp NUMBER {
180 $$.self = NewBlock(0, AnyMask, $3, $2.comp, FUNC_BPS, NULL);
181 }
182
183 | BPP comp NUMBER {
184 $$.self = NewBlock(0, AnyMask, $3, $2.comp, FUNC_BPP, NULL);
166185 }
167186
168187 | DURATION comp NUMBER {
185204 $$.self = NewBlock(OffsetFlags, MaskFlags, ($3 << ShiftFlags) & MaskFlags, $2.comp, FUNC_NONE, NULL);
186205 }
187206
188 | FLAGS ALPHA_FLAGS {
207 | FLAGS STRING {
189208 uint64_t fl = 0;
190 if ( strlen($2) > 7 ) {
209 int cnt = 0;
210 size_t len = strlen($2);
211
212 if ( len > 7 ) {
191213 yyerror("Too many flags");
192214 YYABORT;
193215 }
194216
195 if ( strchr($2, 'F') ) fl |= 1;
196 if ( strchr($2, 'S') ) fl |= 2;
197 if ( strchr($2, 'R') ) fl |= 4;
198 if ( strchr($2, 'P') ) fl |= 8;
199 if ( strchr($2, 'A') ) fl |= 16;
200 if ( strchr($2, 'U') ) fl |= 32;
201 if ( strchr($2, 'X') ) fl = 63;
217 if ( strchr($2, 'F') ) { fl |= 1; cnt++; }
218 if ( strchr($2, 'S') ) { fl |= 2; cnt++; }
219 if ( strchr($2, 'R') ) { fl |= 4; cnt++; }
220 if ( strchr($2, 'P') ) { fl |= 8; cnt++; }
221 if ( strchr($2, 'A') ) { fl |= 16; cnt++; }
222 if ( strchr($2, 'U') ) { fl |= 32; cnt++; }
223 if ( strchr($2, 'X') ) { fl = 63; cnt++; }
224
225 if ( cnt != len ) {
226 yyerror("Too many flags");
227 YYABORT;
228 }
202229
203230 $$.self = NewBlock(OffsetFlags, (fl << ShiftFlags) & MaskFlags,
204231 (fl << ShiftFlags) & MaskFlags, CMP_FLAGS, FUNC_NONE, NULL);
205232 }
206233
207 | dqual IP IPSTRING {
208 int af, bytes;
209 if ( parse_ip(&af, $3, $$.ip, &bytes) == 0 ) {
210 yyerror("Invalid IP address");
211 YYABORT;
212 }
213 if ( ( af == PF_INET && bytes != 4 ) || ( af == PF_INET6 && bytes != 16 )) {
214 yyerror("incomplete IP address");
215 YYABORT;
216 }
217
218 $$.direction = $1.direction;
219 if ( $$.direction == SOURCE ) {
220 $$.self = Connect_AND(
221 NewBlock(OffsetSrcIPv6b, MaskIPv6, $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
222 NewBlock(OffsetSrcIPv6a, MaskIPv6, $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
223 );
224 } else if ( $$.direction == DESTINATION) {
225 $$.self = Connect_AND(
226 NewBlock(OffsetDstIPv6b, MaskIPv6, $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
227 NewBlock(OffsetDstIPv6a, MaskIPv6, $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
228 );
229 } else if ( $$.direction == SOURCE_OR_DESTINATION ) {
230 $$.self = Connect_OR(
231 Connect_AND(
232 NewBlock(OffsetSrcIPv6b, MaskIPv6, $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
233 NewBlock(OffsetSrcIPv6a, MaskIPv6, $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
234 ),
235 Connect_AND(
236 NewBlock(OffsetDstIPv6b, MaskIPv6, $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
237 NewBlock(OffsetDstIPv6a, MaskIPv6, $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
238 )
239 );
240 } else if ( $$.direction == SOURCE_AND_DESTINATION ) {
241 $$.self = Connect_AND(
242 Connect_AND(
243 NewBlock(OffsetSrcIPv6b, MaskIPv6, $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
244 NewBlock(OffsetSrcIPv6a, MaskIPv6, $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
245 ),
246 Connect_AND(
247 NewBlock(OffsetDstIPv6b, MaskIPv6, $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
248 NewBlock(OffsetDstIPv6a, MaskIPv6, $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
249 )
250 );
234 | dqual IP STRING {
235 int af, bytes, ret;
236
237 ret = parse_ip(&af, $3, IPstack, &bytes, ALLOW_LOOKUP, &num_ip);
238
239 if ( ret == 0 ) {
240 yyerror("Error parsing IP address.");
241 YYABORT;
242 }
243
244 // ret == -1 will never happen here, as ALLOW_LOOKUP is set
245 if ( ret == -2 ) {
246 // could not resolv host => 'not any'
247 $$.self = Invert(NewBlock(OffsetProto, 0, 0, CMP_EQ, FUNC_NONE, NULL ));
251248 } else {
252 /* should never happen */
253 yyerror("Internal parser error");
254 YYABORT;
249
250 if ( af && (( af == PF_INET && bytes != 4 ) || ( af == PF_INET6 && bytes != 16 ))) {
251 yyerror("incomplete IP address");
252 YYABORT;
253 }
254
255 if ( $$.direction == SOURCE || $$.direction == DESTINATION ) {
256 $$.self = ChainHosts(IPstack, num_ip, $$.direction);
257 } else {
258 uint32_t src = ChainHosts(IPstack, num_ip, SOURCE);
259 uint32_t dst = ChainHosts(IPstack, num_ip, DESTINATION);
260
261 if ( $$.direction == SOURCE_OR_DESTINATION ) {
262 $$.self = Connect_OR(src, dst);
263 } else if ( $$.direction == SOURCE_AND_DESTINATION ) {
264 $$.self = Connect_AND(src, dst);
265 } else {
266 /* should never happen */
267 yyerror("Internal parser error");
268 YYABORT;
269 }
270 }
255271 }
256272 }
257273
362378 }
363379 }
364380
381 | ICMP_TYPE NUMBER {
382 if ( $2 > 255 ) {
383 yyerror("ICMP tpye of range 0..15");
384 YYABORT;
385 }
386 $$.self = Connect_AND(
387 // imply proto ICMP with a proto ICMP block
388 NewBlock(OffsetProto, MaskProto, (1LL << ShiftProto) & MaskProto, CMP_EQ, FUNC_NONE, NULL),
389 NewBlock(OffsetPort, MaskICMPtype, ($2 << ShiftICMPtype) & MaskICMPtype, CMP_EQ, FUNC_NONE, NULL )
390 );
391
392 }
393
394 | ICMP_CODE NUMBER {
395 if ( $2 > 255 ) {
396 yyerror("ICMP code of range 0..15");
397 YYABORT;
398 }
399 $$.self = Connect_AND(
400 // imply proto ICMP with a proto ICMP block
401 NewBlock(OffsetProto, MaskProto, (1LL << ShiftProto) & MaskProto, CMP_EQ, FUNC_NONE, NULL),
402 NewBlock(OffsetPort, MaskICMPcode, ($2 << ShiftICMPcode) & MaskICMPcode, CMP_EQ, FUNC_NONE, NULL )
403 );
404
405 }
406
365407 | dqual AS NUMBER {
366408 $$.direction = $1.direction;
367409 if ( $3 > 65535 || $3 < 0 ) {
368 yyerror("AS number outside of range 0..65535");
410 yyerror("AS number of range 0..65535");
369411 YYABORT;
370412 }
371413
445487 }
446488 }
447489
448 | dqual NET IPSTRING IPSTRING {
449 int af, bytes;
490 | dqual NET STRING STRING {
491 int af, bytes, ret;
450492 uint64_t mask[2];
451 if ( parse_ip(&af, $3, $$.ip, &bytes) == 0 ) {
493 ret = parse_ip(&af, $3, IPstack, &bytes, STRICT_IP, &num_ip);
494
495 if ( ret == 0 ) {
452496 yyerror("Invalid IP address");
453497 YYABORT;
454498 }
499
500 if ( ret == -1 ) {
501 yyerror("IP address required - hostname not allowed here.");
502 YYABORT;
503 }
504 // ret == -2 will never happen here, as STRICT_IP is set
505
455506 if ( af != PF_INET ) {
456507 yyerror("IP netmask syntax valid only for IPv4");
457508 YYABORT;
460511 yyerror("Need complete IP address");
461512 YYABORT;
462513 }
463 if ( parse_ip(&af, $4, mask, &bytes) == 0 ) {
514
515 ret = parse_ip(&af, $4, mask, &bytes, STRICT_IP, &num_ip);
516 if ( ret == 0 ) {
464517 yyerror("Invalid IP address");
465518 YYABORT;
466519 }
520 if ( ret == -1 ) {
521 yyerror("IP address required - hostname not allowed here.");
522 YYABORT;
523 }
524 // ret == -2 will never happen here, as STRICT_IP is set
525
467526 if ( af != PF_INET || bytes != 4 ) {
468527 yyerror("Invalid netmask for IPv4 address");
469528 YYABORT;
470529 }
471530
472 $$.ip[0] &= mask[0];
473 $$.ip[1] &= mask[1];
531 IPstack[0] &= mask[0];
532 IPstack[1] &= mask[1];
474533
475534 $$.direction = $1.direction;
476535
477536 if ( $$.direction == SOURCE ) {
478537 $$.self = Connect_AND(
479 NewBlock(OffsetSrcIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
480 NewBlock(OffsetSrcIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
538 NewBlock(OffsetSrcIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
539 NewBlock(OffsetSrcIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
481540 );
482541 } else if ( $$.direction == DESTINATION) {
483542 $$.self = Connect_AND(
484 NewBlock(OffsetDstIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
485 NewBlock(OffsetDstIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
543 NewBlock(OffsetDstIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
544 NewBlock(OffsetDstIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
486545 );
487546 } else if ( $$.direction == SOURCE_OR_DESTINATION ) {
488547 $$.self = Connect_OR(
489548 Connect_AND(
490 NewBlock(OffsetSrcIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
491 NewBlock(OffsetSrcIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
549 NewBlock(OffsetSrcIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
550 NewBlock(OffsetSrcIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
492551 ),
493552 Connect_AND(
494 NewBlock(OffsetDstIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
495 NewBlock(OffsetDstIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
553 NewBlock(OffsetDstIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
554 NewBlock(OffsetDstIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
496555 )
497556 );
498557 } else if ( $$.direction == SOURCE_AND_DESTINATION ) {
499558 $$.self = Connect_AND(
500559 Connect_AND(
501 NewBlock(OffsetSrcIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
502 NewBlock(OffsetSrcIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
560 NewBlock(OffsetSrcIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
561 NewBlock(OffsetSrcIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
503562 ),
504563 Connect_AND(
505 NewBlock(OffsetDstIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
506 NewBlock(OffsetDstIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
564 NewBlock(OffsetDstIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
565 NewBlock(OffsetDstIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
507566 )
508567 );
509568 } else {
513572 }
514573 }
515574
516 | dqual NET IPSTRING '/' NUMBER {
517 int af, bytes;
575 | dqual NET STRING '/' NUMBER {
576 int af, bytes, ret;
518577 uint64_t mask[2];
519 if ( parse_ip(&af, $3, $$.ip, &bytes) == 0 ) {
578
579 ret = parse_ip(&af, $3, IPstack, &bytes, STRICT_IP, &num_ip);
580 if ( ret == 0 ) {
520581 yyerror("Invalid IP address");
521582 YYABORT;
522583 }
584 if ( ret == -1 ) {
585 yyerror("IP address required - hostname not allowed here.");
586 YYABORT;
587 }
588 // ret == -2 will never happen here, as STRICT_IP is set
589
523590
524591 if ( $5 > (bytes*8) ) {
525592 yyerror("Too many netbits for this IP addresss");
542609 mask[0] = mask[0];
543610 mask[1] = mask[1];
544611
545 $$.ip[0] &= mask[0];
546 $$.ip[1] &= mask[1];
612 IPstack[0] &= mask[0];
613 IPstack[1] &= mask[1];
547614
548615 $$.direction = $1.direction;
549616 if ( $$.direction == SOURCE ) {
550617 $$.self = Connect_AND(
551 NewBlock(OffsetSrcIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
552 NewBlock(OffsetSrcIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
618 NewBlock(OffsetSrcIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
619 NewBlock(OffsetSrcIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
553620 );
554621 } else if ( $$.direction == DESTINATION) {
555622 $$.self = Connect_AND(
556 NewBlock(OffsetDstIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
557 NewBlock(OffsetDstIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
623 NewBlock(OffsetDstIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
624 NewBlock(OffsetDstIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
558625 );
559626 } else if ( $$.direction == SOURCE_OR_DESTINATION ) {
560627 $$.self = Connect_OR(
561628 Connect_AND(
562 NewBlock(OffsetSrcIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
563 NewBlock(OffsetSrcIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
629 NewBlock(OffsetSrcIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
630 NewBlock(OffsetSrcIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
564631 ),
565632 Connect_AND(
566 NewBlock(OffsetDstIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
567 NewBlock(OffsetDstIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
633 NewBlock(OffsetDstIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
634 NewBlock(OffsetDstIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
568635 )
569636 );
570637 } else if ( $$.direction == SOURCE_AND_DESTINATION ) {
571638 $$.self = Connect_AND(
572639 Connect_AND(
573 NewBlock(OffsetSrcIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
574 NewBlock(OffsetSrcIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
640 NewBlock(OffsetSrcIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
641 NewBlock(OffsetSrcIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
575642 ),
576643 Connect_AND(
577 NewBlock(OffsetDstIPv6b, mask[1], $$.ip[1] , CMP_EQ, FUNC_NONE, NULL ),
578 NewBlock(OffsetDstIPv6a, mask[0], $$.ip[0] , CMP_EQ, FUNC_NONE, NULL )
644 NewBlock(OffsetDstIPv6b, mask[1], IPstack[1] , CMP_EQ, FUNC_NONE, NULL ),
645 NewBlock(OffsetDstIPv6a, mask[0], IPstack[0] , CMP_EQ, FUNC_NONE, NULL )
579646 )
580647 );
581648 } else {
605672 YYABORT;
606673 }
607674 }
608
609675 ;
610676
611677 /* iplist definition */
612 iplist: IPSTRING {
613 int af, bytes;
614 uint64_t ipaddr[2];
678 iplist: STRING {
679 int i, af, bytes, ret;
615680 struct IPListNode *node;
616681
617682 IPlist_t *root = malloc(sizeof(IPlist_t));
622687 }
623688 RB_INIT(root);
624689
625 if ( parse_ip(&af, $1, ipaddr, &bytes) == 0 ) {
690 ret = parse_ip(&af, $1, IPstack, &bytes, ALLOW_LOOKUP, &num_ip);
691
692 if ( ret == 0 ) {
626693 yyerror("Invalid IP address");
627694 YYABORT;
628695 }
629 if ( ( af == PF_INET && bytes != 4 ) || ( af == PF_INET6 && bytes != 16 )) {
696 // ret == -1 will never happen here, as ALLOW_LOOKUP is set
697
698 if ( ret != -2 ) {
699 if ( af && (( af == PF_INET && bytes != 4 ) || ( af == PF_INET6 && bytes != 16 ))) {
700 yyerror("incomplete IP address");
701 YYABORT;
702 }
703
704 for ( i=0; i<num_ip; i++ ) {
705 if ((node = malloc(sizeof(struct IPListNode))) == NULL) {
706 yyerror("malloc() error");
707 YYABORT;
708 }
709 node->ip[0] = IPstack[2*i];
710 node->ip[1] = IPstack[2*i+1];
711 RB_INSERT(IPtree, root, node);
712 }
713
714 }
715 $$ = (void *)root;
716
717 }
718 | iplist STRING {
719 int i, af, bytes, ret;
720 struct IPListNode *node;
721
722 ret = parse_ip(&af, $2, IPstack, &bytes, STRICT_IP, &num_ip);
723
724 if ( ret == 0 ) {
725 yyerror("Invalid IP address");
726 YYABORT;
727 }
728 if ( af && (( af == PF_INET && bytes != 4 ) || ( af == PF_INET6 && bytes != 16 ))) {
630729 yyerror("incomplete IP address");
631730 YYABORT;
632731 }
633 if ((node = malloc(sizeof(struct IPListNode))) == NULL) {
634 yyerror("malloc() error");
635 YYABORT;
636 }
637 node->ip[0] = ipaddr[0];
638 node->ip[1] = ipaddr[1];
639
640 RB_INSERT(IPtree, root, node);
641 $$ = (void *)root;
642 }
643 | iplist IPSTRING {
644 int af, bytes;
645 uint64_t ipaddr[2];
646 struct IPListNode *node;
647
648 if ( parse_ip(&af, $2, ipaddr, &bytes) == 0 ) {
649 yyerror("Invalid IP address");
650 YYABORT;
651 }
652 if ( ( af == PF_INET && bytes != 4 ) || ( af == PF_INET6 && bytes != 16 )) {
653 yyerror("incomplete IP address");
654 YYABORT;
655 }
656 if ((node = malloc(sizeof(struct IPListNode))) == NULL) {
657 yyerror("malloc() error");
658 YYABORT;
659 }
660 node->ip[0] = ipaddr[0];
661 node->ip[1] = ipaddr[1];
662 RB_INSERT(IPtree, (IPlist_t *)$$, node);
732
733 // ret == - 2 means lookup failure
734 if ( ret != -2 ) {
735 for ( i=0; i<num_ip; i++ ) {
736 if ((node = malloc(sizeof(struct IPListNode))) == NULL) {
737 yyerror("malloc() error");
738 YYABORT;
739 }
740 node->ip[0] = IPstack[2*i];
741 node->ip[1] = IPstack[2*i+1];
742
743 RB_INSERT(IPtree, (IPlist_t *)$$, node);
744 }
745 }
663746 }
664747 ;
665748
705788 ;
706789
707790 /* scaling qualifiers */
708 scale: { $$.scale = 1; }
709 | 'k' { $$.scale = 1024; }
710 | 'm' { $$.scale = 1024*1024; }
711 | 'g' { $$.scale = 1024*1024*1024; }
712 ;
713791
714792 /* comparator qualifiers */
715793 comp: { $$.comp = CMP_EQ; }
746824 fprintf(stderr,"line %d: %s at '%s'\n", lineno, msg, yytext);
747825 } /* End of yyerror */
748826
749
827 static uint32_t ChainHosts(uint64_t *hostlist, int num_records, int type) {
828 uint32_t offset_a, offset_b, i, j, block;
829
830 if ( type == SOURCE ) {
831 offset_a = OffsetSrcIPv6a;
832 offset_b = OffsetSrcIPv6b;
833 } else {
834 offset_a = OffsetDstIPv6a;
835 offset_b = OffsetDstIPv6b;
836 }
837
838 i = 0;
839 block = Connect_AND(
840 NewBlock(offset_b, MaskIPv6, hostlist[i+1] , CMP_EQ, FUNC_NONE, NULL ),
841 NewBlock(offset_a, MaskIPv6, hostlist[i] , CMP_EQ, FUNC_NONE, NULL )
842 );
843 i += 2;
844 for ( j=1; j<num_records; j++ ) {
845 uint32_t b = Connect_AND(
846 NewBlock(offset_b, MaskIPv6, hostlist[i+1] , CMP_EQ, FUNC_NONE, NULL ),
847 NewBlock(offset_a, MaskIPv6, hostlist[i] , CMP_EQ, FUNC_NONE, NULL )
848 );
849 block = Connect_OR(block, b);
850 i += 2;
851 }
852
853 return block;
854
855 } // End of ChainHosts
1717
1818 #include <sys/types.h>
1919 #include <sys/socket.h>
20 #include <netinet/in.h>
2021 #include <arpa/inet.h>
22 #include <arpa/nameser.h>
23 #include <netdb.h>
24 #include <stdio.h>
25 #include <stdlib.h>
2126 #include <string.h>
27 #include <errno.h>
28
29 #ifdef HAVE_RESOLV_H
30 #include <resolv.h>
31 #endif
2232
2333 #ifdef HAVE_STDINT_H
2434 #include <stdint.h>
2838 #include "util.h"
2939 #include "ipconv.h"
3040
41
3142 static int parse_ipv4(const char *src, uint32_t *dst, int *bytes);
3243 static int parse_ipv6(const char *src, uint64_t *dst, int *bytes);
33
34 int parse_ip(int *af, const char *src, uint64_t *dst, int *bytes) {
44 static int lookup_host(const char *hostname, uint64_t *iplist, uint32_t *num_ip );
45
46 int parse_ip(int *af, const char *src, uint64_t *dst, int *bytes, int lookup, uint32_t *num_ip ) {
47 char *alpha = "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY";
3548 uint32_t v4addr;
3649 int ret;
3750
38 if ( strchr(src, ':') != NULL )
51 // check for IPv6 address
52 if ( strchr(src, ':') != NULL ) {
3953 *af = PF_INET6;
40 else
54 // check for alpha chars -> hostname -> lookup
55 } else if ( strpbrk(src, alpha)) {
56 *af = 0;
57 if ( lookup == STRICT_IP )
58 return -1;
59 else
60 return lookup_host(src, dst, num_ip );
61 // it's IPv4
62 } else
4163 *af = PF_INET;
4264
65 *num_ip = 1;
4366 switch (*af) {
4467 case AF_INET:
4568 ret = (parse_ipv4(src, &v4addr, bytes));
180203 return (1);
181204 }
182205
206 static int lookup_host(const char *hostname, uint64_t *iplist, uint32_t *num_ip ) {
207 struct addrinfo hints, *res, *r;
208 int errcode, i, len;
209 char addrstr[128];
210 char reverse[256];
211 void *ptr;
212
213 printf("Resolving %s ...\n", hostname);
214
215 memset (&hints, 0, sizeof (hints));
216 hints.ai_family = PF_UNSPEC;
217 hints.ai_socktype = SOCK_STREAM;
218 hints.ai_flags |= AI_CANONNAME;
219
220 errcode = getaddrinfo (hostname, NULL, &hints, &res);
221 if (errcode != 0) {
222 fprintf(stderr, "Failed to resolve IP address for %s: %s\n", hostname, gai_strerror(errno));
223 return 0;
224 }
225
226 // count the number of records found
227 *num_ip = 0;
228
229 // remember res for later free()
230 r = res;
231
232 i = 0;
233 while (res) {
234 if ( *num_ip >= MAXHOSTS ) {
235 printf ("Too man IP addresses in DNS response\n");
236 return 1;
237 }
238 switch (res->ai_family) {
239 case PF_INET:
240 ptr = &(((struct sockaddr_in *) res->ai_addr)->sin_addr);
241 iplist[i++] = 0;
242 iplist[i++] = ntohl(*(uint32_t *)ptr) & 0xffffffffLL ;
243 len = sizeof(struct sockaddr_in);
244 break;
245 case AF_INET6:
246 ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
247 iplist[i++] = ntohll(((uint64_t *)ptr)[0]);
248 iplist[i++] = ntohll(((uint64_t *)ptr)[1]);
249 len = sizeof(struct sockaddr_in6);
250 break;
251 default: {
252 // not handled
253 res = res->ai_next;
254 continue;
255 }
256 }
257 inet_ntop (res->ai_family, ptr, addrstr, 100);
258 addrstr[99] = '\0';
259 if ( (errcode = getnameinfo(res->ai_addr, len, reverse, sizeof(reverse), NULL,0,0)) != 0 ) {
260 snprintf(reverse, sizeof(reverse)-1, "<reverse lookup failed>");
261 // fprintf(stderr, "Failed to reverse lookup %s: %s\n", addrstr, gai_strerror(errcode));
262 }
263
264 printf ("IPv%d address: %s (%s)\n", res->ai_family == PF_INET6 ? 6 : 4, addrstr, reverse );
265 res = res->ai_next;
266 (*num_ip)++;
267 }
268
269 freeaddrinfo(r);
270 return 1;
271
272 } // End of lookup_host
273
274 int set_nameserver(char *ns) {
275 struct hostent *host;
276
277 res_init();
278 host = gethostbyname(ns);
279 if (host == NULL) {
280 (void) fprintf(stderr,"Can not resolv nameserver %s: %s\n", ns, hstrerror(h_errno));
281 return 0;
282 }
283 (void) memcpy((void *)&_res.nsaddr_list[0].sin_addr, (void *)host->h_addr_list[0], (size_t)host->h_length);
284 _res.nscount = 1;
285 return 1;
286
287 } // End of set_nameserver
288
289
183290 /*
184291 int main( int argc, char **argv ) {
185292
186293 char *s, t[64];
187294 uint64_t anyaddr[2];
295 uint32_t num_ip;
188296 int af, ret, bytes;
297
189298
190299 s = argv[1];
300 if (argc == 3 && !set_nameserver(argv[2]) )
301 return 0;
302
303 lookup_host(s, &num_ip);
304 return 0;
305
191306 ret = parse_ip(&af, s, anyaddr, &bytes);
192307 if ( ret != 1 ) {
193308 printf("Parse failed!\n");
194 exit(0);
309 return 0;
195310 }
196311
197312 if ( af == PF_INET )
204319 }
205320
206321 */
322
00
1 int parse_ip(int *af, const char *src, uint64_t *dst, int *bytes);
1 int parse_ip(int *af, const char *src, uint64_t *dst, int *bytes, int lookup, uint32_t *num_ip );
22
3 int set_nameserver(char *ns);
4
5 #define MAXHOSTS 512
6
7 #define STRICT_IP 0
8 #define ALLOW_LOOKUP 1
2727 *
2828 * $Author: peter $
2929 *
30 * $Id: launch.c 92 2007-08-24 12:10:24Z peter $
30 * $Id: launch.c 97 2008-02-21 09:50:02Z peter $
3131 *
32 * $LastChangedRevision: 92 $
32 * $LastChangedRevision: 97 $
3333 *
3434 *
3535 */
272272 RescanDir(datadir, dirstat);
273273 if ( bookkeeper_stat == BOOKKEEPER_OK ) {
274274 ClearBooks(books, NULL);
275 ReleaseBookkeeper(books, DETACH_ONLY);
275 // release the books below
276276 }
277277 }
278278
312312 } else {
313313 syslog(LOG_INFO, "expire completed - nothing to expire.");
314314 }
315 ReleaseStatInfo(dirstat);
315316
316317 } // End of do_expire
317318
318319 void launcher (char *commbuff, char *datadir, char *process, int expire) {
319320 struct sigaction act;
320 char *cmd;
321321 char *args[MAXARGS];
322322 int pid, stat;
323323 srecord_t *InfoRecord;
326326
327327 syslog(LOG_INFO, "Launcher: Startup. auto-expire %s", expire ? "enabled" : "off" );
328328 done = launch = child_exit = 0;
329 cmd = NULL;
330329
331330 if ( chdir(datadir)) {
332331 syslog(LOG_ERR, "Error can't chdir to '%s': %s", datadir, strerror(errno));
335334
336335 // process may be NULL, if we only expire data files
337336 if ( process ) {
337 char *cmd = NULL;
338338 srecord_t TestRecord;
339339 // check for valid command expansion
340340 strncpy(TestRecord.fname, "test", FNAME_SIZE-1);
369369 launch = 0;
370370
371371 if ( process ) {
372 char *cmd = NULL;
372373 // Expand % placeholders
373374 cmd = cmd_expand(InfoRecord, datadir, process);
374375 if ( cmd == NULL ) {
383384 if ( args[0] )
384385 cmd_execute(args);
385386 // else cmd_parse already reported the error
387 free(cmd);
386388 }
387389
388390 if ( expire )
412414 syslog(LOG_INFO, "Launcher: exit.");
413415
414416 } // End of launcher
417
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: netflow_v9.c 95 2007-10-15 06:05:26Z peter $
32 * $Id: netflow_v9.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 95 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
8181 uint32_t zero_index;
8282 uint32_t packet_offset;
8383 uint32_t byte_offset;
84 uint32_t ICMP_offset;
8485 translation_element_t element[NumElements];
8586 } input_translation_t;
8687
373374
374375 // clear current table
375376 memset((void *)table->element, 0, NumElements * sizeof(translation_element_t));
376 table->updated = time(NULL);
377 table->flags = 0;
377 table->updated = time(NULL);
378 table->flags = 0;
379 table->ICMP_offset = 0;
378380
379381 // printf("[%u] Fill translation table %u\n", exporter->exporter_id, id);
380382
450452
451453 table->input_record_size = input_record_size;
452454 table->output_record_size = offset;
455
456 /* ICMP hack for v9, until file version 2 for FNF is fully impemented */
457 if ( input_template[NF9_ICMP_TYPE].offset != 0 ) {
458 if ( input_template[NF9_ICMP_TYPE].length == 2 )
459 table->ICMP_offset = input_template[NF9_ICMP_TYPE].offset;
460 else
461 syslog(LOG_ERR, "Process_v9: Unexpected ICMP type field length: %d \n",
462 input_template[NF9_ICMP_TYPE].length);
463 }
453464
454465 /*
455466 printf("Table %u Flags: %u, index: %u, Zero: %u input_size: %u, output_size: %u\n",
669680 }
670681 } // End for
671682
683 // Ungly ICMP hack for v9, until file version 2 for FNF is implemented
684 if ( ( data_record->prot == IPPROTO_ICMP || data_record->prot == IPPROTO_ICMPV6 ) &&
685 table->ICMP_offset ) { // it's an ICMP record
686 data_record->dstport = ntohs(Get_val16((void *)&in[table->ICMP_offset]));
687 }
688
672689 First = data_record->first;
673690 Last = data_record->last;
674691
10081025 record_length += element_info[NF9_DST_AS].min;
10091026 count++;
10101027
1028 fields->record[count].type = htons(NF9_ICMP_TYPE);
1029 fields->record[count].length = htons(element_info[NF9_ICMP_TYPE].min);
1030 record_length += element_info[NF9_ICMP_TYPE].min;
1031 count++;
1032
10111033 if ( (flags & FLAG_IPV6_ADDR) != 0 ) { // IPv6 addresses
10121034 fields->record[count].type = htons(NF9_IPV6_SRC_ADDR);
10131035 fields->record[count].length = htons(element_info[NF9_IPV6_SRC_ADDR].min);
10661088 static uint32_t last_flags, common_block_size;
10671089 static int record_count, template_count, flowset_count, packet_count;
10681090 uint32_t required_size, t1, t2;
1091 uint16_t icmp;
10691092 void *endwrite;
10701093 time_t now = time(NULL);
10711094
12171240 master_record->srcas = htons(master_record->srcas);
12181241 master_record->dstas = htons(master_record->dstas);
12191242
1243 if ( master_record->prot == IPPROTO_ICMP || master_record->prot == IPPROTO_ICMPV6 ) { // it's an ICMP
1244 icmp = master_record->dstport;
1245 master_record->dstport = 0;
1246 } else {
1247 icmp = 0;
1248 }
1249
12201250 memcpy(peer->writeto, (void *)&master_record->first,common_block_size);
12211251 peer->writeto = (void *)((pointer_addr_t)peer->writeto + common_block_size);
12221252
1253 memcpy(peer->writeto, (void *)&icmp,2);
1254 peer->writeto = (void *)((pointer_addr_t)peer->writeto + 2);
1255
12231256 if ((master_record->flags & FLAG_IPV6_ADDR) != 0 ) { // IPv6
12241257 master_record->v6.srcaddr[0] = htonll(master_record->v6.srcaddr[0]);
12251258 master_record->v6.srcaddr[1] = htonll(master_record->v6.srcaddr[1]);
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nf_common.c 92 2007-08-24 12:10:24Z peter $
32 * $Id: nf_common.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 92 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
732732 static inline void ICMP_Port_decode(master_record_t *r, char *string) {
733733 uint8_t type, code;
734734
735 if ( r->prot == 1 ) { // ICMP
735 if ( r->prot == IPPROTO_ICMP || r->prot == IPPROTO_ICMPV6 ) { // ICMP
736736 type = r->dstport >> 8;
737737 code = r->dstport & 0xFF;
738738 snprintf(string, MAX_STRING_LENGTH-1, "%u.%u", type, code);
3030 *
3131 * $Author: peter $
3232 *
33 * $Id: nfcapd.c 95 2007-10-15 06:05:26Z peter $
33 * $Id: nfcapd.c 97 2008-02-21 09:50:02Z peter $
3434 *
35 * $LastChangedRevision: 95 $
35 * $LastChangedRevision: 97 $
3636 *
3737 *
3838 */
143143
144144 static char Ident[IdentLen];
145145
146 static char const *rcsid = "$Id: nfcapd.c 95 2007-10-15 06:05:26Z peter $";
146 static char const *rcsid = "$Id: nfcapd.c 97 2008-02-21 09:50:02Z peter $";
147147
148148 /* exported fuctions */
149149 void LogError(char *format, ...);
452452 #if 0
453453 // Debug code to read from pcap file
454454 cnt = NextPacket(in_buff, NETWORK_INPUT_BUFF_SIZE);
455 if ( cnt == 0 )
456 done = 1;
455457 #else
456458
457459 cnt = recvfrom (socket, in_buff, NETWORK_INPUT_BUFF_SIZE , 0, NULL, 0);
698700 time_t twin, t_start, t_tmp;
699701 int sock, err, synctime, do_daemonize, expire, report_sequence;
700702 int subdir_index, sampling_rate, compress;
701 char c;
703 int c;
702704
703705 verbose = synctime = do_daemonize = 0;
704706 bufflen = 0;
9292 Print flow statistics from file specified by -r, or timeslot specified by -R/-M.
9393 The printed information corresponds to pre nfdump 1.5 nfcapd stat files.
9494 .TP 3
95 .B -D \fIdns
96 Set \fIdns\fR as nameserver to lookup hostnames.
97 .TP 3
9598 .B -S
9699 Compatibility option with pre 1.4 nfdump. Is equal to \fI-s record/packets/bytes\fR.
97100 .TP 3
459462 .RS 4
460463 \fI[SourceDestination]\fR \fBIP <ipaddr>\fR or
461464 .P
462 \fI[SourceDestination]\fR \fBHOST <ipaddr>\fR with \fI<ipaddr>\fR as any valid IPv4 or IPv6 address.
463 \fIISourceDestination\fR may be omitted.
465 \fI[SourceDestination]\fR \fBHOST <ipaddr>\fR with \fI<ipaddr>\fR as any valid IPv4, IPv6 address, or a full qualified
466 hostname. In case of a hostname, the IP address is looked up in DNS. If more than a single IP address is found,
467 all IP addresses are chained together. ip1 or ip2 or ip3 ...
468 The direction tag \fISourceDestination\fR may be omitted.
464469 .P
465470 \fI[SourceDestination]\fR \fBIP IN\fR [\fB<iplist>\fR]
466471 .P
467472 \fI[SourceDestination]\fR \fBHOST IN\fR [\fB<iplist>\fR]
468473 .P
469 \fBiplist\fR space separated list of individual \fB<ipaddr>\fR
474 \fBiplist\fR space separated list of individual \fB<ipaddr>\fR or full qualified hostnames. In case of a hostname,
475 the IP address is looked up in DNS. If more than a single IP address is found, all IP addresses are put into the list.
470476 .RE
471477 .PD
472478 .TP 4
487493 as a valid IPv4 or IPv6 network and \fInum\fR as maskbits. The number of mask bits must match
488494 the appropriate address familiy IPv4 or IPv6. Networks may be abreviated such as 172.16/16
489495 if they are unambiguous.
496 .RE
497 .PD
498 .TP 4
499 .I ICMP
500 .PD 0
501 .RS 4
502 \fBICMP-TYPE\fR \fInum\fR, \fBICMP-CODE\fR \fInum\fR with \fInum\fR as a valid icmp type/code respectively.
503 This implies automatically \fBPROTO ICMP\fR
490504 .RE
491505 .PD
492506 .TP 4
3131 *
3232 * $Author: peter $
3333 *
34 * $Id: nfdump.c 95 2007-10-15 06:05:26Z peter $
34 * $Id: nfdump.c 98 2008-02-22 09:13:12Z peter $
3535 *
36 * $LastChangedRevision: 95 $
36 * $LastChangedRevision: 98 $
3737 *
3838 *
3939 */
6767 #include "nfprof.h"
6868 #include "nfdump.h"
6969 #include "nfstat.h"
70 #include "ipconv.h"
7071 #include "version.h"
7172 #include "launch.h"
7273 #include "util.h"
8485 FilterEngine_data_t *Engine;
8586
8687 /* Local Variables */
87 static char const *rcsid = "$Id: nfdump.c 95 2007-10-15 06:05:26Z peter $";
88 static char const *rcsid = "$Id: nfdump.c 98 2008-02-22 09:13:12Z peter $";
8889 static uint64_t total_bytes;
8990 static uint32_t total_flows;
9091 static uint32_t skipped_records;
210211 "-f\t\tread netflow filter from file\n"
211212 "-n\t\tDefine number of top N. \n"
212213 "-c\t\tLimit number of records to display\n"
214 "-D <dns>\tUse nameserver <dns> for host lookup.\n"
213215 "-S\t\tGenerate netflow statistics info.\n"
214216 "-s <expr>[/<order>]\tGenerate statistics for <expr>: \n"
215217 "-N\t\tPrint plain numbers in summary line\n"
225227 "-M <expr>\tRead input from multiple directories.\n"
226228 "-I \t\tPrint netflow summary statistics info from file, specified by -r.\n"
227229 "\t\t/dir/dir1:dir2:dir3 Read the same files from '/dir/dir1' '/dir/dir2' and '/dir/dir3'.\n"
228 "\t\treqquests either -r filename or -R firstfile:lastfile without pathnames\n"
230 "\t\trequests either -r filename or -R firstfile:lastfile without pathnames\n"
229231 "-m\t\tPrint netflow data date sorted. Only useful with -M\n"
230232 "-R <expr>\tRead input from sequence of files.\n"
231233 "\t\t/any/dir Read all files in that directory.\n"
773775 stat_record_t sum_stat, *sr;
774776 printer_t print_header, print_record;
775777 nfprof_t profile_data;
776 char c, *rfile, *Rfile, *Mdirs, *wfile, *ffile, *filter, *tstring, *stat_type;
778 char *rfile, *Rfile, *Mdirs, *wfile, *ffile, *filter, *tstring, *stat_type;
777779 char *byte_limit_string, *packet_limit_string, *print_mode, *record_header;
778 char *order_by, *query_file, *UnCompress_file, CryptoPAnKey[32];
779 int ffd, ret, element_stat, fdump;
780 char *order_by, *query_file, *UnCompress_file, *nameserver, CryptoPAnKey[32];
781 int c, ffd, ret, element_stat, fdump;
780782 int i, user_format, quiet, flow_stat, topN, aggregate, aggregate_mask;
781783 int print_stat, syntax_only, date_sorted, do_anonymize, do_tag, compress;
782784 int plain_numbers, pipe_output;
808810 compress = 0;
809811 plain_numbers = 0;
810812 pipe_output = 0;
813 nameserver = NULL;
811814
812815 print_mode = NULL;
813816 print_header = NULL;
823826
824827 for ( i=0; i<AGGR_SIZE; AggregateMasks[i++] = 0 ) ;
825828
826 while ((c = getopt(argc, argv, "6aA:c:Ss:hn:i:j:f:qzr:v:w:K:M:NImO:R:XZt:TVv:l:L:o:")) != EOF) {
829 while ((c = getopt(argc, argv, "6aA:c:D:Ss:hn:i:j:f:qzr:v:w:K:M:NImO:R:XZt:TVv:l:L:o:")) != EOF) {
827830 switch (c) {
828831 case 'h':
829832 usage(argv[0]);
838841 exit(255);
839842 }
840843 aggregate_mask = 1;
844 break;
845 case 'D':
846 nameserver = optarg;
847 if ( !set_nameserver(nameserver) ) {
848 exit(255);
849 }
841850 break;
842851 case 'X':
843852 fdump = 1;
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nfdump.h 95 2007-10-15 06:05:26Z peter $
32 * $Id: nfdump.h 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 95 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
4545 #include "config.h"
4646
4747 typedef struct FilterParam {
48 uint32_t scale;
4948 uint16_t comp;
5049 uint16_t direction;
51 uint16_t proto;
5250 uint32_t data;
53 uint64_t ip[2];
54 uint32_t netmask;
55 uint32_t netbits;
5651 uint32_t self;
5752 } FilterParam_t;
5853
7166
7267 void lex_init(char *buf);
7368
69 int ScreenIPString(char *string);
70
71 int ScreenIdentString(char *string);
72
7473 // Insert the RB prototypes here
7574 RB_PROTOTYPE(IPtree, IPListNode, entry, IPNodeCMP);
7675
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nfexpire.c 92 2007-08-24 12:10:24Z peter $
32 * $Id: nfexpire.c 98 2008-02-22 09:13:12Z peter $
3333 *
34 * $LastChangedRevision: 92 $
34 * $LastChangedRevision: 98 $
3535 *
3636 */
3737
8888 "-r datadir\tRescan data directory\n"
8989 "-u datadir\tUpdate expire params from collector logging at <datadir>\n"
9090 "-s size\t\tmax size: scales b bytes, k kilo, m mega, g giga t tera\n"
91 "-t lifetime\tmaximun life time of data: scales: w week, d day, H hour, M minute\n"
91 "-t lifetime\tmaximum life time of data: scales: w week, d day, H hour, M minute\n"
9292 "-w watermark\tlow water mark in %% for expire.\n"
9393 , name);
9494
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nffile.c 95 2007-10-15 06:05:26Z peter $
32 * $Id: nffile.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 95 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
240240 return fd;
241241 }
242242 #endif
243 snprintf(error_string, ERR_SIZE, "Open file '%s': bad magic: 0x%X\n", filename, FileHeader.magic );
243 snprintf(error_string, ERR_SIZE, "Open file '%s': bad magic: 0x%X\n", filename ? filename : "<stdin>", FileHeader.magic );
244244 error_string[ERR_SIZE-1] = 0;
245245 *err = error_string;
246246 ZeroStat();
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nffile.h 95 2007-10-15 06:05:26Z peter $
33 *
34 * $LastChangedRevision: 95 $
32 * $Id: nffile.h 97 2008-02-21 09:50:02Z peter $
33 *
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
254254 #define MaskSrcPort 0x00000000ffff0000LL
255255 #define ShiftDstPort 0
256256 #define ShiftSrcPort 16
257 #define MaskICMPtype 0x000000000000ff00LL
258 #define MaskICMPcode 0x00000000000000ffLL
259 #define ShiftICMPcode 0
260 #define ShiftICMPtype 8
257261
258262 #define OffsetAS 4
259263 #define MaskDstAS 0x0000ffff00000000LL
317321 #define MaskSrcPort 0x0000ffff00000000LL
318322 #define ShiftDstPort 48
319323 #define ShiftSrcPort 32
324 #define MaskICMPtype 0xff00000000000000LL
325 #define MaskICMPcode 0x00ff000000000000LL
326 #define ShiftICMPcode 48
327 #define ShiftICMPtype 56
320328
321329 #define OffsetAS 4
322330 #define MaskDstAS 0x00000000ffff0000LL
3030 *
3131 * $Author: peter $
3232 *
33 * $Id: nfgen.c 92 2007-08-24 12:10:24Z peter $
33 * $Id: nfgen.c 97 2008-02-21 09:50:02Z peter $
3434 *
35 * $LastChangedRevision: 92 $
35 * $LastChangedRevision: 97 $
3636 *
3737 */
3838
170170
171171
172172 int main( int argc, char **argv ) {
173 char c;
173 int c;
174174 data_block_header_t *nf_header;
175175 file_header_t *file_header;
176176 size_t len;
203203
204204 numrecords = 0;
205205 // src_ip dst_ip, src_port, dst_port, proto, tcp_flags, tos, packets, bytes, src_as, dst_as
206 writeto = GenRecord(PF_INET, writeto, "172.16.1.66", "192.168.170.100", 1024, 25, 6, 0, 0, 101, 101, 775, 8404);
207 numrecords++;
208 writeto = GenRecord(PF_INET, writeto, "172.16.2.66", "192.168.170.101", 1024, 25, 6, 0, 0, 101, 101, 775, 8404);
209 numrecords++;
210 writeto = GenRecord(PF_INET, writeto, "172.16.3.66", "192.168.170.102", 1024, 25, 6, 0, 0, 101, 101, 775, 8404);
211 numrecords++;
212 writeto = GenRecord(PF_INET, writeto, "172.16.4.66", "192.168.170.103", 2024, 25, 17, 1, 1, 1001, 1001, 775, 8404);
206 writeto = GenRecord(PF_INET, writeto, "172.16.1.66", "192.168.170.100", 1024, 25, IPPROTO_TCP, 0, 0, 101, 101, 775, 8404);
207 numrecords++;
208 writeto = GenRecord(PF_INET, writeto, "172.16.2.66", "192.168.170.101", 1024, 25, IPPROTO_TCP, 0, 0, 101, 101, 775, 8404);
209 numrecords++;
210 writeto = GenRecord(PF_INET, writeto, "172.16.3.66", "192.168.170.102", 1024, 25, IPPROTO_TCP, 0, 0, 101, 101, 775, 8404);
211 numrecords++;
212 writeto = GenRecord(PF_INET, writeto, "172.16.4.66", "192.168.170.103", 2024, 25, IPPROTO_UDP, 1, 1, 1001, 1001, 775, 8404);
213213 numrecords++;
214214 writeto = GenRecord(PF_INET, writeto, "172.16.5.66", "192.168.170.104", 3024, 25, 51, 2, 2, 10001, 10001, 775, 8404);
215215 numrecords++;
216 writeto = GenRecord(PF_INET, writeto, "172.16.6.66", "192.168.170.105", 4024, 25, 6, 4, 3, 100001, 100001, 775, 8404);
217 numrecords++;
218 writeto = GenRecord(PF_INET, writeto, "172.16.7.66", "192.168.170.106", 5024, 25, 6, 8, 4, 1000001, 1000001, 775, 8404);
219 numrecords++;
220 writeto = GenRecord(PF_INET, writeto, "172.16.8.66", "192.168.170.107", 5024, 25, 6, 1, 4, 10000010, 1001, 775, 8404);
221 numrecords++;
222 writeto = GenRecord(PF_INET, writeto, "172.16.9.66", "192.168.170.108", 6024, 25, 6, 16, 5, 500, 10000001, 775, 8404);
223 numrecords++;
224 writeto = GenRecord(PF_INET, writeto, "172.16.10.66", "192.168.170.109", 6024, 25, 6, 16, 5, 500, 10000001, 775, 8404);
225 numrecords++;
226 writeto = GenRecord(PF_INET, writeto, "172.16.11.66", "192.168.170.110", 7024, 25, 6, 32, 255, 5000, 100000001, 775, 8404);
227 numrecords++;
228 writeto = GenRecord(PF_INET, writeto, "172.16.12.66", "192.168.170.111", 8024, 25, 6, 63, 0, 5000, 1000000001, 775, 8404);
216 writeto = GenRecord(PF_INET, writeto, "172.16.6.66", "192.168.170.105", 4024, 25, IPPROTO_TCP, 4, 3, 100001, 100001, 775, 8404);
217 numrecords++;
218 writeto = GenRecord(PF_INET, writeto, "172.16.7.66", "192.168.170.106", 5024, 25, IPPROTO_TCP, 8, 4, 1000001, 1000001, 775, 8404);
219 numrecords++;
220 writeto = GenRecord(PF_INET, writeto, "172.16.8.66", "192.168.170.107", 5024, 25, IPPROTO_TCP, 1, 4, 10000010, 1001, 775, 8404);
221 numrecords++;
222 writeto = GenRecord(PF_INET, writeto, "172.16.9.66", "192.168.170.108", 6024, 25, IPPROTO_TCP, 16, 5, 500, 10000001, 775, 8404);
223 numrecords++;
224 writeto = GenRecord(PF_INET, writeto, "172.16.10.66", "192.168.170.109", 6024, 25, IPPROTO_TCP, 16, 5, 500, 10000001, 775, 8404);
225 numrecords++;
226 writeto = GenRecord(PF_INET, writeto, "172.16.11.66", "192.168.170.110", 7024, 25, IPPROTO_TCP, 32, 255, 5000, 100000001, 775, 8404);
227 numrecords++;
228 writeto = GenRecord(PF_INET, writeto, "172.16.12.66", "192.168.170.111", 8024, 25, IPPROTO_TCP, 63, 0, 5000, 1000000001, 775, 8404);
229229 numrecords++;
230230 writeto = GenRecord(PF_INET, writeto, "172.16.13.66", "192.168.170.112", 0, 8, 1, 0, 0, 50000, 50000, 775, 8404);
231231 numrecords++;
232 writeto = GenRecord(PF_INET, writeto, "172.160.160.166", "172.160.160.180", 10024, 25000, 6, 0, 0, 500000, 500000, 775, 8404);
233 numrecords++;
234
235 writeto = GenRecord(PF_INET6, writeto, "fe80::2110:abcd:1234:0", "fe80::2110:abcd:1235:4321", 1024, 25, 6, 27, 0, 10, 15100, 775, 8404);
236 numrecords++;
237 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, 6, 27, 0, 10100, 15000000, 775, 8404);
232 writeto = GenRecord(PF_INET, writeto, "172.160.160.166", "172.160.160.180", 10024, 25000, IPPROTO_TCP, 0, 0, 500000, 500000, 775, 8404);
233 numrecords++;
234
235 writeto = GenRecord(PF_INET6, writeto, "fe80::2110:abcd:1234:0", "fe80::2110:abcd:1235:4321", 1024, 25, IPPROTO_TCP, 27, 0, 10, 15100, 775, 8404);
236 numrecords++;
237 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, IPPROTO_TCP, 27, 0, 10100, 15000000, 775, 8404);
238238 numrecords++;
239239
240240 // flows with 64 bit counters
241 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, 6, 27, 0, 10100000, 0x100000000LL, 775, 8404);
242 numrecords++;
243 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, 6, 27, 0, 0x100000000LL, 15000000, 775, 8404);
244 numrecords++;
245 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, 6, 27, 0, 0x100000000LL, 0x200000000LL, 775, 8404);
246 numrecords++;
247
248 writeto = GenRecord(PF_INET, writeto, "172.16.14.18", "192.168.170.113", 10240, 52345, 6, 27, 0, 10100000, 0x100000000LL, 775, 8404);
249 numrecords++;
250 writeto = GenRecord(PF_INET, writeto, "172.16.15.18", "192.168.170.114", 10240, 52345, 6, 27, 0, 0x100000000LL, 15000000, 775, 8404);
251 numrecords++;
252 writeto = GenRecord(PF_INET, writeto, "172.16.16.18", "192.168.170.115", 10240, 52345, 6, 27, 0, 0x100000000LL, 0x200000000LL, 775, 8404);
241 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, IPPROTO_TCP, 27, 0, 10100000, 0x100000000LL, 775, 8404);
242 numrecords++;
243 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, IPPROTO_TCP, 27, 0, 0x100000000LL, 15000000, 775, 8404);
244 numrecords++;
245 writeto = GenRecord(PF_INET6, writeto, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5", 10240, 52345, IPPROTO_TCP, 27, 0, 0x100000000LL, 0x200000000LL, 775, 8404);
246 numrecords++;
247
248 writeto = GenRecord(PF_INET, writeto, "172.16.14.18", "192.168.170.113", 10240, 52345, IPPROTO_TCP, 27, 0, 10100000, 0x100000000LL, 775, 8404);
249 numrecords++;
250 writeto = GenRecord(PF_INET, writeto, "172.16.15.18", "192.168.170.114", 10240, 52345, IPPROTO_TCP, 27, 0, 0x100000000LL, 15000000, 775, 8404);
251 numrecords++;
252 writeto = GenRecord(PF_INET, writeto, "172.16.16.18", "192.168.170.115", 10240, 52345, IPPROTO_TCP, 27, 0, 0x100000000LL, 0x200000000LL, 775, 8404);
253253 numrecords++;
254254
255255 nf_header->NumBlocks = numrecords;
3131 *
3232 * $Author: peter $
3333 *
34 * $Id: nfprofile.c 95 2007-10-15 06:05:26Z peter $
34 * $Id: nfprofile.c 98 2008-02-22 09:13:12Z peter $
3535 *
36 * $LastChangedRevision: 95 $
36 * $LastChangedRevision: 98 $
3737 *
3838 */
3939
6363 #include "nffile.h"
6464 #include "nfstat.h"
6565 #include "nfstatfile.h"
66 #include "ipconv.h"
6667 #include "flist.h"
6768 #include "util.h"
6869 #include "profile.h"
6970
7071 /* Local Variables */
71 static char const *rcsid = "$Id: nfprofile.c 95 2007-10-15 06:05:26Z peter $";
72 static char const *rcsid = "$Id: nfprofile.c 98 2008-02-22 09:13:12Z peter $";
7273
7374 /* exported fuctions */
7475 void LogError(char *format, ...);
8687 printf("usage %s [options] \n"
8788 "-h\t\tthis text you see right here\n"
8889 "-V\t\tPrint version and exit.\n"
90 "-D <dns>\tUse nameserver <dns> for host lookup.\n"
8991 "-M <expr>\tRead input from multiple directories.\n"
9092 "-r\t\tread input from file\n"
9193 "-f\t\tfilename with filter syntaxfile\n"
493495 unsigned int num_channels, compress;
494496 struct stat stat_buf;
495497 profile_param_info_t *profile_list;
496 char c, *rfile, *ffile, *filename, *Mdirs, *tstring;
497 char *profile_datadir, *profile_statdir;
498 int syntax_only, subdir_index, stdin_profile_params;;
498 char *rfile, *ffile, *filename, *Mdirs, *tstring;
499 char *profile_datadir, *profile_statdir, *nameserver;
500 int c, syntax_only, subdir_index, stdin_profile_params;;
499501 time_t tslot;
500502
501503 tstring = NULL;
507509 compress = 0;
508510 subdir_index = 0;
509511 profile_list = NULL;
512 nameserver = NULL;
510513 stdin_profile_params = 0;
511514
512515 // default file names
513516 ffile = "filter.txt";
514517 rfile = NULL;
515 while ((c = getopt(argc, argv, "Ip:P:hf:r:n:M:S:t:VzZ")) != EOF) {
518 while ((c = getopt(argc, argv, "D:Ip:P:hf:r:n:M:S:t:VzZ")) != EOF) {
516519 switch (c) {
517520 case 'h':
518521 usage(argv[0]);
519522 exit(0);
523 break;
524 case 'D':
525 nameserver = optarg;
526 if ( !set_nameserver(nameserver) ) {
527 exit(255);
528 }
520529 break;
521530 case 'I':
522531 stdin_profile_params = 1;
3030 *
3131 * $Author: peter $
3232 *
33 * $Id: nfreplay.c 95 2007-10-15 06:05:26Z peter $
33 * $Id: nfreplay.c 99 2008-02-22 09:33:19Z peter $
3434 *
35 * $LastChangedRevision: 95 $
35 * $LastChangedRevision: 99 $
3636 *
3737 */
3838
8585 int verbose;
8686
8787 /* Local Variables */
88 static char const *rcsid = "$Id: nfreplay.c 95 2007-10-15 06:05:26Z peter $";
88 static char const *rcsid = "$Id: nfreplay.c 99 2008-02-22 09:33:19Z peter $";
8989
9090 send_peer_t peer;
9191
110110 "-h\t\tthis text you see right here\n"
111111 "-V\t\tPrint version and exit.\n"
112112 "-H <Host/ip>\tTarget IP address default: 127.0.0.1\n"
113 "-j <mcast>\tSend packets to multcast group\n"
113 "-j <mcast>\tSend packets to multicast group\n"
114114 "-4\t\tForce IPv4 protocol.\n"
115115 "-6\t\tForce IPv6 protocol.\n"
116116 "-p <port>\tTarget port default 9995\n"
119119 "-b <bsize>\tSend buffer size.\n"
120120 "-r <input>\tread from file. default: stdin\n"
121121 "-f <filter>\tfilter syntaxfile\n"
122 "-t <time>\ttime window for sendiing packets\n"
122 "-t <time>\ttime window for sending packets\n"
123123 "\t\tyyyy/MM/dd.hh:mm:ss[-yyyy/MM/dd.hh:mm:ss]\n"
124124 , name);
125125 } /* usage */
414414 rfile = ffile = filter = tstring = NULL;
415415 t_start = t_end = 0;
416416
417 peer.hostname = DEFAULTHOSTNAME;
417 peer.hostname = NULL;
418418 peer.port = DEFAULTCISCOPORT;
419419 peer.mcast = 0;
420420 peer.family = AF_UNSPEC;
518518 filter = argv[optind];
519519 }
520520
521 if ( peer.hostname == NULL )
522 peer.hostname = DEFAULTHOSTNAME;
523
521524 if ( !filter && ffile ) {
522525 if ( stat(ffile, &stat_buff) ) {
523526 perror("Can't stat file");
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nfstatfile.c 92 2007-08-24 12:10:24Z peter $
32 * $Id: nfstatfile.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 92 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
8282 #define STACK_BLOCK_SIZE 32
8383
8484 static int stack_max_entries = 0;
85 static int stack_num_entries = 0;
8685 static dirstat_env_t *dirstat_stack = NULL;
8786
8887 static const double _1K = 1024.0;
242241 struct stat filestat;
243242 char *in_buff, *s, *p, *k, *v;
244243 char filename[MAXPATHLEN];
245 int fd, err, r_size, new_created;
244 int fd, err, r_size, new_created, next_free;
246245
247246 new_created = 0;
248247 *dirstat_p = NULL;
249248
250249 // if the dirstack does not exist, creat it
251250 if ( !dirstat_stack ) {
251 int i;
252252 dirstat_stack = (dirstat_env_t *)malloc(STACK_BLOCK_SIZE * sizeof(dirstat_env_t));
253253 if ( !dirstat_stack ) {
254254 LogError("malloc() error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
255255 return ERR_FAIL;
256256 }
257 for ( i=0; i<STACK_BLOCK_SIZE; i++ ) {
258 dirstat_stack[i].dirstat = NULL;
259 }
257260 stack_max_entries = STACK_BLOCK_SIZE;
258 stack_num_entries = 0;
259 }
261 }
262
263 // search for next free slot
264 next_free = 0;
265 while ( next_free < stack_max_entries && (dirstat_stack[next_free].dirstat != NULL) )
266 next_free++;
260267
261268 // if too many entries exist, expand the stack
262 if ( stack_num_entries >= stack_max_entries ) {
269 if ( next_free >= stack_max_entries ) {
263270 dirstat_env_t *tmp;
271 int i;
264272 tmp = realloc((void *)dirstat_stack, (stack_max_entries+STACK_BLOCK_SIZE) * sizeof(dirstat_env_t));
265273 if ( !tmp ) {
266274 LogError("ralloc() error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
267275 return ERR_FAIL;
268276 }
269277 dirstat_stack = tmp;
278 for ( i=stack_max_entries; i<stack_max_entries+STACK_BLOCK_SIZE; i++ ) {
279 dirstat_stack[i].dirstat = NULL;
280 }
281 next_free = stack_max_entries;
270282 stack_max_entries += STACK_BLOCK_SIZE;
271283 }
272284
273 dirstat_stack[stack_num_entries].dirstat = (dirstat_t *)malloc(sizeof(dirstat_t));
274 if ( !dirstat_stack[stack_num_entries].dirstat ) {
285 dirstat_stack[next_free].dirstat = (dirstat_t *)malloc(sizeof(dirstat_t));
286 if ( !dirstat_stack[next_free].dirstat ) {
275287 LogError("malloc() error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
276288 return ERR_FAIL;
277289 }
280292 snprintf(filename, MAXPATHLEN-1, "%s/%s", dirname, stat_filename);
281293 filename[MAXPATHLEN-1] = '\0';
282294
283 memset((void *)dirstat_stack[stack_num_entries].dirstat, 0, sizeof(dirstat_t));
295 memset((void *)dirstat_stack[next_free].dirstat, 0, sizeof(dirstat_t));
284296 memset((void *)&dirstat_tmpl, 0, sizeof(dirstat_t));
285297 dirstat_tmpl.low_water = 95; // defaults to 95%
286298 dirstat_tmpl.status = FORCE_REBUILD; // in case status is not set -> fishy
287 *dirstat_p = dirstat_stack[stack_num_entries].dirstat;
288 dirstat_stack[stack_num_entries].fd = 0;
289 dirstat_stack[stack_num_entries].filename = strdup(filename);
299 *dirstat_p = dirstat_stack[next_free].dirstat;
300 dirstat_stack[next_free].fd = 0;
301 dirstat_stack[next_free].filename = strdup(filename);
290302
291303
292304 fd = open(filename, O_RDWR, 0);
293305 if ( fd < 0 ) {
294306 if ( errno == ENOENT ) {
295307 if ( lock == READ_ONLY || lock == LOCK_IF_EXISTS) { // no lock need
296 stack_num_entries++; // return empty stat entry
297308 return ERR_NOSTATFILE;
298309 } else { // create the file, to and lock the file
299310 fd = open(filename, O_RDWR|O_TRUNC|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
300311 if ( fd < 0 ) {
301312 LogError("open() error on '%s' in %s line %d: %s\n", filename, __FILE__, __LINE__, strerror(errno) );
302 free(dirstat_stack[stack_num_entries].dirstat);
303 dirstat_stack[stack_num_entries].dirstat = NULL;
313 free(dirstat_stack[next_free].dirstat);
314 dirstat_stack[next_free].dirstat = NULL;
304315 return ERR_FAIL;
305316 }
306317 err = SetFileLock(fd);
307318 if ( err != 0 ) {
308319 LogError("ioctl(F_WRLCK) error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
309320 close(fd);
310 free(dirstat_stack[stack_num_entries].dirstat);
311 dirstat_stack[stack_num_entries].dirstat = NULL;
321 free(dirstat_stack[next_free].dirstat);
322 dirstat_stack[next_free].dirstat = NULL;
312323 return ERR_FAIL;
313324 }
314 dirstat_stack[stack_num_entries].fd = fd;
315 stack_num_entries++; // return empty stat entry
325 dirstat_stack[next_free].fd = fd;
316326 return ERR_NOSTATFILE;
317327 }
318328 } else {
319329 LogError("open() error on '%s' in %s line %d: %s\n", filename, __FILE__, __LINE__, strerror(errno) );
320 free(dirstat_stack[stack_num_entries].dirstat);
321 dirstat_stack[stack_num_entries].dirstat = NULL;
330 free(dirstat_stack[next_free].dirstat);
331 dirstat_stack[next_free].dirstat = NULL;
322332 return ERR_FAIL;
323333 }
324334 }
327337 if ( err != 0 ) {
328338 LogError("ioctl(F_WRLCK) error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
329339 close(fd);
330 free(dirstat_stack[stack_num_entries].dirstat);
331 dirstat_stack[stack_num_entries].dirstat = NULL;
340 free(dirstat_stack[next_free].dirstat);
341 dirstat_stack[next_free].dirstat = NULL;
332342 return ERR_FAIL;
333343 }
334344
338348 LogError("File size error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
339349 ReleaseFileLock(fd);
340350 close(fd);
341 free(dirstat_stack[stack_num_entries].dirstat);
342 dirstat_stack[stack_num_entries].dirstat = NULL;
351 free(dirstat_stack[next_free].dirstat);
352 dirstat_stack[next_free].dirstat = NULL;
343353 return ERR_FAIL;
344354 }
345355
348358 LogError("mallow() error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
349359 ReleaseFileLock(fd);
350360 close(fd);
351 free(dirstat_stack[stack_num_entries].dirstat);
352 dirstat_stack[stack_num_entries].dirstat = NULL;
361 free(dirstat_stack[next_free].dirstat);
362 dirstat_stack[next_free].dirstat = NULL;
353363 return ERR_FAIL;
354364 }
355365
359369 ReleaseFileLock(fd);
360370 close(fd);
361371 free(in_buff);
362 free(dirstat_stack[stack_num_entries].dirstat);
363 dirstat_stack[stack_num_entries].dirstat = NULL;
372 free(dirstat_stack[next_free].dirstat);
373 dirstat_stack[next_free].dirstat = NULL;
364374 return ERR_FAIL;
365375 }
366376 in_buff[filestat.st_size] = '\0';
370380 ReleaseFileLock(fd);
371381 close(fd);
372382 free(in_buff);
373 free(dirstat_stack[stack_num_entries].dirstat);
374 dirstat_stack[stack_num_entries].dirstat = NULL;
383 free(dirstat_stack[next_free].dirstat);
384 dirstat_stack[next_free].dirstat = NULL;
375385 return ERR_FAIL;
376386 }
377387
379389 ReleaseFileLock(fd);
380390 close(fd);
381391 } else {
382 dirstat_stack[stack_num_entries].fd = fd;
392 dirstat_stack[next_free].fd = fd;
383393 }
384394
385395 p = in_buff;
419429 p++;
420430 }
421431 VerifyStatInfo(&dirstat_tmpl);
422 *dirstat_stack[stack_num_entries].dirstat = dirstat_tmpl;
423 stack_num_entries++;
432 *dirstat_stack[next_free].dirstat = dirstat_tmpl;
424433
425434 free(in_buff);
426435 return dirstat_tmpl.status;
432441 char *filename, line[256];
433442
434443 // search for entry in dirstat stack
435 for (i=0; dirstat_stack[i].dirstat != dirstat && i < stack_num_entries; i++ ) {}
436
437 if ( i >= stack_num_entries ) {
438 LogError( "No such dirstat entry\n");
444 for (i=0; dirstat_stack[i].dirstat != dirstat && i < stack_max_entries; i++ ) {}
445
446 if ( i >= stack_max_entries ) {
447 LogError( "WriteStatInfo(): dirstat entry not found in %s line %d\n", __FILE__, __LINE__ );
439448 return ERR_FAIL;
440449 }
441450
490499 return STATFILE_OK;
491500
492501 } // End of WriteStatInfo
502
503 int ReleaseStatInfo(dirstat_t *dirstat) {
504 int i, index;
505
506 // search for entry in dirstat stack
507 for (i=0; dirstat_stack[i].dirstat != dirstat && i < stack_max_entries; i++ ) {}
508
509 if ( i >= stack_max_entries ) {
510 LogError( "ReleaseStatInfo() error in %s line %d: %s\n", __FILE__, __LINE__, "dirstat entry not found" );
511 return ERR_FAIL;
512 }
513
514 index = i;
515 if ( dirstat_stack[index].filename == NULL ) {
516 LogError( "ReleaseStatInfo() error in %s line %d: %s\n", __FILE__, __LINE__, "Attempted to free NULL pointer" );
517 return ERR_FAIL;
518 }
519 free(dirstat_stack[index].filename);
520
521 free(dirstat_stack[index].dirstat);
522 dirstat_stack[index].dirstat = NULL;
523
524 return 0;
525
526 } // End of ReleaseStatInfo
493527
494528 void PrintDirStat(dirstat_t *dirstat) {
495529 struct tm *ts;
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nfstatfile.h 77 2006-06-14 14:52:25Z peter $
32 * $Id: nfstatfile.h 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 77 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
7171
7272 int WriteStatInfo(dirstat_t *dirstat);
7373
74 int ReleaseStatInfo(dirstat_t *dirstat);
75
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nftest.c 95 2007-10-15 06:05:26Z peter $
32 * $Id: nftest.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 95 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
6767
6868 FilterEngine_data_t *Engine;
6969
70 #define ICMP 1
7071 #define TCP 6
7172 #define UDP 17
7273
298299 flow_record.prot = TCP;
299300 ret = check_filter_block("any", &flow_record, 1);
300301 ret = check_filter_block("not any", &flow_record, 0);
301 ret = check_filter_block("tcp", &flow_record, 1);
302302 ret = check_filter_block("proto tcp", &flow_record, 1);
303303 ret = check_filter_block("proto udp", &flow_record, 0);
304304 flow_record.prot = UDP;
315315 ret = check_filter_block("proto gre", &flow_record, 1);
316316 ret = check_filter_block("proto 47", &flow_record, 1);
317317 ret = check_filter_block("proto 42", &flow_record, 0);
318
319 flow_record.prot = 1;
320 flow_record.dstport = 250; // -> icmp code 250
321 ret = check_filter_block("icmp-code 250", &flow_record, 1);
322 ret = check_filter_block("icmp-code 251", &flow_record, 0);
323 flow_record.dstport = 3 << 8; // -> icmp type 8
324 ret = check_filter_block("icmp-type 3", &flow_record, 1);
325 ret = check_filter_block("icmp-type 4", &flow_record, 0);
326
318327
319328 inet_pton(PF_INET6, "fe80::2110:abcd:1234:5678", flow_record.v6.srcaddr);
320329 inet_pton(PF_INET6, "fe80::1104:fedc:4321:8765", flow_record.v6.dstaddr);
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: nftree.c 95 2007-10-15 06:05:26Z peter $
32 * $Id: nftree.c 97 2008-02-21 09:50:02Z peter $
3333 *
34 * $LastChangedRevision: 95 $
34 * $LastChangedRevision: 97 $
3535 *
3636 */
3737
5151 #include "nfdump.h"
5252 #include "nffile.h"
5353 #include "nf_common.h"
54 #include "ipconv.h"
5455 #include "nftree.h"
5556 #include "grammar.h"
5657 /*
9697 {NULL, NULL}
9798 };
9899
100 uint64_t *IPstack = NULL;
99101 uint32_t StartNode;
100102 uint16_t Extended;
101103
158160 if ( !FilterSyntax )
159161 return NULL;
160162
163 IPstack = (uint64_t *)malloc(16 * MAXHOSTS);
164 if ( !IPstack ) {
165 fprintf(stderr, "Memory allocation error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
166 exit(255);
167 }
168
161169 InitTree();
162170 lex_init(FilterSyntax);
163171 ret = yyparse();
164 lex_cleanup();
165172 if ( ret != 0 ) {
166173 return NULL;
167174 }
175 lex_cleanup();
176 free(IPstack);
177
168178 engine = malloc(sizeof(FilterEngine_data_t));
169179 if ( !engine ) {
170180 fprintf(stderr, "Memory allocation error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
2929 *
3030 * $Author: peter $
3131 *
32 * $Id: scanner.l 92 2007-08-24 12:10:24Z peter $
33 *
34 * $LastChangedRevision: 92 $
32 * $Id: scanner.l 97 2008-02-21 09:50:02Z peter $
33 *
34 * $LastChangedRevision: 97 $
3535 *
3636 *
3737 *
4646 #include <stdlib.h>
4747 #include <string.h>
4848 #include <limits.h>
49 #include <ctype.h>
4950
5051 #ifdef HAVE_STDINT_H
5152 #include <stdint.h>
6667 #define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++)
6768 #endif
6869
69 static void ProtoDepreciated(char *s);
70
7170 %}
7271
7372 N [0-9]+
7978 yylval.value = (uint64_t) strtoull(yytext,NULL,10);
8079 return NUMBER;
8180 }
82 [0-9A-Fa-f:][0-9A-Fa-f\.:]+[0-9A-Fa-f:] {
83 yylval.s = strdup(yytext);
84 return IPSTRING;
81
82 [0-9]+[kmgt]{0,1} {
83 size_t len = strlen(yytext);
84 switch (yytext[len-1]) {
85 case 'k':
86 yylval.value = 1024LL * (uint64_t) strtoull(yytext,NULL,10);
87 break;
88 case 'm':
89 yylval.value = 1024LL * 1024LL * (uint64_t) strtoull(yytext,NULL,10);
90 break;
91 case 'g':
92 yylval.value = 1024LL * 1024LL * 1024LL * (uint64_t) strtoull(yytext,NULL,10);
93 break;
94 case 't':
95 yylval.value = 1024LL * 1024LL * 1024LL * 1024LL * (uint64_t) strtoull(yytext,NULL,10);
96 break;
97 default:
98 yylval.value = (uint64_t) strtoull(yytext,NULL,10);
99 }
100 return NUMBER;
85101 }
86 ident[ \t]+[a-zA-Z0-9_\-]+ {
87 char *p = &(yytext[5]);
88 while ( *p == ' ' || *p == '\t' ) p++;
89 yylval.s = strdup(p);
90 return IDENT;
91 }
92 proto[ \t]+[a-zA-Z0-9_+\-:]+ {
93 char *p = &(yytext[5]);
94 while ( *p == ' ' || *p == '\t' ) p++;
95 yylval.s = strdup(p);
96 return PROTOSTR;
97 }
102
98103 any { return ANY; }
99104 ip|host { return IP; }
105 hostname { return HOSTNAME; }
100106 if { return IF; }
101107 in { return IN; }
108 ident { return IDENT; }
102109 out { return OUT; }
103110
104 tcp|udp|icmp { yylval.s = strdup(yytext); ProtoDepreciated(yylval.s); return PROTOSTR; }
105 gre|esp|ah|rsvp { yylval.s = strdup(yytext); ProtoDepreciated(yylval.s); return PROTOSTR; }
106
107111 flags { return FLAGS; }
112 proto { return PROTO; }
108113 tos { return TOS; }
109114 net { return NET; }
110115 port { return PORT; }
117122 duration { return DURATION; }
118123 ipv4|inet { return IPV4; }
119124 ipv6|inet6 { return IPV6; }
125 icmp-type { return ICMP_TYPE; }
126 icmp-code { return ICMP_CODE; }
120127 and|"&&" { return AND; }
121128 or|"||" { return OR; }
122129 not|"!" { return NOT; }
127134 dst { return DST; }
128135 #.* { ; }
129136 [ \t] { ; }
130 [FSRPAUX]+ {
131 yylval.s = strdup(yytext);
132 return ALPHA_FLAGS;
137
138 [a-zA-Z0-9_:\.\-]+ {
139 yylval.s = strdup(yytext);
140 return STRING;
133141 }
134142 \n { lineno++; }
135143 . { return yytext[0]; }
159167 return 1;
160168 }
161169
162 static void ProtoDepreciated(char *s) {
163 fprintf(stderr, "Syntax '%s' depreciated. Use 'proto %s' instead\n", s, s);
164 } // End of Protodepreciated
165
170 int ScreenIPString(char *string) {
171 char *c;
172
173 // [0-9A-Fa-f:][0-9A-Fa-f\.:]+[0-9A-Fa-f:] {
174 int len = strlen(string);
175 if ( len < 3 || len > 39 )
176 return 0;
177
178 if ( !isxdigit(string[0]) )
179 return 0;
180
181 c = &string[1];
182 while ( *c ) {
183 if ( *c != '.' || *c != ':' || !isxdigit(*c) )
184 return 0;
185 c++;
186 }
187 return 1;
188
189 } // End of ScreenString
190
191 int ScreenIdentString(char *string) {
192 char *c;
193
194 // ident[a-zA-Z0-9_\-]+ {
195 int len = strlen(string);
196 if ( len == 0 || len > 255 )
197 return 0;
198
199 c = &string[0];
200 while ( *c ) {
201 if ( *c != '_' && *c != '-' && !isalnum(*c) )
202 return 0;
203 c++;
204 }
205 return 1;
206
207
208 } // End of ScreenIdentString
209
210
3030 *
3131 * $Author: peter $
3232 *
33 * $Id: sfcapd.c 95 2007-10-15 06:05:26Z peter $
33 * $Id: sfcapd.c 97 2008-02-21 09:50:02Z peter $
3434 *
35 * $LastChangedRevision: 95 $
35 * $LastChangedRevision: 97 $
3636 *
3737 *
3838 */
130130
131131 static char Ident[IdentLen];
132132
133 static char const *rcsid = "$Id: sfcapd.c 95 2007-10-15 06:05:26Z peter $";
133 static char const *rcsid = "$Id: sfcapd.c 97 2008-02-21 09:50:02Z peter $";
134134
135135 /* exported fuctions */
136136 void LogError(char *format, ...);
636636 time_t twin, t_start, t_tmp;
637637 int sock, err, synctime, do_daemonize, expire, report_sequence;
638638 int subdir_index, compress;
639 char c;
639 int c;
640640
641641 verbose = synctime = do_daemonize = 0;
642642 bufflen = 0;
2929 #
3030 # $Author: peter $
3131 #
32 # $Id: test.sh 96 2007-10-15 06:34:03Z peter $
32 # $Id: test.sh 62 2006-03-08 12:59:51Z peter $
3333 #
34 # $LastChangedRevision: 96 $
34 # $LastChangedRevision: 62 $
3535 #
3636 #
3737
2727 *
2828 * $Author: peter $
2929 *
30 * $Id: version.h 95 2007-10-15 06:05:26Z peter $
30 * $Id: version.h 97 2008-02-21 09:50:02Z peter $
3131 *
32 * $LastChangedRevision: 95 $
32 * $LastChangedRevision: 97 $
3333 *
3434 *
3535 */
3636
37 const char *nfdump_version = "1.5.6";
37 const char *nfdump_version = "1.5.7";
3838
39 const char *nfdump_date = "$LastChangedDate: 2007-10-15 08:05:26 +0200 (Mon, 15 Oct 2007) $";
39 const char *nfdump_date = "$LastChangedDate: 2008-02-21 10:50:02 +0100 (Thu, 21 Feb 2008) $";