# CONFIG.Common.solaris-x86
#
# Definitions for solaris-x86 target archs
# Sites may override these definitions in CONFIG_SITE.Common.solaris-x86
#-------------------------------------------------------

# Include definitions common to all Unix target archs
include $(CONFIG)/os/CONFIG.Common.UnixCommon

OS_CLASS = solaris
ARCH_CLASS = x86

CODE_CPPFLAGS = -D__EXTENSIONS__

COMPILER_CPPFLAGS += -mt
COMPILER_LDFLAGS += -mt

SOLARIS_VERSION = $(subst 5.,,$(shell uname -r))

POSIX_CFLAGS = -xc99 -D_POSIX_C_SOURCE=200112L
POSIX_LDLIBS += -lposix4 -lpthread

OP_SYS_CPPFLAGS += -DSOLARIS=$(SOLARIS_VERSION) $(COMPILER_CPPFLAGS)
OP_SYS_LDFLAGS +=  $(COMPILER_LDFLAGS)
ARCH_DEP_CPPFLAGS = -D_X86_

# Set runtime path for shared libraries
SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-R%)
SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))

# Set runtime path for products
PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-R%)
PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))

GNU_TARGET=x86-sun-solaris2

STLPORT_CFLAGS_YES= -library=stlport4
STLPORT_CFLAGS_NO=
STLPORT_LDLIBS_YES =
STLPORT_LDLIBS_NO = -lCstd

# can be overridden from ...SITE
USE_STLPORT=NO

OP_SYS_CFLAGS+=$(STLPORT_CFLAGS_$(USE_STLPORT))
OP_SYS_LDFLAGS+=$(STLPORT_CFLAGS_$(USE_STLPORT))

OP_SYS_LDLIBS += -lsocket -lnsl
OP_SYS_LDLIBS_8 += -ldl -lCrun -lc
OP_SYS_LDLIBS_9 += -ldl -lCrun -lc
OP_SYS_LDLIBS_10 += -lCrun -lc
OP_SYS_LDLIBS_11 += -lCrun -lc
OP_SYS_LDLIBS += $(OP_SYS_LDLIBS_$(SOLARIS_VERSION))
OP_SYS_LDLIBS += $(STLPORT_LDLIBS_$(USE_STLPORT))

#  Definitions used when COMMANDLINE_LIBRARY is READLINE
READLINE_DIR = $(GNU_DIR)
INCLUDES_READLINE = -I$(READLINE_DIR)/include
RUNTIME_LDFLAGS_READLINE_YES += -R$(READLINE_DIR)/lib
RUNTIME_LDFLAGS_READLINE += $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
LDFLAGS_READLINE += -L$(READLINE_DIR)/lib
LDLIBS_READLINE = -lreadline -lcurses
# Use archive if there is a problem with the readline shared library
#LDLIBS_READLINE = -Bstatic -lreadline -Bdynamic -lcurses

