diff configure.in @ 118:0f1492b7fe8b

patch from Fridrich Strba for building on mingw and general cleanup of autoconf files add processing for pst files of type 0x0f start adding support for properly building and installing libpst.so and the header files required to use it. remove version.h since the version number is now in config.h more const correctness issues regarding getopt()
author Carl Byington <carl@five-ten-sg.com>
date Sat, 31 Jan 2009 12:12:36 -0800
parents ed2a260bbb98
children 6395ced2b8b2
line wrap: on
line diff
--- a/configure.in	Fri Jan 16 15:31:11 2009 -0800
+++ b/configure.in	Sat Jan 31 12:12:36 2009 -0800
@@ -1,44 +1,68 @@
 AC_PREREQ(2.59)
-AC_INIT(libpst,0.6.25,carl@five-ten-sg.com)
+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
+AC_MSG_CHECKING([for Win32])
+case "$host" in
+    *-mingw*)
+        os_win32=yes
+        ;;
+    *)
+        os_win32=no
+        ;;
+esac
+AC_MSG_RESULT($os_win32)
+AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
+
 
 # Checks for programs.
-my_build_dii=yes
-AC_PATH_PROG(CONVERT, convert)
-if test "x$CONVERT" = "x" ; then
-    AC_MSG_WARN([convert not found.  pst2dii disabled])
-    my_build_dii=no
-else
-    # 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]),
-          [if test "${enable_dii}" = "no" ; then
-              AC_MSG_RESULT([no])
-              my_build_dii=no
-          else
-              AC_MSG_RESULT([yes])
-          fi],
-          # Default value for configure
-          AC_MSG_RESULT([yes])
-          )
+# 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
-AM_CONDITIONAL(BUILD_DII, test $my_build_dii = yes)
+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
@@ -51,15 +75,12 @@
 
 # Checks for header files.
 AC_CHECK_HEADER([unistd.h],
-    AM_CONDITIONAL(NEED_XGETOPT, [test yes = no ]),
+    AM_CONDITIONAL(NEED_XGETOPT, [test yes = no]),
     AM_CONDITIONAL(NEED_XGETOPT, [test yes = yes])
     )
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h stdlib.h string.h sys/param.h unistd.h wchar.h])
-if test "$my_build_dii" = "yes"; then
-    AC_CHECK_HEADERS([gd.h])
-fi
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -72,17 +93,19 @@
 AC_FUNC_FSEEKO
 AC_FUNC_LSTAT
 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
-AC_FUNC_MALLOC
-AC_FUNC_MKTIME
-AC_FUNC_REALLOC
+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 strchr strdup strerror strpbrk strrchr strstr strtol])
+AC_CHECK_FUNCS([memchr memmove memset strcasecmp strncasecmp strchr strdup strerror strpbrk strrchr strstr strtol])
 
 # iconv on mac is a library
-SAVELIBS="${LIBS}"
+SAVELIBS="$LIBS"
 AC_SEARCH_LIBS([iconv_open], [iconv])
-if test "x${SAVELIBS}" != "x${LIBS}"; then
+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])
@@ -92,7 +115,8 @@
 AC_LANG_PUSH([C++])
 AC_COMPILE_IFELSE([
         #include <iconv.h>
-        int main(int argc, char **argv)
+        #include <stddef.h>
+        int main(int argc, char* const* argv)
         {
             size_t  inlen = 100;
             char buffer[[inlen]];
@@ -122,16 +146,21 @@
 #
 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]),
-      [if test "${enable_pst_debug}" = "no" ; then
-          AC_MSG_RESULT([no])
-      else
-          AC_DEFINE(DEBUG_ALL, 1, Define to 1 to force debug dump file creation)
-          AC_MSG_RESULT([yes])
-      fi],
-      # Default value for configure
-      AC_MSG_RESULT([no])
-      )
+    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:
@@ -143,31 +172,74 @@
 #
 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]),
-      [if test "${enable_libpst_shared}" = "no" ; then
-          AC_MSG_RESULT([no])
-          AM_CONDITIONAL(BUILD_LIBPST_SHARED, test 0 = 1)
-      else
-          AC_MSG_RESULT([yes])
-          AM_CONDITIONAL(BUILD_LIBPST_SHARED, test 1 = 1)
-      fi],
-      # Default value for configure
-      [AC_MSG_RESULT([no])
-       AM_CONDITIONAL(BUILD_LIBPST_SHARED, test 0 = 1)]
-      )
+    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        \
-    debian/Makefile         \
-    libpst.spec             \
-    libpst.pc               \
     html/Makefile           \
     info/Makefile           \
+    libpst.pc               \
+    libpst.spec             \
+    libpst/Makefile         \
     man/Makefile            \
     src/Makefile            \
-    src/version.h           \
     src/pst2dii.cpp         \
     xml/Makefile            \
     xml/libpst              \