diff --git a/CMakeLists.txt b/CMakeLists.txt index 57f963bcc..2ae249529 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,6 +199,9 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") if ("${TARGET_ARCHITECTURE}" STREQUAL "x86_64") list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_USE_THREAD_LOCAL") endif() +elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "GNU") + message(STATUS "Platform: GNU/Hurd") + list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_HURD_") elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") # Does macOS really not need any special flags? message(STATUS "Platform: Darwin") diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 91e513366..6829b7251 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -70,6 +70,7 @@ PYTHON_COMPONENT='python' ##################### IS_WINDOWS=False IS_LINUX=False +IS_HURD=False IS_OSX=False IS_FREEBSD=False IS_NETBSD=False @@ -145,6 +146,9 @@ def is_windows(): def is_linux(): return IS_LINUX +def is_hurd(): + return IS_HURD + def is_freebsd(): return IS_FREEBSD @@ -591,6 +595,8 @@ elif os.name == 'posix': PREFIX="/usr/local" elif os.uname()[0] == 'Linux': IS_LINUX=True + elif os.uname()[0] == 'GNU': + IS_HURD=True elif os.uname()[0] == 'FreeBSD': IS_FREEBSD=True elif os.uname()[0] == 'NetBSD': @@ -1258,7 +1264,7 @@ def get_so_ext(): sysname = os.uname()[0] if sysname == 'Darwin': return 'dylib' - elif sysname == 'Linux' or sysname == 'FreeBSD' or sysname == 'NetBSD' or sysname == 'OpenBSD': + elif sysname == 'Linux' or sysname == 'GNU' or sysname == 'FreeBSD' or sysname == 'NetBSD' or sysname == 'OpenBSD': return 'so' elif sysname == 'CYGWIN' or sysname.startswith('MSYS_NT') or sysname.startswith('MINGW'): return 'dll' @@ -1825,6 +1831,8 @@ class JavaDLLComponent(Component): t = t.replace('PLATFORM', 'darwin') elif IS_LINUX: t = t.replace('PLATFORM', 'linux') + elif IS_GNU: + t = t.replace('PLATFORM', 'hurd') elif IS_FREEBSD: t = t.replace('PLATFORM', 'freebsd') elif IS_NETBSD: @@ -2553,6 +2561,11 @@ def mk_config(): SO_EXT = '.so' SLIBFLAGS = '-shared' SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so' % SLIBEXTRAFLAGS + elif sysname == 'GNU': + CXXFLAGS = '%s -D_HURD_' % CXXFLAGS + OS_DEFINES = '-D_HURD_' + SO_EXT = '.so' + SLIBFLAGS = '-shared' elif sysname == 'FreeBSD': CXXFLAGS = '%s -D_FREEBSD_' % CXXFLAGS OS_DEFINES = '-D_FREEBSD_'