- more tcp stuff (uses locking.h, hashtables, mostly untested)
[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 = pre4-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 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
145          -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH)\
146          -DCFG_DIR='"$(cfg-target)"'\
147          -DPKG_MALLOC \
148          -DSHM_MEM  -DSHM_MMAP \
149          -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
150          -DDNS_IP_HACK \
151          -DUSE_IPV6 \
152          -DDBG_QM_MALLOC \
153          -DUSE_TCP \
154          #-DF_MALLOC \
155          #-DNO_DEBUG \
156          #-DNO_LOG
157          #-DEXTRA_DEBUG \
158          #-DDBG_QM_MALLOC \
159          #-DVQ_MALLOC  
160          #-DCONTACT_BUG
161          #-DDBG_LOCK
162          #-DNOSMP \
163          #-DEXTRA_DEBUG \
164          #-DUSE_SHM_MEM \
165          #-DSTATS \
166          #-DWITH_SNMP_MOD \
167          #-DNO_LOG
168
169 #PROFILE=  -pg #set this if you want profiling
170 #mode = debug
171 ifeq ($(mode),)
172         mode = release
173 endif
174
175 # platform dependent settings
176
177
178 #common
179 ifeq ($(CC),)
180         CC=gcc
181 endif
182 LD= $(CC)
183 CC_LONGVER=$(shell if  $(CC) -v 2>/dev/null; then \
184                                                 $(CC) -v 2>&1 ;\
185                                         else \
186                                                 $(CC) -V 2>&1 ; \
187                                         fi )
188 MKTAGS=ctags -R .
189
190 #find-out the compiler's name
191
192 ifneq (,$(findstring gcc, $(CC_LONGVER)))
193         CC_NAME=gcc
194         CC_VER=$(CC) $(shell $(CC) --version|head -1| \
195                                  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/')
196         # sun sed is a little brain damaged => this complicated expression
197         MKDEP=$(CC) -MM 
198         #transform gcc version into 2.9x or 3.0
199         CC_SHORTVER=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
200                                  sed -e 's/[^0-9]*-\(.*\)/\1/'| \
201                                  sed -e 's/2\.9.*/2.9x/' -e 's/3\..\..*/3.0/' -e \
202                                         's/3\../3.0/')
203 endif
204
205 ifneq (, $(findstring Sun, $(CC_LONGVER)))
206         CC_NAME=suncc
207         CC_SHORTVER=$(shell echo "$(CC_LONGVER)"|head -1| \
208                                         sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
209         CC_VER=$(CC) $(CC_SHORTVER)
210         MKDEP=$(CC) -xM1 
211 endif
212
213 ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
214         # very nice: gcc compatible
215         CC_NAME=icc
216         CC_FULLVER=$(shell echo "$(CC_LONGVER)"|head -1| \
217                                         sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/g' )
218         CC_SHORTVER=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
219         CC_VER=$(CC) $(CC_FULLVER)
220         MKDEP=$(CC) -MM 
221 endif
222
223
224 ifeq (,$(CC_NAME))
225 #not found
226         CC_NAME=$(CC)
227         CC_SHORTVER=unknown
228         CC_VER=unknown
229         MKDEP=gcc -MM 
230 $(warning       Unknown compiler $(CC)\; supported compilers: \
231                         gcc, sun cc, intel icc )
232 endif
233
234 # find ld & as name (gnu or solaris)
235 ifeq ($(ARCH), sparc64)
236 ifeq ($(CC_NAME), gcc)
237                 LDGCC=$(shell $(CC) -v 2>&1 | grep with-ld| \
238                                    sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' )
239                 ASGCC=$(shell $(CC) -v 2>&1 | grep with-as| \
240                                    sed -e 's/.*--with-as=\([^ ][^ ]*\).*/\1/' )
241                 LDPATH=$(shell  if [ -z "$(LDGCC)" ] ; then echo "ld" ;\
242                                                 else \
243                                                 if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \
244                                                         echo $(LDGCC); \
245                                                 else echo "ld" ; \
246                                                 fi\
247                                                 fi)
248                 ASPATH=$(shell  if [ -z "$(ASGCC)" ] ; then echo "as" ;\
249                                                 else \
250                                                 if $(ASGCC) -V 2>/dev/null 1>/dev/null; then \
251                                                         echo $(ASGCC); \
252                                                 else echo "as" ; \
253                                                 fi\
254                                                 fi)
255                                                         
256                 LDTYPE=$(shell if $(LDPATH) -V 1>/dev/null  2>/dev/null; then \
257                                                         if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
258                                                         then echo gnu; \
259                                                         else \
260                                                         if $(LDPATH) -V 2>&1|grep Solaris >/dev/null;\
261                                                         then echo solaris; \
262                                                         else \
263                                                                 echo unknown ; \
264                                                         fi \
265                                                         fi \
266                                                 fi)
267                 ASTYPE=$(shell if $(ASPATH) -V 1>/dev/null  2>/dev/null </dev/null; \
268                                                 then \
269                                                         if $(ASPATH) -V 2>&1 </dev/null |grep GNU >/dev/null; \
270                                                         then echo gnu; \
271                                                         else \
272                                                         if $(ASPATH) -V 2>&1 </dev/null |grep Sun >/dev/null;\
273                                                         then echo solaris; \
274                                                         else \
275                                                                 echo unknown ; \
276                                                         fi \
277                                                         fi \
278                                                 fi)
279 #$(warning "using ld=$(LDPATH)/$(LDTYPE), as=$(ASPATH)/$(ASTYPE)")
280
281 endif
282 endif
283
284 # arh. specific definitions
285 ifeq ($(ARCH), i386)
286         use_fast_lock=yes
287 endif
288
289 ifeq ($(ARCH), sparc64)
290 ifeq    ($(CC_NAME), gcc)
291         use_fast_lock=yes
292 endif
293 endif
294
295 ifeq ($(ARCH), arm)
296         use_fast_lock=yes
297 endif
298
299 ifeq ($(ARCH), ppc)
300         use_fast_lock=yes
301 endif
302
303 ifeq ($(use_fast_lock), yes)
304         DEFS+= -DFAST_LOCK
305         found_lock_method=yes
306 endif
307
308 CFLAGS=
309 # setting CFLAGS
310 ifeq ($(mode), release)
311         #if i386
312 ifeq    ($(ARCH), i386)
313                 # if gcc 
314 ifeq            ($(CC_NAME), gcc)
315                                 #common stuff
316                                 CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
317                                         -Wall   \
318                         #if gcc 3.0
319 ifeq                    ($(CC_SHORTVER), 3.0)
320                                         CFLAGS+=-minline-all-stringops -malign-double \
321                                                         -falign-loops \
322                                                         -march=athlon \
323                                                         #-mcpu=athlon
324 else
325 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
326 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
327                                         for better results)
328                                         
329                                         CFLAGS+=-m486 \
330                                                         -malign-loops=4
331 else
332                                 #really old version
333 $(warning                       You are using an old and unsupported gcc \
334                                          version  ($(CC_SHORTVER)), compile at your own risk!)
335
336 endif                   # CC_SHORTVER, 2.9x
337 endif                   # CC_SHORTVER, 3.0
338
339 else            # CC_NAME, gcc
340 ifeq            ($(CC_NAME), icc)
341                         CFLAGS=-O3  -ipo -ipo_obj -unroll  $(PROFILE) \
342                                          -tpp6 -xK  #-openmp  #optimize for PIII 
343                                 # -prefetch doesn't seem to work
344                                 #( ty to inline acroos files, unroll loops,prefetch,
345                                 # optimize for PIII, use PIII instructions & vect.,
346                                 # mutlithread loops)
347 else
348                                 #other compilers
349 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
350 endif           #CC_NAME, icc
351 endif           #CC_NAME, gcc
352 endif   #ARCH, i386
353
354
355         #if sparc
356 ifeq    ($(ARCH), sparc64)
357                         #if gcc
358 ifeq            ($(CC_NAME), gcc)
359                                 #common stuff
360                                 CFLAGS=-g -O9 -funroll-loops  $(PROFILE) \
361                                         -Wall\
362                                         #-Wcast-align \
363                                         #-Wmissing-prototypes 
364                                 #if gcc 3.0
365 ifeq                    ($(CC_SHORTVER), 3.0)
366                                         #use 32bit for now
367                                         CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc  -m32  \
368                                         # -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
369                                         #-mno-epilogue #try to inline function exit code
370                                         #-mflat # omit save/restore
371                                         #-,faster-structs #faster non Sparc ABI structure copy ops
372 else                    # CC_SHORTVER, 3.0
373 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
374 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc >= 3.1 \
375                                         for better results)
376 ifneq                           ($(OS), netbsd)
377                                                 # on netbsd/sparc64,  gcc 2.95.3 does not compile
378                                                 # ser with -mv8
379                                                 CFLAGS+= -mv8 
380 endif
381 ifeq                                    ($(ASTYPE), solaris)
382                                                         CFLAGS+= -Wa,-xarch=v8plus
383 endif                                   
384 else                    #CC_SHORTVER, 2.9x
385                                 #really old version
386 $(warning                       You are using an old and unsupported gcc \
387                                          version ($(CC_SHORTVER)), compile at your own risk!)
388                                         
389                                         CFLAGS+= -mv8 
390 ifeq                                    ($(ASTYPE), solaris)
391                                                         CFLAGS+= -Wa,-xarch=v8plus
392 endif                                   
393         
394 endif                   #CC_SHORTVER, 2.9x
395 endif                   #CC_SHORTVER, 3.0
396
397 else            #CC_NAME, gcc
398 ifeq            ($(CC_NAME), suncc)
399                         CFLAGS+=-xO5 -fast -native -xarch=v8plusa -xCC \
400                                         -xc99 # C99 support
401                         # -Dinline="" # add this if cc < 5.3 (define inline as null)
402 else
403                                 #other compilers
404 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
405 endif           #CC_NAME, suncc
406 endif           #CC_NAME, gcc
407 endif   #ARCH, sparc
408
409         #if ipaq/netwinder
410 ifeq    ($(ARCH), arm)
411                 # if gcc 
412 ifeq            ($(CC_NAME), gcc)
413                                 #common stuff
414                                 CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
415                                         -Wall   \
416                         #if gcc 3.0
417 ifeq                    ($(CC_SHORTVER), 3.0)
418                                         CFLAGS+= -mcpu=strongarm1100
419                                                         #-mcpu=athlon
420 else
421 ifeq                    ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
422 $(warning                       Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
423                                         for better results)
424                                         
425                                         CFLAGS+=
426 else
427                                 #really old version
428 $(warning                       You are using an old and unsupported gcc \
429                                          version ($(CC_SHORTVER)), compile at your own risk!)
430
431 endif                   # CC_SHORTVER, 2.9x
432 endif                   # CC_SHORTVER, 3.0
433
434 else            # CC_NAME, gcc
435                                 #other compilers
436 $(error                         Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
437 endif           #CC_NAME, gcc
438 endif   #ARCH, i386
439
440
441         
442
443 LDFLAGS=
444 # setting LDFLAGS
445 ifeq    ($(CC_NAME), gcc)
446 ifeq            ($(ARCH), sparc64)
447 ifeq                    ($(LDTYPE), solaris)
448                                         # solaris ld
449                                         LDFLAGS+=-O2 $(PROFILE)
450                                         MOD_LDFLAGS=-G $(LDFLAGS)
451 else                    
452                                         #gcc and maybe others, on solaris, with gnu ld
453                                         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
454                                         MOD_LDFLAGS=-shared $(LDFLAGS)
455 endif
456 else
457                         #gcc and maybe others
458                         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
459                         MOD_LDFLAGS=-shared $(LDFLAGS)
460 endif
461 endif
462 ifeq    ($(CC_NAME), icc)
463         #gcc and maybe others
464         LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
465         MOD_LDFLAGS=-shared $(LDFLAGS)
466 endif
467 ifeq    ($(CC_NAME), suncc)
468         LDFLAGS+=-xO5 $(PROFILE)
469         MOD_LDFLAGS=-G $(LDFLAGS)
470 endif
471         # we need -fPIC -DPIC only for shared objects, we don't need them for
472         # the executable file, because it's always loaded at a fixed address
473         # -andrei
474 else    #mode,release
475 ifeq    ($(CC_NAME), gcc)
476                 CFLAGS=-g -Wcast-align $(PROFILE)
477 ifeq            ($(ARCH), sparc64)
478                         CFLAGS+= -mcpu=ultrasparc 
479 endif
480 ifeq            ($(LDTYPE), solaris)
481                         #solaris ld
482                         LDFLAGS+=-g $(PROFILE)
483                         MOD_LDFLAGS=-G $(LDFLAGS)
484 else
485                         #gnu or other ld type
486                         LDFLAGS+=-g -Wl,-E $(PROFILE)
487                         MOD_LDFLAGS=-shared $(LDFLAGS)
488 endif
489 endif
490 ifeq    ($(CC_NAME), icc)
491                 CFLAGS=-g  $(PROFILE)
492                 LDFLAGS+=-g -Wl,-E $(PROFILE)
493                 MOD_LDFLAGS=-shared $(LDFLAGS)
494 endif
495 ifeq    ($(CC_NAME), suncc)
496                 CFLAGS= -g $(PROFILE)
497                 LDFLAGS+=-g $(PROFILE)
498                 MOD_LDFLAGS=-G $(LDFLAGS)
499 endif
500
501 endif #mode=release
502
503
504 #*FLAGS used for compiling the modules
505 ifeq    ($(CC_NAME), gcc)
506 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
507 endif
508 ifeq    ($(CC_NAME), icc)
509 MOD_CFLAGS=-Kpic $(CFLAGS)
510 endif
511 ifeq    ($(CC_NAME), suncc)
512 MOD_CFLAGS=-Kpic  $(CFLAGS)
513 endif
514
515 ifeq ($(LEX),)
516         LEX=flex
517 endif
518 ifeq ($(YACC),)
519         YACC=bison
520 endif
521 YACC_FLAGS=-d -b cfg
522 # on solaris add -lxnet (e.g. LIBS= -lxnet)
523 LIBS= -lfl -ldl -lresolv
524
525
526 #os specific stuff
527 ifeq ($(OS), linux)
528         DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD
529         ifneq ($(found_lock_method), yes)
530                 DEFS+= -DUSE_SYSV_SEM  # try posix sems
531                 found_lock_method=yes
532         endif
533 endif
534
535 ifeq  ($(OS), solaris)
536         DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD
537         ifneq ($(found_lock_method), yes)
538                 DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
539                 found_lock_method=yes
540         endif
541         ifeq ($(mode), release)
542                 #use these only if you're using gcc with Solaris ld
543                 #LDFLAGS=-O2 $(PROFILE)
544                 #MOD_LDFLAGS=-O2 -G
545         else
546                 #LDFLAGS=-g $(PROFILE)
547                 #MOD_LDFLAGS=-g -G
548         endif
549
550         YACC=yacc
551
552 ifeq ($(CC_NAME), suncc)
553         LIBS= -lfast -ldl -lresolv
554 endif
555         LIBS+= -L/usr/local/lib -lfl -lxnet -lrt -lnsl 
556         # -lrt needed for sched_yield
557 endif
558
559 ifeq ($(OS), freebsd)
560         DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
561                 -DHAVE_SCHED_YIELD
562         ifneq ($(found_lock_method), yes)
563                 DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
564                 found_lock_method=yes
565         endif
566         YACC=yacc
567         LIBS= -lfl  #dlopen is in libc
568 endif
569
570 ifeq ($(OS), openbsd)
571         DEFS+=-DHAVE_SOCKADDR_SA_LEN -DDLSYM_PREFIX='"_"' -DHAVE_GETHOSTBYNAME2 \
572                 -DHAVE_UNION_SEMUN
573         ifneq ($(found_lock_method), yes)
574                 DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
575                 found_lock_method=yes
576         endif
577         # (symbols on openbsd are prefixed by "_")
578         YACC=yacc
579         # no sched_yield on openbsd unless linking with c_r (not recommended)
580         LIBS= -lfl 
581         LDFLAGS=        # openbsd ld doesn't like -O2 or -E
582 endif
583         
584 ifeq ($(OS), netbsd)
585         DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 
586         ifneq ($(found_lock_method), yes)
587                 DEFS+= -DUSE_SYSV_SEM  # try pthread sems
588                 found_lock_method=yes
589         endif
590         YACC=yacc
591         LIBS= -lfl 
592 endif
593
594 ifneq (,$(findstring CYGWIN, $(OS)))
595         #cygwin is the same as common
596         ifneq ($(found_lock_method), yes)
597                 DEFS+= -DUSE_SYSV_SEM  # try sys v sems
598                 found_lock_method=yes
599         endif
600 endif
601
602 ifneq ($(found_lock_method), yes)
603 $(warning       No locking method found so far, trying SYS V sems)
604                 DEFS+= -DUSE_SYSV_SEM  # try sys v sems
605                 found_lock_method=yes
606 endif