view configure.in @ 120:6395ced2b8b2

disable building pst2dii on cygwin consistent ordering of our include files all system includes protected by ifdef HAVE_ from autoconf
author Carl Byington <carl@five-ten-sg.com>
date Sun, 01 Feb 2009 11:24:22 -0800
parents 0f1492b7fe8b
children 8399ef94c11b
line wrap: on
line source

AC_PREREQ(2.59)
AC_INIT(libpst,0.6.26,carl@five-ten-sg.com)
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)

AC_CANONICAL_HOST

# Check for win32 which needs iconv library specified on the link line
AC_MSG_CHECKING([for Win32])
case "$host" in
    *-mingw*)
        os_win32=yes
        ;;
    *cygwin*)
        os_win32=yes
        enable_dii=no   # cygwin would find windir/system32/convert, not image magick convert
        ;;
    *)
        os_win32=no
        ;;
esac
AC_MSG_RESULT($os_win32)
AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])


# Checks for programs.
# The following lines adds the --enable-dii option to configure:
#
# Give the user the choice to enter one of these:
# --enable-dii
# --enable-dii=yes
# --enable-dii=no
#
AC_MSG_CHECKING([whether we are enabling dii utility])
AC_ARG_ENABLE(dii,
    AC_HELP_STRING([--enable-dii], [enable dii utility]),
    [
        case "${enableval}" in
          yes) ;;
          no)  ;;
          *)   AC_MSG_ERROR(bad value ${enableval} for --enable-dii) ;;
        esac
    ],
    # default if not specified
    enable_dii=yes
    )
AC_MSG_RESULT([$enable_dii])
if test "$enable_dii" = "yes"; then
    AC_PATH_PROG(CONVERT, convert)
    if test "x$CONVERT" = "x" ; then
        AC_MSG_WARN([convert not found. pst2dii disabled])
        enable_dii=no
    fi
fi
if test "$enable_dii" = "yes"; then
    AC_CHECK_HEADER([gd.h], , [
                       enable_dii=no
                       AC_MSG_WARN([gd.h not found. pst2dii disabled])
                    ])
fi
AM_CONDITIONAL(BUILD_DII, [test "$enable_dii" = "yes"])


# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

AC_SYS_LARGEFILE
AC_CHECK_SIZEOF(off_t)

# Checks for header files.
AC_CHECK_HEADER([unistd.h],
    AM_CONDITIONAL(NEED_XGETOPT, [test yes = no]),
    AM_CONDITIONAL(NEED_XGETOPT, [test yes = yes])
    )
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h inttypes.h limits.h signal.h stdarg.h stdint.h stdio.h stdlib.h string.h sys/param.h sys/stat.h sys/types.h time.h unistd.h wchar.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_FSEEKO
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
if test "$cross_compiling" != "yes"; then
    AC_FUNC_MALLOC
    AC_FUNC_MKTIME
    AC_FUNC_REALLOC
fi
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memchr memmove memset strcasecmp strncasecmp strchr strdup strerror strpbrk strrchr strstr strtol])

# iconv on mac is a library
SAVELIBS="$LIBS"
AC_SEARCH_LIBS([iconv_open], [iconv])
if test "$SAVELIBS" != "$LIBS"; then
    all_libraries="-L/usr/lib $all_libraries"
    AC_SUBST(all_libraries)
    AC_MSG_WARN([This should be building on Mac OSX, adding /usr/lib to the library path])
fi

AC_MSG_CHECKING([if iconv uses const arguments])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([
        #include <iconv.h>
        #include <stddef.h>
        int main(int argc, char* const* argv)
        {
            size_t  inlen = 100;
            char buffer[[inlen]];
            char *p = buffer;
            size_t utf8_len = 2 * inlen + 1;
            char utf8_buffer[[utf8_len]];
            char *utf8_p = utf8_buffer;
            iconv_t cd = 0;
            iconv(cd, (const char**)&p, &inlen, &utf8_p, &utf8_len);
        }
    ],
    [AC_DEFINE(ICONV_CONST,const,[do we have const headers])
     AC_MSG_RESULT([yes])
    ],
    [AC_DEFINE(ICONV_CONST,,[do we have const headers])
     AC_MSG_RESULT([no])
    ])
AC_LANG_POP([C++])


# The following lines adds the --enable-pst-debug option to configure:
#
# Give the user the choice to enter one of these:
# --enable-pst-debug
# --enable-pst-debug=yes
# --enable-pst-debug=no
#
AC_MSG_CHECKING([whether we are forcing debug dump file creation])
AC_ARG_ENABLE(pst-debug,
    AC_HELP_STRING([--enable-pst-debug], [force debug dump file creation]),
    [
        case "${enableval}" in
          yes) ;;
          no)  ;;
          *)   AC_MSG_ERROR(bad value ${enableval} for --enable-pst-debug) ;;
        esac
    ],
    # default if not specified
    enable_pst_debug=no
    )
AC_MSG_RESULT([$enable_pst_debug])
if test "$enable_pst_debug" = "yes"; then
    AC_DEFINE(DEBUG_ALL, 1, Define to 1 to force debug dump file creation)
fi


# The following lines adds the --enable-libpst-shared option to configure:
#
# Give the user the choice to enter one of these:
# --enable-libpst-shared
# --enable-libpst-shared=yes
# --enable-libpst-shared=no
#
AC_MSG_CHECKING([whether we are building libpst shared object])
AC_ARG_ENABLE(libpst-shared,
    AC_HELP_STRING([--enable-libpst-shared], [build libpst shared object]),
    [
        case "${enableval}" in
          yes) ;;
          no)  ;;
          *)   AC_MSG_ERROR(bad value ${enableval} for --enable-libpst-shared) ;;
        esac
    ],
    # default if not specified
    enable_libpst_shared=no
    )
AC_MSG_RESULT([$enable_libpst_shared])
enable_static_tools=yes
if test "$enable_libpst_shared" = "yes"; then
    enable_shared=yes
    enable_static_tools=no
fi


# needed by STATIC_TOOLS in src/Makefile.am
AC_SUBST(PST_OBJDIR, [$objdir])


# The following lines adds the --enable-static-tools option to configure:
#
# Give the user the choice to enter one of these:
# --enable-static-tools
# --enable-static-tools=yes
# --enable-static-tools=no
#
AC_MSG_CHECKING([whether to link command line tools with libpst statically])
AC_ARG_ENABLE([static-tools],
    AC_HELP_STRING([--enable-static-tools], [link command line tools with libpst statically]),
    [
        case "${enableval}" in
          yes) ;;
          no)  ;;
          *)   AC_MSG_ERROR(bad value ${enableval} for --static-tools) ;;
        esac
    ],
    [
        enable_static_tools=no
    ])
AC_MSG_RESULT([$enable_static_tools])
AM_CONDITIONAL(STATIC_TOOLS, [test "$enable_static_tools" = "yes"])
if test "$enable_static_tools" = "yes"; then
	enable_static="yes"
fi


AC_MSG_CHECKING([system enable shared])
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([system enable static])
AC_MSG_RESULT([$enable_static])



AC_OUTPUT(                  \
    Makefile                \
    debian/Makefile         \
    debian/changelog        \
    html/Makefile           \
    info/Makefile           \
    libpst.pc               \
    libpst.spec             \
    libpst/Makefile         \
    man/Makefile            \
    src/Makefile            \
    src/pst2dii.cpp         \
    xml/Makefile            \
    xml/libpst              \
    )