]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/aclocal.m4
*** empty log message ***
[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=maybe;
800                   shared_size=`wc -c conftest | sed 's/ .*//g'`]
801                  [have_libkpathsea_so=no])
802
803     if test "$have_libkpathsea_so" = "maybe"; then
804         if test $shared_size -lt 40000 ; then
805           have_libkpathsea_so=yes
806         else
807           have_libkpathsea_so=no
808         fi
809     fi
810     
811     AC_MSG_RESULT($have_libkpathsea_so)
812     if test "$have_libkpathsea_so" = "yes"; then
813         AC_DEFINE(HAVE_LIBKPATHSEA_SO)
814     fi
815     CFLAGS="$save_CFLAGS"
816
817     KPATHSEA_LIBS="$LIBS"
818     LIBS="$save_LIBS"
819     AC_MSG_CHECKING(whether to use kpathsea)
820     if test "$kpathsea_b" != no; then
821         AC_MSG_RESULT(yes)
822         KPATHSEA=1
823     else
824         AC_MSG_RESULT(no)
825         KPATHSEA=0
826     fi
827
828     AC_SUBST(KPATHSEA)
829     AC_SUBST(KPATHSEA_LIBS)
830     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
831 ])
832
833
834 AC_DEFUN(STEPMAKE_LIB, [
835     STEPMAKE_PROGS(AR, ar, $1)
836     AC_PROG_RANLIB
837     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
838 ])
839
840
841 AC_DEFUN(STEPMAKE_LIBTOOL, [
842     # libtool.info ...
843     # **Never** try to set library version numbers so that they correspond
844     # to the release number of your package.  This is an abuse that only
845     # fosters misunderstanding of the purpose of library versions.
846
847     REVISION=$PATCH_LEVEL
848     # CURRENT=$MINOR_VERSION
849     CURRENT=`expr $MINOR_VERSION + 1`
850     # AGE=`expr $MAJOR_VERSION + 1`
851     AGE=$MAJOR_VERSION
852     AC_SUBST(CURRENT)
853     AC_SUBST(REVISION)
854     AC_SUBST(AGE)
855 ])
856
857
858 AC_DEFUN(STEPMAKE_LOCALE, [
859     lang=English
860     ALL_LINGUAS="en nl"
861
862     # with/enable ??
863     AC_ARG_WITH(localedir,
864     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
865                             PREFIX/share/locale ],
866     localedir=$with_localedir,
867     localedir='${prefix}/share/locale')
868
869     AC_ARG_WITH(lang,
870     [  --with-lang=LANG        use LANG as language to emit messages],
871     language=$with_lang,
872     language=English)
873
874     AC_MSG_CHECKING(language)    
875     case "$language" in
876       En* | en* | Am* | am* | US* | us*)
877             lang=English;;
878       NL | nl | Du* | du* | Ned* | ned*)
879             lang=Dutch;;
880       "")
881             lang=English;;
882       *)
883             lang=unknown;;
884     esac
885     AC_MSG_RESULT($lang)
886
887     if test "$lang" = "unknown" ; then
888         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
889     fi
890
891 ])
892
893
894 AC_DEFUN(STEPMAKE_MAKEINFO, [
895     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
896     if test "$MAKEINFO" = "makeinfo"; then
897         AC_MSG_CHECKING(whether makeinfo can split html by @node)
898         mkdir -p out
899         makeinfo --html --output=out/split <<EOF
900 \input texinfo
901 \input texinfo @c -*-texinfo-*-
902 @setfilename split.info
903 @settitle split.info
904 @bye
905 EOF
906         if test -d out/split; then
907             SPLITTING_MAKEINFO=yes
908             AC_MSG_RESULT(yes)
909             rm -rf out/split
910         else
911             AC_MSG_RESULT(no)
912             STEPMAKE_WARN(your html documentation will be one large file)
913             rm -rf out/split
914         fi
915     fi
916     AC_SUBST(SPLITTING_MAKEINFO)
917 ])
918
919
920
921 AC_DEFUN(STEPMAKE_MAN, [
922     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
923     AC_SUBST(GROFF)
924     STEPMAKE_PROGS(TROFF, troff, $1)
925     AC_SUBST(TROFF)
926     STEPMAKE_PROGS(TBL, tbl, $1)
927     AC_SUBST(TBL)
928 ])
929
930
931 AC_DEFUN(STEPMAKE_MSGFMT, [
932     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
933 ])
934
935
936 # Check for program ($2), set full path result to ($1).
937 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
938 AC_DEFUN(STEPMAKE_PATH_PROG, [
939     AC_CHECK_PROGS($1, $2, no)
940     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
941     if test $? -eq 0; then
942         AC_PATH_PROG($1, $2)
943         if test -n "$4"; then
944             STEPMAKE_CHECK_VERSION($1, $3, $4)
945         fi
946     fi
947 ])
948
949
950 # Check for program in set of names ($2), set result to ($1) .
951 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
952 # If exists, and a minimal version ($4) is required
953 AC_DEFUN(STEPMAKE_PROGS, [
954     AC_CHECK_PROGS($1, $2, no)
955     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
956     if test $? -eq 0 -a -n "$4"; then
957         STEPMAKE_CHECK_VERSION($1, $3, $4)
958     fi
959 ])
960
961
962 AC_DEFUN(STEPMAKE_PERL, [
963     STEPMAKE_PATH_PROG(PERL, perl, $1)
964 ])
965
966
967 AC_DEFUN(STEPMAKE_PYTHON, [
968     unset pv
969     AC_MSG_CHECKING([for python])
970     for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
971         AC_MSG_RESULT([$python])
972         if ! $python -V > /dev/null 2>&1 ; then
973             #AC_MSG_WARN([cannot execute $python])
974             PYTHON='echo no python'
975         else
976             unset pv
977             STEPMAKE_CHECK_VERSION(python, pv, $2)
978             if test -z "$pv"; then
979                 PYTHON=$python
980                 break
981             fi
982         fi
983     done
984     if test -n "$pv"; then
985         STEPMAKE_ADD_ENTRY($1, $pv)
986     fi
987     AC_PATH_PROG(PYTHON, $PYTHON)
988     AC_SUBST(PYTHON)
989 ])
990
991 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
992     unset PYTHON_HEADER PYTHON_INCLUDE
993     if test -n "$PYTHON"; then
994         changequote(<<, >>)dnl
995         # alternatively, for python >= 2.0
996         # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
997         PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
998         changequote([, ])dnl
999     fi
1000     
1001     ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1002     if test -z "$PYTHON_HEADER"; then
1003         #URG -- how to extend include path?
1004         ac_compile="$ac_compile -I$PYTHON_INCLUDE"
1005         ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
1006         CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
1007         AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1008     fi
1009     
1010     if test -z "$PYTHON_HEADER"; then
1011         warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
1012         STEPMAKE_ADD_ENTRY($1, $warn)
1013     fi
1014 ])
1015
1016
1017 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1018     AC_ARG_ENABLE(tfm-path,
1019     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
1020                             esp.: cmr10.tfm.  Default: use kpsewhich],
1021     [tfm_path=$enableval],
1022     [tfm_path=auto] )
1023
1024     # ugh
1025     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1026     AC_MSG_CHECKING(for tfm path)
1027
1028     TFM_FONTS="cmr msam"
1029
1030     if test "x$tfm_path" = xauto ; then
1031         if test "x$KPSEWHICH" != "xno" ; then
1032             for i in $TFM_FONTS; do
1033                 dir=`$KPSEWHICH tfm ${i}10.tfm`
1034                 TFM_PATH="$TFM_PATH `dirname $dir`"
1035             done
1036         else
1037             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
1038     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
1039         fi
1040     else
1041          TFM_PATH=$tfm_path
1042     fi
1043
1044     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
1045     AC_MSG_RESULT($TFM_PATH)
1046     AC_SUBST(TFM_PATH)
1047 ])
1048
1049
1050 AC_DEFUN(STEPMAKE_TEXMF, [
1051     STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1052     # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1053
1054     AC_MSG_CHECKING(for working metafont mode)
1055     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1056     for MFMODE in $modelist; do
1057         $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1058         if test -f mfput.tfm; then
1059             break;
1060         fi
1061     done
1062     AC_MSG_RESULT($MFMODE)
1063
1064     rm -f mfput.*
1065
1066     AC_SUBST(MFMODE)
1067 ])
1068
1069
1070 AC_DEFUN(STEPMAKE_WARN, [
1071     AC_MSG_WARN($1)
1072     warn_b=yes
1073 ])
1074
1075
1076 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1077 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1078 dnl also defines GSTUFF_PKG_ERRORS on error
1079 AC_DEFUN(PKG_CHECK_MODULES, [
1080   succeeded=no
1081
1082   if test -z "$PKG_CONFIG"; then
1083     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1084   fi
1085
1086   if test "$PKG_CONFIG" = "no" ; then
1087      echo "*** The pkg-config script could not be found. Make sure it is"
1088      echo "*** in your path, or set the PKG_CONFIG environment variable"
1089      echo "*** to the full path to pkg-config."
1090      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1091   else
1092      PKG_CONFIG_MIN_VERSION=0.9.0
1093      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1094         AC_MSG_CHECKING(for $2)
1095
1096         if $PKG_CONFIG --exists "$2" ; then
1097             AC_MSG_RESULT(yes)
1098             succeeded=yes
1099
1100             AC_MSG_CHECKING($1_CFLAGS)
1101             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1102             AC_MSG_RESULT($$1_CFLAGS)
1103
1104             AC_MSG_CHECKING($1_LIBS)
1105             $1_LIBS=`$PKG_CONFIG --libs "$2"`
1106             AC_MSG_RESULT($$1_LIBS)
1107         else
1108             $1_CFLAGS=""
1109             $1_LIBS=""
1110             ## If we have a custom action on failure, don't print errors, but 
1111             ## do set a variable so people can do so.
1112             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1113             ifelse([$4], ,echo $$1_PKG_ERRORS,)
1114         fi
1115
1116         AC_SUBST($1_CFLAGS)
1117         AC_SUBST($1_LIBS)
1118      else
1119         echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1120         echo "*** See http://www.freedesktop.org/software/pkgconfig"
1121      fi
1122   fi
1123
1124   if test $succeeded = yes; then
1125      ifelse([$3], , :, [$3])
1126   else
1127      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])
1128   fi
1129 ])
1130
1131
1132 AC_DEFUN(STEPMAKE_FREETYPE2, [
1133     PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
1134     if $have_freetype2 ; then
1135         AC_DEFINE(HAVE_FREETYPE2)
1136         AC_SUBST(FREETYPE2_CFLAGS)
1137         AC_SUBST(FREETYPE2_LIBS)
1138     fi
1139 ])
1140
1141 AC_DEFUN(STEPMAKE_GTK2, [
1142     PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
1143     if $have_gtk2 ; then
1144         AC_DEFINE(HAVE_GTK2)
1145         AC_SUBST(GTK2_CFLAGS)
1146         AC_SUBST(GTK2_LIBS)
1147     fi
1148 ])
1149
1150 AC_DEFUN(STEPMAKE_PANGO, [
1151     PKG_CHECK_MODULES(PANGO, pango >= 1.6.0, have_pango16=true, true)
1152     if $have_pango16 ; then
1153         AC_DEFINE(HAVE_PANGO16)
1154         PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1155         PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1156         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1157         save_CPPFLAGS="$CPPFLAGS"
1158         save_LIBS="$LIBS"
1159         AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1160         AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1161         AC_SUBST(PANGO_CFLAGS)
1162         AC_SUBST(PANGO_LIBS)
1163         CPPFLAGS="$save_CPPFLAGS"
1164         LIBS="$save_LIBS"
1165 fi
1166 ])
1167
1168
1169 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1170     PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true)
1171     if $have_pangoft2 ; then
1172         AC_DEFINE(HAVE_PANGO_FT2)
1173         PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
1174         PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
1175         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1176         save_CPPFLAGS="$CPPFLAGS"
1177         save_LIBS="$LIBS"
1178         CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1179         LIBS="$PANGO_FT2_LIBS $LIBS"
1180         AC_CHECK_HEADERS([pango/pangoft2.h])
1181         AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1182         AC_SUBST(PANGO_FT2_CFLAGS)
1183         AC_SUBST(PANGO_FT2_LIBS)
1184         CPPFLAGS="$save_CPPFLAGS"
1185         LIBS="$save_LIBS"
1186 fi
1187 ])