Compatibility tests for EasyTree and Family Origins.
[gedcom-parse.git] / configure.in
index 3a111a2d6061e476e587f49af3621c7b186800c0..b942a935cd719bc265148ecafa79e29a5afae608 100644 (file)
@@ -1,27 +1,65 @@
 # Process this file with autoconf to produce a configure script.
 # $Id$
 # $Name$
-AC_INIT(standalone.c)
+AC_INIT(gedcom/interface.c)
 
 dnl =============================================================
 dnl Global variables
 NAME=gedcom-parse
-VERSION=0.13
-LIBVERSION=0:3
-SHELL=/bin/sh
 AC_SUBST(NAME)
+
+VERSION=0.20.0
+VERSION_MAJOR=`echo $VERSION | sed 's/\..*$//'`
+changequote(<<,>>)
+VERSION_MINOR=`echo $VERSION | sed 's/^[^\.]*\.//' | sed 's/\..*$//'`
+VERSION_PATCH=`echo $VERSION | sed 's/^[^\.]*\.[^\.]*\.//'`
+changequote([,])
+AC_SUBST(VERSION_MAJOR)
+AC_SUBST(VERSION_MINOR)
+AC_SUBST(VERSION_PATCH)
 AC_SUBST(VERSION)
-AC_SUBST(SHELL)
+
+LIBVERSION=0:8
 AC_SUBST(LIBVERSION)
 
+SHELL=/bin/sh
+AC_SUBST(SHELL)
+
 dnl =============================================================
 AM_INIT_AUTOMAKE(${NAME},${VERSION})
 AM_CONFIG_HEADER(config.h)
+AC_CONFIG_SUBDIRS(utf8)
 ALL_LINGUAS="nl"
 
+AC_CANONICAL_HOST
+
+EXTRA_CFLAGS=""
+case "$host_os" in
+ darwin*) AC_MSG_WARN([Disabling smart preprocessing])
+          EXTRA_CFLAGS="-no-cpp-precomp $EXTRA_CFLAGS";;
+esac
+
+AC_ARG_ENABLE(debug,
+[  --enable-debug          Compilation flags to allow debugging [default=yes]],
+  if test $enableval == "yes"
+  then
+    EXTRA_CFLAGS="-g $EXTRA_CFLAGS"
+  fi,
+  EXTRA_CFLAGS="-g $EXTRA_CFLAGS"
+)
+
+AC_SUBST(EXTRA_CFLAGS)
+
+dnl =============================================================
+dnl Checks for programs.
 AC_PROG_CC
 AM_PROG_LIBTOOL
+AC_PROG_AWK
 AM_PROG_LEX
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_RANLIB
 AC_PROG_YACC
 if test "$YACC" = "bison -y"; then
   AC_MSG_WARN([We'll remove the -y option here])
@@ -29,16 +67,97 @@ if test "$YACC" = "bison -y"; then
 else
   AC_MSG_ERROR([Sorry, bison is needed])
 fi
-AM_WITH_DMALLOC
-AM_GNU_GETTEXT
 
-AC_OUTPUT(Makefile
+dnl =============================================================
+dnl Checks for libraries.
+AM_GNU_GETTEXT([use-libtool],[need-ngettext])
+
+dnl =============================================================
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(void *, 4)
+
+dnl ==========================================================
+dnl Checks for library functions.
+AC_CHECK_HEADERS(stddef.h stdlib.h string.h)
+AC_CHECK_FUNCS(setlocale vsnprintf vsprintf)
+
+dnl ==========================================================
+dnl My local stuff
+
+gedcom_SYS_NEWLINE
+AM_ICONV
+gedcom_SANE_ICONV
+if test "$am_cv_func_iconv" != yes -o "$is_iconv_sane" != yes; then
+  AC_MSG_ERROR([
+*******************************************************************************
+You need 'iconv' (with features comparable to what is in glibc 2.2) to use this
+library, consider installing GNU libiconv or use --with-libiconv-prefix to
+point to an existing installation of that library (see README)
+*******************************************************************************
+  ])
+fi
+
+if test "${with_libiconv_prefix+set}" = set; then
+  withval="$with_libiconv_prefix"
+  
+    for dir in `echo "$withval" | tr : ' '`; do
+      if test -d $dir/lib; then ICONV_LIBPATH="$ICONV_LIBPATH -L$dir/lib"; fi
+    done
+
+  ICONV_PATH=`echo "$withval" | tr : '/bin:'`
+  ICONV_PATH="$ICONV_PATH/bin"
+fi
+AC_SUBST(ICONV_LIBPATH)
+AC_SUBST(ICONV_PATH)
+
+AC_MSG_CHECKING(for location of iconv)
+if test "$am_cv_lib_iconv" = yes; then
+  AC_MSG_RESULT(libiconv)
+  gedcom_LIBICONV_HAS_ANSEL
+else
+  AC_MSG_RESULT(libc)
+  gedcom_GLIBC22_ICONV
+  if test "$is_glibc22_iconv" = yes; then
+    DIRS="glibc"
+    is_ansel_supported=yes
+    AC_SUBST(DIRS)
+  fi
+fi
+
+if test "$is_ansel_supported" != yes; then
+  AC_MSG_WARN([
+*******************************************************************************
+Your iconv implementation doesn't support ANSEL.  Consider installing the
+modified libiconv library if you need ANSEL support in the Gedcom parser
+library (see README).
+*******************************************************************************
+  ])
+fi
+
+AC_OUTPUT(GNUmakefile
+          Makefile
+         gedcom-config
          gedcom/Makefile
          gedcom/calendar/Makefile
-         ansel/Makefile
+         gom/Makefile
+         iconv/Makefile
+         iconv/glibc/Makefile
+         iconv/libiconv/Makefile
          t/Makefile
+         t/src/Makefile
+         t/input/Makefile
+         t/output/Makefile
+         data/Makefile
+         data/new.ged
          doc/Makefile
          doc/images/Makefile
+         doc/index.html
          include/Makefile
+         include/gedcom.h
           intl/Makefile
-          po/Makefile.in)
+          po/Makefile.in
+         m4/Makefile
+         bin/Makefile)