diff options
author | James Laird <jlaird@hdfgroup.org> | 2005-05-05 17:38:59 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2005-05-05 17:38:59 (GMT) |
commit | b0e5134171d5c92a0b50bae4daba97651eeeafe6 (patch) | |
tree | ddef77a0e5d0a56eda180c068b4fe66398998a68 /src | |
parent | 8570c314ef67c03f9b3ef9609c49cff7ee6488c0 (diff) | |
download | hdf5-b0e5134171d5c92a0b50bae4daba97651eeeafe6.zip hdf5-b0e5134171d5c92a0b50bae4daba97651eeeafe6.tar.gz hdf5-b0e5134171d5c92a0b50bae4daba97651eeeafe6.tar.bz2 |
[svn-r10730] Purpose:
Portability feature
Description:
The random() and srandom() functions are not available on all machines.
Set up the configure script to automatically detect them, rather than
requiring their presence or absence to be hardcoded.
Solution:
Added AC_CHECK_FUNCS macro to configure.in and replaced
#ifdef WIN32 conditionals with #ifdef H5_HAVE_RANDOM conditionals.
Platforms tested:
sleipnir, Windows
Diffstat (limited to 'src')
-rw-r--r-- | src/H5config.h.in | 6 | ||||
-rw-r--r-- | src/H5private.h | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/H5config.h.in b/src/H5config.h.in index d805b36..a5f0d11 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -205,6 +205,9 @@ /* Define to 1 if you have the <pthread.h> header file. */ #undef HAVE_PTHREAD_H +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + /* Define to 1 if you have the <setjmp.h> header file. */ #undef HAVE_SETJMP_H @@ -223,6 +226,9 @@ /* Define if `socklen_t' is defined */ #undef HAVE_SOCKLEN_T +/* Define to 1 if you have the `srandom' function. */ +#undef HAVE_SRANDOM + /* Define if `struct stat' has the `st_blocks' field */ #undef HAVE_STAT_ST_BLOCKS diff --git a/src/H5private.h b/src/H5private.h index ba4ddc7..eb8eae4 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -758,10 +758,10 @@ typedef off_t h5_stat_size_t; #define HDqsort(M,N,Z,F) qsort(M,N,Z,F) #define HDraise(N) raise(N) #define HDrand() rand() -#ifdef WIN32 -#define HDrandom() rand() -#else +#ifdef H5_HAVE_RANDOM #define HDrandom() random() +#else +#define HDrandom() rand() #endif #define HDread(F,M,Z) read(F,M,Z) #define HDreaddir(D) readdir(D) @@ -801,10 +801,10 @@ typedef off_t h5_stat_size_t; /* sprintf() variable arguments */ #define HDsqrt(X) sqrt(X) #define HDsrand(N) srand(N) -#ifdef WIN32 -#define HDsrandom(N) srand(N) -#else +#ifdef H5_HAVE_SRANDOM #define HDsrandom(N) srandom(N) +#else +#define HDsrandom(N) srand(N) #endif /* sscanf() variable arguments */ |