diff --git a/Makefile b/Makefile index e0a222cc..a395e020 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,7 @@ all: CFLAGS= -W -Wall -std=c99 -pedantic -Os -fomit-frame-pointer $(COPT) MAC_SHARED= -flat_namespace -bundle -undefined suppress -LINFLAGS= -D_POSIX_SOURCE -D_BSD_SOURCE -D_FILE_OFFSET_BITS=64 \ - -D_LARGEFILE_SOURCE -ldl -lpthread $(CFLAGS) +LINFLAGS= -ldl -pthread $(CFLAGS) LIB= _$(PROG).so linux: @@ -32,17 +31,17 @@ linux: $(CC) $(LINFLAGS) mongoose.c main.c -s -o $(PROG) bsd: - $(CC) $(CFLAGS) mongoose.c -shared -lpthread -s -fpic -fPIC -o $(LIB) - $(CC) $(CFLAGS) mongoose.c main.c -lpthread -s -o $(PROG) + $(CC) $(CFLAGS) mongoose.c -shared -pthread -s -fpic -fPIC -o $(LIB) + $(CC) $(CFLAGS) mongoose.c main.c -pthread -s -o $(PROG) mac: - $(CC) $(CFLAGS) $(MAC_SHARED) mongoose.c -lpthread -o $(LIB) - $(CC) $(CFLAGS) mongoose.c main.c -lpthread -o $(PROG) + $(CC) $(CFLAGS) $(MAC_SHARED) mongoose.c -pthread -o $(LIB) + $(CC) $(CFLAGS) mongoose.c main.c -pthread -o $(PROG) solaris: - gcc $(CFLAGS) mongoose.c -lpthread -lnsl \ + gcc $(CFLAGS) mongoose.c -pthread -lnsl \ -lsocket -s -fpic -fPIC -shared -o $(LIB) - gcc $(CFLAGS) mongoose.c main.c -lpthread -lnsl -lsocket -s -o $(PROG) + gcc $(CFLAGS) mongoose.c main.c -pthread -lnsl -lsocket -s -o $(PROG) ########################################################################## diff --git a/mongoose.c b/mongoose.c index 9fbb0ec9..25a60459 100644 --- a/mongoose.c +++ b/mongoose.c @@ -25,7 +25,10 @@ #if defined(_WIN32) #define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005 */ -#endif /* _WIN32 */ +#else +#define _XOPEN_SOURCE 600 /* Needed for pthread_rwlock on linux */ +#define _LARGEFILE_SOURCE /* Enable 64-bit file offsets */ +#endif #ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */ #include