[fix] conditional compilation for strndup and drand48 for Windows, using config.h
This commit is contained in:
@@ -48,7 +48,7 @@ AC_TYPE_UINT8_T
|
|||||||
AC_CHECK_TYPES([ptrdiff_t])
|
AC_CHECK_TYPES([ptrdiff_t])
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_CHECK_FUNCS([malloc realloc getcwd gettimeofday memmove memset regcomp setlocale sqrt strdup strndup])
|
AC_CHECK_FUNCS([malloc realloc drand48 getcwd gettimeofday memmove memset regcomp setlocale sqrt strdup strndup])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
libpostal.pc
|
libpostal.pc
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
|
|
||||||
//I've rearranged the source into a header-only implementation for drand48() -Benjamin Kusin
|
//I've rearranged the source into a header-only implementation for drand48() -Benjamin Kusin
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_DRAND48
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "drand48.h"
|
#include "drand48.h"
|
||||||
|
|
||||||
@@ -67,4 +73,6 @@ double erand48(unsigned short xseed[3])
|
|||||||
double drand48(void)
|
double drand48(void)
|
||||||
{
|
{
|
||||||
return erand48(_rand48_seed);
|
return erand48(_rand48_seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // HAVE_DRAND48
|
||||||
|
|||||||
@@ -12,11 +12,15 @@
|
|||||||
* to anyone/anything when using this software.
|
* to anyone/anything when using this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//I've rearranged the source into a header-only implementation for drand48() -Benjamin Kusin
|
|
||||||
|
|
||||||
#ifndef _DRAND48_H
|
#ifndef _DRAND48_H
|
||||||
#define _DRAND48_H
|
#define _DRAND48_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_DRAND48
|
||||||
|
|
||||||
#define RAND48_SEED_0 (0x330e)
|
#define RAND48_SEED_0 (0x330e)
|
||||||
#define RAND48_SEED_1 (0xabcd)
|
#define RAND48_SEED_1 (0xabcd)
|
||||||
#define RAND48_SEED_2 (0x1234)
|
#define RAND48_SEED_2 (0x1234)
|
||||||
@@ -37,5 +41,7 @@ double erand48(unsigned short xseed[3]);
|
|||||||
|
|
||||||
double drand48(void);
|
double drand48(void);
|
||||||
|
|
||||||
|
#endif // HAVE_DRAND48
|
||||||
|
|
||||||
|
#endif // _DRAND48_H
|
||||||
|
|
||||||
#endif // _DRAND48_H
|
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRNDUP
|
#ifndef HAVE_STRNDUP
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#ifndef STRNDUP_H
|
#ifndef STRNDUP_H
|
||||||
#define STRNDUP_H
|
#define STRNDUP_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRNDUP
|
#ifndef HAVE_STRNDUP
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ AC_TYPE_UINT8_T
|
|||||||
AC_CHECK_TYPES([ptrdiff_t])
|
AC_CHECK_TYPES([ptrdiff_t])
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_CHECK_FUNCS([malloc realloc getcwd gettimeofday memmove memset regcomp setlocale sqrt strdup strndup])
|
AC_CHECK_FUNCS([malloc realloc drand48 getcwd gettimeofday memmove memset regcomp setlocale sqrt strdup strndup])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
libpostal.pc
|
libpostal.pc
|
||||||
|
|||||||
Reference in New Issue
Block a user