dnl Process this file with autoconf to produce a configure script
AC_INIT(SAXCount/SAXCount.hpp)

dnl Checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)

dnl Checks for libraries
AC_CHECK_LIB(m, floor)

dnl special pthread handling (AIX uses pthreads instead of pthread)
AC_CHECK_LIB(pthread, pthread_create)
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(pthreads, pthread_create)
fi

dnl Checks for header files
AC_CHECK_HEADERS(inttypes.h)
if test $ac_cv_header_inttypes_h = no; then
HAVE_INTTYPES_H=0
else
HAVE_INTTYPES_H=1
fi
AC_SUBST(HAVE_INTTYPES_H)

dnl Determine the host system and Makefile fragment
AC_CANONICAL_HOST

dnl Platform-specific Makefile setup
case "${host}" in
        *-*-solaris*)   platform=SOLARIS ;;
        *-*-sco*)       platform=OPENSERVER ;;
        *-*-sysv5*)     platform=UNIXWARE ;;
        *-*-UnixWare*)  platform=UNIXWARE ;;
        *-*-*unixware*) platform=UNIXWARE ;;
        *-*-sysv5uw7*)  platform=UNIXWARE ;;
        *-*-beos*)      platform=BEOS ;;
        *-*-linux*)     platform=LINUX ;;
        *-*-nto*)       platform=QNX ;;
        *-*-freebsd*)   platform=FREEBSD ;;
        *-*-netbsd*)    platform=NETBSD ;;
        *-*-irix*)      platform=IRIX ;;
        *-*-aix*)       platform=AIX ;;
        *-*-hp*)        platform=HPUX ;
                        case "${host}" in
                            *-*-hpux11*)  osver=HPUX11;;
                            *-*-hpux10*)  osver=HPUX10;;
                            *)            osver=HPUX11;;
                        esac;;
        *-*-mvs*)       platform=OS390 ;;
        *-*-os400*)     platform=OS400 ;;
        *-*-OS400*)     platform=OS400 ;;
        *-*-osf*)       platform=TRU64 ;;
        *-apple-*)		platform=MACOSX ;;
        *-*-cygwin*)	platform=CYGWIN ;;
		*-*-mingw*)		platform=MINGW ;;
        *-*-interix*)   platform=INTERIX ;;
        *)              platform=UNKNOWN ;;
esac
AC_SUBST(platform)

compiler=${CXX}
AC_SUBST(compiler)
AC_SUBST(GXX)
AC_SUBST(GCC)

cxxver=${CXXVER}
AC_SUBST(cxxver)

# prefix=${prefix}
AC_SUBST(prefix)

cxxflags=${CXXFLAGS}
AC_SUBST(cxxflags)

cflags=${CFLAGS}
AC_SUBST(cflags)

ldflags=${LDFLAGS}
AC_SUBST(ldflags)

threads=${THREADS}
AC_SUBST(threads)

bitstobuild=${BITSTOBUILD}
AC_SUBST(bitstobuild)

extra_libs=${EXTRA_LIBS}
AC_SUBST(extra_libs)

dnl output the Makefiles
AC_OUTPUT([Makefile \
SAXCount/Makefile \
SAX2Count/Makefile \
DOMCount/Makefile \
SAXPrint/Makefile \
SAX2Print/Makefile \
DOMPrint/Makefile \
MemParse/Makefile \
Redirect/Makefile \
PParse/Makefile \
StdInParse/Makefile \
EnumVal/Makefile \
SEnumVal/Makefile \
CreateDOMDocument/Makefile \
SCMPrint/Makefile \
PSVIWriter/Makefile])

echo
echo Having build problems? Read instructions at http://xml.apache.org/xerces-c/build.html

