view GEMBASSY-1.0.3/configure.in @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
line wrap: on
line source

#                                               -*- Autoconf -*-
# Configure template for the EMBOSS package.
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.64])
AC_INIT([GEMBASSY],
[1.0.3],
[celery@g-language.org],
[GEMBASSY],
[http://www.g-language.org/gembassy/])
AC_REVISION([$Revision: 1.35 $])
AC_CONFIG_SRCDIR([src/ggcskew.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])

# Make sure CFLAGS is defined to stop AC_PROG_CC adding -g.
CFLAGS="${CFLAGS} "

# Checks for programs.
AC_PROG_AWK
AC_PROG_CC([icc gcc cc])
AC_PROG_CXX([icpc g++])
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P

AM_INIT_AUTOMAKE

# Use libtool to make a shared library.
LT_INIT




# Check if 64 bit pointer support is required on 32 bit machines
# Disabled by default

AC_ARG_ENABLE([64],
[AS_HELP_STRING([--enable-64], [64 bit pointers on 32 bit machines])])

AS_IF([test "x${enable_64}" = "xyes"],
[
  AC_MSG_CHECKING([for 64bit compilation support])

  AS_CASE([${host_os}],
  [aix*],
  [
    CPPFLAGS="-DAJ_AIX64 ${CPPFLAGS}"
    AS_CASE([${CC}],
    [gcc],
    [],
    [
      AS_VAR_APPEND([CC], [" -q64"])
    ])
    NM="nm -B -X 64"
    AR="ar -X 64"
  ],
  [hpux*],
  [
    AS_CASE([${CC}],
    [gcc],
    [],
    [
      AS_VAR_APPEND([CC], [" +DD64"])
    ])
    AC_DEFINE([HPUX64PTRS], [1], [Set to 1 if HPUX 64bit ptrs on 32 bit m/c])
  ])
  AC_MSG_RESULT([done])
])




# Compiler optimisations
# The Solaris 64bit ptr check has to be done here owing to param order

AC_ARG_WITH([optimisation],
[AS_HELP_STRING([--without-optimisation], [Disable compiler optimisation])])

AS_IF([test "x${with_optimisation}" != "xno"],
[
  AS_CASE([${CC}],
  [gcc],
  [
    # Intel MacOSX requires reduced optimisation for PCRE code
    # other OSs just use -O2
    AS_CASE([${host_os}],
    [darwin*],
    [
      AS_IF([test "x${host_cpu}" = "xi386"],
      [AS_VAR_APPEND([CFLAGS], [" -O1"])],
      [AS_VAR_APPEND([CFLAGS], [" -O2"])])
    ],
    [
      AS_VAR_APPEND([CFLAGS], [" -O2"])
    ])
  ],
  [
    AS_CASE([${host_os}],
    [aix*],
    [
      AS_VAR_APPEND([CFLAGS], [" -O3 -qstrict -qarch=auto -qtune=auto"])
    ],
    [irix*],
    [
      LD="/usr/bin/ld -IPA"
      AS_VAR_APPEND([CFLAGS], [" -O3"])
    ],
    [hpux*],
    [
      AS_VAR_APPEND([CFLAGS], [" -fast"])
    ],
    [osf*],
    [
      AS_VAR_APPEND([CFLAGS], [" -fast -U_FASTMATH"])
    ],
    [solaris*],
    [
      AS_VAR_APPEND([CFLAGS], [" -O"])
      # test for 64 bit ptr here (see Solaris 64bit above)
      AS_IF([test "x${enable_64}" = "xyes"],
      [AS_VAR_APPEND([CFLAGS], [" -xtarget=ultra -xarch=v9"])])
    ],
    [linux*],
    [
      # Default optimisation for non-gcc compilers under Linux
      AS_VAR_APPEND([CFLAGS], [" -O2"])
    ],
    [freebsd*],
    [
      AS_VAR_APPEND([CFLAGS], [" -O2"])
    ])
  ])
])




# Compiler warning settings: --enable-warnings, defines WARN_CFLAGS

AC_ARG_ENABLE([warnings],
[AS_HELP_STRING([--enable-warnings], [compiler warnings])])

AS_IF([test "x${enable_warnings}" = "xyes"],
[
  AS_CASE([${CC}],
  [gcc],
  [
    # -Wall priovides:
    #    -Waddress
    #    -Warray-bounds (only with -O2)
    #    -Wc++0x-compat
    #    -Wchar-subscripts
    #    -Wenum-compare (in C/Objc; this is on by default in C++)
    #    -Wimplicit-int (C and Objective-C only)
    #    -Wimplicit-function-declaration (C and Objective-C only)
    #    -Wcomment
    #    -Wformat
    #    -Wmain (only for C/ObjC and unless -ffreestanding)
    #    -Wmissing-braces
    #    -Wnonnull
    #    -Wparentheses
    #    -Wpointer-sign
    #    -Wreorder
    #    -Wreturn-type
    #    -Wsequence-point
    #    -Wsign-compare (only in C++)
    #    -Wstrict-aliasing
    #    -Wstrict-overflow=1
    #    -Wswitch
    #    -Wtrigraphs
    #    -Wuninitialized
    #    -Wunknown-pragmas
    #    -Wunused-function
    #    -Wunused-label
    #    -Wunused-value
    #    -Wunused-variable
    #    -Wvolatile-register-var

    AS_VAR_SET([WARN_CFLAGS], ["-Wall -fno-strict-aliasing"])
  ])
])

AC_SUBST([WARN_CFLAGS])




# Compiler developer warning settings: --enable-devwarnings,
# sets DEVWARN_CFLAGS

AC_ARG_ENABLE([devwarnings],
[AS_HELP_STRING([--enable-devwarnings],
[strict compiler warnings for developers])])

AS_IF([test "x${enable_devwarnings}" = "xyes"],
[
  AS_CASE([${CC}],
  [gcc],
  [
    # Only -Wstrict-prototypes and -Wmissing-prototypes are set in this
    # EMBASSY module.

    AS_VAR_SET([DEVWARN_CFLAGS], ["-Wstrict-prototypes -Wmissing-prototypes"])

    # Diagnostic options for the GNU GCC compiler version 4.6.1.
    # http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Warning-Options.html
    #
    # -Wextra: more warnings beyond what -Wall provides
    #    -Wclobbered
    #    -Wempty-body
    #    -Wignored-qualifiers
    #    -Wmissing-field-initializers
    #    -Wmissing-parameter-type (C only)
    #    -Wold-style-declaration (C only)
    #    -Woverride-init
    #    -Wsign-compare
    #    -Wtype-limits
    #    -Wuninitialized
    #    -Wunused-parameter (only with -Wunused or -Wall)
    #    -Wunused-but-set-parameter (only with -Wunused or -Wall)

    # AS_VAR_SET([DEVWARN_CFLAGS], ["-Wextra"])

    # Warn if a function is declared or defined without specifying the
    # argument types.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wstrict-prototypes"])

    # Warn if a global function is defined without a previous prototype
    # declaration.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmissing-prototypes"])

    # Warn for obsolescent usages, according to the C Standard,
    # in a declaration.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wold-style-definition"])

    # Warn if a global function is defined without a previous declaration.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmissing-declarations"])

    # When compiling C, give string constants the type const char[length]
    # so that copying the address of one into a non-const char * pointer
    # will get a warning.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wwrite-strings"])

    # Warn whenever a local variable or type declaration shadows another
    # variable, parameter, type, or class member (in C++), or whenever a
    # built-in function is shadowed.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wshadow"])

    # Warn when a declaration is found after a statement in a block.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wdeclaration-after-statement"])

    # Warn if an undefined identifier is evaluated in an `#if' directive.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wundef"])

    # Warn about anything that depends on the "size of" a function type
    # or of void.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wpointer-arith"])

    # Warn whenever a pointer is cast so as to remove a type qualifier
    # from the target type.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wcast-qual"])

    # Warn whenever a pointer is cast such that the required alignment
    # of the target is increased.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wcast-align"])

    # Warn whenever a function call is cast to a non-matching type.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wbad-function-cast"])

    # Warn when a comparison between signed and unsigned values could
    # produce an incorrect result when the signed value is converted to
    # unsigned.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wsign-compare"])

    # Warn if a structure's initializer has some fields missing.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmissing-field-initializers"])

    # An alias of the new option -Wsuggest-attribute=noreturn
    # Warn for cases where adding an attribute may be beneficial.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmissing-noreturn"])

    # Warn if an extern declaration is encountered within a function.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wnested-externs"])

    # Warn if anything is declared more than once in the same scope,
    # even in cases where multiple declaration is valid and changes
    # nothing.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wredundant-decls"])

    # Warn if the loop cannot be optimized because the compiler could not
    # assume anything on the bounds of the loop indices.
    # -Wunsafe-loop-optimizations objects to loops with increments more
    # than 1 because if the end is at INT_MAX it could run forever ...
    # rarely

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wunsafe-loop-optimizations"])

    # Warn for implicit conversions that may alter a value.
    # -Wconversion is brain-damaged - complains about char arguments
    # every time

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wconversion"])

    # Warn about certain constructs that behave differently in traditional
    # and ISO C.
    # -Wtraditional gives #elif and #error msgs

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wtraditional"])

    # Warn if floating point values are used in equality comparisons.
    # -Wfloat-equal will not allow tests for values still 0.0

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wfloat-equal"])

    # This option is only active when -ftree-vrp is active
    # (default for -O2 and above). It warns about subscripts to arrays
    # that are always out of bounds.
    # -Warray-bounds gives false positives in gcc 4.6.0
    # Disable rather than use a non-portable pragma

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wno-array-bounds"])
  ],
  [icc],
  [
    # Diagnostic options for the Intel(R) C++ compiler version 11.1.
    # http://software.intel.com/en-us/articles/intel-c-compiler-professional-edition-for-linux-documentation/

    # This option specifies the level of diagnostic messages to be
    # generated by the compiler.

    AS_VAR_SET([DEVWARN_CFLAGS], ["-w2"])

    # This option determines whether a warning is issued if generated
    # code is not C++ ABI compliant.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wabi"])

    # This option tells the compiler to display errors, warnings, and
    # remarks.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wall"])

    # This option tells the compiler to display a shorter form of
    # diagnostic output.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wbrief"])

    # This option warns if cast is used to override pointer type
    # qualifier

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wcast-qual"])

    # This option tells the compiler to perform compile-time code
    # checking for certain code.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wcheck"])

    # This option determines whether a warning is issued when /*
    # appears in the middle of a /* */ comment.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wcomment"])

    # Set maximum number of template instantiation contexts shown in
    # diagnostic.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wcontext-limit=n"])

    # This option enables warnings for implicit conversions that may
    # alter a value.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wconversion"])

    # This option determines whether warnings are issued for deprecated
    # features.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wdeprecated"])

    # This option enables warnings based on certain C++ programming
    # guidelines.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Weffc++"])

    # This option changes all warnings to errors.
    # Alternate: -diag-error warn

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Werror"])

    # This option changes all warnings and remarks to errors.
    # Alternate: -diag-error warn, remark

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Werror-all"])

    # This option determines whether warnings are issued about extra
    # tokens at the end of preprocessor directives.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wextra-tokens"])

    # This option determines whether argument checking is enabled for
    # calls to printf, scanf, and so forth.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wformat"])

    # This option determines whether the compiler issues a warning when
    # the use of format functions may cause security problems.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wformat-security"])

    # This option enables diagnostics about what is inlined and what is
    # not inlined.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Winline"])

    # This option determines whether a warning is issued if the return
    # type of main is not expected.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmain"])

    # This option determines whether warnings are issued for global
    # functions and variables without prior declaration.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmissing-declarations"])

    # Determines whether warnings are issued for missing prototypes.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmissing-prototypes"])

    # This option enables warnings if a multicharacter constant
    # ('ABC') is used.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wmultichar"])

    # Issue a warning when a class appears to be polymorphic,
    # yet it declares a non-virtual one.
    # This option is supported in C++ only.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wnon-virtual-dtor"])

    # This option warns about operations that could result in
    # integer overflow.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Woverflow"])

    # This option tells the compiler to display diagnostics for 64-bit
    # porting.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wp64"])

    # Determines whether warnings are issued for questionable pointer
    # arithmetic.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wpointer-arith"])

    # his option determines whether a warning is issued about the
    # use of #pragma once.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wpragma-once"])

    # Issue a warning when the order of member initializers does not
    # match the order in which they must be executed.
    # This option is supported with C++ only.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wreorder"])

    # This option determines whether warnings are issued when a function
    # uses the default int return type or when a return statement is
    # used in a void function.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wreturn-type"])

    # This option determines whether a warning is issued when a variable
    # declaration hides a previous declaration.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wshadow"])

    # This option warns for code that might violate the optimizer's
    # strict aliasing rules. Warnings are issued only when using
    # -fstrict-aliasing or -ansi-alias.

    # AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wstrict-aliasing"])

    # This option determines whether warnings are issued for functions
    # declared or defined without specified argument types.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wstrict-prototypes"])

    # This option determines whether warnings are issued if any trigraphs
    # are encountered that might change the meaning of the program.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wtrigraphs"])

    # This option determines whether a warning is issued if a variable
    # is used before being initialized.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wuninitialized"])

    # This option determines whether a warning is issued if an unknown
    # #pragma directive is used.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wunknown-pragmas"])

    # This option determines whether a warning is issued if a declared
    # function is not used.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wunused-function"])

    # This option determines whether a warning is issued if a local or
    # non-constant static variable is unused after being declared.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wunused-variable"])

    # This option issues a diagnostic message if const char* is
    # converted to (non-const) char *.

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wwrite-strings"])

    # Disable warning #981 operands are evaluated in unspecified order
    # http://software.intel.com/en-us/articles/cdiag981/

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -diag-disable 981"])
  ])
])

AC_SUBST([DEVWARN_CFLAGS])




# Compiler extra developer warning settings: --enable-devextrawarnings,
# appends DEVWARN_CFLAGS
# Will only have an effect if --enable-devwarnings also given

AC_ARG_ENABLE([devextrawarnings],
[AS_HELP_STRING([--enable-devextrawarnings],
[add extra warnings to devwarnings])])

AS_IF([test "x${enable_devwarnings}" = "xyes" &&
       test "x${enable_devextrawarnings}" = "xyes"],
[
  AS_CASE([${CC}],
  [gcc],
  [
    # flags used by Ubuntu 8.10 to check open has 2/3 arguments etc.

    AC_DEFINE([_FORTIFY_SOURCE], [2], [Set to 2 for open args])

    # compiler flags

    CPPFLAGS="-fstack-protector ${CPPFLAGS}"

    # warnings used by Ubuntu 8.10
    # -Wall already includes:
    #           -Wformat

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wformat-security -Wl,-z,relro"])

    # -Wpadded means moving char to end of structs - but also flags
    #  end of struct so need to add padding at end

    AS_VAR_APPEND([DEVWARN_CFLAGS], [" -Wpadded"])
  ])
])




# Compile deprecated functions still used in the book text for 6.2.0

AC_ARG_ENABLE([buildbookdeprecated],
[AS_HELP_STRING([--enable-buildbookdeprecated],
[build deprecated functions used in books for 6.2.0])])

# Compile all deprecated functions

AC_ARG_ENABLE([buildalldeprecated],
[AS_HELP_STRING([--enable-buildalldeprecated],
[build all deprecated functions])])

AS_IF([test "x${enable_buildbookdeprecated}" = "xyes" ||
       test "x${enable_buildalldeprecated}" = "xyes"],
[
  AC_DEFINE([AJ_COMPILE_DEPRECATED_BOOK], [1],
  [Define to 1 to compile deprecated functions used in book texts for 6.2.0])
])

AS_IF([test "x${enable_buildalldeprecated}" = "xyes"],
[
  AC_DEFINE([AJ_COMPILE_DEPRECATED], [1],
  [Define to 1 to compile all deprecated functions])
])




# Add extensions to Solaris for some reentrant functions

AS_CASE([${host_os}],
[solaris*],
[AS_VAR_APPEND([CFLAGS], [" -D__EXTENSIONS__"])])




# Test whether --with-sgiabi given for IRIX (n32m3 n32m4 64m3 64m4)

AS_CASE([${host_os}],
[irix*],
[
  AS_CASE([${CC}],
  [gcc],
  [],
  [cc],
  [CHECK_SGI])
])




dnl PCRE library definitions - see the MAJOR and MINOR values
dnl to see which version's configure.in these lines come from

dnl Provide the current PCRE version information. Do not use numbers
dnl with leading zeros for the minor version, as they end up in a C
dnl macro, and may be treated as octal constants. Stick to single
dnl digits for minor numbers less than 10. There are unlikely to be
dnl that many releases anyway.

PCRE_MAJOR="7"
PCRE_MINOR="9"
PCRE_DATE="11-Apr-2009"
PCRE_VERSION="${PCRE_MAJOR}.${PCRE_MINOR}"

dnl Default values for miscellaneous macros

POSIX_MALLOC_THRESHOLD="-DPOSIX_MALLOC_THRESHOLD=10"

dnl Provide versioning information for libtool shared libraries that
dnl are built by default on Unix systems.

PCRE_LIB_VERSION="0:1:0"
PCRE_POSIXLIB_VERSION="0:0:0"




dnl FIXME: This does no longer seem required with Autoconf 2.67?
dnl Intel MacOSX 10.6 puts X11 in a non-standard place
dnl AS_IF([test "x${with_x}" != "xno"],
dnl [
dnl   AS_CASE([${host_os}],
dnl   [darwin*],
dnl   [
dnl     OSXX=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
dnl     AS_IF([test ${OSXX} '>' '10.4'],
dnl     [AS_VAR_APPEND([CFLAGS], [" -I/usr/X11/include -L/usr/X11/lib"])])
dnl   ])
dnl ])




# Checks for header files.
AC_PATH_XTRA
AC_HEADER_DIRENT
AC_HEADER_STDC

AC_CHECK_HEADERS([unistd.h TargetConfig.h])


# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM


# Checks for library functions.
AC_FUNC_GETPGRP
AC_FUNC_STRFTIME
AC_FUNC_FORK
AC_FUNC_VPRINTF

AC_CHECK_FUNCS([strdup strstr strchr erand48 memmove])

AS_IF([test "x${with_x}" != "xno"], [LF_EMBOSS_PATH_XLIB])


# Library checks.
AC_CHECK_LIB([c], [socket], [LIBS="${LIBS}"], [LIBS="${LIBS} -lsocket"])
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([curl], [curl_easy_init], [],
[AC_MSG_ERROR([You need to install libcurl-devel library to your system])])

# GD for FreeBSD requires libiconv

AS_CASE([${host_os}],
[freebsd*],
[
  AS_IF([test "x${with_pngdriver}" != "xno"],
  [AC_CHECK_LIB([iconv], [main], [LIBS="${LIBS}"], [LIBS="-liconv ${LIBS}"])])
])




AM_CONDITIONAL([AMPNG], [false])
AM_CONDITIONAL([AMPDF], [false])

CHECK_GENERAL
CHECK_JAVA
CHECK_HPDF
CHECK_PNGDRIVER

AX_LIB_MYSQL
AX_LIB_POSTGRESQL




dnl "Export" these variables for PCRE

AC_SUBST([HAVE_MEMMOVE])
AC_SUBST([HAVE_STRERROR])
AC_SUBST([PCRE_MAJOR])
AC_SUBST([PCRE_MINOR])
AC_SUBST([PCRE_DATE])
AC_SUBST([PCRE_VERSION])
AC_SUBST([PCRE_LIB_VERSION])
AC_SUBST([PCRE_POSIXLIB_VERSION])
AC_SUBST([POSIX_MALLOC_THRESHOLD])




dnl Test if --enable-localforce given
locallink="no"
embprefix="/usr/local"
AC_ARG_ENABLE([localforce],
  [AS_HELP_STRING([--enable-localforce],
  [force compile/link against /usr/local])])

AS_IF([test "x${enable_localforce}" = "xyes"],
[embprefix="/usr/local"])

AS_IF([test "x${prefix}" = "xNONE"],
[
    AS_IF([test "x${enable_localforce}" != "xyes"],
    [locallink="yes"],
    [
        locallink="no"
        embprefix="/usr/local"
    ])
],
[
    embprefix="${prefix}"
])

AM_CONDITIONAL([LOCALLINK], [test "x${locallink}" = "xyes"])

AC_SUBST([embprefix])




# Enable debugging: --enable-debug, sets CFLAGS

AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [debug (-g option on compiler)])])

AS_IF([test "x${enable_debug}" = "xyes"], [AS_VAR_APPEND([CFLAGS], [" -g"])])




# Turn off irritating linker warnings in IRIX

AS_CASE([${host_os}],
[irix*],
[
  CFLAGS="-Wl,-LD_MSG:off=85:off=84:off=16:off=134 ${CFLAGS}"
])




# Enable the large file interface: --enable-large, appends CPPFLAGS

AC_ARG_ENABLE([large],
[AS_HELP_STRING([--enable-large],
[over 2Gb file support @<:@default=yes@:>@])])

AC_MSG_CHECKING([for large file support])

AS_IF([test "x${enable_large}" = "xno"],
[
  AC_MSG_RESULT([no])
],
[
  AS_CASE([${host_os}],
  [linux*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_LinuxLF"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_LARGEFILE_SOURCE"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_LARGEFILE64_SOURCE"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_FILE_OFFSET_BITS=64"])
  ],
  [freebsd*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_FreeBSDLF"])
  ],
  [solaris*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_SolarisLF"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_LARGEFILE_SOURCE"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_FILE_OFFSET_BITS=64"])
  ],
  [osf*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_OSF1LF"])
  ],
  [irix*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_IRIXLF"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_LARGEFILE64_SOURCE"])
  ],
  [aix*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_AIXLF"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_LARGE_FILES"])
  ],
  [hpux*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_HPUXLF"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_LARGEFILE_SOURCE"])
    AS_VAR_APPEND([CPPFLAGS], [" -D_FILE_OFFSET_BITS=64"])
  ],
  [darwin*],
  [
    AS_VAR_APPEND([CPPFLAGS], [" -DAJ_MACOSXLF"])
  ])

  AC_MSG_RESULT([yes])
])




