aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Kahrs <Juergen.Kahrs@googlemail.com>2013-05-06 21:18:05 +0200
committerJuergen Kahrs <Juergen.Kahrs@googlemail.com>2013-05-06 21:18:05 +0200
commit55775186a2fb7e4f61b57e2923abe4e6e4728eb0 (patch)
treeb39c84f9212b04a70cbee319ecaea3f6f5cba730
parent263bd7ca867fdb26241a8681075f99d97c33c4d0 (diff)
downloadegawk-55775186a2fb7e4f61b57e2923abe4e6e4728eb0.tar.gz
egawk-55775186a2fb7e4f61b57e2923abe4e6e4728eb0.tar.bz2
egawk-55775186a2fb7e4f61b57e2923abe4e6e4728eb0.zip
Found better way to auto-detect GETGROUPS_T and GETPGRP_VOID.
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/configure.cmake16
-rw-r--r--test/CMakeLists.txt8
3 files changed, 15 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77fad100..c55321eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
# - insert #include <windows.h> at the top of awk.h
# - remove function execvp from pc/gawkmisc.pc
DefineConfigHValue(HAVE_SETENV 1)
+ DefineConfigHValue(HAVE_USLEEP 1)
DefineConfigHValue(STDC_HEADERS 1)
DefineConfigHValue(HAVE_STRINGIZE 1)
# TODO: Eli Zaretskii remined me that the generated
diff --git a/cmake/configure.cmake b/cmake/configure.cmake
index ec4c4e52..c8ab206a 100644
--- a/cmake/configure.cmake
+++ b/cmake/configure.cmake
@@ -44,6 +44,7 @@ include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckStructHasMember)
INCLUDE(CheckCSourceCompiles)
+include(CheckPrototypeDefinition)
MACRO(DefineConfigH feature)
# message(STATUS feature=${feature}=${${feature}})
@@ -135,7 +136,8 @@ add_definitions(-D PRINTF_HAS_F_FORMAT)
#/* Define as the return type of signal handlers (`int' or `void'). */
add_definitions(-D RETSIGTYPE=void)
#add_definitions(-D PIPES_SIMULATED)
-add_definitions(-D GETPGRP_VOID)
+check_prototype_definition(getpgrp "pid_t getpgrp(void)" "NULL" "unistd.h" GETPGRP_VOID)
+DefineConfigH(GETPGRP_VOID)
#add_definitions(-D YYPARSE_PARAM)
DefineFunctionIfAvailable(snprintf HAVE_SNPRINTF)
@@ -205,8 +207,16 @@ DefineFunctionIfAvailable(fmod HAVE_FMOD)
DefineFunctionIfAvailable(isinf HAVE_ISINF)
DefineFunctionIfAvailable(ismod HAVE_ISMOD)
DefineFunctionIfAvailable(getgrent HAVE_GETGRENT)
-DefineFunctionIfAvailable(getgroups HAVE_GETGROUPS)
-add_definitions(-D GETGROUPS_T=gid_t)
+DefineSymbolIfAvailable("getgroups" "unistd.h" HAVE_GETGROUPS)
+if (${HAVE_GETGROUPS})
+ check_prototype_definition(getgroups "int getgroups(int size, gid_t list[])" "NULL" "unistd.h" GETGROUPS_T)
+ if (${GETGROUPS_T})
+ DefineConfigHValue(GETGROUPS_T gid_t)
+ else()
+ DefineConfigHValue(GETGROUPS_T int)
+ endif()
+endif()
+
DefineTypeIfAvailable("pid_t" PID_T)
DefineTypeIfAvailable("intmax_t" HAVE_INTMAX_T)
DefineFunctionIfAvailable(grantpt HAVE_GRANTPT)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d92897d8..564eb776 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -43,7 +43,6 @@ foreach(testgroup ${ALL_GROUPS} )
# Some test cases are special, treat them accordingly.
foreach(testcase ${ONE_GROUP} )
set(options "")
- set(file_suffix "")
if(${testcase} STREQUAL lintold)
set(options "--lint-old")
elseif(
@@ -55,12 +54,7 @@ foreach(testgroup ${ALL_GROUPS} )
${testcase} STREQUAL uninitialized)
set(options "--lint")
endif()
-
- if ("${file_suffix}" STREQUAL "")
- add_test("${testgroup}.${testcase}" ${SHELL_PREFIX} ${CMAKE_SOURCE_DIR}/cmake/basictest ${CMAKE_BINARY_DIR}/gawk ${testcase}${file_suffix} ${options} )
- else()
- message(STATUS "Skipping test case ${testgroup}.${testcase}")
- endif()
+ add_test("${testgroup}.${testcase}" ${SHELL_PREFIX} ${CMAKE_SOURCE_DIR}/cmake/basictest ${CMAKE_BINARY_DIR}/gawk ${testcase}${file_suffix} ${options} )
endforeach(testcase)
endforeach(testgroup)