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