# Enable libraries provided by the system rather than EMBOSS:
# --enable-systemlibs, sets ESYSTEMLIBS

AC_ARG_ENABLE([systemlibs],
[AS_HELP_STRING([--enable-systemlibs], [utility for RPM/dpkg bundles])])

AM_CONDITIONAL([ESYSTEMLIBS], [test "x${enable_systemlibs}" = "xyes"])




# Enable the purify tool: --enable-purify, sets CC and LIBTOOL

AC_ARG_ENABLE([purify],
[AS_HELP_STRING([--enable-purify], [purify])])

AC_MSG_CHECKING([for purify])

AS_IF([test "x${enable_purify}" = "xyes"],
[
dnl if(purify -version) < /dev/null > /dev/null 2>&1; then
  CC="purify --chain-length=20 -best-effort -windows=yes gcc -g"
  LIBTOOL="${LIBTOOL} --tag=CC"
  AC_MSG_RESULT([yes])
dnl fi
],
[
  AC_MSG_RESULT([no])
])




dnl Set extra needed compiler flags
if test "x${CC}" = "xcc"; then
  case "${host}" in
    alpha*-dec-osf*) CFLAGS="${CFLAGS} -ieee";;
  esac
fi

AM_CONDITIONAL([PURIFY], [test "x${enable_purify}" = "xyes"])




dnl Test for cygwin to set AM_LDFLAGS in library & apps Makefile.ams
dnl Replaces original version which used 'expr' and so wasn't entirely
dnl portable.
platform_cygwin="no"
AC_MSG_CHECKING([for cygwin])
case "${host}" in
  *-*-mingw*|*-*-cygwin*)
    platform_cygwin="yes"
    ;;
  *)
    platform_cygwin="no"
    ;;
esac
AC_MSG_RESULT([${platform_cygwin}])
AM_CONDITIONAL([ISCYGWIN], [test "x${platform_cygwin}" = "xyes"])




dnl Tests for AIX
dnl If shared needs -Wl,-G in plplot,ajax,nucleus, -lX11 in plplot,
dnl and -Wl,brtl -Wl,-bdynamic in emboss
dnl We therefore need a static test as well
needajax="no"

AS_CASE([${host_os}],
[aix*],
[AM_CONDITIONAL([ISAIXIA64], [true])],
[AM_CONDITIONAL([ISAIXIA64], [false])])

AM_CONDITIONAL([ISSHARED], [test "x${enable_shared}" = "xyes"])

AS_CASE([${host_os}],
[aix*],
[
  AS_IF([test -d ajax/.libs],
  [AS_ECHO(["AIX ajax/.libs exists"])], [mkdir ajax/.libs])

  AS_CASE([${host_os}],
  [aix5*], [needajax="no"],
  [aix4.3.3*], [needajax="yes"],
  [needajax="no"])
])

