dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
+AC_HEADER_DIRENT
+AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
printf("d %s\n",dent->d_name);
}
if (strlen(dent->d_name)>4 && S_ISREG(st.st_mode)){
- if (!strcmp(dent->d_name+strlen(dent->d_name)-4,".rrd") ||
- !strcmp(dent->d_name+strlen(dent->d_name)-4,".RRD")){
+ if (!strcmp(dent->d_name+NAMLEN(dent)-4,".rrd") ||
+ !strcmp(dent->d_name+NAMLEN(dent)-4,".RRD")){
printf("- %s\n",dent->d_name);
}
}
/* Sorry: don't know autoconf as well how to check the exist of
dirent.h ans sys/stat.h
*/
-#include <sys/stat.h>
-#include <dirent.h>
-#include <sys/types.h>
-/*
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
#endif
-*/
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+
#if HAVE_UNISTD_H
# include <unistd.h>
#endif