source: trunk/third/gal/configure.in @ 19190

Revision 19190, 10.0 KB checked in by ghudson, 21 years ago (diff)
Merge with gal 0.24.
Line 
1AC_INIT(README)
2AM_CONFIG_HEADER(config.h)
3AM_INIT_AUTOMAKE(gal,0.24)
4
5AM_MAINTAINER_MODE
6AM_ACLOCAL_INCLUDE(macros)
7
8dnl version to mangle into lib names and header installation dir
9GAL_API_VERSION=1.0
10AC_SUBST(GAL_API_VERSION)
11
12dnl libtool versioning
13
14dnl gal-0.24 = 0
15dnl increment if any interfaces have been added; set to 0
16dnl  if any interfaces have been removed. removal has
17dnl  precedence over adding, so set to 0 if both happened.
18GAL_AGE=0
19
20dnl gal-0.24 = 0
21dnl increment any time the source changes; set to
22dnl  0 if you increment CURRENT
23GAL_REVISION=0
24
25dnl gal-0.24 = 23
26dnl increment if the interface has additions, changes, removals.
27GAL_CURRENT=23
28
29AC_SUBST(GAL_CURRENT)
30AC_SUBST(GAL_REVISION)
31AC_SUBST(GAL_AGE)
32
33AC_ISC_POSIX
34AC_PROG_CC
35AC_PROG_YACC
36AM_PROG_LEX
37AC_STDC_HEADERS
38AC_ARG_PROGRAM
39AM_PROG_LIBTOOL
40
41AM_PROG_XML_I18N_TOOLS
42
43GNOME_INIT
44
45if test -f $srcdir/po/Makefile.in.in ; then
46   cp $srcdir/po/Makefile.in.in $srcdir/po/Makefile.in.in.bak
47   sed -e  "s/\$(PACKAGE).mo/\$(PACKAGE)-\$(VERSION).mo/" $srcdir/po/Makefile.in.in.bak > $srcdir/po/Makefile.in.in
48else
49    AC_MSG_ERROR([
50""
51"Can not find Makefile: $srcdir/po/Makefile.in.in"])
52fi
53
54## this should come after `AC_PROG_CC'
55GNOME_COMPILE_WARNINGS
56GNOME_X_CHECKS
57GNOME_XML_CHECK
58
59AC_DEFINE_UNQUOTED(GNOME_EXPLICIT_TRANSLATION_DOMAIN, "${PACKAGE}-${VERSION}")
60
61dnl
62dnl alloca tests
63dnl test for both ac_cv_header_alloca_h and ac_cv_working_alloca_h so
64dnl we're compatible with both autoconf 2.1X and autoconf >= 2.50
65dnl;
66AC_FUNC_ALLOCA
67if      test X$ac_cv_working_alloca_h = Xyes || \
68        test X$ac_cv_header_alloca_h = Xyes ; then
69        GAL_HAVE_ALLOCA_H=1
70else
71        GAL_HAVE_ALLOCA_H=0
72fi
73AC_SUBST(GAL_HAVE_ALLOCA_H)
74
75AC_SUBST(CFLAGS)
76AC_SUBST(CPPFLAGS)
77AC_SUBST(LDFLAGS)
78
79ALL_LINGUAS="az ca cs da de el en_GB es eu fi fr gl hu it ja ko lt ms nn no pl pt pt_BR ro ru sk sv ta tr uk zh_CN zh_TW"
80AM_GNOME_GETTEXT
81
82gnomelocaledir='${prefix}/${DATADIRNAME}/locale'
83AC_SUBST(gnomelocaledir)
84
85dnl ******************************
86dnl gnome-xml checking
87dnl ******************************
88AC_MSG_CHECKING(for libxml (aka gnome-xml) libraries 1.8.8 <= version < 2.0.0)
89if xml-config --libs > /dev/null 2>&1; then
90    vers=`xml-config --version | sed -e "s/libxml //" | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
91    if test "$vers" -ge 1008008; then
92        if test "$vers" -lt 2000000; then
93            AC_MSG_RESULT(found)
94        else
95            AC_MSG_ERROR(This version of GAL does not support libxml (aka gnome-xml) 2.x.x yet.)
96        fi
97    else
98        AC_MSG_ERROR(You need at least libxml (aka gnome-xml) 1.8.8 for this version of GAL.)
99    fi
100else
101    AC_MSG_ERROR(Did not find libxml (aka gnome-xml) installed)
102fi
103
104dnl ******************************
105dnl iconv checking
106dnl ******************************
107have_iconv=no
108AC_ARG_WITH(libiconv, [  --with-libiconv         Prefix where libiconv is installed])
109case $withval in
110/*)
111    ICONV_CFLAGS="-I$withval/include"
112    ICONV_LIBS="-L$withval/lib"
113    ;;
114esac
115
116save_CFLAGS="$CFLAGS"
117save_LIBS="$LIBS"
118CFLAGS="$CFLAGS $ICONV_CFLAGS"
119LIBS="$LIBS $ICONV_LIBS -liconv"
120AC_CACHE_CHECK(for iconv in -liconv, ac_cv_libiconv, AC_TRY_LINK([
121#include <iconv.h>
122], [
123        iconv_t cd;
124        cd = iconv_open ("UTF-8", "ISO-8859-1");
125], ac_cv_libiconv=yes, ac_cv_libiconv=no))
126if test $ac_cv_libiconv = yes; then
127        ICONV_LIBS="$ICONV_LIBS -liconv"
128        have_iconv=yes
129else
130        CFLAGS="$save_CFLAGS"
131        LIBS="$save_LIBS"
132        AC_CHECK_FUNC(iconv, have_iconv=yes, have_iconv=no)
133fi
134
135if test $have_iconv = yes; then
136        if test $ac_cv_libiconv = no; then
137                AC_CHECK_FUNCS(gnu_get_libc_version)
138        fi
139        AC_CACHE_CHECK([if iconv() handles UTF-8], ac_cv_libiconv_utf8, AC_TRY_RUN([
140#include <iconv.h>
141#include <stdlib.h>
142#include <string.h>
143#ifdef HAVE_GNU_GET_LIBC_VERSION
144#include <gnu/libc-version.h>
145#endif
146
147int main (int argc, char **argv)
148{
149        const char *jp = "\x1B\x24\x42\x46\x7C\x4B\x5C\x38\x6C";
150        const char *utf8 = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E";
151        char *transbuf = malloc (10), *trans = transbuf;
152        iconv_t cd;
153        size_t jp_len = strlen (jp), utf8_len = 10;
154        size_t utf8_real_len = strlen (utf8);
155
156#ifdef HAVE_GNU_GET_LIBC_VERSION
157        /* glibc 2.1.2's iconv is broken in hard to test ways. */
158        if (!strcmp (gnu_get_libc_version (), "2.1.2"))
159                exit (1);
160#endif
161
162        cd = iconv_open ("UTF-8", "ISO-2022-JP");
163        if (cd == (iconv_t) -1)
164                exit (1);
165        if (iconv (cd, &jp, &jp_len, &trans, &utf8_len) == -1 || jp_len != 0)
166                exit (1);
167        if (memcmp (utf8, transbuf, utf8_real_len) != 0)
168                exit (1);
169
170        exit (0);
171}], ac_cv_libiconv_utf8=yes, [ac_cv_libiconv_utf8=no; have_iconv=no], [ac_cv_libiconv_utf8=no; have_iconv=no]))
172fi
173
174if test "$have_iconv" = no; then
175        AC_MSG_ERROR([You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv])
176fi
177AC_SUBST(ICONV_CFLAGS)
178AC_SUBST(ICONV_LIBS)
179
180CFLAGS="$CFLAGS -I$srcdir"
181
182AC_MSG_CHECKING(preferred charset formats for system iconv)
183AC_TRY_RUN([
184#define CONFIGURE_IN
185#include "iconv-detect.c"
186],[
187        AC_MSG_RESULT(found)
188],[
189        AC_MSG_RESULT(not found)
190        AC_WARN([
191        *** The iconv-detect program was unable to determine the
192        *** preferred charset formats recognized by your system
193        *** iconv library. It is suggested that you install a
194        *** working iconv library such as the one found at
195        *** ftp://ftp.gnu.org/pub/gnu/libiconv
196        ])
197])
198
199CFLAGS="$save_CFLAGS"
200LIBS="$save_LIBS"
201
202dnl Check to see if strftime supports the use of %l and %k
203
204AC_MSG_CHECKING(for %l and %k support in strftime)
205AC_TRY_RUN([
206#include <string.h>
207#include <time.h>
208
209int main(int argc, char **argv)
210{
211        char buf[10];
212        time_t rawtime;
213        struct tm *timeinfo;
214
215        time(&rawtime);
216        timeinfo=localtime(&rawtime);
217        strftime(buf, 10, "%l %k", timeinfo);
218
219        if (strstr(buf, "l") || strstr(buf, "k"))
220                exit(1);
221        else
222                exit(0);
223}],[
224AC_DEFINE(HAVE_LKSTRFTIME, 1, [strftime supports use of l and k])
225ac_cv_lkstrftime=yes
226],ac_cv_lkstrftime=no,ac_cv_lkstrftime=no])
227AC_MSG_RESULT($ac_cv_lkstrftime)
228
229dnl Check for nl_langinfo and CODESET
230
231AC_MSG_CHECKING([for nl_langinfo (CODESET)])
232AC_TRY_COMPILE([#include <langinfo.h>],
233        [char *codeset = nl_langinfo (CODESET);],
234   AC_DEFINE(HAVE_CODESET,1,[Have nl_langinfo (CODESET)])
235   have_codeset=yes,
236   have_codeset=no)
237AC_MSG_RESULT($have_codeset)
238
239dnl ******************************
240dnl GnomePrint checking
241dnl ******************************
242AC_MSG_CHECKING(for GnomePrint libraries >= 0.25)
243if gnome-config --libs print > /dev/null 2>&1; then
244    vers=`gnome-config --modversion print | sed -e "s/gnome-print-//" -e 's/cvs$//' -e 's/pre$//' | \
245        awk 'BEGIN { FS = "."; } { print $1 * 1000 + $2;}'`
246    if test "$vers" -ge 25; then
247        AC_MSG_RESULT(found)
248    else
249        AC_MSG_ERROR(You need at least GNOME print 0.25 for this version of GAL)
250    fi
251else
252    AC_MSG_ERROR(Did not find GnomePrint installed)
253fi
254
255dnl ******************************
256dnl LibGlade checking
257dnl ******************************
258AC_MSG_CHECKING(for Glade libraries >= 0.13)
259if gnome-config --libs libglade > /dev/null 2>&1; then
260    vers=`gnome-config --modversion libglade | awk 'BEGIN { FS = "."; } { print $1 * 1000 + $2;}'`
261    if test "$vers" -ge 13; then
262        AC_MSG_RESULT(found)
263    else
264        AC_MSG_ERROR(You need at least libglade 0.13 for this version of GAL)
265    fi
266else
267    AC_MSG_ERROR(Did not find libGlade installed)
268fi
269
270dnl ******************************
271dnl gtk+ checking
272dnl ******************************
273AC_MSG_CHECKING(for GTK >= 1.2.7)
274if $GTK_CONFIG --version > /dev/null 2>&1; then
275    dnl We need the "%d" in order not to get e-notation on hpux.
276    vers=`"$GTK_CONFIG" --version | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
277    if test "$vers" -ge 1002007; then
278        AC_MSG_RESULT(found)
279    else
280        AC_MSG_ERROR(You need at least GTK+ 1.2.7 for this version of GAL)
281    fi
282else
283    AC_MSG_ERROR(Did not find GTK+ installed)
284fi
285
286dnl ***************************************
287
288dnl ******************************
289dnl Gnome-VFS checking
290dnl ******************************
291AC_MSG_CHECKING(for GNOME-VFS)
292if gnome-config --libs vfs > /dev/null 2>&1; then
293        vers=`gnome-config --modversion vfs`
294        case $vers
295        in
296            gnome-vfs-0.[012]) vfs_ok=false ;;
297            *) vfs_ok=true ;;
298        esac
299else
300        vfs_ok=false
301fi
302
303if $vfs_ok; then
304        AC_MSG_RESULT($vers)
305
306        GNOME_VFS_LIBS="`gnome-config --libs vfs`"
307        GNOME_VFS_CFLAGS="`gnome-config --cflags vfs`"
308        AC_SUBST(GNOME_VFS_LIBS)
309        AC_SUBST(GNOME_VFS_CFLAGS)
310
311        have_vfs=true
312else
313        AC_MSG_RESULT(Gnome-VFS not found.  Not compiling test-tree-2.)
314        have_vfs=false
315fi
316AM_CONDITIONAL(GAL_HAVE_VFS,$have_vfs)
317
318dnl
319dnl Gtk-doc
320dnl
321AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
322
323if test x$enable_gtk_doc = xauto ; then
324  if test x$GTKDOC = xtrue ; then
325    enable_gtk_doc=yes
326  else
327    enable_gtk_doc=no
328  fi
329fi
330dnl NOTE: We need to use a separate automake conditional for this
331dnl       to make this work with the tarballs.
332AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
333
334AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
335if test "x$with_html_dir" = "x" ; then
336  HTML_DIR='${datadir}/gal/html'
337else
338  HTML_DIR=$with_html_dir
339fi
340
341AC_SUBST(HTML_DIR)
342
343dnl
344dnl For the various galConf.sh scripts generation.
345dnl
346GAL_LIBDIR='-L${libdir}'
347GAL_INCLUDEDIR=" -I${includedir}/gal-1.0 `$GNOME_CONFIG --cflags gnomeui gdk_pixbuf print libglade gnomecanvaspixbuf` $ICONV_CFLAGS"
348GAL_LIBS="-lgal `$GNOME_CONFIG --libs gnomeui gdk_pixbuf print libglade gnomecanvaspixbuf` $ICONV_LIBS"
349AC_SUBST(GAL_LIBDIR)
350AC_SUBST(GAL_INCLUDEDIR)
351AC_SUBST(GAL_LIBS)
352
353EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui print libart libglade gdk_pixbuf gnomecanvaspixbuf`
354EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui print libart libglade gdk_pixbuf gnomecanvaspixbuf`
355AC_SUBST(EXTRA_GNOME_LIBS)
356AC_SUBST(EXTRA_GNOME_CFLAGS)
357
358CFLAGS="$CFLAGS -D_REENTRANT"
359
360AC_OUTPUT([
361Makefile
362intl/Makefile
363po/Makefile.in
364macros/Makefile
365gal/Makefile
366gal/util/Makefile
367gal/unicode/Makefile
368gal/widgets/Makefile
369gal/e-text/Makefile
370gal/e-paned/Makefile
371gal/e-table/Makefile
372gal/menus/Makefile
373gal/shortcut-bar/Makefile
374tests/Makefile
375docs/Makefile
376art/Makefile
377gal.spec
378gal.pc
379stamp.h
380],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
Note: See TracBrowser for help on using the repository browser.