فهرست منبع

moved linux-specific compilation #defines into mongoose.c. This way we make sure flags are picked up if Makefile is not used.

lsm 15 سال پیش
والد
کامیت
d94c3f8b64
2فایلهای تغییر یافته به همراه11 افزوده شده و 9 حذف شده
  1. 7 8
      Makefile
  2. 4 1
      mongoose.c

+ 7 - 8
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)
 
 
 ##########################################################################

+ 4 - 1
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 <sys/types.h>