Skip to content

Commit

Permalink
Add hurd support
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
  • Loading branch information
sthibaul authored and NikolajBjorner committed Nov 3, 2019
1 parent 16d4ccd commit da061bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 14 additions & 1 deletion scripts/mk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def getenv(name, default):
#####################
IS_WINDOWS=False
IS_LINUX=False
IS_HURD=False
IS_OSX=False
IS_FREEBSD=False
IS_NETBSD=False
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -591,6 +595,8 @@ def check_eol():
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':
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -1825,6 +1831,8 @@ def mk_makefile(self, out):
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:
Expand Down Expand Up @@ -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_'
Expand Down

0 comments on commit da061bb

Please sign in to comment.