Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ project(Neko C)
include(GNUInstallDirs)
include(CheckCCompilerFlag)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(TestBigEndian)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Expand Down Expand Up @@ -88,6 +89,8 @@ endif()

check_include_file(xlocale.h NEKO_XLOCALE_H)

check_symbol_exists(getexecpath unistd.h HAVE_GETEXECPATH)

option(NEKO_JIT_DISABLE "Disable Neko JIT." OFF)
option(NEKO_JIT_DEBUG "Debug Neko JIT." OFF)

Expand Down
5 changes: 5 additions & 0 deletions vm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ static char *executable_path() {
sysctl(mib, 4, path, &cb, NULL, 0);
if (!cb) return NULL;
return path;
#elif defined(__OpenBSD__) && defined(HAVE_GETEXECPATH)
static char path[PATH_MAX];
if (getexecpath(path, sizeof(path)) == -1)
return NULL;
return path;
#elif defined(NEKO_LINUX)
static char path[PATH_MAX];
int length = readlink("/proc/self/exe", path, sizeof(path));
Expand Down
2 changes: 2 additions & 0 deletions vm/neko.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
# include <stdint.h>
#endif

#cmakedefine HAVE_GETEXECPATH

#cmakedefine NEKO_XLOCALE_H

#cmakedefine NEKO_BIG_ENDIAN
Expand Down