]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/aclocal.m4
0ad2655aafee44618128247c25f6a193e7678b78
[lilypond.git] / stepmake / aclocal.m4
1 dnl aclocal.m4   -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
3
4
5 ### mostly interal macros
6
7 # Get full path of executable ($1)
8 AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [
9     ## which doesn't work in ash, if /usr/bin/which isn't installed
10     ## type -p doesn't work in ash
11     ## command -v doesn't work in zsh
12     ## command -v "$1" 2>&1
13     ## this test should work in ash, bash, pdksh (ksh), zsh
14     type -p "$1" 2>/dev/null | tail -n 1 | awk '{print $NF}'
15 ])
16
17
18 # Get version string from executable ($1)
19 AC_DEFUN(STEPMAKE_GET_VERSION, [
20     ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}'
21     ##
22     ## ARG.
23     ## Workaround for broken Debian gcc version string:
24     ##     gcc (GCC) 3.1.1 20020606 (Debian prerelease)
25     ##
26     ## -V: Workaround for python
27
28     changequote(<<, >>)dnl
29     ##set -x
30     ## Assume and hunt for dotted version multiplet.
31     ## use eval trickery, because we cannot use multi-level $() instead of ``
32     ## for compatibility reasons.
33     ## FIXME: what systems still do not have $() in /bin/sh?
34     eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \
35         | head -n 1 \
36         | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
37             -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
38     if test -z "$_ver"; then
39         ## If empty, try date [fontforge]
40         eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
41             | head -n 1 \
42             | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
43     fi
44     echo "$_ver"
45     ##set +x
46     changequote([, ])dnl
47 ])
48
49 # Calculate simplistic numeric version from version string ($1)
50 # As yet, we have no need for something more elaborate.
51 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
52     echo "$1" | awk -F. '
53     {
54       if ([$]3) {three = [$]3}
55       else {three = 0}
56     }
57     {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
58 ])
59
60
61 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
62 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
63     eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
64 ])
65
66 # Check if tested program ($2) was found ($1).
67 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
68 # We could abort here if a 'REQUIRED' program is not found
69 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
70     STEPMAKE_CHECK_SEARCH_RESULT($1)
71     if test $? -ne 0; then
72         STEPMAKE_ADD_ENTRY($3, $2)
73         if test "$3" = "REQUIRED"; then
74             command="echo ERROR: $2 not found"
75             # abort configure process here?
76         else
77             command="- echo $2 not found"
78         fi
79         eval "$1"='$command'
80         false
81     else
82         true
83     fi
84 ])
85
86
87 # Return if tested proram ($1) was found (true) or not (false).
88 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
89     r="`eval echo '$'"$1"`"
90     if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
91         true
92     else
93         ##STEPMAKE_WARN(cannot find $2. $3)
94         false
95     fi
96 ])
97
98
99 # Check version of program ($1)
100 # If version ($4: optional argument, supply if version cannot be
101 # parsed using --version or -V ) is smaller than requested ($3), add
102 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
103 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
104     r="`eval echo '$'"$1"`"
105     AC_MSG_CHECKING([$r version])
106     exe=`STEPMAKE_GET_EXECUTABLE($r)`
107     if test -n "$4"; then
108         ver="$4"
109     else
110         ver=`STEPMAKE_GET_VERSION($exe)`
111     fi
112     num=`STEPMAKE_NUMERIC_VERSION($ver)`
113     req=`STEPMAKE_NUMERIC_VERSION($3)`
114     AC_MSG_RESULT([$ver])
115     if test "$num" -lt "$req"; then
116         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
117     fi
118     vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
119     eval `echo $vervar=$num`
120 ##    AC_SUBST(`eval echo $vervar`)
121 ])
122
123 # Check version of program ($1)
124 # If version is greater than or equals unsupported ($3),
125 # add entry to unsupported list ($2, 'UNSUPPORTED')
126 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
127     r="`eval echo '$'"$1"`"
128     AC_MSG_CHECKING([$r version])
129     exe=`STEPMAKE_GET_EXECUTABLE($r)`
130     ver=`STEPMAKE_GET_VERSION($exe)`
131     num=`STEPMAKE_NUMERIC_VERSION($ver)`
132     sup=`STEPMAKE_NUMERIC_VERSION($3)`
133     AC_MSG_RESULT([$ver])
134     if test "$num" -ge "$sup"; then
135         STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
136     fi
137 ])
138
139 ### Macros to build configure.in
140
141
142 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
143     STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
144     if test "$BIBTEX2HTML" = "bib2html"; then
145         BIBTEX2HTML_FLAGS='$< $(@)'
146     else
147         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
148     fi
149     AC_SUBST(BIBTEX2HTML)
150     AC_SUBST(BIBTEX2HTML_FLAGS)
151 ])
152
153
154 AC_DEFUN(STEPMAKE_BISON, [
155     # ugh, automake: we want (and check for) bison
156     AC_PROG_YACC
157     
158     STEPMAKE_PROGS(BISON, bison, $1)
159     
160     # urg.  should test functionality rather than version.
161     if test "$BISON" = "bison" -a -n "$2"; then
162         STEPMAKE_CHECK_VERSION(BISON, $1, $2)
163     fi
164 ])
165
166
167 AC_DEFUN(STEPMAKE_COMPILE, [
168     # -O is necessary to get inlining
169     CFLAGS=${CFLAGS-""}
170     CXXFLAGS=${CXXFLAGS-$CFLAGS}
171     LDFLAGS=${LDFLAGS-""}
172     optimise_b=yes
173     profile_b=no
174     debug_b=yes
175     pipe_b=yes
176
177     AC_ARG_ENABLE(debugging,
178     [  --enable-debugging      compile with debugging info.  Default: on],
179     [debug_b=$enableval])
180
181     AC_ARG_ENABLE(optimising,
182     [  --enable-optimising     compile with optimising.  Default: on],
183     [optimise_b=$enableval])
184
185     AC_ARG_ENABLE(profiling, 
186     [  --enable-profiling      compile with gprof support.  Default: off],
187     [profile_b=$enableval])
188     
189     AC_ARG_ENABLE(pipe, 
190     [  --enable-pipe           compile with -pipe.  Default: on],
191     [pipe_b=$enableval])
192
193     if test "$optimise_b" = yes; then
194         AC_DEFINE(NDEBUG)
195         DEFINES="$DEFINES -DNDEBUG"
196         OPTIMIZE="-O2 -finline-functions"
197     fi
198
199     if test $profile_b = yes; then
200         EXTRA_LIBES="-pg"
201         OPTIMIZE="$OPTIMIZE -pg"
202     fi
203
204     if test $debug_b = yes; then
205         OPTIMIZE="$OPTIMIZE -g"
206     fi
207  
208     AC_PROG_CC
209     STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
210     LD='$(CC)'
211     AC_SUBST(LD)
212
213     # If -pipe requested, test if it works and add to CFLAGS.
214     if test "$pipe_b" = yes; then
215         save_cflags="$CFLAGS"
216         CFLAGS="-pipe $CFLAGS";
217         AC_CACHE_CHECK([whether compiler understands -pipe],
218             [stepmake_cflags_pipe],
219             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
220                 [stepmake_cflags_pipe=yes],
221                 [stepmake_cflags_pipe=no]))
222         CFLAGS=$save_cflags
223         if test $stepmake_cflags_pipe = yes; then
224             OPTIMIZE="$OPTIMIZE -pipe"
225         fi
226     fi
227
228     CFLAGS="$CFLAGS $OPTIMIZE"
229     CPPFLAGS=${CPPFLAGS-""}
230
231     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
232     save_cflags="$CFLAGS"
233     case "$host" in
234         alpha*-*-*)
235             dnl should do compile test?
236             AC_MSG_RESULT(-mieee)
237             CFLAGS="-mieee $CFLAGS"
238             ;;
239         *)
240             AC_MSG_RESULT([none])
241             ;;
242     esac
243
244     AC_SUBST(cross_compiling)
245     AC_SUBST(CFLAGS)
246     AC_SUBST(CPPFLAGS)
247     AC_SUBST(LDFLAGS)
248     AC_SUBST(ICFLAGS)
249     AC_SUBST(ILDFLAGS)
250     AC_SUBST(DEFINES)
251     AC_SUBST(EXTRA_LIBES)
252 ])
253
254 AC_DEFUN(STEPMAKE_CXX, [
255     AC_LANG([C++])
256     AC_PROG_CXX
257     STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
258
259     CPPFLAGS="$CPPFLAGS $DEFINES"
260     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
261     LDFLAGS="$LDFLAGS $EXTRA_LIBES"
262
263     AC_SUBST(CXXFLAGS)
264     AC_SUBST(CXX)
265     LD='$(CXX)'
266     AC_SUBST(LD)
267 ])
268
269
270 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
271     AC_CACHE_CHECK([whether explicit instantiation is needed],
272         lily_cv_need_explicit_instantiation,
273         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
274     template <class T> struct foo { static int baz; };
275     template <class T> int foo<T>::baz = 1;
276     ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
277     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
278         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
279     fi
280 ])
281
282
283 AC_DEFUN(STEPMAKE_DATADIR, [
284     if test "$datadir" = "\${prefix}/share"; then
285             datadir='${prefix}/share'
286     fi
287     presome=${prefix}
288     if test "$prefix" = "NONE"; then
289         presome=${ac_default_prefix}
290     fi
291     
292     build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package
293     
294     DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
295     BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
296     
297     AC_SUBST(datadir)
298     AC_SUBST(build_package_datadir)
299     AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
300     AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
301 ])
302
303 ## ugh: cut & paste programming from datadir. 
304 AC_DEFUN(STEPMAKE_LIBDIR, [
305
306     if test "$libdir" = "\${exec_prefix}/lib"; then
307         libdir='${exec_prefix}/lib'
308     fi
309     presome=$exec_prefix
310     build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package
311     
312     LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
313     BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
314     
315     AC_SUBST(libdir)
316     AC_SUBST(build_package_libdir)
317     AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
318     AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
319 ])
320
321
322 AC_DEFUN(STEPMAKE_END, [
323     AC_SUBST(OPTIONAL)
324     AC_SUBST(REQUIRED)
325     
326     AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
327     AC_OUTPUT
328     
329     if test -n "$OPTIONAL"; then
330         echo
331         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
332     fi
333
334     if test -n "$REQUIRED"; then
335         echo
336         echo "ERROR: Please install required programs: $REQUIRED"
337     fi
338     
339     if test -n "$UNSUPPORTED"; then
340         echo
341         echo "ERROR: Please use older version of programs: $UNSUPPORTED"
342     fi
343     
344     if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
345         echo
346         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
347         if test -f config.cache ; then
348             echo "Remove config.cache before rerunning ./configure"
349         fi 
350     fi
351     
352     if test -n "$REQUIRED$UNSUPPORTED"; then
353         rm -f $srcdir/GNUmakefile
354         exit 1
355     fi
356
357     # regular in-place build
358     # test for srcdir_build = yes ?
359     if test "$srcdir_build" = "yes"; then
360         rm -f $srcdir/GNUmakefile
361         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
362         chmod 444 $srcdir/GNUmakefile
363     else # --srcdir build
364         rm -f GNUmakefile
365         cp $srcdir/make/srcdir.make.in GNUmakefile
366         chmod 444 GNUmakefile
367     fi
368 ])
369
370
371 AC_DEFUN(STEPMAKE_FLEX, [
372     # ugh, automake: we want (and check for) flex
373     # AC_PROG_LEX
374     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
375
376     # AC_PROG_LEX()
377     # ugh, ugh
378     ac_cv_prog_lex_root=lex.yy
379     STEPMAKE_PROGS(FLEX, flex, $1)
380 ])
381
382
383 AC_DEFUN(STEPMAKE_FLEXLEXER, [
384     AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
385     if test $? -ne 0; then
386         warn='FlexLexer.h (flex package)'
387         STEPMAKE_ADD_ENTRY($1, $warn)
388     fi
389     # check for yyFlexLexer.yy_current_buffer,
390     # in 2.5.4 <= flex < 2.5.29
391     AC_LANG_PUSH(C++)
392     AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
393         [stepmake_flexlexer_yy_current_buffer],
394         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
395 using namespace std;
396 #include <FlexLexer.h>
397 class yy_flex_lexer: public yyFlexLexer
398 {
399   public:
400     yy_flex_lexer ()
401     {
402       yy_current_buffer = 0;
403     }
404 };
405 ]])],
406             [stepmake_flexlexer_yy_current_buffer=yes],
407             [stepmake_flexlexer_yy_current_buffer=no]))
408     if test $stepmake_flexlexer_yy_current_buffer = yes; then
409         AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
410     fi
411     AC_LANG_POP(C++)
412 ])
413   
414
415 AC_DEFUN(STEPMAKE_GCC, [
416     if test "$GCC" = "yes"; then
417         STEPMAKE_CHECK_VERSION(CC, $1, $2)
418     else
419         warn="$CC (Please install *GNU* cc)"
420         STEPMAKE_ADD_ENTRY($1, $warn)
421     fi
422 ])
423
424 AC_DEFUN(STEPMAKE_GETTEXT, [
425     presome=${prefix}
426     if test "$prefix" = "NONE"; then
427             presome=${ac_default_prefix}
428     fi
429     LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
430     
431     AC_SUBST(localedir)
432     AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
433     # ouch.  autoconf <= 2.57's gettext check fails for
434     # g++ >= 3.3 (with -std=gnu++98, the default).
435     # While the check is OK for g++ -std=c++98,
436     # LilyPond needs GNU g++, so who is to blame here?
437     # Use a workaround until this is resolved:
438     # for g++ >= 3.3, select C language.
439     GCC_UNSUPPORTED=
440     STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
441     if test -n "$GCC_UNSUPPORTED"; then
442         AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
443         AC_MSG_WARN([Trying gcc, cross fingers.])
444         AC_LANG_PUSH(C)
445     fi
446     AC_CHECK_LIB(intl, gettext)
447     AC_CHECK_FUNCS(gettext)
448     if test -n "$GCC_UNSUPPORTED"; then
449         AC_LANG_POP(C)
450     fi
451 ])
452
453
454 AC_DEFUN(STEPMAKE_GUILE, [
455     STEPMAKE_PATH_PROG(GUILE, guile, $1)
456 ])
457
458
459 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
460 #
461 #   This macro runs the guile-config script, installed with Guile,
462 #   to find out where Guile's header files and libraries are
463 #   installed.  It sets two variables, marked for substitution, as
464 #   by AC_SUBST.
465 #   
466 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
467 #             code that uses Guile header files.  This is almost
468 #             always just a -I flag.
469 #   
470 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
471 #             program against Guile.  This includes -lguile for
472 #             the Guile library itself, any libraries that Guile
473 #             itself requires (like -lqthreads), and so on.  It may
474 #             also include a -L flag to tell the compiler where to
475 #             find the libraries.
476
477 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
478     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
479     if test -x $exe; then
480         AC_MSG_CHECKING([guile compile flags])
481         GUILE_CFLAGS="`$guile_config compile`"
482         AC_MSG_RESULT($GUILE_CFLAGS)
483         AC_MSG_CHECKING([guile link flags])
484         GUILE_LDFLAGS="`$guile_config link`"
485         AC_MSG_RESULT($GUILE_LDFLAGS)
486     fi
487     AC_SUBST(GUILE_CFLAGS)
488     AC_SUBST(GUILE_LDFLAGS)
489 ])
490
491
492 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
493     ## First, let's just see if we can find Guile at all.
494     test -n "$target_alias" && target_guile_config=$target_alias-guile-config
495     test -n "$host_alias" && host_guile_config=$host_alias-guile-config
496     AC_MSG_CHECKING([for guile-config])
497     for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
498         AC_MSG_RESULT([$guile_config])
499         if ! $guile_config --version > /dev/null 2>&1 ; then
500             AC_MSG_WARN([cannot execute $guile_config])
501             AC_MSG_CHECKING([if we are cross compiling])
502             GUILE_CONFIG='echo no guile-config'
503         else
504             GUILE_CONFIG=$guile_config
505             break
506         fi
507     done
508     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
509     if test $? -ne 0; then
510         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
511     fi 
512
513     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
514     # urg.  should test functionality rather than version.
515     if test $? -eq 0 -a -n "$2"; then
516         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
517     fi
518
519     AC_SUBST(GUILE_CONFIG)
520     
521     guile_version="$ver"
522     changequote(<<, >>)dnl
523     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
524     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
525     GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
526     changequote([, ])dnl
527     STEPMAKE_GUILE_FLAGS
528     save_CPPFLAGS="$CPPFLAGS"
529     save_LIBS="$LIBS"
530     CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
531     LIBS="$GUILE_LDFLAGS $LIBS"
532     AC_CHECK_HEADERS([libguile.h])
533     AC_CHECK_LIB(guile, scm_boot_guile)
534     AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
535     if test "$libguile_b" = "no"; then
536             warn='libguile (libguile-dev, guile-devel or guile-dev
537    package).'
538             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
539     fi
540     CPPFLAGS="$save_CPPFLAGS"
541     LIBS="$save_LIBS"
542     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
543     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
544     AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
545 ])
546
547
548 AC_DEFUN(STEPMAKE_DLOPEN, [
549     AC_CHECK_LIB(dl, dlopen)
550     AC_CHECK_FUNCS(dlopen)
551 ])
552
553 AC_DEFUN(STEPMAKE_GXX, [
554     if test "$GXX" = "yes"; then
555         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
556     else
557         warn="$CXX (Please install *GNU* c++)"
558         STEPMAKE_ADD_ENTRY($1, $warn)
559     fi
560 ])
561
562
563 AC_DEFUN(STEPMAKE_INIT, [
564
565     AC_PREREQ(2.50)
566     . $srcdir/VERSION
567     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
568     if test x$MY_PATCH_LEVEL != x; then
569         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
570     fi
571     export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
572     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
573     changequote(<<, >>)dnl
574     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
575     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
576     changequote([, ])dnl
577
578     # No versioning on directory names of sub-packages 
579     # urg, urg
580     stepmake=${datadir}/stepmake
581     presome=${prefix}
582     if test "$prefix" = "NONE"; then
583             presome=${ac_default_prefix}
584     fi
585     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
586
587     # urg, how is this supposed to work?
588     if test "$program_prefix" = "NONE"; then
589           program_prefix=
590     fi
591     if test "$program_suffix" = "NONE"; then
592           program_suffix=
593     fi
594
595     AC_MSG_CHECKING(Package)
596     if test "$PACKAGE" = "STEPMAKE"; then
597         AC_MSG_RESULT(Stepmake package!)
598
599         AC_MSG_CHECKING(builddir)
600
601         ugh_ugh_autoconf250_builddir="`pwd`"
602         
603         if test "$srcdir" = "."; then
604             srcdir_build=yes
605         else
606             srcdir_build=no
607             package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
608             package_srcdir="`dirname  $srcdir`"
609         fi
610         AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
611
612         (cd stepmake 2>/dev/null || mkdir stepmake)
613         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
614 # only possible with autoconf < 2.50 -- hardcoded in configure.in
615 #       AC_CONFIG_AUX_DIR(bin)
616         stepmake=stepmake
617     else
618         AC_MSG_RESULT($PACKAGE)
619
620         AC_MSG_CHECKING(builddir)
621         ugh_ugh_autoconf250_builddir="`pwd`"
622         if test "$srcdir" = "."; then
623             srcdir_build=yes
624         else
625             srcdir_build=no
626         fi
627         AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
628
629         AC_MSG_CHECKING(for stepmake)
630         # Check for installed stepmake
631         if test -d $stepmake; then
632             AC_MSG_RESULT($stepmake)
633         else
634             stepmake="`cd $srcdir/stepmake; pwd`"
635             AC_MSG_RESULT([$srcdir/stepmake  ($datadir/stepmake not found)])
636         fi
637
638 # only possible with autoconf < 2.50 -- hardcoded in configure.in
639 #       AC_CONFIG_AUX_DIR(\
640 #         stepmake/bin\
641 #         $srcdir/stepmake/bin\
642 #       )
643     fi
644
645     AC_SUBST(ugh_ugh_autoconf250_builddir)
646     AC_SUBST(stepmake)
647     AC_SUBST(package)
648     AC_SUBST(PACKAGE)
649     AC_SUBST(PACKAGE_NAME)
650     AC_SUBST(MAJOR_VERSION)
651     AC_SUBST(MINOR_VERSION)
652     
653     # We don't need the upper case variant,
654     # so stick to macros are uppercase convention.
655     # AC_DEFINE_UNQUOTED(package, ["${package}"])
656     # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
657     AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
658     AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
659     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
660
661     if test -z "$package_depth"; then
662         package_depth="."
663     else
664         package_depth="../$package_depth"
665     fi
666     export package_depth
667     AC_SUBST(package_depth)
668
669     AUTOGENERATE="This file was automatically generated by configure"
670     AC_SUBST(AUTOGENERATE)
671
672     CONFIGSUFFIX=
673     AC_ARG_ENABLE(config,
674     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
675                             do \`make conf=CONF' to get output in ./out-CONF],
676     [CONFIGURATION=$enableval])
677
678     ##'
679
680     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
681     CONFIGFILE=config$CONFIGSUFFIX
682     AC_SUBST(CONFIGSUFFIX)
683      
684     AC_CANONICAL_HOST
685     STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
686     STEPMAKE_PROGS(FIND, find, REQUIRED)
687
688     STEPMAKE_PROGS(TAR, tar, REQUIRED)
689
690     if test "$(echo 2)" != "2" ||
691         test "x`uname`" = "xHP-UX"; then
692         AC_PATH_PROG(KSH, ksh, /bin/ksh)
693         AC_PATH_PROG(BASH, bash, $KSH)
694         STEPMAKE_WARN(avoiding buggy /bin/sh)
695         AC_PATH_PROG(SHELL, bash, $KSH)
696     else
697         SHELL=/bin/sh
698         AC_PATH_PROG(BASH, bash, $SHELL)
699     fi
700     AC_SUBST(SHELL)
701
702     STEPMAKE_PYTHON(REQUIRED, 1.5)
703
704     if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
705         $MAKE -v 2> /dev/null | grep GNU > /dev/null
706         if test "$?" = 1; then
707             warn='make (Please install *GNU* make)'
708             # STEPMAKE_WARN($warn)
709             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
710         fi
711     fi 
712
713     if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
714         LN=cp # hard link does not work under cygnus-nt
715         LN_S='cp -r' # symbolic link does not work for native nt
716         ZIP="zip -r -9" #
717         program_suffix=.exe
718         ROOTSEP=':'
719         DIRSEP='/'
720         PATHSEP=':'
721         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
722     else
723         ROOTSEP=':'
724         DIRSEP='/'
725         PATHSEP=':'
726         LN=ln
727         LN_S='ln -s'
728         ZIP="zip -r -9"
729         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
730     fi
731     AC_SUBST(program_prefix)
732     AC_SUBST(program_suffix)
733     AC_SUBST(ZIP)
734     AC_SUBST(LN)
735     AC_SUBST(LN_S)
736     AC_SUBST(INSTALL)
737     AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
738     AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
739     AC_SUBST(DIRSEP)
740     AC_SUBST(PATHSEP)
741     AC_SUBST(ROOTSEP)
742   
743     STEPMAKE_DATADIR
744     STEPMAKE_LIBDIR
745 ])
746
747     
748 AC_DEFUN(STEPMAKE_KPATHSEA, [
749         
750     AC_ARG_WITH(kpathsea-include,
751         [  --with-kpathsea-include=DIR
752                           location of the kpathsea include dir],[
753             if test "$withval" = "yes" -o "$withval" = "no"; then
754                 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
755             else
756                 CPPFLAGS="$CPPFLAGS -I${withval}"
757             fi
758             ])
759     
760     AC_ARG_WITH(kpathsea-lib,
761         [  --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
762             if test "$withval" = "yes" -o "$withval" = "no"; then
763                 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
764             else
765                 LDFLAGS="$LDFLAGS -L${withval}"
766             fi
767             ])
768     
769     kpathsea_b=yes
770     #FIXME --with-xxx is meant for specifying a PATH too,
771     # so this should read: --enable-kpathsea,
772     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
773     AC_ARG_WITH(kpathsea,
774     [  --with-kpathsea         use kpathsea lib.  Default: on],
775     [kpathsea_b=$with_kpathsea])
776
777     save_LIBS="$LIBS"
778     if test "$kpathsea_b" != "no"; then 
779         AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
780         AC_CHECK_LIB(kpathsea, kpse_find_file)
781         AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
782         if test "$kpathsea_b" = "no"; then
783             warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel
784    package).
785    Else, please specify the directories where kpathsea/kpathsea.h and
786    libkpathsea.a are installed using --with-kpathsea-include and
787    --with-kpathsea-lib options.  You should install kpathsea; see
788    INSTALL.txt.  Rerun ./configure --without-kpathsea only if kpathsea
789    is not available for your platform.'
790             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
791         fi
792     fi
793
794     save_CFLAGS="$CFLAGS"
795     CFLAGS="-shared $CFLAGS"
796     AC_MSG_CHECKING([for shared libkpathsea])
797     AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
798                  [kpse_var_expand ("\$TEXMF");],
799                  [have_libkpathsea_so=yes],
800                  [have_libkpathsea_so=no])
801     AC_MSG_RESULT($have_libkpathsea_so)
802     if test "$have_libkpathsea_so" = "yes"; then
803         AC_DEFINE(HAVE_LIBKPATHSEA_SO)
804     fi
805     CFLAGS="$save_CFLAGS"
806
807     KPATHSEA_LIBS="$LIBS"
808     LIBS="$save_LIBS"
809     AC_MSG_CHECKING(whether to use kpathsea)
810     if test "$kpathsea_b" != no; then
811         AC_MSG_RESULT(yes)
812         KPATHSEA=1
813     else
814         AC_MSG_RESULT(no)
815         KPATHSEA=0
816     fi
817
818     AC_SUBST(KPATHSEA)
819     AC_SUBST(KPATHSEA_LIBS)
820     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
821 ])
822
823
824 AC_DEFUN(STEPMAKE_LIB, [
825     STEPMAKE_PROGS(AR, ar, $1)
826     AC_PROG_RANLIB
827     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
828 ])
829
830
831 AC_DEFUN(STEPMAKE_LIBTOOL, [
832     # libtool.info ...
833     # **Never** try to set library version numbers so that they correspond
834     # to the release number of your package.  This is an abuse that only
835     # fosters misunderstanding of the purpose of library versions.
836
837     REVISION=$PATCH_LEVEL
838     # CURRENT=$MINOR_VERSION
839     CURRENT=`expr $MINOR_VERSION + 1`
840     # AGE=`expr $MAJOR_VERSION + 1`
841     AGE=$MAJOR_VERSION
842     AC_SUBST(CURRENT)
843     AC_SUBST(REVISION)
844     AC_SUBST(AGE)
845 ])
846
847
848 AC_DEFUN(STEPMAKE_LOCALE, [
849     lang=English
850     ALL_LINGUAS="en nl"
851
852     # with/enable ??
853     AC_ARG_WITH(localedir,
854     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
855                             PREFIX/share/locale ],
856     localedir=$with_localedir,
857     localedir='${prefix}/share/locale')
858
859     AC_ARG_WITH(lang,
860     [  --with-lang=LANG        use LANG as language to emit messages],
861     language=$with_lang,
862     language=English)
863
864     AC_MSG_CHECKING(language)    
865     case "$language" in
866       En* | en* | Am* | am* | US* | us*)
867             lang=English;;
868       NL | nl | Du* | du* | Ned* | ned*)
869             lang=Dutch;;
870       "")
871             lang=English;;
872       *)
873             lang=unknown;;
874     esac
875     AC_MSG_RESULT($lang)
876
877     if test "$lang" = "unknown" ; then
878         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
879     fi
880
881 ])
882
883
884 AC_DEFUN(STEPMAKE_MAKEINFO, [
885     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
886     if test "$MAKEINFO" = "makeinfo"; then
887         AC_MSG_CHECKING(whether makeinfo can split html by @node)
888         mkdir -p out
889         makeinfo --html --output=out/split <<EOF
890 \input texinfo
891 \input texinfo @c -*-texinfo-*-
892 @setfilename split.info
893 @settitle split.info
894 @bye
895 EOF
896         if test -d out/split; then
897             SPLITTING_MAKEINFO=yes
898             AC_MSG_RESULT(yes)
899             rm -rf out/split
900         else
901             AC_MSG_RESULT(no)
902             STEPMAKE_WARN(your html documentation will be one large file)
903             rm -rf out/split
904         fi
905     fi
906     AC_SUBST(SPLITTING_MAKEINFO)
907 ])
908
909
910
911 AC_DEFUN(STEPMAKE_MAN, [
912     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
913     AC_SUBST(GROFF)
914     STEPMAKE_PROGS(TROFF, troff, $1)
915     AC_SUBST(TROFF)
916     STEPMAKE_PROGS(TBL, tbl, $1)
917     AC_SUBST(TBL)
918 ])
919
920
921 AC_DEFUN(STEPMAKE_MSGFMT, [
922     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
923 ])
924
925
926 # Check for program ($2), set full path result to ($1).
927 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
928 AC_DEFUN(STEPMAKE_PATH_PROG, [
929     AC_CHECK_PROGS($1, $2, no)
930     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
931     if test $? -eq 0; then
932         AC_PATH_PROG($1, $2)
933         if test -n "$4"; then
934             STEPMAKE_CHECK_VERSION($1, $3, $4)
935         fi
936     fi
937 ])
938
939
940 # Check for program in set of names ($2), set result to ($1) .
941 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
942 # If exists, and a minimal version ($4) is required
943 AC_DEFUN(STEPMAKE_PROGS, [
944     AC_CHECK_PROGS($1, $2, no)
945     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
946     if test $? -eq 0 -a -n "$4"; then
947         STEPMAKE_CHECK_VERSION($1, $3, $4)
948     fi
949 ])
950
951
952 AC_DEFUN(STEPMAKE_PERL, [
953     STEPMAKE_PATH_PROG(PERL, perl, $1)
954 ])
955
956
957 AC_DEFUN(STEPMAKE_PYTHON, [
958     unset pv
959     AC_MSG_CHECKING([for python])
960     for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
961         AC_MSG_RESULT([$python])
962         if ! $python -V > /dev/null 2>&1 ; then
963             #AC_MSG_WARN([cannot execute $python])
964             PYTHON='echo no python'
965         else
966             unset pv
967             STEPMAKE_CHECK_VERSION(python, pv, $2)
968             if test -z "$pv"; then
969                 PYTHON=$python
970                 break
971             fi
972         fi
973     done
974     if test -n "$pv"; then
975         STEPMAKE_ADD_ENTRY($1, $pv)
976     fi
977     AC_PATH_PROG(PYTHON, $PYTHON)
978     AC_SUBST(PYTHON)
979 ])
980
981 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
982     unset PYTHON_HEADER PYTHON_INCLUDE
983     if test -n "$PYTHON"; then
984         changequote(<<, >>)dnl
985         # alternatively, for python >= 2.0
986         # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
987         PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
988         changequote([, ])dnl
989     fi
990     
991     ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
992     if test -z "$PYTHON_HEADER"; then
993         #URG -- how to extend include path?
994         ac_compile="$ac_compile -I$PYTHON_INCLUDE"
995         ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
996         CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
997         AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
998     fi
999     
1000     if test -z "$PYTHON_HEADER"; then
1001         warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
1002         STEPMAKE_ADD_ENTRY($1, $warn)
1003     fi
1004 ])
1005
1006
1007 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1008     AC_ARG_ENABLE(tfm-path,
1009     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
1010                             esp.: cmr10.tfm.  Default: use kpsewhich],
1011     [tfm_path=$enableval],
1012     [tfm_path=auto] )
1013
1014     # ugh
1015     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1016     AC_MSG_CHECKING(for tfm path)
1017
1018     TFM_FONTS="cmr msam"
1019
1020     if test "x$tfm_path" = xauto ; then
1021         if test "x$KPSEWHICH" != "xno" ; then
1022             for i in $TFM_FONTS; do
1023                 dir=`$KPSEWHICH tfm ${i}10.tfm`
1024                 TFM_PATH="$TFM_PATH `dirname $dir`"
1025             done
1026         else
1027             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
1028     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
1029         fi
1030     else
1031          TFM_PATH=$tfm_path
1032     fi
1033
1034     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
1035     AC_MSG_RESULT($TFM_PATH)
1036     AC_SUBST(TFM_PATH)
1037 ])
1038
1039
1040 AC_DEFUN(STEPMAKE_TEXMF, [
1041     STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1042     # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1043
1044     AC_MSG_CHECKING(for working metafont mode)
1045     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1046     for MFMODE in $modelist; do
1047         $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1048         if test -f mfput.tfm; then
1049             break;
1050         fi
1051     done
1052     AC_MSG_RESULT($MFMODE)
1053
1054     rm -f mfput.*
1055
1056     AC_SUBST(MFMODE)
1057 ])
1058
1059
1060 AC_DEFUN(STEPMAKE_WARN, [
1061     AC_MSG_WARN($1)
1062     warn_b=yes
1063 ])
1064
1065
1066 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1067 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1068 dnl also defines GSTUFF_PKG_ERRORS on error
1069 AC_DEFUN(PKG_CHECK_MODULES, [
1070   succeeded=no
1071
1072   if test -z "$PKG_CONFIG"; then
1073     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1074   fi
1075
1076   if test "$PKG_CONFIG" = "no" ; then
1077      echo "*** The pkg-config script could not be found. Make sure it is"
1078      echo "*** in your path, or set the PKG_CONFIG environment variable"
1079      echo "*** to the full path to pkg-config."
1080      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1081   else
1082      PKG_CONFIG_MIN_VERSION=0.9.0
1083      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1084         AC_MSG_CHECKING(for $2)
1085
1086         if $PKG_CONFIG --exists "$2" ; then
1087             AC_MSG_RESULT(yes)
1088             succeeded=yes
1089
1090             AC_MSG_CHECKING($1_CFLAGS)
1091             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1092             AC_MSG_RESULT($$1_CFLAGS)
1093
1094             AC_MSG_CHECKING($1_LIBS)
1095             $1_LIBS=`$PKG_CONFIG --libs "$2"`
1096             AC_MSG_RESULT($$1_LIBS)
1097         else
1098             $1_CFLAGS=""
1099             $1_LIBS=""
1100             ## If we have a custom action on failure, don't print errors, but 
1101             ## do set a variable so people can do so.
1102             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1103             ifelse([$4], ,echo $$1_PKG_ERRORS,)
1104         fi
1105
1106         AC_SUBST($1_CFLAGS)
1107         AC_SUBST($1_LIBS)
1108      else
1109         echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1110         echo "*** See http://www.freedesktop.org/software/pkgconfig"
1111      fi
1112   fi
1113
1114   if test $succeeded = yes; then
1115      ifelse([$3], , :, [$3])
1116   else
1117      ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
1118   fi
1119 ])
1120
1121
1122 AC_DEFUN(STEPMAKE_FREETYPE2, [
1123     PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
1124     if $have_freetype2 ; then
1125         AC_DEFINE(HAVE_FREETYPE2)
1126         AC_SUBST(FREETYPE2_CFLAGS)
1127         AC_SUBST(FREETYPE2_LIBS)
1128     fi
1129 ])
1130
1131 AC_DEFUN(STEPMAKE_GTK2, [
1132     PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
1133     if $have_gtk2 ; then
1134         AC_DEFINE(HAVE_GTK2)
1135         AC_SUBST(GTK2_CFLAGS)
1136         AC_SUBST(GTK2_LIBS)
1137     fi
1138 ])
1139
1140 AC_DEFUN(STEPMAKE_PANGO, [
1141     PKG_CHECK_MODULES(PANGO, pango >= 1.6.0, have_pango16=true, true)
1142     if $have_pango16 ; then
1143         AC_DEFINE(HAVE_PANGO16)
1144         PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1145         PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1146         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1147         save_CPPFLAGS="$CPPFLAGS"
1148         save_LIBS="$LIBS"
1149         AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1150         AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1151         AC_SUBST(PANGO_CFLAGS)
1152         AC_SUBST(PANGO_LIBS)
1153         CPPFLAGS="$save_CPPFLAGS"
1154         LIBS="$save_LIBS"
1155 fi
1156 ])
1157
1158
1159 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1160     PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true)
1161     if $have_pangoft2 ; then
1162         AC_DEFINE(HAVE_PANGO_FT2)
1163         PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
1164         PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
1165         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1166         save_CPPFLAGS="$CPPFLAGS"
1167         save_LIBS="$LIBS"
1168         CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1169         LIBS="$PANGO_FT2_LIBS $LIBS"
1170         AC_CHECK_HEADERS([pango/pangoft2.h])
1171         AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1172         AC_SUBST(PANGO_FT2_CFLAGS)
1173         AC_SUBST(PANGO_FT2_LIBS)
1174         CPPFLAGS="$save_CPPFLAGS"
1175         LIBS="$save_LIBS"
1176 fi
1177 ])