3 # makefile defs (CC, LD,a.s.o)
5 # Environment variables:
6 # PREFIX, LOCALBASE, BASEDIR
7 # INSTALL, TAR , CC, LEX, YACC,
9 # exclude_modules, skip_modules, include_modules
15 # 2003-02-24 added LOCALBASE, fixed doc_dir for freebsd - patch provided
16 # by Maxim Sobolev <sobomax@FreeBSD.org>
17 # 2003-02-25 added -DDISABLE_NAGLE (andrei)
18 # 2003-03-02 added -DDIGEST_DOMAIN (janakj)
19 # 2003-03-10 added -xcode=pic32 for module compilation w/ sun cc
20 # (too many symbols for pic13) (andrei)
21 # 2003-04-16 added CC_EXTRA_OPTS, s/march/mcpu, added CPU (cpu to optimize
22 # for, used only with gcc-3.x) (andrei)
23 # 2003-05-23 check if this makefile was already included (andrei)
24 # removed -DDIGEST_DOMAIN (andrei)
25 # 2003-05-30 added extra_defs (andrei)
26 # 2003-06-06 moved compiler detection before DEFS (andrei)
27 # 2003-06-10 removed -m32 for gcc 3.x/sparc64 -- it will use
28 # arch. default: -m32 on solaris, -m64 on *bsd (andrei)
29 # 2003-09-25 added -pthread into LIBS when compiling on FreeBSD/alpha
30 # and other FreeBSD arches for which no fast locking assembly
31 # code exists (sobomax)
32 # 2003-11-08 mips1 support introduced (andrei)
33 # 2003-11-24 openbsd 3.4 (elf) fixes (andrei)
34 # 2004-07-27 darwin (mac os x) port (andrei)
35 # 2004-09-12 mips2 & cobalt support introduced (andrei)
36 # 2004-09-28 x86_64 support introduced (andrei)
37 # 2004-12-14 gcc-3.4 special case added (andrei)
38 # 2004-12-15 HAVE_ALLOCA_H added (andrei)
39 # 2004-12-19 amd64 transformed in x86_64 (andrei)
40 # 2005-04-27 alpha support added (andrei)
41 # 2005-06-01 use $(LOCALBASE) instead of /usr/{local,pkg} (andrei)
42 # 2005-06-26 numeric OSREL & HAVE_KQUEUE added to the *BSD (andrei)
43 # 2005-07-04 HAVE_DEVPOLL added to solaris (andrei)
44 # 2005-07-06 gcc 4.0 optimizations support (andrei)
45 # 2005-07-25 better solaris arch detection (andrei)
46 # 2005-09-12 -mallign-double removed (too many problems) (andrei)
47 # 2005-10-02 distcc get gcc version hack (andrei)
48 # 2006-03-30 64 bit mode compile by default on sparc64 (-m64), added
49 # CC_GCC_LIKE_ASM and SPARC64_MODE (andrei)
50 # sparc <= v8 support (andrei)
51 # 2006-03-31 armv6 & mips64 support added
52 # mips and arm set to NOSMP by default (andrei)
53 # 2006-07-10 added -DPROFILING (hscholz)
54 # 2007-02-09 added TLS_HOOKS and CORE_TLS support, obsoleted TLS=1
55 # added TLS_EXTRA_LIBS (andrei)
56 # 2007-03-16 added LIB building options: LIB_LDFLAGS, LIB_SONAME, LIB_RPATH,
57 # INSTALL_LIB, libraries install paths (andrei)
58 # 2007-05-14 futex support if linux 2.5.70+ and
59 # use_futex=yes (default) (andrei)
60 # 2007-05-26 changed darwin module link flags (instead of -bundle_loader ser
61 # -flat_namespace -undefined suppress) (andrei)
62 # 2007-07-07 use isainfo -n to detect cpu type on solaris (andrei)
63 # 2007-07-07 added HAVE_SCHED_SETSCHEDULER for linux (andrei)
64 # 2007-07-18 added DNS_WATCHDOG_SUPPORT (Miklos)
65 # 2007-07-30 added USE_DNS_CACHE_STATS and USE_DST_BLACKLIST_STATS (Gergo)
66 # 2008-06-26 support for make cfg / config.mak and hack to load
67 # automatically config.mak when included from a module, lib
68 # a.s.o (not from the main Makefile) (andrei)
71 # check if already included/exported
74 # used for sanity checks for Makefile.defs inclusion (!= makefile_defs which
75 # specifies if we have a set of valid defs)
76 override makefile_defs_included:=1
77 ifeq ($(makefile_defs),1)
78 $(info Makefile.defs defs skipped)
81 ifeq (,$(main_makefile))
82 # hack to automatically use config.mak in all the modules, without
83 # changing the current module makefiles (which all include Makefile.defs):
84 # if not called from the main makefile (module, lib or ut):
85 # include config.mak, but if not present or incomplete (makefile_defs!=1)
86 # don't export the vars)
88 include $(COREPATH)/config.mak
89 $(info config.mak included)
90 # config.mak should set makefile_defs if complete
94 override makefile_defs=1
98 $(info normal Makefile.defs exec)
106 EXTRAVERSION = -dev23-make
108 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
110 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
111 OS = $(shell uname -s | sed -e s/SunOS/solaris/ -e s/CYGWIN.*/cygwin/ \
112 | tr "[A-Z]" "[a-z]")
123 ARCH := $(shell $(GETARCH) |sed -e s/i.86/i386/ -e s/sun4[uv]/sparc64/ \
124 -e s/armv[3-5].*/arm/ -e s/armv6.*/arm6/ \
125 -e "s/Power Macintosh/ppc/" \
126 -e "s/cobalt/mips2/" \
127 -e s/amd64/x86_64/ -e s/sparcv9/sparc64/ )
128 # fix sparc -> sparc64
130 ifeq ($(shell uname -m),sun4u)
133 ifeq ($(shell uname -m),sun4v)
138 OSREL = $(shell uname -r)
139 # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)
140 OSREL_N= $(shell echo $(OSREL) | sed -e 's/^[^0-9]*//' \
141 -e 's/^\([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*$$/\1/g' | \
142 (IFS=. read A B C D; R=0; \
143 [ -n "$$A" ] && R=`expr $$R \* 1000 + $$A` && \
144 [ -n "$$B" ] && R=`expr $$R \* 1000 + $$B` && \
145 [ -n "$$C" ] && R=`expr $$R \* 1000 + $$C`; echo $$R ) )
149 # by default compile with tls hooks support (so that no ser recompile is
150 # needed before the tls module can be used)
152 ifeq ($(CORE_TLS), 1)
153 RELEASE:=$(RELEASE)-tls
156 ifeq ($(TLS_HOOKS), 1)
157 # RELEASE:=$(RELEASE)-tls
160 # extra CC command line options (e.g -march=athlon-mp)
166 share_dir = share/ser/
167 modules_dir = lib/ser/modules/
170 doc_dir = share/doc/ser/
172 LOCALBASE ?= /usr/local
174 ifeq ($(OS), freebsd)
175 doc_dir = share/doc/ser/
177 LOCALBASE ?= /usr/local
179 ifeq ($(OS), openbsd)
180 doc_dir = share/doc/ser/
182 LOCALBASE ?= /usr/local
185 doc_dir = share/doc/ser
187 LOCALBASE ?= /usr/pkg
190 doc_dir = share/doc/ser/
192 LOCALBASE ?= /usr/local
196 LOCALBASE ?= /usr/local
204 doxygen_dir=doc/doxygen
207 DESTDIR ?= $(LOCALBASE)
210 # install path is $(basedir) $(prefix)
212 # creating a bin. archive in /tmp, which unpacks in /usr/local
218 # install prefixes for various stuff
219 cfg_prefix = $(basedir)$(prefix)
220 bin_prefix = $(basedir)$(prefix)
221 modules_prefix = $(basedir)$(prefix)
222 lib_prefix = $(basedir)$(prefix)
223 doc_prefix = $(basedir)$(prefix)
224 man_prefix = $(basedir)$(prefix)
225 ut_prefix = $(basedir)$(prefix)
226 share_prefix = $(basedir)$(prefix)
229 # target dirs for various stuff
230 cfg_target = $(prefix)/$(cfg_dir)
231 bin_target = $(prefix)/$(bin_dir)
232 modules_target = $(prefix)/$(modules_dir)
233 lib_target = $(prefix)/$(lib_dir)
234 doc_target = $(prefix)/$(doc_dir)
237 ifeq ($(OS), solaris)
246 INSTALL_TOUCH = touch # used to create the file first (good to
247 # make solaris install work)
248 INSTALL_CFG = $(INSTALL) -m 644
249 INSTALL_BIN = $(INSTALL) -m 755
250 INSTALL_SCRIPT = $(INSTALL) -m 755
251 INSTALL_MODULES = $(INSTALL) -m 755
252 INSTALL_LIB = $(INSTALL) -m 755
253 INSTALL_DOC = $(INSTALL) -m 644
254 INSTALL_MAN = $(INSTALL) -m 644
255 INSTALL_SHARE = $(INSTALL) -m 644
257 #set some vars from the environment (and not make builtins)
258 CC := $(shell echo "$${CC}")
259 LEX := $(shell echo "$${LEX}")
260 YACC := $(shell echo "$${YACC}")
265 # find compiler name & version
270 CC_LONGVER=$(shell if $(CC) -v 2>/dev/null; then \
277 #find-out the compiler's name
279 ifneq (,$(findstring gcc, $(CC_LONGVER)))
281 CC_VER=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|cut -d" " -f 3|\
282 sed -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
283 -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
284 # sed with POSIX.1 regex doesn't support |, + or ?
285 # (darwin, solaris ...) => this complicated expression
287 #transform gcc version into 2.9x or 3.0
288 CC_SHORTVER=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
289 sed -e 's/[^0-9]*-\(.*\)/\1/'| \
290 sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-3]\..*/3.0/' -e \
291 's/3\.[0-3]/3.0/' -e 's/3\.[4-9]\..*/3.4/' -e \
292 's/3\.[4-9]/3.4/' -e 's/4\.[0-9]\..*/4.x/' -e \
296 ifneq (, $(findstring Sun, $(CC_LONGVER)))
298 CC_SHORTVER=$(shell echo "$(CC_LONGVER)"|head -n 1| \
299 sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
300 CC_VER=$(CC) $(CC_SHORTVER)
304 ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
305 # very nice: gcc compatible
307 CC_FULLVER=$(shell echo "$(CC_LONGVER)"|head -n 1| \
308 sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/g' )
309 CC_SHORTVER=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
310 CC_VER=$(CC) $(CC_FULLVER)
321 $(warning Unknown compiler $(CC)\; supported compilers: \
322 gcc, sun cc, intel icc )
326 # compile-time options
329 # allows to print out number of packets processed on CTRL-C;
330 # implementation still nasty and reports per-process
332 # turns off some of the debug messages (DBG(...)).
334 # completely turns of all the logging (and DBG(...))
336 # compiles in some extra debugging code
338 # faster ip address resolver for ip strings (e.g "127.0.0.1")
340 # compiles in shared mem. support, needed by some modules and
343 # use mmap instead of SYSV shared memory
345 # uses a faster malloc (exclusive w/ USE_SHM_MEM)
347 # all pkg_malloc => shm_malloc (most mallocs use a common sh.
348 # mem. segment); don't define PKG_MALLOC if you want this!
350 # qm_malloc debug code, will cause pkg_malloc and shm_malloc
351 # to keep and display lot of debuging information: file name,
352 # function, line number of malloc/free call for each block,
353 # extra error checking (trying to free the same pointer
354 # twice, trying to free a pointer alloc'ed with a different
357 # additional option to PKG_MALLOC which utilizes a fater then
359 # (not true anymore, q_malloc performs approx. the same)
361 # an even faster malloc, not recommended for debugging
363 # a malloc implementation based on Doug Lea's dl_malloc
365 # an experimental multi-CPU, pool based, multi-process safe version of
366 # F_MALLOC. Should give better performance on machines with lots of CPUs
367 # after some tunning.
369 # an experimental multi-CPU, pool based, multi-process safe, mostly
370 # lockless version of SF_MALLOC/F_MALLOC. Not for production use for
373 # issues additional debugging information if lock/unlock is called
375 # uses fast arhitecture specific locking (see the arh. specific section)
377 # uses sys v sems for locking (slower & limited number)
378 # -DUSE_PTHREAD_MUTEX
379 # uses pthread mutexes, faster than sys v or posix sems, but do not
380 # work on all systems inter-processes (e.g. linux)
382 # uses posix semaphores for locking (faster than sys v)
384 # uses futexes for locking (linux 2.6+)
386 # uses busy waiting on the lock (FAST_LOCK)
388 # try busy waiting for a while and if the lock is still held go to
389 # force reschedule (FAST_LOCK)
390 # -DADAPTIVE_WAIT_LOOPS=number
391 # number of loops we busy wait, after "number" loops have elapsed we
392 # force a reschedule (FAST_LOCK)
394 # don't use smp compliant locking (faster but won't work on SMP machines)
395 # (not yet enabled) (FAST_LOCK)
396 # -DNO_PINGTEL_TAG_HACK
397 # if enabled, To-header-field will be less liberal and will not accept
398 # 'tag=' (tag parameter with equal sign and without value); it is called
399 # this way because such message was sighted from a Pingtel phone
401 # compiles in tcp support
403 # disable the tcp Nagle algorithm (lower delay)
405 # compiles in tls support, requires -DUSE_TCP. Note: this is only
406 # generic support (parsing a.s.o.), it does not include the actual
407 # "tls engine". If you really want tls you need also either
408 # -DCORE_TLS and a tls/ subdir with the tls code or -DTLS_HOOKS and
409 # the tls module loaded.
411 # compiles tls in-core support. Requires -DUSE_TLS, conflicts
412 # -DTLS_HOOKS. Please use make CORE_TLS=1 instead (it will set all the
413 # needed defines automatically and extra libraries needed for linking).
415 # compile tls module support (support for having the "tls engine" in a
416 # module). Requires -DUSE_TLS, conflicts -DCORE_TLS.
417 # Please use make TLS_HOOKS=1 (or TLS_HOOKS=0 to for disabling) instead
418 # of setting -DTLS_HOOKS (it will set all the needed defines
421 # support for changing some of the resolver parameters present
422 # (_res structure in <resolv.h>)
424 # compiles in comp=[sergz|sigcomp] support (parsing uri & via,
425 # adding it to via, lumps a.s.o). WARNING: right now this option
426 # is useless since the compression code doesn't exist yet.
428 # compiles in checks and use for maddr parameter in uri.
429 # Required to support Windows Messenger 5.x over TCP connection
430 # which (mis)uses this parameter.
432 # use an internal dns cache instead of making dns requests each time
433 # -DUSE_DNS_CACHE_STATS
434 # turns on DNS cache measurements
436 # if the destination resolves to multiple ips, on send error fall back
438 # -DUSE_DST_BLACKLIST
439 # blacklist bad destination (timeout, failed to connect, error sending
441 # -DUSE_DST_BLACKLIST_STATS
442 # turns on blacklist bad destination measurements
444 # if enabled profiling will be enabled for child processes
445 # Don't forget to set PROFILE (see below)
447 # compiles in stun support
449 # turns off debugging messages in signal handlers (which might be
452 # turns on naptr support (but must be also enabled from the config)
453 # -DDNS_WATCHDOG_SUPPORT
454 # turns on DNS watchdog support which can be used to inform the
455 # core that the DNS servers are down. No DNS query is performed
456 # when the servers are unreachable, and even expired resource
457 # records are used from the cache. (requires external watchdog)
458 # Sometimes is needes correct non-quoted $OS. HACK: gcc translates known OS to number ('linux'), so there is added underscore
460 DEFS= $(extra_defs) \
461 -DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
462 -DOS='$(OS)_' -DOS_QUOTED='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
463 -DSER_VER=$(SER_VER) \
464 -DCFG_DIR='"$(cfg_target)"'\
465 -DMODS_DIR='"$(modules_target)"'\
467 -DSHM_MEM -DSHM_MMAP \
476 -DUSE_DST_BLACKLIST \
479 #-DUSE_DNS_CACHE_STATS \
480 #-DUSE_DST_BLACKLIST_STATS \
481 #-DDNS_WATCHDOG_SUPPORT \
499 #PROFILE= -pg # set this if you want profiling
500 # you may also want to set -DPROFILING
502 # WARNING: do not add mode=debug or mode=release anymore in the Makefile,
503 # use make mode=debug all instead. Anyway no by default ser is compiled w/
504 # debugging symbols in all cases (-g). --andrei
506 ifeq ($(CORE_TLS), 1)
507 DEFS+= -DUSE_TLS -DCORE_TLS
509 ifeq ($(TLS_HOOKS), 1)
510 DEFS+= -DUSE_TLS -DTLS_HOOKS
525 # platform dependent settings
527 # find ld & as name (gnu or solaris)
528 ifeq ($(OS), solaris)
529 ifeq ($(CC_NAME), gcc)
530 LDGCC=$(shell $(CC) -v 2>&1 | grep with-ld| \
531 sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' )
532 ASGCC=$(shell $(CC) -v 2>&1 | grep with-as| \
533 sed -e 's/.*--with-as=\([^ ][^ ]*\).*/\1/' )
534 LDPATH=$(shell if [ -z "$(LDGCC)" ] ; then echo "ld" ;\
536 if $(LDGCC) -V 2>/dev/null 1>/dev/null; then \
541 ASPATH=$(shell if [ -z "$(ASGCC)" ] ; then echo "as" ;\
543 if $(ASGCC) -V 2>/dev/null 1>/dev/null; then \
549 LDTYPE=$(shell if $(LDPATH) -V 1>/dev/null 2>/dev/null; then \
550 if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
553 if $(LDPATH) -V 2>&1|grep Solaris >/dev/null;\
560 ASTYPE=$(shell if $(ASPATH) -V 1>/dev/null 2>/dev/null </dev/null; \
562 if $(ASPATH) -V 2>&1 </dev/null |grep GNU >/dev/null; \
565 if $(ASPATH) -V 2>&1 </dev/null |grep Sun >/dev/null;\
572 #$(warning "using ld=$(LDPATH)/$(LDTYPE), as=$(ASPATH)/$(ASTYPE)")
577 # arch. specific definitions
582 ifeq ($(ARCH), x86_64)
586 ifeq ($(ARCH), sparc64)
587 ifeq ($(CC_NAME), gcc)
592 ifeq ($(ARCH), sparc)
598 DEFS+=-DNOSMP # very unlikely to have an smp arm
609 ifeq ($(ARCH), ppc64)
614 # mips1 arch. (e.g. R3000) - no hardware locking support
616 DEFS+=-DMIPS_HAS_LLSC # likely
617 DEFS+=-DNOSMP # very likely
620 ifeq ($(ARCH), mips2)
621 # mips2 arch and newer (mips3=R4000, mips4=R5000 a.s.o)
625 ifeq ($(ARCH), mips64)
626 # mips2 arch and newer (mips3=R4000, mips4=R5000 a.s.o)
630 ifeq ($(ARCH), alpha)
632 DEFS+=-DNOSMP # very likely
635 ifeq ($(use_fast_lock), yes)
636 DEFS+= -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024
637 found_lock_method=yes
644 ifeq ($(mode), release)
648 ifeq ($(CC_NAME), gcc)
649 DEFS+=-DCC_GCC_LIKE_ASM
651 CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE)
653 ifeq ($(CC_SHORTVER), 4.x)
655 CFLAGS+=-minline-all-stringops \
661 ifeq ($(CC_SHORTVER), 3.4)
663 CFLAGS+=-minline-all-stringops \
668 ifeq ($(CC_SHORTVER), 3.0)
670 CFLAGS+=-minline-all-stringops \
674 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
675 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
682 $(warning You are using an old and unsupported gcc \
683 version ($(CC_SHORTVER)), compile at your own risk!)
685 endif # CC_SHORTVER, 2.9x
686 endif # CC_SHORTVER, 3.0
687 endif # CC_SHORTVER, 3.4
688 endif # CC_SHORTVER, 4.x
691 ifeq ($(CC_NAME), icc)
692 DEFS+=-DCC_GCC_LIKE_ASM
693 CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \
694 -tpp6 -xK #-openmp #optimize for PIII
695 # -prefetch doesn't seem to work
696 #( ty to inline acroos files, unroll loops,prefetch,
697 # optimize for PIII, use PIII instructions & vect.,
701 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
707 ifeq ($(ARCH), x86_64)
709 ifeq ($(CC_NAME), gcc)
710 DEFS+=-DCC_GCC_LIKE_ASM
712 CFLAGS=-m64 -g -O9 -funroll-loops -Wcast-align $(PROFILE)
715 ifeq ($(CC_SHORTVER), 4.x)
717 CFLAGS+=-minline-all-stringops \
723 ifeq ($(CC_SHORTVER), 3.4)
725 CFLAGS+=-minline-all-stringops \
729 ifeq ($(CC_SHORTVER), 3.0)
731 CFLAGS+=-minline-all-stringops \
733 #-mcpu=$(CPU) \ # not working on all x86_64 gccs
736 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
737 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
744 $(warning You are using an old and unsupported gcc \
745 version ($(CC_SHORTVER)), compile at your own risk!)
747 endif # CC_SHORTVER, 2.9x
748 endif # CC_SHORTVER, 3.0
749 endif # CC_SHORTVER, 3.4
750 endif # CC_SHORTVER, 4.x
753 ifeq ($(CC_NAME), icc)
754 DEFS+=-DCC_GCC_LIKE_ASM
755 CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \
756 -tpp6 -xK #-openmp #optimize for PIII
757 # -prefetch doesn't seem to work
758 #( ty to inline acroos files, unroll loops,prefetch,
759 # optimize for PIII, use PIII instructions & vect.,
763 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
769 ifeq ($(ARCH), sparc64)
771 ifeq ($(CC_NAME), gcc)
772 DEFS+=-DCC_GCC_LIKE_ASM -DSPARC64_MODE
774 CFLAGS=-m64 -g -O9 -funroll-loops $(PROFILE) \
776 #-Wmissing-prototypes
777 # use -m64 to force 64 bit (but add it also to LDFLAGS and
778 # don't forget to define SPARC64_MODE)
779 # -m32 for 32 bit (default on solaris),
780 # nothing for arch. default
783 ifeq ($(CC_SHORTVER), 4.x)
786 CFLAGS+=-mcpu=ultrasparc \
791 ifeq ($(CC_SHORTVER), 3.4)
794 CFLAGS+= -mcpu=ultrasparc -mtune=$(CPU)
797 ifeq ($(CC_SHORTVER), 3.0)
800 CFLAGS+= -mcpu=ultrasparc -mtune=$(CPU) \
801 # -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
802 #-mno-epilogue #try to inline function exit code
803 #-mflat # omit save/restore
804 #-,faster-structs #faster non Sparc ABI structure copy ops
805 else # CC_SHORTVER, 3.0
806 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
807 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
809 ifneq ($(OS), netbsd)
810 # on netbsd/sparc64, gcc 2.95.3 does not compile
814 ifeq ($(ASTYPE), solaris)
815 CFLAGS+= -Wa,-xarch=v8plus
817 else #CC_SHORTVER, 2.9x
819 $(warning You are using an old and unsupported gcc \
820 version ($(CC_SHORTVER)), compile at your own risk!)
823 ifeq ($(ASTYPE), solaris)
824 CFLAGS+= -Wa,-xarch=v8plus
827 endif #CC_SHORTVER, 2.9x
828 endif #CC_SHORTVER, 3.0
829 endif #CC_SHORTVER, 3.4
830 endif #CC_SHORTVER, 4.x
833 ifeq ($(CC_NAME), suncc)
835 CFLAGS+= -m64 -g -xO5 -fast -native -xarch=v9 -xCC \
837 # -Dinline="" # add this if cc < 5.3 (define inline as null)
840 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
841 endif #CC_NAME, suncc
846 ifeq ($(ARCH), sparc)
848 ifeq ($(CC_NAME), gcc)
849 DEFS+=-DCC_GCC_LIKE_ASM
851 CFLAGS=-g -O9 -funroll-loops $(PROFILE) \
853 #-Wmissing-prototypes
855 ifeq ($(CC_SHORTVER), 4.x)
858 CFLAGS+= -minline-all-stringops \
863 ifeq ($(CC_SHORTVER), 3.4)
866 CFLAGS+= -mtune=$(CPU)
869 ifeq ($(CC_SHORTVER), 3.0)
872 CFLAGS+= -mtune=$(CPU) \
873 #-mno-epilogue #try to inline function exit code
874 #-mflat # omit save/restore
875 #-,faster-structs #faster non Sparc ABI structure copy ops
876 else # CC_SHORTVER, 3.0
877 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
878 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
880 else #CC_SHORTVER, 2.9x
882 $(warning You are using an old and unsupported gcc \
883 version ($(CC_SHORTVER)), compile at your own risk!)
885 endif #CC_SHORTVER, 2.9x
886 endif #CC_SHORTVER, 3.0
887 endif #CC_SHORTVER, 3.4
888 endif #CC_SHORTVER, 4.x
891 ifeq ($(CC_NAME), suncc)
892 CFLAGS+= -g -xO5 -fast -native -xCC \
894 # -Dinline="" # add this if cc < 5.3 (define inline as null)
897 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
898 endif #CC_NAME, suncc
905 ifeq ($(CC_NAME), gcc)
906 DEFS+=-DCC_GCC_LIKE_ASM
908 CFLAGS=-O9 -funroll-loops $(PROFILE)
910 ifeq ($(CC_SHORTVER), 4.x)
911 CFLAGS+= -ftree-vectorize
912 # not supported on arm: -minline-all-stringops
915 ifeq ($(CC_SHORTVER), 3.4)
919 ifeq ($(CC_SHORTVER), 3.0)
923 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
924 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
930 $(warning You are using an old and unsupported gcc \
931 version ($(CC_SHORTVER)), compile at your own risk!)
933 endif # CC_SHORTVER, 2.9x
934 endif # CC_SHORTVER, 3.0
935 endif # CC_SHORTVER, 3.4
936 endif # CC_SHORTVER, 4.0
940 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
947 ifeq ($(CC_NAME), gcc)
948 DEFS+=-DCC_GCC_LIKE_ASM
950 CFLAGS=-march=armv6 -O9 -funroll-loops \
953 ifeq ($(CC_SHORTVER), 4.x)
954 CFLAGS+= -ftree-vectorize
957 ifeq ($(CC_SHORTVER), 3.4)
961 ifeq ($(CC_SHORTVER), 3.0)
965 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
966 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
972 $(warning You are using an old and unsupported gcc \
973 version ($(CC_SHORTVER)), compile at your own risk!)
975 endif # CC_SHORTVER, 2.9x
976 endif # CC_SHORTVER, 3.0
977 endif # CC_SHORTVER, 3.4
978 endif # CC_SHORTVER, 4.0
982 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
989 ifeq ($(CC_NAME), gcc)
990 DEFS+=-DCC_GCC_LIKE_ASM
992 CFLAGS=-O9 -funroll-loops $(PROFILE)
994 ifeq ($(CC_SHORTVER), 4.x)
995 CFLAGS+=-march=r3000 -minline-all-stringops \
999 ifeq ($(CC_SHORTVER), 3.4)
1000 CFLAGS+= -march=r3000
1003 ifeq ($(CC_SHORTVER), 3.0)
1004 CFLAGS+= -march=r3000
1006 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1007 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
1010 CFLAGS+=-march=r3000
1013 $(warning You are using an old and unsupported gcc \
1014 version ($(CC_SHORTVER)), compile at your own risk!)
1016 endif # CC_SHORTVER, 2.9x
1017 endif # CC_SHORTVER, 3.0
1018 endif # CC_SHORTVER, 3.4
1019 endif # CC_SHORTVER, 4.x
1023 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1027 #if >=mips2 (R4000, R5000, R6000 ....)
1028 ifeq ($(ARCH), mips2)
1030 ifeq ($(CC_NAME), gcc)
1031 DEFS+=-DCC_GCC_LIKE_ASM
1033 CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE)
1035 ifeq ($(CC_SHORTVER), 4.x)
1036 CFLAGS+=-minline-all-stringops -ftree-vectorize
1039 ifeq ($(CC_SHORTVER), 3.4)
1043 ifeq ($(CC_SHORTVER), 3.0)
1046 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1047 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
1052 $(warning You are using an old and unsupported gcc \
1053 version ($(CC_SHORTVER)), compile at your own risk!)
1055 endif # CC_SHORTVER, 2.9x
1056 endif # CC_SHORTVER, 3.0
1057 endif # CC_SHORTVER, 3.4
1058 endif # CC_SHORTVER, 4.x
1062 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1067 ifeq ($(ARCH), mips64)
1069 ifeq ($(CC_NAME), gcc)
1070 DEFS+=-DCC_GCC_LIKE_ASM
1072 CFLAGS= -mips64 -O9 -funroll-loops $(PROFILE)
1074 ifeq ($(CC_SHORTVER), 4.x)
1075 CFLAGS+=-minline-all-stringops -ftree-vectorize
1078 ifeq ($(CC_SHORTVER), 3.4)
1082 ifeq ($(CC_SHORTVER), 3.0)
1085 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1086 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
1091 $(warning You are using an old and unsupported gcc \
1092 version ($(CC_SHORTVER)), compile at your own risk!)
1094 endif # CC_SHORTVER, 2.9x
1095 endif # CC_SHORTVER, 3.0
1096 endif # CC_SHORTVER, 3.4
1097 endif # CC_SHORTVER, 4.x
1101 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1106 ifeq ($(ARCH), alpha)
1108 ifeq ($(CC_NAME), gcc)
1109 DEFS+=-DCC_GCC_LIKE_ASM
1111 CFLAGS= -O9 -funroll-loops $(PROFILE)
1113 ifeq ($(CC_SHORTVER), 4.x)
1115 # not supported: -minline-all-stringops
1118 ifeq ($(CC_SHORTVER), 3.4)
1122 ifeq ($(CC_SHORTVER), 3.0)
1125 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1126 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
1131 $(warning You are using an old and unsupported gcc \
1132 version ($(CC_SHORTVER)), compile at your own risk!)
1134 endif # CC_SHORTVER, 2.9x
1135 endif # CC_SHORTVER, 3.0
1136 endif # CC_SHORTVER, 3.4
1137 endif # CC_SHORTVER, 4.x
1141 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1148 ifeq ($(CC_NAME), gcc)
1149 DEFS+=-DCC_GCC_LIKE_ASM
1151 CFLAGS= -O9 -funroll-loops $(PROFILE)
1153 ifeq ($(CC_SHORTVER), 4.x)
1155 CFLAGS+=-ftree-vectorize \
1156 -mtune=$(CPU) -maltivec
1159 ifeq ($(CC_SHORTVER), 3.4)
1163 ifeq ($(CC_SHORTVER), 3.0)
1166 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1167 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
1172 $(warning You are using an old and unsupported gcc \
1173 version ($(CC_SHORTVER)), compile at your own risk!)
1175 endif # CC_SHORTVER, 2.9x
1176 endif # CC_SHORTVER, 3.0
1177 endif # CC_SHORTVER, 3.4
1178 endif # CC_SHORTVER, 4.x
1182 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1187 ifeq ($(ARCH), ppc64)
1189 ifeq ($(CC_NAME), gcc)
1190 DEFS+=-DCC_GCC_LIKE_ASM
1192 CFLAGS= -O9 -funroll-loops $(PROFILE)
1193 ifeq ($(CC_SHORTVER), 4.x)
1195 CFLAGS+=-ftree-vectorize \
1196 -mtune=$(CPU) -maltivec
1199 ifeq ($(CC_SHORTVER), 3.4)
1203 ifeq ($(CC_SHORTVER), 3.0)
1206 ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
1207 $(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
1212 $(warning You are using an old and unsupported gcc \
1213 version ($(CC_SHORTVER)), compile at your own risk!)
1215 endif # CC_SHORTVER, 2.9x
1216 endif # CC_SHORTVER, 3.0
1217 endif # CC_SHORTVER, 3.4
1218 endif # CC_SHORTVER, 4.x
1222 $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
1226 CFLAGS+= $(CC_EXTRA_OPTS)
1230 ifeq ($(CC_NAME), gcc)
1231 ifeq ($(LDTYPE), solaris)
1233 LDFLAGS+=-O2 $(PROFILE)
1234 MOD_LDFLAGS:=-G $(LDFLAGS)
1235 LIB_LDFLAGS:=-G $(LDFLAGS)
1239 #gcc and maybe others, => gnu ld
1240 LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
1241 MOD_LDFLAGS:=-shared $(LDFLAGS)
1242 LIB_LDFLAGS:=-shared $(LDFLAGS)
1243 LIB_SONAME=-Wl,-soname,
1244 LD_RPATH=-Wl,-rpath,
1247 ifeq ($(CC_NAME), icc)
1248 #gcc and maybe others
1249 LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
1250 MOD_LDFLAGS:=-shared $(LDFLAGS)
1251 LIB_LDFLAGS:=-shared $(LDFLAGS)
1252 LIB_SONAME=-Wl,-soname,
1253 LD_RPATH=-Wl,-rpath,
1255 ifeq ($(CC_NAME), suncc)
1257 LDFLAGS+=-xO5 $(PROFILE)
1258 MOD_LDFLAGS:=-G $(LDFLAGS)
1259 LIB_LDFLAGS:=-G $(LDFLAGS)
1263 # we need -fPIC -DPIC only for shared objects, we don't need them for
1264 # the executable file, because it's always loaded at a fixed address
1267 ifeq ($(CC_NAME), gcc)
1268 CFLAGS=-g -Wcast-align $(PROFILE)
1269 DEFS+=-DCC_GCC_LIKE_ASM
1270 ifeq ($(ARCH), sparc64)
1272 CFLAGS+= -mcpu=ultrasparc -m64
1275 ifeq ($(LDTYPE), solaris)
1277 LDFLAGS+=-g $(PROFILE)
1278 MOD_LDFLAGS:=-G $(LDFLAGS)
1279 LIB_LDFLAGS:=-G $(LDFLAGS)
1283 #gnu or other ld type
1284 LDFLAGS+=-g -Wl,-E $(PROFILE)
1285 MOD_LDFLAGS:=-shared $(LDFLAGS)
1286 LIB_LDFLAGS:=-shared $(LDFLAGS)
1287 LIB_SONAME=-Wl,-soname,
1288 LD_RPATH=-Wl,-rpath,
1291 ifeq ($(CC_NAME), icc)
1292 DEFS+=-DCC_GCC_LIKE_ASM
1293 CFLAGS=-g $(PROFILE)
1294 LDFLAGS+=-g -Wl,-E $(PROFILE)
1295 MOD_LDFLAGS:=-shared $(LDFLAGS)
1296 LIB_LDFLAGS:=-shared $(LDFLAGS)
1297 LIB_SONAME=-Wl,-soname,
1298 LD_RPATH=-Wl,-rpath,
1300 ifeq ($(CC_NAME), suncc)
1301 CFLAGS= -g $(PROFILE)
1302 LDFLAGS+=-g $(PROFILE)
1303 MOD_LDFLAGS:=-G $(LDFLAGS)
1304 LIB_LDFLAGS:=-G $(LDFLAGS)
1312 # set pedantic compiler options
1313 ifeq ($(CC_NAME), gcc)
1316 ifeq ($(CC_NAME), icc)
1319 ifeq ($(CC_NAME), suncc)
1320 # FIXME: is the default (-Xa ?) enough?
1321 endif # CC_NAME=suncc
1325 #*FLAGS used for compiling the modules
1326 ifeq ($(CC_NAME), gcc)
1327 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
1328 LIB_CFLAGS=-fPIC -DPIC $(CFLAGS)
1330 ifeq ($(CC_NAME), icc)
1331 MOD_CFLAGS=-Kpic $(CFLAGS)
1332 LIB_CFLAGS=-Kpic $(CFLAGS)
1334 ifeq ($(CC_NAME), suncc)
1335 # FIMXE: use -KPIC instead -xcode ?
1336 MOD_CFLAGS=-xcode=pic32 $(CFLAGS)
1337 LIB_CFLAGS=-xcode=pic32 $(CFLAGS)
1346 YACC_FLAGS=-d -b cfg
1347 # on solaris add -lxnet (e.g. LIBS= -lxnet)
1355 # by default use futexes if available
1357 DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
1358 -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
1359 -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
1360 ifneq ($(found_lock_method), yes)
1361 #DEFS+= -DUSE_POSIX_SEM
1362 DEFS+=-DUSE_PTHREAD_MUTEX
1364 #DEFS+= -DUSE_SYSV_SEM # try posix sems
1365 found_lock_method=yes
1367 ifneq (,$(findstring -DUSE_POSIX_SEM, $(DEFS)))
1370 ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(DEFS)))
1374 # check for >= 2.5.44
1375 ifeq ($(shell [ $(OSREL_N) -ge 2005044 ] && echo has_epoll), has_epoll)
1378 # linux + gcc >= 3.0 + -malign-double + epoll => problems
1379 CFLAGS_RM+=-malign-double
1380 #CFLAGS:=$(filter-out -malign-double, $(CFLAGS))
1383 # check for >= 2.2.0
1384 ifeq ($(shell [ $(OSREL_N) -ge 2002000 ] && echo has_sigio), has_sigio)
1386 DEFS+=-DHAVE_SIGIO_RT -DSIGINFO64_WORKARROUND
1389 # check for >= 2.5.70
1390 ifeq ($(shell [ $(OSREL_N) -ge 2005070 ] && echo has_futex), has_futex)
1391 ifeq ($(use_futex), yes)
1395 ifeq ($(NO_SELECT),)
1400 ifeq ($(OS), solaris)
1401 DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD \
1402 -DHAVE_ALLOCA_H -DUSE_SIGACTION
1403 ifneq ($(found_lock_method), yes)
1404 DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
1405 found_lock_method=yes
1407 # check for ver >= 5.7
1408 ifeq ($(shell [ $(OSREL_N) -gt 5007 ] && echo has_devpoll), has_devpoll)
1409 ifeq ($(NO_DEVPOLL),)
1410 DEFS+=-DHAVE_DEVPOLL
1413 ifeq ($(NO_SELECT),)
1416 ifeq ($(mode), release)
1417 #use these only if you're using gcc with Solaris ld
1418 #LDFLAGS=-O2 $(PROFILE)
1421 #LDFLAGS=-g $(PROFILE)
1426 ifeq ($(CC_NAME), suncc)
1427 LIBS= -lfast -ldl -lresolv
1429 OLD_SOLARIS= $(shell echo "$(OSREL)" | \
1430 sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
1431 LIBS+= -L$(LOCALBASE)/lib -lxnet -lnsl
1432 ifeq ($(OLD_SOLARIS), yes)
1437 # -lrt needed for sched_yield
1440 ifeq ($(OS), freebsd)
1441 DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
1442 -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
1443 -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1444 -DHAVE_NETINET_IN_SYSTM
1445 ifneq ($(found_lock_method), yes)
1446 DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
1447 found_lock_method=yes
1448 LIBS+= -pthread #dlopen is in libc
1450 LIBS= #dlopen is in libc
1452 # check for ver >= 4.1
1453 ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
1454 ifeq ($(NO_KQUEUE),)
1458 ifeq ($(NO_SELECT),)
1464 ifeq ($(OS), openbsd)
1465 DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 \
1466 -DHAVE_UNION_SEMUN -DHAVE_MSGHDR_MSG_CONTROL \
1467 -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1468 -DHAVE_NETINET_IN_SYSTM -DUSE_SIGWAIT
1469 ifneq ($(found_lock_method), yes)
1470 DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
1471 found_lock_method=yes
1473 # check for ver >=2 9
1474 ifeq ($(shell [ $(OSREL_N) -ge 2009 ] && echo has_kqueue), has_kqueue)
1475 ifeq ($(NO_KQUEUE),)
1479 ifeq ($(NO_SELECT),)
1482 # (symbols on openbsd are prefixed by "_")
1484 # no sched_yield on openbsd unless linking with c_r (not recommended)
1485 # unfortunately pthread is needed for sigwait
1487 OPENBSD_IS_AOUT= $(shell echo "$(OSREL)" | \
1488 sed -e 's/^3\.[0-3][^0-9]*$$/yes/' |sed -e 's/^[0-2]\..*/yes/')
1489 # exception: on sparc openbsd 3.2 is elf and not aout
1490 ifeq ($(OSREL), 3.2)
1491 ifeq ($(ARCH), sparc)
1494 ifeq ($(ARCH), sparc64)
1499 ifeq ($(OPENBSD_IS_AOUT), yes)
1500 DEFS+=-DDLSYM_PREFIX='"_"'
1501 LDFLAGS= # openbsd ld doesn't like -O2 or -E
1505 ifeq ($(OS), netbsd)
1506 DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 \
1507 -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM
1508 ifneq ($(found_lock_method), yes)
1509 DEFS+= -DUSE_SYSV_SEM # try pthread sems
1510 found_lock_method=yes
1512 # check for ver >= 2.0.0
1513 ifeq ($(shell [ $(OSREL_N) -ge 2000000 ] && echo has_kqueue), has_kqueue)
1514 ifeq ($(NO_KQUEUE),)
1516 # netbsd + kqueue and -malign-double don't work
1517 CFLAGS_RM+=-malign-double
1518 #CFLAGS:=$(filter-out -malign-double, $(CFLAGS))
1521 ifeq ($(NO_SELECT),)
1528 # OS X support, same as freebsd
1529 ifeq ($(OS), darwin)
1530 DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
1531 -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
1533 -DNDEBUG -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
1535 # -DNDEBUG used to turn off assert (assert wants to call
1536 # eprintf which doesn't seem to be defined in any shared lib
1537 ifneq ($(found_lock_method), yes)
1538 DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
1539 found_lock_method=yes
1540 DEFS+= -DUSE_SYSV_SEM # try sys v sems (pthread don't work for
1541 # processes and unnamed posix sems are not
1544 LIBS= -lresolv #dlopen is in libc
1545 ifeq ($(NO_KQUEUE),)
1548 ifeq ($(NO_SELECT),)
1551 LDFLAGS= # darwin doesn't like -O2 or -E
1552 # the modules uses symbols from ser => either
1553 # -flat_namespace -undefined_suppress or -bundle_loader ../../$(MAIN_NAME)
1554 MOD_LDFLAGS:= -bundle -flat_namespace -undefined suppress
1555 LIB_LDFLAGS:= -dynamiclib
1557 # on darwin soname should include the full path
1558 # (it kind of combines rpath & soname)
1560 # no equiv. for rpath on darwin
1565 ifneq (,$(findstring cygwin, $(OS)))
1566 # cygwin doesn't support IPV6 and doesn't support fd passing so no TCP
1567 #DEFS:=$(filter-out -DUSE_IPV6 -DUSE_TCP, $(DEFS))
1568 DEFS_RM+=-DUSE_IPV6 -DUSE_TCP
1569 DEFS+=-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
1570 -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
1571 -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
1572 ifneq ($(found_lock_method), yes)
1573 DEFS+= -DUSE_POSIX_SEM
1574 #DEFS+= -DUSE_SYSV_SEM # try posix sems
1575 # PTHREAD_MUTEX do not work for processes (try test/pthread_test.c)
1577 found_lock_method=yes
1579 ifneq (,$(findstring -DUSE_POSIX_SEM, $(DEFS)))
1582 ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(DEFS)))
1583 $(error PTHREAD_MUTEX do not work for processes on Windows/CYGWIN)
1586 # check for >= 2.5.70
1587 ifeq ($(NO_SELECT),)
1592 #add libssl if needed
1593 ifeq ($(CORE_TLS), 1)
1594 DEFS+= -I$(LOCALBASE)/ssl/include
1595 LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl -lcrypto \
1597 # NOTE: depending on the way in which libssl was compiled you might
1598 # have to add -lz -lkrb5 (zlib and kerberos5).
1599 # E.g.: make CORE_TLS=1 EXTRA_TLS_LIBS="-lz -lkrb5"
1603 DEFS+= -I$(LOCALBASE)/ssl/include
1604 LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lcrypto
1607 ifneq ($(found_lock_method), yes)
1608 $(warning No locking method found so far, trying SYS V sems)
1609 DEFS+= -DUSE_SYSV_SEM # try sys v sems
1610 found_lock_method=yes
1614 endif # ifeq (,$(main_makefile))
1615 endif # ifeq ($(makefile_defs), 1)
1617 # if incomplete or missing config.mak, or already exported vars, don't
1618 # try to export/re-export
1619 ifeq ($(makefile_defs),1)
1620 ifneq ($(exported_vars),1)
1623 override exported_vars:=1
1624 export exported_vars
1626 # variable changeable only at configure time (once saved in config.mak they
1627 # cannot be overwritten from environment or command line, unless make cfg
1629 saved_fixed_vars:= MAIN_NAME \
1631 DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS INCLUDES \
1632 MOD_LDFLAGS LIB_LDFLAGS LIB_SONAME LD_RPATH \
1633 LIB_SUFFIX LIB_PREFIX \
1635 LEX YACC YACC_FLAGS \
1638 INSTALL INSTALL_CFG INSTALL_BIN INSTALL_MODULES INSTALL_DOC \
1639 INSTALL_MAN INSTALL_LIB INSTALL_TOUCH INSTALL_SHARE
1641 # variable changeable at compile time
1642 # extra: prefix DESTDIR BASEDIR basedirt
1644 CC_EXTRA_OPTS CPU CFLAGS_RM CFLAGS MOD_CFLAGS LIB_CFLAGS \
1645 BASEDIR basedir DESTDIR \
1647 cfg_prefix cfg_dir bin_prefix bin_dir modules_prefix modules_dir \
1648 doc_prefix doc_dir man_prefix man_dir ut_prefix ut_dir \
1649 share_prefix share_dir lib_prefix lib_dir \
1650 cfg_target lib_target modules_target
1653 #export relevant variables to the sub-makes
1654 export $(saved_fixed_vars)
1655 export $(saved_chg_vars)
1658 endif # ifneq ($(exported_vars),1)
1659 endif # ifeq ($(makefile_defs),1)