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