# Makefile.config is generated by 'configure' using Makefile.config.in
# as a template and information that 'configure' gathers from the build
# system and from user options.

# Makefile.config should someday replace most of the other files that
# 'configure' generates, thus simplifying development and customization.
# Makefile.config is intended to contain information specific to the
# particular build environment or user build choices.

# Furthermore, most of the logic in 'configure', and thus 'configure.in',
# should go into the make files to simplify the build.  Makefile.config
# should just pass raw configure variables through to the make file.

# Tokens of the form @TOKEN@ in the template file get replaced by
# 'configure' with the values of variables of the same name within
# 'configure', because of a AC_SUBST(TOKEN) statement in the
# 'configure.in' from which 'configure' was built.

# Here are the options the user chose on 'configure':

ENABLE_ABYSS_SERVER    = @ENABLE_ABYSS_SERVER@
ENABLE_ABYSS_THREADS   = @ENABLE_ABYSS_THREADS@
ENABLE_CPLUSPLUS       = @ENABLE_CPLUSPLUS@
ENABLE_CGI_SERVER      = @ENABLE_CGI_SERVER@
ENABLE_LIBXML2_BACKEND = @ENABLE_LIBXML2_BACKEND@

MUST_BUILD_WININET_CLIENT = @MUST_BUILD_WININET_CLIENT@
MUST_BUILD_CURL_CLIENT    = @MUST_BUILD_CURL_CLIENT@
MUST_BUILD_LIBWWW_CLIENT  = @MUST_BUILD_LIBWWW_CLIENT@

HAVE_WCHAR_H_DEFINE = @HAVE_WCHAR_H_DEFINE@

# Stuff 'configure' figured out about our build platform:

SHELL = @SHELL@
CC = @CC@
CXX = @CXX@
CCLD = $(CC)
CXXLD = $(CXX)
AR = ar
RANLIB = @RANLIB@
LN_S = @LN_S@
INSTALL = $(SRCDIR)/install-sh

C_COMPILER_GNU = @C_COMPILER_GNU@
CXX_COMPILER_GNU = @CXX_COMPILER_GNU@

# Stuff 'configure' figured out via AC_CANONICAL_HOST macro in configure.in
# and config.guess program and 'configure' command options:

# HOST_OS names the operating system on which Xmlrpc-c is to run.
# E.g. "linux-gnu".
HOST_OS = @host_os@

# Hardcoded in configure.in:
XMLRPC_C_VERSION = @VERSION@

###############################################################################

MUST_BUILD_CLIENT = no
ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
  MUST_BUILD_CLIENT = yes
endif
ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
  MUST_BUILD_CLIENT = yes
endif
ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
  MUST_BUILD_CLIENT = yes
endif


##############################################################################
# SHARED LIBRARY STUFF
##############################################################################

# Shared libraries are very difficult, because how you build and use
# them varies greatly from one platform to the next.  # There are two
# ways shared libraries get built in the Xmlrpc-c build: Libtool and
# direct.  In the beginning, there was just Libtool.  Libtool is
# supposed to solve the problem of the diversity of shared libraries,
# but it does it by adding a layer of complexity and yet another build
# tool a developer has to know.  The encapsulation of shared library
# building reduced flexibility and makes diagnosing problems much
# harder.  So we are phasing out Libtool.  New libraries (in
# particular, the C++ ones) don't involve Libtool.  Some day, the
# older ones won't either, but we aren't as good yet with the direct
# method as with Libtool, and we don't want to break something that's
# working.

# First, we break down shared library schemes into a few major types,
# and indicate the type by SHARED_LIB_TYPE.

# We also have a bunch of other make variables that reflect the different
# ways we have to build on and for different platforms:

# CFLAGS_SHLIB is a set of flags needed to compile a module which will
# become part of a shared library.

# On older systems, you have to make shared libraries out of position
# independent code, so you need -fpic or -fPIC here.  (The rule is: if
# -fpic works, use it.  If it bombs, go to -fPIC).  On newer systems,
# it isn't necessary, but can save real memory at the expense of
# execution speed.  Without position independent code, the library
# loader may have to patch addresses into the executable text.  On an
# older system, this would cause a program crash because the loader
# would be writing into read-only shared memory.  But on newer
# systems, the system silently creates a private mapping of the page
# or segment being modified (the "copy on write" phenomenon).  So it
# needs its own private real page frame.

