[build] better autoconf checks for time and dirent headers
This commit is contained in:
11
src/bench.c
11
src/bench.c
@@ -1,9 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#else
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libpostal.h"
|
||||
#include "libpostal_config.h"
|
||||
#include "log/log.h"
|
||||
#include "scanner.h"
|
||||
|
||||
|
||||
@@ -1,15 +1,38 @@
|
||||
#ifndef FILE_UTILS_H
|
||||
#define FILE_UTILS_H
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "libpostal_config.h"
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
|
||||
#else
|
||||
|
||||
#define dirent direct
|
||||
#define NAMLEN(dirent) ((dirent)->d_namlen)
|
||||
|
||||
#ifdef HAVE_SYS_NDIR_H
|
||||
#include <sys/ndir.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_DIR_H
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NDIR_H
|
||||
#include <ndir.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BUFSIZ
|
||||
#define BUFSIZ 4096
|
||||
@@ -51,7 +74,4 @@ bool file_write_uint8(FILE *file, uint8_t value);
|
||||
bool file_read_chars(FILE *file, char *buf, size_t len);
|
||||
bool file_write_chars(FILE *file, const char *buf, size_t len);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user