AM_CONDITIONAL([NEEDAJAX], [test "x${needajax}" = "xyes"])




# HP-UX needs -lsec for shadow passwords

AS_CASE([${host_os}],
[hpux*],
[AS_VAR_APPEND([LDFLAGS], [" -lsec"])])




# GNU mcheck functions: --enable-mcheck, defines HAVE_MCHECK

AC_ARG_ENABLE([mcheck],
[AS_HELP_STRING([--enable-mcheck],
[mcheck and mprobe memory allocation test])])

AS_IF([test "x${enable_mcheck}" = "xyes"], [AC_CHECK_FUNCS([mcheck])])




# Collect AJAX statistics: --enable-savestats, defines AJ_SAVESTATS

AC_ARG_ENABLE([savestats],
[AS_HELP_STRING([--enable-savestats],
[save AJAX statistics and print with debug output])])

AC_MSG_CHECKING([for savestats])

AS_IF([test "x${enable_savestats}" = "xyes"],
[
  AC_DEFINE([AJ_SAVESTATS], [1],
  [Define to 1 to collect AJAX library usage statistics.])
  AC_MSG_RESULT([yes])
],
[
  AC_MSG_RESULT([no])
])




AC_CONFIG_FILES([Makefile
                 src/Makefile
                 acd/Makefile
                 doc/Makefile
                 doc/html/Makefile
                 doc/text/Makefile
])

AC_OUTPUT