# We have seen -fPIC required on IA64 and AMD64 machines (GNU
# compiler/linker).  Build-time linking fails without it.  I don't
# know why -- history seems to be repeating itself.  2005.02.23.

# SHLIB_CLIB is the link option to include the C library in a shared library,
# normally "-lc".  On typical systems, this serves no purpose.  On some,
# though, it causes information about which C library to use to be recorded
# in the shared library and thus choose the correct library among several or
# avoid using an incompatible one.  But on some systems, the link fails.
# On 2002.09.30, "John H. DuBois III" <spcecdt@armory.com> reports that on 
# SCO OpenServer, he gets the following error message with -lc:
#
#  -lc; relocations referenced  ;  from file(s) /usr/ccs/lib/libc.so(random.o);
#   fatal error: relocations remain against allocatable but non-writable 
#   section: ; .text
#
# On Bryan's system, with gcc 2.95.3 and glibc 2.2.2, -lc causes
# throws (from anywhere in a program that links the shared library)
# not to work.  I have no idea how.

# LDFLAGS_SHLIB is the linker (Ld) flags needed to generate a shared
# library from object files.  It may use $(SONAME) as the soname for
# the shared library being created (assuming sonames exist).

# We build shared libraries only for platforms for which we've figured
# out how.  For the rest, we have this default:
SHARED_LIB_TYPE = NONE

ifeq ($(HOST_OS),linux-gnu)
  # Assume linker is GNU Compiler (gcc)
  SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = so
#  SHLIB_CLIB = -lc
  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
endif

ifeq ($(findstring solaris,$(HOST_OS)),solaris)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = so
  # Solaris compiler can't take multiple ld options as -Wl,-a,-b .  Ld sees
  # -a,-b in that case.
  LDFLAGS_SHLIB = -Wl,-Bdynamic -Wl,-G -Wl,-h -Wl,$(SONAME)
  CFLAGS_SHLIB = -Kpic
endif

ifeq ($(HOST_OS),aix)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = a
  LDFLAGS_SHLIB = -qmkshrobj
endif

ifeq ($(HOST_OS),irix)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = irix
  SHLIB_SUFFIX = so
  LDFLAGS_SHLIB = -shared -n32
endif

ifeq ($(HOST_OS),hpux)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = sl
  LDFLAGS_SHLIB: -shared -fPIC
endif

ifeq ($(HOST_OS),osf)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = so
  LDFLAGS_SHLIB = -shared -expect_unresolved
endif

ifeq ($(findstring netbsd,$(HOST_OS)),netbsd)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = so
  CFLAGS_SHLIB = -fpic
endif

ifeq ($(HOST_OS),darwin)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = dylib
  SHLIB_SUFFIX = dylib
endif

ifeq ($(HOST_OS),beos)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = unix
  SHLIB_SUFFIX = so
  LDFLAGS_SHLIB = -nostart
endif

ifeq ($(HOST_OS),cygwin)
  # This code is not finished; that's why we don't set SHARED_LIB_TYPE.
  # If you can finish it and make it work on AIX, please do.
  # SHARED_LIB_TYPE = dll
  SHLIB_SUFFIX = dll
endif

##############################################################################
#                     MISCELLANEOUS
##############################################################################

# BUILDTOOL_CC is the compiler to use to generate build tools, which we
# will then run to build product.  The typical reason this would be
# different from CC is that you're cross-compiling: the product will run
# in Environment A, but you're building in Environment B, so you must
# build the build toos for Environment B.

# The cross compiling user can update Makefile.config or override
# BUILDTOOL_CC on a make command.

BUILDTOOL_CC = $(CC)
BUILDTOOL_CCLD = $(CCLD)

# Here are the commands 'make install' uses to install various kinds of files:

INSTALL_PROGRAM = $(INSTALL) -c -m 755
INSTALL_SHLIB = $(INSTALL) -c -m 755
INSTALL_DATA = $(INSTALL) -c -m 644
INSTALL_SCRIPT = $(INSTALL) -c -m 755

# Here are the locations at which 'make install' puts files:

# DESTDIR is designed to be overriden at make time in order to relocate
# the entire install into a subdirectory.
DESTDIR =

exec_prefix = @exec_prefix@
prefix = @prefix@
LIBINST_DIR = @libdir@
HEADERINST_DIR = @includedir@
PROGRAMINST_DIR = @bindir@
