Browse code

- more locking test fixes

Andrei Pelinescu-Onciul authored on 13/02/2002 20:17:59
Showing 2 changed files
... ...
@@ -10,6 +10,7 @@ CFLAGS= -O2 -Wall
10 10
 DEFS=
11 11
 LIBS=
12 12
 INCLUDE=
13
+PTHREAD_LIBS= -lpthread
13 14
 
14 15
 OS = $(shell uname -s)
15 16
 
... ...
@@ -17,6 +18,10 @@ OS = $(shell uname -s)
17 18
 ifeq ($(OS), SunOS)
18 19
 LIBS+= -lrt
19 20
 CFLAGS+=-mv8 -Wa,-xarch=v8plus
21
+PTHREAD_LIBS= -lpthread
22
+endif
23
+ifeq ($(OS), FreeBSD)
24
+PTHREAD_LIBS= -lc_r
20 25
 endif
21 26
 
22 27
 $(NAME): $(NAME).c
... ...
@@ -31,10 +36,12 @@ $(NAME)_flock: $(NAME).c
31 36
 	gcc $(CFLAGS) $(DEFS) -DFLOCK -o $@ $(INCLUDE) $< $(LIBS)
32 37
 
33 38
 $(NAME)_posix: $(NAME).c
34
-	gcc $(CFLAGS) $(DEFS) -DPOSIX_SEM -o $@ $(INCLUDE) $< $(LIBS) -lpthread
39
+	gcc $(CFLAGS) $(DEFS) -DPOSIX_SEM -o $@ $(INCLUDE) $< $(LIBS) \
40
+		$(PTHREAD_LIBS) 
35 41
 
36 42
 $(NAME)_pmutex: $(NAME).c
37
-	gcc $(CFLAGS) $(DEFS) -DPTHREAD_MUTEX -o $@ $(INCLUDE) $< $(LIBS) -lpthread
43
+	gcc $(CFLAGS) $(DEFS) -DPTHREAD_MUTEX -o $@ $(INCLUDE) $< $(LIBS) \
44
+		$(PTHREAD_LIBS)
38 45
 
39 46
 $(NAME)_fastlock: $(NAME).c
40 47
 	gcc $(CFLAGS) $(DEFS) -DFAST_LOCK -o $@ $(INCLUDE) $< $(LIBS) 
... ...
@@ -37,7 +37,8 @@ fl_lock_t lock;
37 37
 #include <sys/sem.h>
38 38
 
39 39
 
40
-#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
40
+#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) || \
41
+	defined(__FreeBSD__)
41 42
 	/* union semun is defined by including <sys/sem.h> */
42 43
 #else
43 44
 	/* according to X/OPEN we have to define it ourselves */