# # $Id$ # # configuration file for gcc # ############################################################################## CXX = gcc CCVER = $(shell $(CXX) -dumpversion | sed "s/[^0-9]*\([0-9.]*\).*/\1/g") # determine the major version of gcc CXX_MAJOR = $(shell echo "$(CCVER)" | sed "s/^\([1-9][0-9]*\).*/\1/") CXX_MINOR = $(shell echo "$(CCVER)" | sed "s/[1-9]*\.\([0-9]*\).*/\1/") WARNFLAGS = -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings # -Wno-long-long not available prior to 2.90 ifeq ($(shell [ $(CXX_MAJOR) -gt 2 -o $(CXX_MAJOR) -eq 2 -a $(CXX_MINOR) -ge 90 ] && echo 1), 1) WARNFLAGS += -Wno-long-long endif # gcc >= 2.90 # prevent (bogus?) warnings on SunOS ifneq ($(OSNAME),SunOS) WARNFLAGS += -Wcast-align else # prevent gcc 3.x warnings about #pragma ident on SunOS ifeq ($(CXX_MAJOR),3) ifeq ($(shell expr $(CXX_MINOR) \< 4),1) WARNFLAGS += -Wno-unknown-pragmas endif # gcc < 3.4 endif # gcc == 3.x endif # !SunOS # do not enable -Wunreachable-code: it's useless the way implemented # ifeq ($(shell expr $(CXX_MAJOR) \> 3 \& $(CXX_MINOR) \> 3),1) # WARNFLAGS += -Wunreachable-code # endif # gcc > 3.3 DEPENDFLAGS = -M # IBM AIX code is always position independent ifneq ($(OSNAME),AIX) PICFLAGS = -fPIC endif ifeq ($(OSNAME),SunOS) # linker flags for symbol versioning # disabled (causes unsats in optimized builds due to a binary # incompatibility with debugging symbols involving iterators) # MAPFLAGS = -Wl,-M endif ifneq ($(MAPFLAGS),) # path to mapfile (relative to $(TOPDIR)) for symbol versioning ifneq ($(CXX_MAJOR),2) MAPFILE = src/mapfile.$(CXX) else # gcc 2.x implements a different ABI than gcc 3 MAPFILE = src/mapfile.$(CXX)-$(CXX_MAJOR) endif endif LDSOFLAGS = -shared ifneq ($(CXX_MAJOR),2) LDSOFLAGS += -lsupc++ endif # -fPIC needed both to compile and link shared libs on HP-UX 11 ifeq ($(OSNAME),HP-UX) LDSOFLAGS += -fPIC endif CXXFLAGS = -pedantic -nostdinc++ ifeq ($(CXX_MAJOR),2) ifeq ($(shell expr $(CXX_MINOR) / 10),9) CXXFLAGS += -fhonor-std -ftemplate-depth-32 else CXXFLAGS += -ftemplate-depth-32 endif endif ifeq ($(OSNAME),IRIX64) ifeq ($(CXX_MAJOR),2) # prevent (some) assembler errors caused by overly long symbol names # (the option is not supported in gcc 3 and beyond) CXXFLAGS += -fsquangle endif # disable ld warnings about libs not used to resolve any symbols LDFLAGS += -Wl,-woff,84 endif # prevent (some) assemler errors caused by overly long symbol names ifeq ($(OSNAME),OSF1) CXXFLAGS += -fsquangle endif CXXPRELINK = # enable C++ C library headers (the kind) CPPFLAGS = -I$(TOPDIR)/include/ansi # decrease warning level to prevent annoying linker warnings # about duplicate symbols (the linker has no concept of weak symbols) ifeq ($(OSNAME),AIX) LDFLAGS = -Wl,-bh:5 endif ifneq ($(CXX_MAJOR),2) # gcc 3.x needs to explicitly link with libsupc++ for language support # g++ 3.x links with it as well as libstdc++ automatically LDLIBS = -lsupc++ endif # debug/optimization options DEBUG_CXXFLAGS = -g DEBUG_CPPFLAGS = OPTMZ_CXXFLAGS = -O2 OPTMZ_CPPFLAGS = # shared/static library options SHARED_CXXFLAGS = SHARED_CPPFLAGS = SHARED_LDFLAGS = ifeq ($(OSNAME),AIX) SHARED_SUFFIX = .a endif ifeq ($(OSNAME),HP-UX) SHARED_SUFFIX = .sl endif STATIC_CXXFLAGS = STATIC_CPPFLAGS = STATIC_LDFLAGS = # compiler and linker flags for thread safety # use undocumented (though long implemented) gcc option -pthread # which defines _REENTRANT; # the same option is named -pthreads on Solaris ifeq ($(findstring CYGWIN,$(OSNAME)),) ifeq ($(OSNAME),SunOS) MULTI_CPPFLAGS_POSIX = -pthreads MULTI_LDFLAGS_POSIX = -pthreads else ifeq ($(OSNAME),IRIX64) # no -pthreads option (or similar) on IRIX? MULTI_CPPFLAGS_POSIX = -D_REENTRANT MULTI_LDFLAGS_POSIX = -lpthread else MULTI_CPPFLAGS_POSIX = -pthread MULTI_LDFLAGS_POSIX = -pthread endif endif else # on Cygwin use MingW-threads by default MULTI_CPPFLAGS_POSIX = -mthreads MULTI_LDFLAGS_POSIX = -mthreads # set the assembler file suffix to .s AS_EXT = .s endif MULTI_CPPFLAGS_SOLARIS = -threads MULTI_LDFLAGS_SOLARIS = -threads MULTI_CPPFLAGS_DCE = MULTI_LDFLAGS_DCE = # POSIX MULTI_CPPFLAGS = $(MULTI_CPPFLAGS_POSIX) MULTI_LDFLAGS = $(MULTI_LDFLAGS_POSIX) SINGL_CPPFLAGS = SINGL_LDFLAGS = # wide (64-bit flags) WIDE_CXXFLAGS = -m64 WIDE_LDFLAGS = -m64 WIDE_LDSOFLAGS = -m64 WIDE_ARFLAGS =