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