voicemail specific code added (see #define VOICE_MAIL and module vm)
[sip-router] / Makefile.defs
1 # $Id$
2 #
3 # makefile defs (CC, LD,a.s.o)
4 #
5
6
7 #version number
8 VERSION = 0
9 PATCHLEVEL = 8
10 SUBLEVEL =   11
11 EXTRAVERSION = pre5-tcp1-locking
12
13 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
14 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
15 ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
16                         -e s/armv4l/arm/)
17
18  # install location
19 PREFIX = /usr/local
20 prefix = $(PREFIX)
21 # install path is $(basedir) $(prefix) 
22 # example:
23 #  creating a bin. archive in /tmp, which unpacks in /usr/local
24 #  basedir=/tmp
25 #  prefix=/usr/local
26 basedir = 
27 # install prefixes for various stuff
28 cfg-prefix = $(basedir)$(prefix)
29 bin-prefix = $(basedir)$(prefix)
30 modules-prefix = $(basedir)$(prefix)
31 doc-prefix = $(basedir)$(prefix)
32 man-prefix = $(basedir)$(prefix)
33 ut-prefix = $(basedir)$(prefix)
34
35 # dirs
36 cfg-dir = etc/ser/
37 bin-dir = sbin/
38 modules-dir = lib/ser/modules/
39 ifeq ($(OS), linux)
40         doc-dir = share/doc/ser/
41         man-dir = share/man/
42 else
43         doc-dir=doc/ser/
44         man-dir=man/
45 endif
46 ut-prefix = bin/
47 # target dirs for various stuff
48 cfg-target = $(prefix)/$(cfg-dir)
49 modules-target = $(prefix)/$(modules-dir)
50
51
52 ifeq ($(OS), solaris)
53 #use GNU versions
54 INSTALL = ginstall
55 TAR = gtar
56 else
57 INSTALL = install 
58 TAR= tar
59 endif
60
61 # INSTALL-CFG = $(INSTALL) -m 644
62 INSTALL-BIN = $(INSTALL) -m 755
63 INSTALL-MODULES = $(INSTALL) -m 755
64 INSTALL-DOC = $(INSTALL) -m 644
65 INSTALL-MAN = $(INSTALL) -m 644
66
67 #set some vars from the environment (and not make builtins)
68 CC   := $(shell echo "$${CC}")
69 LEX  := $(shell echo "$${LEX}")
70 YACC := $(shell echo "$${YACC}")
71
72
73
74
75 # compile-time options
76 #
77 # -DSTATS
78 #               allows to print out number of packets processed on CTRL-C;
79 #               implementation still nasty and reports per-process
80 # -DNO_DEBUG
81 #               turns off some of the debug messages (DBG(...)).
82 # -DNO_LOG
83 #               completely turns of all the logging (and DBG(...))
84 # -DEXTRA_DEBUG
85 #               compiles in some extra debugging code
86 # -DDNS_IP_HACK
87 #               faster ip address resolver for ip strings (e.g "127.0.0.1")
88 # -DSHM_MEM
89 #               compiles in shared mem. support, needed by some modules and
90 #               by USE_SHM_MEM
91 # -DSHM_MMAP
92 #               use mmap instead of SYSV shared memory
93 # -DPKG_MALLOC
94 #               uses a faster malloc (exclusive w/ USE_SHM_MEM)
95 # -DUSE_SHM_MEM
96 #               all pkg_malloc => shm_malloc (most mallocs use a common sh.
97 #               mem. segment); don't define PKG_MALLOC if you want this!
98 # -DDBG_QM_MALLOC
99 #               qm_malloc debug code, will cause pkg_malloc and shm_malloc
100 #               to keep and display lot of debuging information: file name,
101 #               function, line number of malloc/free call for each block,
102 #               extra error checking (trying to free the same pointer
103 #               twice, trying to free a pointer alloc'ed with a different
104 #               malloc etc.)
105 # -DVQ_MALLOC
106 #               additional option to PKG_MALLOC which utilizes a fater then
107 #               qm version
108 #               (not true anymore, q_malloc performs approx. the same)
109 # -DF_MALLOC
110 #               an even faster malloc, not recommended for debugging
111 # -DDBG_MALLOC
112 #               issues additional debugging information if lock/unlock is called
113 # -DFAST_LOCK
114 #               uses fast arhitecture specific locking (see the arh. specific section)
115 # -DUSE_SYSV_SEM
116 #               uses sys v sems for locking (slower & limited number)
117 # -DUSE_PTHREAD_MUTEX
118 #               uses pthread mutexes, faster than sys v or posix sems, but do not 
119 #               work on all systems inter-processes (e.g. linux)
120 # -DUSE_POSIX_SEM
121 #               uses posix semaphores for locking (faster than sys v)
122 # -DBUSY_WAIT
123 #               uses busy waiting on the lock
124 # -DADAPTIVE_WAIT
125 #               try busy waiting for a while and if the lock is still held go to
126 #               force reschedule
127 # -DADAPTIVE_WAIT_LOOPS=number
128 #               number of loops we busy wait, after "number" loops have elapsed we 
129 #               force a reschedule
130 # -DNOSMP
131 #               don't use smp compliant locking (faster but won't work on SMP machines)
132 #               (not yet enabled)
133 # -DNO_PINGTEL_TAG_HACK
134 #               if enabled, To-header-field will be less liberal and will not accept
135 #               'tag=' (tag parameter with equal sign and without value); it is called
136 #               this way because such message was sighted from a Pingtel phone
137 # -DWITH_SNMP_MOD
138 #               if enabled, allows forking of the snmp agent just before child
139 #               forking (done at the top of main_loop). Needed if you want
140 #               to use the snmp module.
141 # -DUSE_TCP
142 #               compiles in tcp support (highly experimental for now, it will probably
143 #               not work, use it only if you really now what you are doing)
144 # -DVOICE_MAIL
145 #               enables voicemail support in ser core and in tm module
146 #               voicemail needs also -D_TOTAG
147
148 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
149          -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH)\
150          -DCFG_DIR='"$(cfg-target)"'\
151          -DPKG_MALLOC \
152          -DSHM_MEM  -DSHM_MMAP \
153          -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
154          -DDNS_IP_HACK \
155          -DUSE_IPV6 \
156          -DVOICE_MAIL \
157          -D_TOTAG \
158          -DUSE_TCP \
159          #-DF_MALLOC \
160          #-DNO_DEBUG \
161          #-DNO_LOG
162          #-DEXTRA_DEBUG \
163          #-DDBG_QM_MALLOC \
164          #-DVQ_MALLOC  
165          #-DCONTACT_BUG
166          #-DDBG_LOCK
167          #-DNOSMP \
168          #-DEXTRA_DEBUG \
169          #-DUSE_SHM_MEM \
170          #-DSTATS \
171          #-DWITH_SNMP_MOD \
172          #-DNO_LOG
173
174 #PROFILE=  -pg #set this if you want profiling
175 #mode = debug
176 ifeq ($(mode),)
177         mode = release
178 endif
179
180 # platform dependent settings
181
182
183 #common
184 ifeq ($(CC),)
185         CC=gcc
186 endif
187 LD= $(CC)
188 CC_LONGVER=$(shell if  $(CC) -v 2>/dev/null; then \
189                                                 $(CC) -v 2>&1 ;\
190                                         else \
191                                                 $(CC) -V 2>&1 ; \
192                                         fi )
193 MKTAGS=ctags -R .
194
195 #find-out the compiler's name
196
197 ifneq (,$(findstring gcc, $(CC_LONGVER)))
198         CC_NAME=gcc
199         CC_VER=$(CC) $(shell $(CC) --version|head -1| \
200                                  sed -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/' -e 's/[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
201         # sun sed is a little brain damaged => this complicated expression
202         MKDEP=$(CC) -MM 
203         #transform gcc version into 2.9x or 3.0
204         CC_SHORTVER=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
205                                  sed -e 's/[^0-9]*-\(.*\)/\1/'| \
206                                  sed -e 's/2\.9.*/2.9x/' -e 's/3\..\..*/3.0/' -e \
207                                         's/3\../3.0/')
208 endif
209
210 ifneq (, $(findstring Sun, $(CC_LONGVER)))
211         CC_NAME=suncc
212         CC_SHORTVER=$(shell echo "$(CC_LONGVER)"|head -1| \
213                                         sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
214         CC_VER=$(CC) $(CC_SHORTVER)
215         MKDEP=$(CC) -xM1 
216 endif
217
218 ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
219         # very nice: gcc compatible
220         CC_NAME=icc
221         CC_FULLVER=$(shell echo "$(CC_LONGVER)"|head -1| \
222                                         sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/g' )
223         CC_SHORTVER=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
224         CC_VER=$(CC) $(CC_FULLVER)
225         MKDEP=$(CC) -MM 
226 endif
227
228
229 ifeq (,$(CC_NAME))
230 #not found
231         CC_NAME=$(CC)
232         CC_SHORTVER=unknown
233         CC_VER=unknown
234         MKDEP=gcc -MM 
235 $(warning       Unknown compiler $(CC)\; supported compilers: \
236                         gcc, sun cc, intel icc )
237 endif
238
239 # find ld & as name (gnu or solaris)
240 ifeq ($(ARCH), sparc64)
241 ifeq ($(CC_NAME), gcc)
242                 LDGCC=$(shell $(CC) -v 2>&1 | grep with-ld| \
243                                    sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' )
244                 ASGCC=$(shell $(CC) -v 2>&1 | grep with-as| \
245                                    sed -e 's/.*--with-as=\([^ ][^ ]*\).*/\1/' )
246                 LDPATH=$(shell  if [ -z "$(LDGCC)" ] ; then echo "ld" ;\
247                                                 else \
248                                                 if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \
249                                                         echo $(LDGCC); \
250                                                 else echo "ld" ; \
251                                                 fi\
252                                                 fi)
253                 ASPATH=$(shell  if [ -z "$(ASGCC)" ] ; then echo "as" ;\
254                                                 else \
255                                                 if $(ASGCC) -V 2>/dev/null 1>/dev/null; then \
256                                                         echo $(ASGCC); \
257                                                 else echo "as" ; \
258                                                 fi\
259                                                 fi)
260                                                         
261                 LDTYPE=$(shell if $(LDPATH) -V 1>/dev/null  2>/dev/null; then \
262                                                         if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
263                                                         then echo gnu; \
264                                                         else \
265                                                         if $(LDPATH) -V 2>&1|grep Solaris >/dev/null;\
266                                                         then echo solaris; \
267                                                         else \
268                                                                 echo unknown ; \
269                                                         fi \
270                                                         fi \
271                                                 fi)
272                 ASTYPE=$(shell if $(ASPATH) -V 1>/dev/null  2>/dev/null </dev/null; \
273                                                 then \
274                                                         if $(ASPATH) -V 2>&1 </dev/null |grep GNU >/dev/null; \
275                                                         then echo gnu; \
276                                                         else \
277                                                         if $(ASPATH) -V 2>&1 </dev/null |grep Sun >/dev/null;\
278                                                         then echo solaris; \
279                                                         else \
280                                                                 echo unknown ; \
281                                                         fi \
282                                                         fi \
283                                                 fi)
284 #$(warning "using ld=$(LDPATH)/$(LDTYPE), as=$(ASPATH)/$(ASTYPE)")
285
286 endif
287 endif
288
289 # arh. specific definitions
290 ifeq ($(ARCH), i386)
291         use_fast_lock=yes
292 endif
293
294 ifeq ($(ARCH), sparc64)
295 ifeq    ($(CC_NAME), gcc)
296         use_fast_lock=yes
297 endif
298 endif
299
300 ifeq ($(ARCH), arm)
301         use_fast_lock=yes
302 endif
303
304 ifeq ($(ARCH), ppc)
305         use_fast_lock=yes
306 endif
307
308 ifeq ($(use_fast_lock), yes)
309         DEFS+= -DFAST_LOCK
310         found_lock_method=yes
311 endif
312
313 CFLAGS=
314 # setting CFLAGS
315 ifeq ($(mode), release)
316         #if i386
317 ifeq    ($(ARCH), i386)
318                 # if gcc 
319 ifeq            ($(CC_NAME), gcc)
320                                 #common stuff
321                                 CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
322                                         -Wall   \
323                         #if gcc 3.0
324 ifeq                    ($(CC_SHORTVER), 3.0)
325                                         CFLAGS+=-minline-all-stringops -malign-double \
326                                                         -falign-loops \
327                                                         -march=athlon \
328                                                         #-mcpu=athlon
329 else
330 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
331 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
332                                         for better results)
333                                         
334                                         CFLAGS+=-m486 \
335                                                         -malign-loops=4
336 else
337                                 #really old version
338 $(warning                       You are using an old and unsupported gcc \
339                                          version  ($(CC_SHORTVER)), compile at your own risk!)
340
341 endif                   # CC_SHORTVER, 2.9x
342 endif                   # CC_SHORTVER, 3.0
343
344 else            # CC_NAME, gcc
345 ifeq            ($(CC_NAME), icc)
346                         CFLAGS=-O3  -ipo -ipo_obj -unroll  $(PROFILE) \
347                                          -tpp6 -xK  #-openmp  #optimize for PIII 
348                                 # -prefetch doesn't seem to work
349                                 #( ty to inline acroos files, unroll loops,prefetch,
350                                 # optimize for PIII, use PIII instructions & vect.,
351                                 # mutlithread loops)
352 else
353                                 #other compilers
354 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
355 endif           #CC_NAME, icc
356 endif           #CC_NAME, gcc
357 endif   #ARCH, i386
358
359
360         #if sparc
361 ifeq    ($(ARCH), sparc64)
362                         #if gcc
363 ifeq            ($(CC_NAME), gcc)
364                                 #common stuff
365                                 CFLAGS=-g -O9 -funroll-loops  $(PROFILE) \
366                                         -Wall\
367                                         #-Wcast-align \
368                                         #-Wmissing-prototypes 
369                                 #if gcc 3.0
370 ifeq                    ($(CC_SHORTVER), 3.0)
371                                         #use 32bit for now
372                                         CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc  -m32  \
373                                         # -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
374                                         #-mno-epilogue #try to inline function exit code
375                                         #-mflat # omit save/restore
376                                         #-,faster-structs #faster non Sparc ABI structure copy ops
377 else                    # CC_SHORTVER, 3.0
378 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
379 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
380                                         for better results)
381 ifneq                           ($(OS), netbsd)
382                                                 # on netbsd/sparc64,  gcc 2.95.3 does not compile
383                                                 # ser with -mv8
384                                                 CFLAGS+= -mv8 
385 endif
386 ifeq                                    ($(ASTYPE), solaris)
387                                                         CFLAGS+= -Wa,-xarch=v8plus
388 endif                                   
389 else                    #CC_SHORTVER, 2.9x
390                                 #really old version
391 $(warning                       You are using an old and unsupported gcc \
392                                          version ($(CC_SHORTVER)), compile at your own risk!)
393                                         
394                                         CFLAGS+= -mv8 
395 ifeq                                    ($(ASTYPE), solaris)
396                                                         CFLAGS+= -Wa,-xarch=v8plus
397 endif                                   
398         
399 endif                   #CC_SHORTVER, 2.9x
400 endif                   #CC_SHORTVER, 3.0
401
402 else            #CC_NAME, gcc
403 ifeq            ($(CC_NAME), suncc)
404                         CFLAGS+=-xO5 -fast -native -xarch=v8plusa -xCC \
405                                         -xc99 # C99 support
406                         # -Dinline="" # add this if cc < 5.3 (define inline as null)
407 else
408                                 #other compilers
409 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
410 endif           #CC_NAME, suncc
411 endif           #CC_NAME, gcc
412 endif   #ARCH, sparc
413
414         #if ipaq/netwinder
415 ifeq    ($(ARCH), arm)
416                 # if gcc 
417 ifeq            ($(CC_NAME), gcc)
418                                 #common stuff
419                                 CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
420                                         -Wall   \
421                         #if gcc 3.0
422 ifeq                    ($(CC_SHORTVER), 3.0)
423                                         CFLAGS+= -mcpu=strongarm1100
424                                                         #-mcpu=athlon
425 else
426 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
427 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
428                                         for better results)
429                                         
430                                         CFLAGS+=
431 else
432                                 #really old version
433 $(warning                       You are using an old and unsupported gcc \
434                                          version ($(CC_SHORTVER)), compile at your own risk!)
435
436 endif                   # CC_SHORTVER, 2.9x
437 endif                   # CC_SHORTVER, 3.0
438
439 else            # CC_NAME, gcc
440                                 #other compilers
441 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
442 endif           #CC_NAME, gcc
443 endif   #ARCH, i386
444
445
446         
447
448 LDFLAGS=
449 # setting LDFLAGS
450 ifeq    ($(CC_NAME), gcc)
451 ifeq            ($(ARCH), sparc64)
452 ifeq                    ($(LDTYPE), solaris)
453                                         # solaris ld
454                                         LDFLAGS+=-O2 $(PROFILE)
455                                         MOD_LDFLAGS=-G $(LDFLAGS)
456 else                    
457                                         #gcc and maybe others, on solaris, with gnu ld
458                                         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
459                                         MOD_LDFLAGS=-shared $(LDFLAGS)
460 endif
461 else
462                         #gcc and maybe others
463                         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
464                         MOD_LDFLAGS=-shared $(LDFLAGS)
465 endif
466 endif
467 ifeq    ($(CC_NAME), icc)
468         #gcc and maybe others
469         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
470         MOD_LDFLAGS=-shared $(LDFLAGS)
471 endif
472 ifeq    ($(CC_NAME), suncc)
473         LDFLAGS+=-xO5 $(PROFILE)
474         MOD_LDFLAGS=-G $(LDFLAGS)
475 endif
476         # we need -fPIC -DPIC only for shared objects, we don't need them for
477         # the executable file, because it's always loaded at a fixed address
478         # -andrei
479 else    #mode,release
480 ifeq    ($(CC_NAME), gcc)
481                 CFLAGS=-g -Wcast-align $(PROFILE)
482 ifeq            ($(ARCH), sparc64)
483                         CFLAGS+= -mcpu=ultrasparc 
484 endif
485 ifeq            ($(LDTYPE), solaris)
486                         #solaris ld
487                         LDFLAGS+=-g $(PROFILE)
488                         MOD_LDFLAGS=-G $(LDFLAGS)
489 else
490                         #gnu or other ld type
491                         LDFLAGS+=-g -Wl,-E $(PROFILE)
492                         MOD_LDFLAGS=-shared $(LDFLAGS)
493 endif
494 endif
495 ifeq    ($(CC_NAME), icc)
496                 CFLAGS=-g  $(PROFILE)
497                 LDFLAGS+=-g -Wl,-E $(PROFILE)
498                 MOD_LDFLAGS=-shared $(LDFLAGS)
499 endif
500 ifeq    ($(CC_NAME), suncc)
501                 CFLAGS= -g $(PROFILE)
502                 LDFLAGS+=-g $(PROFILE)
503                 MOD_LDFLAGS=-G $(LDFLAGS)
504 endif
505
506 endif #mode=release
507
508
509 #*FLAGS used for compiling the modules
510 ifeq    ($(CC_NAME), gcc)
511 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
512 endif
513 ifeq    ($(CC_NAME), icc)
514 MOD_CFLAGS=-Kpic $(CFLAGS)
515 endif
516 ifeq    ($(CC_NAME), suncc)
517 MOD_CFLAGS=-Kpic  $(CFLAGS)
518 endif
519
520 ifeq ($(LEX),)
521         LEX=flex
522 endif
523 ifeq ($(YACC),)
524         YACC=bison
525 endif
526 YACC_FLAGS=-d -b cfg
527 # on solaris add -lxnet (e.g. LIBS= -lxnet)
528 LIBS= -lfl -ldl -lresolv
529
530
531 #os specific stuff
532 ifeq ($(OS), linux)
533         DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD
534         ifneq ($(found_lock_method), yes)
535                 DEFS+= -DUSE_SYSV_SEM  # try posix sems
536                 found_lock_method=yes
537         endif
538 endif
539
540 ifeq  ($(OS), solaris)
541         DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD
542         ifneq ($(found_lock_method), yes)
543                 DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
544                 found_lock_method=yes
545         endif
546         ifeq ($(mode), release)
547                 #use these only if you're using gcc with Solaris ld
548                 #LDFLAGS=-O2 $(PROFILE)
549                 #MOD_LDFLAGS=-O2 -G
550         else
551                 #LDFLAGS=-g $(PROFILE)
552                 #MOD_LDFLAGS=-g -G
553         endif
554
555         YACC=yacc
556
557 ifeq ($(CC_NAME), suncc)
558         LIBS= -lfast -ldl -lresolv
559 endif
560         LIBS+= -L/usr/local/lib -lfl -lxnet -lrt -lnsl 
561         # -lrt needed for sched_yield
562 endif
563
564 ifeq ($(OS), freebsd)
565         DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
566                 -DHAVE_SCHED_YIELD
567         ifneq ($(found_lock_method), yes)
568                 DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
569                 found_lock_method=yes
570         endif
571         YACC=yacc
572         LIBS= -lfl  #dlopen is in libc
573 endif
574
575 ifeq ($(OS), openbsd)
576         DEFS+=-DHAVE_SOCKADDR_SA_LEN -DDLSYM_PREFIX='"_"' -DHAVE_GETHOSTBYNAME2 \
577                 -DHAVE_UNION_SEMUN
578         ifneq ($(found_lock_method), yes)
579                 DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
580                 found_lock_method=yes
581         endif
582         # (symbols on openbsd are prefixed by "_")
583         YACC=yacc
584         # no sched_yield on openbsd unless linking with c_r (not recommended)
585         LIBS= -lfl 
586         LDFLAGS=        # openbsd ld doesn't like -O2 or -E
587 endif
588         
589 ifeq ($(OS), netbsd)
590         DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 
591         ifneq ($(found_lock_method), yes)
592                 DEFS+= -DUSE_SYSV_SEM  # try pthread sems
593                 found_lock_method=yes
594         endif
595         YACC=yacc
596         LIBS= -lfl 
597 endif
598
599 ifneq (,$(findstring CYGWIN, $(OS)))
600         #cygwin is the same as common
601         ifneq ($(found_lock_method), yes)
602                 DEFS+= -DUSE_SYSV_SEM  # try sys v sems
603                 found_lock_method=yes
604         endif
605 endif
606
607 ifneq ($(found_lock_method), yes)
608 $(warning       No locking method found so far, trying SYS V sems)
609                 DEFS+= -DUSE_SYSV_SEM  # try sys v sems
610                 found_lock_method=yes
611 endif