Changeset: 5f8039d275d3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5f8039d275d3
Modified Files:
CMakeLists.txt
clients/mapiclient/mclient.c
common/utils/mutils.c
gdk/gdk_posix.c
gdk/gdk_system.c
gdk/gdk_system.h
monetdb_config.h.in
Branch: cmake-fun
Log Message:
Removed checks for specific platforms.
diffs (262 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -458,13 +458,6 @@ endif()
set(THREADS_PREFER_PTHREAD_FLAG ON) # We do prefer pthreads
find_package(Threads REQUIRED)
set(THREAD_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
-cmake_push_check_state()
-set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${THREAD_LIBRARIES}")
-check_include_file("pthread.h" HAVE_PTHREAD_H)
-check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
-check_symbol_exists("pthread_kill" "signal.h" HAVE_PTHREAD_KILL)
-check_symbol_exists("pthread_sigmask" "signal.h" HAVE_PTHREAD_SIGMASK)
-cmake_pop_check_state()
# Readline libraries
set(READLINE_LIBRARIES "")
@@ -988,7 +981,7 @@ if(NOT ${ENABLE_FITS} STREQUAL "NO") # C
message(FATAL_ERROR "cfitsio library required for FITS support")
endif()
endif()
-if(NOT CFITSIO_FOUND)
+if(NOT HAVE_FITS)
set(CFITSIO_INCLUDE_DIR "")
set(CFITSIO_LIBRARIES "")
endif()
@@ -1052,6 +1045,8 @@ check_include_file("libintl.h" HAVE_LIBI
check_include_file("mach/mach_init.h" HAVE_MACH_MACH_INIT_H)
check_include_file("mach/task.h" HAVE_MACH_TASK_H)
check_include_file("netdb.h" HAVE_NETDB_H)
+check_include_file("pthread.h" HAVE_PTHREAD_H)
+check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
check_include_file("strings.h" HAVE_STRINGS_H)
check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
@@ -1117,7 +1112,6 @@ check_symbol_exists("backtrace" "execinf
check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
check_symbol_exists("ctime_r" "time.h" HAVE_CTIME_R)
check_symbol_exists("ctime_s" "time.h" HAVE_CTIME_S)
-check_symbol_exists("dispatch_semaphore_create" "dispatch/dispatch.h"
HAVE_DISPATCH_SEMAPHORE_CREATE)
check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE)
check_symbol_exists("fcntl" "unistd.h;fcntl.h" HAVE_FCNTL)
check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC)
@@ -1125,7 +1119,6 @@ check_symbol_exists("fork" "sys/types.h;
check_symbol_exists("fseeko" "stdio.h" HAVE_FSEEKO)
check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC)
check_symbol_exists("ftime" "sys/timeb.h" HAVE_FTIME)
-check_symbol_exists("GetDynamicTimeZoneInformation" "Windows.h"
HAVE_GETDYNAMICTIMEZONEINFORMATION)
check_symbol_exists("getopt" "unistd.h" HAVE_GETOPT)
check_symbol_exists("getopt_long" "unistd.h;getopt.h" HAVE_GETOPT_LONG)
check_symbol_exists("gettimeofday" "sys/time.h" HAVE_GETTIMEOFDAY)
@@ -1134,7 +1127,6 @@ check_symbol_exists("localtime_s" "time.
check_symbol_exists("madvise" "sys/mman.h" HAVE_MADVISE)
check_symbol_exists("mremap" "sys/mman.h" HAVE_MREMAP)
check_symbol_exists("nl_langinfo" "langinfo.h" HAVE_NL_LANGINFO)
-check_symbol_exists("_NSGetExecutablePath" "mach-o/dyld.h"
HAVE__NSGETEXECUTABLEPATH)
check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2)
check_symbol_exists("popen" "stdio.h" HAVE_POPEN)
check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE)
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2997,7 +2997,7 @@ set_timezone(Mapi mid)
MapiHdl hdl;
/* figure out our current timezone */
-#if defined HAVE_GETDYNAMICTIMEZONEINFORMATION
+#if defined NATIVE_WIN32 // GetDynamicTimeZoneInformation is available from
Windows Vista up
DYNAMIC_TIME_ZONE_INFORMATION tzinf;
/* documentation says: UTC = localtime + Bias (in minutes),
diff --git a/common/utils/mutils.c b/common/utils/mutils.c
--- a/common/utils/mutils.c
+++ b/common/utils/mutils.c
@@ -26,7 +26,7 @@
# include <execinfo.h>
#endif
-#ifdef HAVE__NSGETEXECUTABLEPATH
+#ifdef __MACH__
# include <mach-o/dyld.h> /* _NSGetExecutablePath on OSX >=10.5 */
#endif
@@ -439,7 +439,7 @@ get_bin_path(void)
if (GetModuleFileName(NULL, _bin_path,
(DWORD) sizeof(_bin_path)) != 0)
return _bin_path;
-#elif defined(HAVE__NSGETEXECUTABLEPATH) /* Darwin/OSX */
+#elif defined(__MACH__) /* Darwin/OSX */
char buf[PATH_MAX];
uint32_t size = PATH_MAX;
if (_NSGetExecutablePath(buf, &size) == 0 &&
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -229,8 +229,6 @@
*/
#ifdef HAVE_PTHREAD_H
-/* pthread.h on Windows includes config.h if HAVE_CONFIG_H is set */
-#undef HAVE_CONFIG_H
#include <sched.h>
#include <pthread.h>
#endif
@@ -307,7 +305,6 @@ MT_getrss(void)
return 0;
}
-
void *
MT_mmap(const char *path, int mode, size_t len)
{
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -600,7 +600,6 @@ MT_thread_setworking(const char *work)
p->working = work;
}
-#ifdef HAVE_PTHREAD_SIGMASK
static void
MT_thread_sigmask(sigset_t *new_mask, sigset_t *orig_mask)
{
@@ -609,7 +608,6 @@ MT_thread_sigmask(sigset_t *new_mask, si
sigdelset(new_mask, SIGPROF);
pthread_sigmask(SIG_SETMASK, new_mask, orig_mask);
}
-#endif
static void
rm_posthread_locked(struct posthread *p)
@@ -706,6 +704,7 @@ MT_create_thread(MT_Id *t, void (*f) (vo
pthread_attr_t attr;
int ret;
struct posthread *p;
+ sigset_t new_mask, orig_mask;
join_threads();
if ((ret = pthread_attr_init(&attr)) != 0) {
@@ -743,11 +742,9 @@ MT_create_thread(MT_Id *t, void (*f) (vo
posthreads = p;
*t = p->mtid = ++MT_thread_id;
pthread_mutex_unlock(&posthread_lock);
-#ifdef HAVE_PTHREAD_SIGMASK
- sigset_t new_mask, orig_mask;
+
(void) sigfillset(&new_mask);
MT_thread_sigmask(&new_mask, &orig_mask);
-#endif
THRDDEBUG fprintf(stderr, "#create \"%s\" \"%s\"\n",
MT_thread_getname(), threadname);
ret = pthread_create(&p->tid, &attr, thread_starter, p);
if (ret != 0) {
@@ -759,9 +756,7 @@ MT_create_thread(MT_Id *t, void (*f) (vo
} else {
/* must not fail after this: the thread has been started */
}
-#ifdef HAVE_PTHREAD_SIGMASK
MT_thread_sigmask(&orig_mask, NULL);
-#endif
return ret;
}
@@ -815,18 +810,13 @@ MT_join_thread(MT_Id t)
int
MT_kill_thread(MT_Id t)
{
+ struct posthread *p;
assert(t > 1);
-#ifdef HAVE_PTHREAD_KILL
- struct posthread *p;
join_threads();
p = find_posthread(t);
if (p)
return pthread_kill(p->tid, SIGHUP);
-#else
- (void) t;
- join_threads();
-#endif
return -1;
}
#endif
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -77,12 +77,6 @@
* @- pthreads Includes and Definitions
*/
#ifdef HAVE_PTHREAD_H
-/* don't re-include config.h; on Windows, don't redefine pid_t in an
- * incompatible way */
-#undef HAVE_CONFIG_H
-#ifdef pid_t
-#undef pid_t
-#endif
#include <sched.h>
#include <pthread.h>
#endif
@@ -91,7 +85,7 @@
# include <semaphore.h>
#endif
-#ifdef HAVE_DISPATCH_SEMAPHORE_CREATE
+#ifdef __MACH__ /* dispatch_semaphore_create function */
#include <dispatch/dispatch.h>
#endif
@@ -526,7 +520,7 @@ typedef struct {
MT_thread_getname(), __func__, (s)->name); \
} while (0)
-#elif defined(HAVE_DISPATCH_SEMAPHORE_CREATE)
+#elif defined(__MACH__)
/* MacOS X */
typedef struct {
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -136,9 +136,6 @@
/* Define to 1 if you have the <dirent.h> header file. */
#cmakedefine HAVE_DIRENT_H 1
-/* Define to 1 if you have the `dispatch_semaphore_create' function. */
-#cmakedefine HAVE_DISPATCH_SEMAPHORE_CREATE 1
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
@@ -172,9 +169,6 @@
/* Define to 1 if you have the `ftime' function. */
#cmakedefine HAVE_FTIME 1
-/* Define to 1 if you have the `GetDynamicTimeZoneInformation' function. */
-#cmakedefine HAVE_GETDYNAMICTIMEZONEINFORMATION 1
-
/* Define to 1 if you have the `getopt' function. */
#cmakedefine HAVE_GETOPT 1
@@ -292,12 +286,6 @@
/* Define to 1 if you have the <pthread.h> header file. */
#cmakedefine HAVE_PTHREAD_H 1
-/* Define to 1 if you have the pthread_kill function */
-#cmakedefine HAVE_PTHREAD_KILL 1
-
-/* Define to 1 if you have the pthread_sigmask function */
-#cmakedefine HAVE_PTHREAD_SIGMASK 1
-
/* Define to 1 if you have the `RIPEMD160_Update' function. */
#cmakedefine HAVE_RIPEMD160_UPDATE 1
@@ -427,9 +415,6 @@
/* Define to 1 if you have the `_mul128' function. */
#cmakedefine HAVE__MUL128 1
-/* Define to 1 if you have the `_NSGetExecutablePath' function. */
-#cmakedefine HAVE__NSGETEXECUTABLEPATH 1
-
/* Define to 1 if you have the `__builtin_{add,sub,mul}_overflow' functions. */
#cmakedefine HAVE___BUILTIN_ADD_OVERFLOW 1
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list