mirror of https://github.com/wb2osz/direwolf.git
Fix CentOS 6 build.
This commit is contained in:
parent
6e92a4fa48
commit
03939d25ba
|
@ -151,15 +151,35 @@ endif()
|
||||||
|
|
||||||
if (C_CLANG OR C_GCC)
|
if (C_CLANG OR C_GCC)
|
||||||
# _BSD_SOURCE is deprecated we need to use _DEFAULT_SOURCE.
|
# _BSD_SOURCE is deprecated we need to use _DEFAULT_SOURCE.
|
||||||
# That might be the case for a more modern compiler but it is still needed
|
#
|
||||||
# for CentOS 6 & 7. Without -D_BSD_SOURCE, we get Warning: Implicit declaration of
|
# That works find for more modern compilers but we have issues with:
|
||||||
|
# Centos 7, gcc 4.8.5, glibc 2.17
|
||||||
|
# Centos 6, gcc 4.4.7, glibc 2.12
|
||||||
|
#
|
||||||
|
# CentOS 6 & 7: Without -D_BSD_SOURCE, we get Warning: Implicit declaration of
|
||||||
# functions alloca, cfmakeraw, scandir, setlinebuf, strcasecmp, strncasecmp, and strsep.
|
# functions alloca, cfmakeraw, scandir, setlinebuf, strcasecmp, strncasecmp, and strsep.
|
||||||
# When a function (like strsep) returns a pointer, the compiler instead assumes a 32 bit
|
# When a function (like strsep) returns a pointer, the compiler instead assumes a 32 bit
|
||||||
# int and sign extends it out to be a 64 bit pointer. Use the pointer and Kaboom!
|
# int and sign extends it out to be a 64 bit pointer. Use the pointer and Kaboom!
|
||||||
#
|
#
|
||||||
### Wextra spews out so much noise a serious problem was not noticed.
|
# CentOS 6: We have additional problem. Without -D_POSIX_C_SOURCE=199309L, we get
|
||||||
|
# implicit declaration of function clock_gettime and the linker can't find it.
|
||||||
|
#
|
||||||
|
# It turns out that -D_GNU_SOURCE can be used instead of both of those. For more information,
|
||||||
|
# see https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
|
||||||
|
#
|
||||||
|
# Why was this not an issue before? If gcc is used without the -std=c99 option,
|
||||||
|
# it is perfectly happy with clock_gettime, strsep, etc. but with the c99 option, it no longer
|
||||||
|
# recognizes a bunch of commonly used functions. Using _GNU_SOURCE, rather than _DEFAULT_SOURCE
|
||||||
|
# solves the problem for CentOS 6 & 7. This also makes -D_XOPEN_SOURCE= unnecessary.
|
||||||
|
# I hope it doesn't break with newer versions of glibc.
|
||||||
|
#
|
||||||
|
# I also took out -Wextra because it spews out so much noise a serious problem was not noticed.
|
||||||
|
# It might go back in someday when I have more patience to clean up all the warnings.
|
||||||
|
#
|
||||||
###set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wvla -ffast-math -ftree-vectorize -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE ${EXTRA_FLAGS}")
|
###set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wvla -ffast-math -ftree-vectorize -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE ${EXTRA_FLAGS}")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wvla -ffast-math -ftree-vectorize -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${EXTRA_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wvla -ffast-math -ftree-vectorize -D_GNU_SOURCE ${EXTRA_FLAGS}")
|
||||||
|
#
|
||||||
|
#
|
||||||
# for math.h
|
# for math.h
|
||||||
link_libraries("-lm")
|
link_libraries("-lm")
|
||||||
elseif (C_MSVC)
|
elseif (C_MSVC)
|
||||||
|
|
|
@ -796,7 +796,7 @@ int main ()
|
||||||
|
|
||||||
for (pf = 0; pf <= 1; pf++) {
|
for (pf = 0; pf <= 1; pf++) {
|
||||||
|
|
||||||
int cmin, cmax;
|
int cmin = 0, cmax = 1;
|
||||||
|
|
||||||
switch (ftype) {
|
switch (ftype) {
|
||||||
// 0 = response, 1 = command
|
// 0 = response, 1 = command
|
||||||
|
@ -867,7 +867,7 @@ int main ()
|
||||||
|
|
||||||
/* SREJ is only S frame which can have information part. */
|
/* SREJ is only S frame which can have information part. */
|
||||||
|
|
||||||
static char srej_info[] = { 1<<1, 2<<1, 3<<1, 4<<1 };
|
static unsigned char srej_info[] = { 1<<1, 2<<1, 3<<1, 4<<1 };
|
||||||
|
|
||||||
ftype = frame_type_S_SREJ;
|
ftype = frame_type_S_SREJ;
|
||||||
for (pf = 0; pf <= 1; pf++) {
|
for (pf = 0; pf <= 1; pf++) {
|
||||||
|
|
Loading…
Reference in New Issue