Skip to content

Commit

Permalink
Allow building against cosmopolitan libc
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsullivan5196 committed May 30, 2024
1 parent fa451a1 commit f0ec73d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion c/expeditor.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ static void s_ee_set_color(int color_id, IBOOL background) {
# include <unistd.h>
# include <time.h>
#endif
#if !defined(__GLIBC__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__EMSCRIPTEN__) && !defined(NO_USELOCALE)
#if !defined(__GLIBC__) && !defined(__COSMOPOLITAN__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__EMSCRIPTEN__) && !defined(NO_USELOCALE)
# include <xlocale.h>
#endif

Expand Down
4 changes: 2 additions & 2 deletions c/prim5.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ static ptr s_system(const char *s) {
#ifdef WIN32
return Sinteger(status);
#else
if WIFEXITED(status) return Sinteger(WEXITSTATUS(status));
if WIFSIGNALED(status) return Sinteger(-WTERMSIG(status));
if (WIFEXITED(status)) return Sinteger(WEXITSTATUS(status));
if (WIFSIGNALED(status)) return Sinteger(-WTERMSIG(status));
S_error("system", "cannot determine subprocess exit status");
return 0 /* not reached */;
#endif /* WIN32 */
Expand Down
6 changes: 4 additions & 2 deletions c/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) {
/*****************************************/
/* Operating systems */

#if defined(__linux__) || defined(__GNU__) /* Hurd */
#if defined(__linux__) || defined(__COSMOPOLITAN__) || defined(__GNU__) /* Hurd */
#define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT
#ifndef __COSMOPOLITAN__
# define LOAD_SHARED_OBJECT
#endif
#define USE_MMAP
#define MMAP_HEAP
#define IEEE_DOUBLE
Expand Down

0 comments on commit f0ec73d

Please sign in to comment.