Skip to content

Commit 7b0dfd8

Browse files
committed
Merge branch 'maint'
2 parents 38826d6 + fd32278 commit 7b0dfd8

File tree

6 files changed

+26
-12
lines changed

6 files changed

+26
-12
lines changed

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ if(MSVC)
148148
add_definitions(/bigobj) #allow for larger object files
149149
endif(MSVC)
150150

151+
if(WIN32)
152+
add_definitions(-D_USE_MATH_DEFINES)
153+
endif(WIN32)
154+
151155
# Record Compiler Info for record
152156
STRING(TOUPPER ${CMAKE_BUILD_TYPE} GRCBTU)
153157
set(COMPILER_INFO "")

cmake/Modules/GrBoost.cmake

+1-6
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@ set(BOOST_REQUIRED_COMPONENTS
3232
filesystem
3333
system
3434
regex
35+
thread
3536
)
3637

37-
if (MINGW)
38-
set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread_win32)
39-
else(MINGW)
40-
set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread)
41-
endif(MINGW)
42-
4338
if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
4439
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
4540
endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")

cmake/msvc/config.h

-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ typedef ptrdiff_t ssize_t;
2121
////////////////////////////////////////////////////////////////////////
2222
// rint functions
2323
////////////////////////////////////////////////////////////////////////
24-
#define _USE_MATH_DEFINES
2524
#include <math.h>
2625
#if _MSC_VER < 1800
2726
static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
@@ -62,7 +61,4 @@ static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x
6261
static inline long int random (void) { return rand(); }
6362
static inline void srandom (unsigned int seed) { srand(seed); }
6463

65-
#define srand48(seed) srand(seed)
66-
#define drand48() (double(rand()) / RAND_MAX)
67-
6864
#endif // _MSC_CONFIG_H_ ]

gr-analog/lib/fastnoise_source_X_impl.cc.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ namespace gr {
144144

145145
@TYPE@ @IMPL_NAME@::sample()
146146
{
147-
#ifdef __USE_GNU
147+
#ifdef HAVE_RAND48
148148
size_t idx = lrand48() % d_samples.size();
149149
#else
150150
size_t idx = rand() % d_samples.size();
@@ -153,7 +153,7 @@ namespace gr {
153153
}
154154

155155
#ifndef FASTNOISE_RANDOM_SIGN
156-
#ifdef _MSC_VER
156+
#ifndef HAVE_RAND48
157157
#define FASTNOISE_RANDOM_SIGN ((rand()%2==0)?1:-1)
158158
#else
159159
#define FASTNOISE_RANDOM_SIGN ((lrand48()%2==0)?1:-1)

gr-blocks/lib/ConfigChecks.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,10 @@ CHECK_CXX_SOURCE_COMPILES("
8989
" HAVE_COSF
9090
)
9191
GR_ADD_COND_DEF(HAVE_COSF)
92+
93+
CHECK_CXX_SOURCE_COMPILES("
94+
#include <stdlib.h>
95+
int main(){srand48(0); drand48(); lrand48(); return 0;}
96+
" HAVE_RAND48
97+
)
98+
GR_ADD_COND_DEF(HAVE_RAND48)

gr-blocks/lib/test_tag_variable_rate_ff_impl.cc

+12
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ namespace gr {
5757
d_new_in = 0;
5858
d_last_out = 0;
5959

60+
#ifdef HAVE_RAND48
6061
srand48(time(NULL));
62+
#else
63+
srand(time(NULL));
64+
#endif
6165
}
6266

6367
test_tag_variable_rate_ff_impl::~test_tag_variable_rate_ff_impl()
@@ -78,7 +82,11 @@ namespace gr {
7882
GR_LOG_DEBUG(d_logger, boost::format("noutput_items: %1%") % noutput_items);
7983

8084
if(d_update_once) {
85+
#ifdef HAVE_RAND48
8186
if(drand48() > 0.5) {
87+
#else
88+
if (rand() > RAND_MAX / 2) {
89+
#endif
8290
d_rrate += d_update_step;
8391
}
8492
else {
@@ -95,7 +103,11 @@ namespace gr {
95103
while(i < ninput_items[0]) {
96104

97105
if(!d_update_once) {
106+
#ifdef HAVE_RAND48
98107
if(drand48() > 0.5) {
108+
#else
109+
if (rand() > RAND_MAX / 2) {
110+
#endif
99111
d_rrate += d_update_step;
100112
}
101113
else {

0 commit comments

Comments
 (0)