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