Move to three part version numbers.
[gedcom-parse.git] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 # $Id$
3 # $Name$
4 AC_INIT(gedcom/interface.c)
5
6 dnl =============================================================
7 dnl Global variables
8 NAME=gedcom-parse
9 AC_SUBST(NAME)
10
11 VERSION=0.20.0
12 VERSION_MAJOR=`echo $VERSION | sed 's/\..*$//'`
13 changequote(<<,>>)
14 VERSION_MINOR=`echo $VERSION | sed 's/^[^\.]*\.//' | sed 's/\..*$//'`
15 VERSION_PATCH=`echo $VERSION | sed 's/^[^\.]*\.[^\.]*\.//'`
16 changequote([,])
17 AC_SUBST(VERSION_MAJOR)
18 AC_SUBST(VERSION_MINOR)
19 AC_SUBST(VERSION_PATCH)
20 AC_SUBST(VERSION)
21
22 LIBVERSION=0:8
23 AC_SUBST(LIBVERSION)
24
25 SHELL=/bin/sh
26 AC_SUBST(SHELL)
27
28 dnl =============================================================
29 AM_INIT_AUTOMAKE(${NAME},${VERSION})
30 AM_CONFIG_HEADER(config.h)
31 AC_CONFIG_SUBDIRS(utf8)
32 ALL_LINGUAS="nl"
33
34 AC_CANONICAL_HOST
35
36 EXTRA_CFLAGS=""
37 case "$host_os" in
38  darwin*) AC_MSG_WARN([Disabling smart preprocessing])
39           EXTRA_CFLAGS="-no-cpp-precomp $EXTRA_CFLAGS";;
40 esac
41
42 AC_ARG_ENABLE(debug,
43 [  --enable-debug          Compilation flags to allow debugging [default=yes]],
44   if test $enableval == "yes"
45   then
46     EXTRA_CFLAGS="-g $EXTRA_CFLAGS"
47   fi,
48   EXTRA_CFLAGS="-g $EXTRA_CFLAGS"
49 )
50
51 AC_SUBST(EXTRA_CFLAGS)
52
53 dnl =============================================================
54 dnl Checks for programs.
55 AC_PROG_CC
56 AM_PROG_LIBTOOL
57 AC_PROG_AWK
58 AM_PROG_LEX
59 AC_PROG_INSTALL
60 AC_PROG_LN_S
61 AC_PROG_MAKE_SET
62 AC_PROG_RANLIB
63 AC_PROG_YACC
64 if test "$YACC" = "bison -y"; then
65   AC_MSG_WARN([We'll remove the -y option here])
66   YACC=bison
67 else
68   AC_MSG_ERROR([Sorry, bison is needed])
69 fi
70
71 dnl =============================================================
72 dnl Checks for libraries.
73 AM_GNU_GETTEXT([use-libtool],[need-ngettext])
74
75 dnl =============================================================
76 dnl Checks for typedefs, structures, and compiler characteristics.
77 AC_C_CONST
78 AC_C_INLINE
79 AC_TYPE_SIZE_T
80 AC_CHECK_SIZEOF(void *, 4)
81
82 dnl ==========================================================
83 dnl Checks for library functions.
84 AC_CHECK_HEADERS(stddef.h stdlib.h string.h)
85 AC_CHECK_FUNCS(setlocale vsnprintf vsprintf)
86
87 dnl ==========================================================
88 dnl My local stuff
89
90 gedcom_SYS_NEWLINE
91 AM_ICONV
92 gedcom_SANE_ICONV
93 if test "$am_cv_func_iconv" != yes -o "$is_iconv_sane" != yes; then
94   AC_MSG_ERROR([
95 *******************************************************************************
96 You need 'iconv' (with features comparable to what is in glibc 2.2) to use this
97 library, consider installing GNU libiconv or use --with-libiconv-prefix to
98 point to an existing installation of that library (see README)
99 *******************************************************************************
100   ])
101 fi
102
103 if test "${with_libiconv_prefix+set}" = set; then
104   withval="$with_libiconv_prefix"
105   
106     for dir in `echo "$withval" | tr : ' '`; do
107       if test -d $dir/lib; then ICONV_LIBPATH="$ICONV_LIBPATH -L$dir/lib"; fi
108     done
109
110   ICONV_PATH=`echo "$withval" | tr : '/bin:'`
111   ICONV_PATH="$ICONV_PATH/bin"
112 fi
113 AC_SUBST(ICONV_PATH)
114
115 AC_MSG_CHECKING(for location of iconv)
116 if test "$am_cv_lib_iconv" = yes; then
117   AC_MSG_RESULT(libiconv)
118   gedcom_LIBICONV_HAS_ANSEL
119 else
120   AC_MSG_RESULT(libc)
121   gedcom_GLIBC22_ICONV
122   if test "$is_glibc22_iconv" = yes; then
123     DIRS="glibc"
124     is_ansel_supported=yes
125     AC_SUBST(DIRS)
126   fi
127 fi
128
129 if test "$is_ansel_supported" != yes; then
130   AC_MSG_WARN([
131 *******************************************************************************
132 Your iconv implementation doesn't support ANSEL.  Consider installing the
133 modified libiconv library if you need ANSEL support in the Gedcom parser
134 library (see README).
135 *******************************************************************************
136   ])
137 fi
138
139 case "$host_os" in
140  darwin*) # Hack to get correct locale_charset() function
141           LDFLAGS="$ICONV_LIBPATH -liconv $LDFLAGS";;
142 esac
143
144 AC_OUTPUT(GNUmakefile
145           Makefile
146           gedcom-config
147           gedcom/Makefile
148           gedcom/calendar/Makefile
149           gom/Makefile
150           iconv/Makefile
151           iconv/glibc/Makefile
152           iconv/libiconv/Makefile
153           t/Makefile
154           t/src/Makefile
155           t/input/Makefile
156           t/output/Makefile
157           data/Makefile
158           data/new.ged
159           doc/Makefile
160           doc/images/Makefile
161           doc/index.html
162           include/Makefile
163           include/gedcom.h
164           intl/Makefile
165           po/Makefile.in
166           m4/Makefile)