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 17
 ifeq ($(OS), SunOS)
18 18
 LIBS+= -lrt
19 19
 CFLAGS+=-mv8 -Wa,-xarch=v8plus
20
+PTHREAD_LIBS= -lpthread
21
+endif
22
+ifeq ($(OS), FreeBSD)
23
+PTHREAD_LIBS= -lc_r
20 24
 endif
21 25
 
22 26
 $(NAME): $(NAME).c
... ...
@@ -31,10 +36,12 @@ $(NAME)_flock: $(NAME).c
31 31
 	gcc $(CFLAGS) $(DEFS) -DFLOCK -o $@ $(INCLUDE) $< $(LIBS)
32 32
 
33 33
 $(NAME)_posix: $(NAME).c
34
-	gcc $(CFLAGS) $(DEFS) -DPOSIX_SEM -o $@ $(INCLUDE) $< $(LIBS) -lpthread
34
+	gcc $(CFLAGS) $(DEFS) -DPOSIX_SEM -o $@ $(INCLUDE) $< $(LIBS) \
35
+		$(PTHREAD_LIBS) 
35 36
 
36 37
 $(NAME)_pmutex: $(NAME).c
37
-	gcc $(CFLAGS) $(DEFS) -DPTHREAD_MUTEX -o $@ $(INCLUDE) $< $(LIBS) -lpthread
38
+	gcc $(CFLAGS) $(DEFS) -DPTHREAD_MUTEX -o $@ $(INCLUDE) $< $(LIBS) \
39
+		$(PTHREAD_LIBS)
38 40
 
39 41
 $(NAME)_fastlock: $(NAME).c
40 42
 	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 */