1 dnl aclocal.m4 -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
5 ### mostly interal macros
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}'
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}'
23 ## Workaround for broken Debian gcc version string:
24 ## gcc (GCC) 3.1.1 20020606 (Debian prerelease)
26 ## -V: Workaround for python
28 changequote(<<, >>)#dnl
30 ## Assume and hunt for dotted version multiplet.
31 ## use eval trickery, because we cannot use multi-level $() instead of ``
32 ## for compatibility reasons.
34 ## grab the first version number in --version output.
35 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 |
36 grep -E '(^| )[0-9][0-9]*\.[0-9]' |
39 sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' |
40 grep -E '(^| )[0-9][0-9]*\.[0-9]' |
43 if test -z "$_ver"; then
44 ## If empty, try date [fontforge]
45 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
47 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
53 # Calculate simplistic numeric version from version string ($1)
54 # As yet, we have no need for something more elaborate.
55 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
58 if ([$]3) {three = [$]3}
61 {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
65 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
66 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
67 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
70 # Check if tested program ($2) was found ($1).
71 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
72 # We could abort here if a 'REQUIRED' program is not found
73 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
74 STEPMAKE_CHECK_SEARCH_RESULT($1)
75 if test $? -ne 0; then
76 STEPMAKE_ADD_ENTRY($3, $2)
77 if test "$3" = "REQUIRED"; then
78 command="echo ERROR: $2 not found"
79 # abort configure process here?
81 command="- echo $2 not found"
91 # Return if tested proram ($1) was found (true) or not (false).
92 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
93 r="`eval echo '$'"$1"`"
94 if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
97 ##STEPMAKE_WARN(cannot find $2. $3)
103 # Check version of program ($1)
104 # If version ($4: optional argument, supply if version cannot be
105 # parsed using --version or -V ) is smaller than requested ($3), add
106 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
107 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
108 r="`eval echo '$'"$1"`"
109 AC_MSG_CHECKING([$r version])
110 exe=`STEPMAKE_GET_EXECUTABLE($r)`
111 if test -n "$4"; then
114 ver=`STEPMAKE_GET_VERSION($exe)`
116 num=`STEPMAKE_NUMERIC_VERSION($ver)`
117 req=`STEPMAKE_NUMERIC_VERSION($3)`
118 AC_MSG_RESULT([$ver])
119 if test "$num" -lt "$req"; then
120 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
122 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
123 eval `echo $vervar=$num`
124 ## AC_SUBST(`eval echo $vervar`)
127 # Check version of program ($1)
128 # If version is greater than or equals unsupported ($3),
129 # add entry to unsupported list ($2, 'UNSUPPORTED')
130 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
131 r="`eval echo '$'"$1"`"
132 AC_MSG_CHECKING([$r version])
133 exe=`STEPMAKE_GET_EXECUTABLE($r)`
134 ver=`STEPMAKE_GET_VERSION($exe)`
135 num=`STEPMAKE_NUMERIC_VERSION($ver)`
136 sup=`STEPMAKE_NUMERIC_VERSION($3)`
137 AC_MSG_RESULT([$ver])
138 if test "$num" -ge "$sup"; then
139 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
143 ### Macros to build configure.in
146 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
147 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
148 if test "$BIBTEX2HTML" = "bib2html"; then
149 BIBTEX2HTML_FLAGS='$< $(@)'
151 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
153 AC_SUBST(BIBTEX2HTML)
154 AC_SUBST(BIBTEX2HTML_FLAGS)
158 AC_DEFUN(STEPMAKE_BISON, [
159 # ugh, automake: we want (and check for) bison
162 STEPMAKE_PROGS(BISON, bison, $1)
164 # urg. should test functionality rather than version.
165 if test "$BISON" = "bison" -a -n "$2"; then
166 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
170 AC_DEFUN(STEPMAKE_COMPILE_BEFORE, [
171 # -O is necessary to get inlining
173 CXXFLAGS=${CXXFLAGS-$CFLAGS}
174 LDFLAGS=${LDFLAGS-""}
180 AC_ARG_ENABLE(debugging,
181 [ --enable-debugging compile with debugging info. Default: on],
182 [debug_b=$enableval])
184 AC_ARG_ENABLE(optimising,
185 [ --enable-optimising compile with optimising. Default: on],
186 [optimise_b=$enableval])
188 AC_ARG_ENABLE(profiling,
189 [ --enable-profiling compile with gprof support. Default: off],
190 [profile_b=$enableval])
193 [ --enable-pipe compile with -pipe. Default: on],
196 if test "$optimise_b" = yes; then
198 DEFINES="$DEFINES -DNDEBUG"
199 OPTIMIZE=" -O2 -finline-functions"
202 if test $profile_b = yes; then
204 OPTIMIZE="$OPTIMIZE -pg"
207 if test $debug_b = yes; then
208 OPTIMIZE="$OPTIMIZE -g"
212 AC_DEFUN(STEPMAKE_COMPILE, [
214 AC_REQUIRE([STEPMAKE_COMPILE_BEFORE])
215 AC_REQUIRE([AC_PROG_CC])
217 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
221 # If -pipe requested, test if it works and add to CFLAGS.
222 if test "$pipe_b" = yes; then
223 save_cflags="$CFLAGS"
224 CFLAGS=" -pipe $CFLAGS";
225 AC_CACHE_CHECK([whether compiler understands -pipe],
226 [stepmake_cv_cflags_pipe],
227 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
228 [stepmake_cv_cflags_pipe=yes],
229 [stepmake_cv_cflags_pipe=no]))
231 if test $stepmake_cv_cflags_pipe = yes; then
232 OPTIMIZE="$OPTIMIZE -pipe"
236 CFLAGS="$CFLAGS $OPTIMIZE"
237 CPPFLAGS=${CPPFLAGS-""}
239 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
240 save_cflags="$CFLAGS"
243 dnl should do compile test?
244 AC_MSG_RESULT(-mieee)
245 CFLAGS=" -mieee $CFLAGS"
248 AC_MSG_RESULT([none])
252 AC_SUBST(cross_compiling)
260 AC_DEFUN(STEPMAKE_CXX, [
263 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
265 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
274 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
275 AC_CACHE_CHECK([whether explicit instantiation is needed],
276 stepmake_cv_need_explicit_instantiation,
277 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
278 template <class T> struct foo { static int baz; };
279 template <class T> int foo<T>::baz = 1;
280 ]], [[ return foo<int>::baz; ]])],[stepmake_cv_need_explicit_instantiation=no],[stepmake_cv_need_explicit_instantiation=yes]))
281 if test x"$stepmake_cv_need_explicit_instantiation"x = x"yes"x; then
282 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
287 AC_DEFUN(STEPMAKE_DATADIR, [
288 if test "$datadir" = "\${prefix}/share"; then
289 datadir='${prefix}/share'
292 if test "$prefix" = "NONE"; then
293 presome=${ac_default_prefix}
296 build_package_datadir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/share/$package
298 DATADIR=`echo ${datadir} | sed "s!\\\${datarootdir}!${prefix}/share!"`
299 DATADIR=`echo ${DATADIR} | sed "s!\\\${prefix}!$presome!"`
300 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
303 AC_SUBST(datarootdir)
304 AC_SUBST(build_package_datadir)
305 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
306 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
309 ## ugh: cut & paste programming from datadir.
310 AC_DEFUN(STEPMAKE_LIBDIR, [
312 if test "$libdir" = "\${exec_prefix}/lib"; then
313 libdir='${exec_prefix}/lib'
316 build_package_libdir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/lib/$package
318 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
319 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
322 AC_SUBST(build_package_libdir)
323 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
324 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
328 AC_DEFUN(STEPMAKE_PREFIX_EXPAND_FIXUP, [
329 # undo expanding of explicit --infodir=/usr/share
330 # to ease install-time override with prefix=...
331 strip=`echo $includedir | eval sed s@^$prefix@@`
332 if test "$includedir" = "`eval echo $prefix$strip`"; then
333 includedir='${prefix}'$strip''
335 strip=`echo $libdir | eval sed s@^$exec_prefix@@`
336 if test "$libdir" = "`eval echo $exec_prefix$strip`"; then
337 libdir='${exec_prefix}'$strip''
339 strip=`echo $infodir | eval sed s@^$datarootdir@@`
340 if test "$infodir" = "`eval echo $datarootdir$strip`"; then
341 infodir='${datarootdir}'$strip''
343 strip=`echo $mandir | eval sed s@^$datarootdir@@`
344 if test "$mandir" = "`eval echo $datarootdir$strip`"; then
345 mandir='${datarootdir}'$strip''
350 AC_DEFUN(STEPMAKE_END, [
351 STEPMAKE_PREFIX_EXPAND_FIXUP
356 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
359 if test -n "$OPTIONAL"; then
361 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
364 if test -n "$REQUIRED"; then
366 echo "ERROR: Please install required programs: $REQUIRED"
369 if test -n "$UNSUPPORTED"; then
371 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
374 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
376 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
377 if test -f config.cache ; then
378 echo "Remove config.cache before rerunning ./configure"
382 if test -n "$REQUIRED$UNSUPPORTED"; then
383 rm -f $srcdir/GNUmakefile
387 # regular in-place build
388 # test for srcdir_build = yes ?
389 if test "$srcdir_build" = "yes"; then
390 rm -f $srcdir/GNUmakefile
391 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
392 chmod 444 $srcdir/GNUmakefile
394 if test -f $srcdir/GNUmakefile; then
396 Source directory already configured. Please clean the source directory
398 make -C $srcdir distclean
406 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name GNUmakefile`; do
407 mkdir -p $(dirname $mf)
408 cat <<EOF | $PYTHON - > $mf
409 print 'depth=' + ('../' * ( $d-1 ) )
410 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
411 print 'include \$(configure-srcdir)/$mf'
412 print 'MODULE_INCLUDES += \$(src-dir)/\$(outbase)'
415 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name '*.make' | grep -v config.make `; do
416 mkdir -p $(dirname $mf)
417 cat <<EOF | $PYTHON - > $mf
418 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
419 print 'include \$(configure-srcdir)/$mf'
425 cat <<EOF > GNUmakefile
427 include config\$(if \$(conf),-\$(conf),).make
428 include \$(configure-srcdir)/GNUmakefile.in
435 AC_DEFUN(STEPMAKE_FLEX, [
436 # ugh, automake: we want (and check for) flex
438 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
442 ac_cv_prog_lex_root=lex.yy
443 STEPMAKE_PROGS(FLEX, flex, $1)
447 AC_DEFUN(STEPMAKE_FLEXLEXER, [
448 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
449 if test $? -ne 0; then
450 warn='FlexLexer.h (flex package)'
451 STEPMAKE_ADD_ENTRY($1, $warn)
453 # check for yyFlexLexer.yy_current_buffer,
454 # in 2.5.4 <= flex < 2.5.29
456 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
457 [stepmake_cv_flexlexer_yy_current_buffer],
458 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
460 #include <FlexLexer.h>
461 class yy_flex_lexer: public yyFlexLexer
466 yy_current_buffer = 0;
470 [stepmake_cv_flexlexer_yy_current_buffer=yes],
471 [stepmake_cv_flexlexer_yy_current_buffer=no]))
472 if test $stepmake_cv_flexlexer_yy_current_buffer = yes; then
473 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
480 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
481 AC_MSG_CHECKING([FlexLexer.h location])
484 cat <<EOF > conftest.cc
486 #include <FlexLexer.h>
488 FLEXLEXER_FILE=`eval $ac_cpp conftest.cc | \
489 sed 's!# 1 "\(.*FlexLexer.h\)"!@FLEXLEXER@\1@@!g' | grep '@@' | \
490 sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` 1> /dev/null 2> /dev/null
492 AC_SUBST(FLEXLEXER_FILE)
493 AC_MSG_RESULT($FLEXLEXER_FILE)
496 AC_DEFUN(STEPMAKE_GCC, [
497 if test "$GCC" = "yes"; then
498 STEPMAKE_CHECK_VERSION(CC, $1, $2)
500 warn="$CC (Please install *GNU* cc)"
501 STEPMAKE_ADD_ENTRY($1, $warn)
505 AC_DEFUN(STEPMAKE_GETTEXT, [
507 if test "$prefix" = "NONE"; then
508 presome=${ac_default_prefix}
510 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
513 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
514 # ouch. autoconf <= 2.57's gettext check fails for
515 # g++ >= 3.3 (with -std=gnu++98, the default).
516 # While the check is OK for g++ -std=c++98,
517 # LilyPond needs GNU g++, so who is to blame here?
518 # Use a workaround until this is resolved:
519 # for g++ >= 3.3, select C language.
521 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
522 if test -n "$GCC_UNSUPPORTED"; then
523 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
524 AC_MSG_WARN([Trying gcc, cross fingers.])
527 AC_CHECK_LIB(intl, gettext)
528 AC_CHECK_FUNCS(gettext)
529 if test -n "$GCC_UNSUPPORTED"; then
535 AC_DEFUN(STEPMAKE_GUILE, [
536 STEPMAKE_PATH_PROG(GUILE, guile, $1)
540 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
542 # This macro runs the guile-config script, installed with Guile,
543 # to find out where Guile's header files and libraries are
544 # installed. It sets two variables, marked for substitution, as
547 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
548 # code that uses Guile header files. This is almost
549 # always just a -I flag.
551 # GUILE_LDFLAGS --- flags to pass to the linker to link a
552 # program against Guile. This includes -lguile for
553 # the Guile library itself, any libraries that Guile
554 # itself requires (like -lqthreads), and so on. It may
555 # also include a -L flag to tell the compiler where to
556 # find the libraries.
558 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
559 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
560 if test -x $exe; then
561 AC_MSG_CHECKING([guile compile flags])
562 GUILE_CFLAGS="`$guile_config compile`"
563 AC_MSG_RESULT($GUILE_CFLAGS)
564 AC_MSG_CHECKING([guile link flags])
565 GUILE_LDFLAGS="`$guile_config link`"
566 AC_MSG_RESULT($GUILE_LDFLAGS)
568 AC_SUBST(GUILE_CFLAGS)
569 AC_SUBST(GUILE_LDFLAGS)
573 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
574 ## First, let's just see if we can find Guile at all.
575 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
576 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
577 AC_MSG_CHECKING([for guile-config])
578 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
579 AC_MSG_RESULT([$guile_config])
580 if ! $guile_config --version > /dev/null 2>&1 ; then
581 AC_MSG_WARN([cannot execute $guile_config])
582 AC_MSG_CHECKING([if we are cross compiling])
583 GUILE_CONFIG='echo no guile-config'
585 GUILE_CONFIG=$guile_config
589 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
590 if test $? -ne 0; then
591 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
594 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
595 # urg. should test functionality rather than version.
596 if test $? -eq 0 -a -n "$2"; then
597 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
600 AC_SUBST(GUILE_CONFIG)
603 changequote(<<, >>)#dnl
604 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
605 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
606 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
607 changequote([, ])#dnl
609 save_CPPFLAGS="$CPPFLAGS"
611 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
612 LIBS="$GUILE_LDFLAGS $LIBS"
613 AC_CHECK_HEADERS([libguile.h])
614 AC_CHECK_LIB(guile, scm_boot_guile)
615 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
616 if test "$libguile_b" = "no"; then
617 warn='libguile (libguile-dev, guile-devel or guile-dev
619 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
621 CPPFLAGS="$save_CPPFLAGS"
623 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
624 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
625 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
629 AC_DEFUN(STEPMAKE_DLOPEN, [
630 AC_CHECK_LIB(dl, dlopen)
631 AC_CHECK_FUNCS(dlopen)
634 AC_DEFUN(STEPMAKE_GXX, [
635 if test "$GXX" = "yes"; then
636 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
638 warn="$CXX (Please install *GNU* c++)"
639 STEPMAKE_ADD_ENTRY($1, $warn)
644 AC_DEFUN(STEPMAKE_INIT, [
648 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
649 MICRO_VERSION=$PATCH_LEVEL
650 TOPLEVEL_VERSION=$FULL_VERSION
651 if test x$MY_PATCH_LEVEL != x; then
652 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
654 VERSION=$FULL_VERSION
655 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
656 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
657 changequote(<<, >>)#dnl
658 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
659 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
660 changequote([, ])#dnl
662 # No versioning on directory names of sub-packages
664 stepmake=${datadir}/stepmake
666 if test "$prefix" = "NONE"; then
667 presome=${ac_default_prefix}
669 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
671 # urg, how is this supposed to work?
672 if test "$program_prefix" = "NONE"; then
675 if test "$program_suffix" = "NONE"; then
679 AC_MSG_CHECKING(Package)
680 if test "$PACKAGE" = "STEPMAKE"; then
681 AC_MSG_RESULT(Stepmake package!)
683 AC_MSG_CHECKING(builddir)
685 ugh_ugh_autoconf250_builddir="`pwd`"
687 if test "$srcdir" = "."; then
691 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
692 package_srcdir="`dirname $srcdir`"
694 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
696 (cd stepmake 2>/dev/null || mkdir stepmake)
697 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
700 AC_MSG_RESULT($PACKAGE)
702 AC_MSG_CHECKING(builddir)
703 ugh_ugh_autoconf250_builddir="`pwd`"
705 here_dir=$(cd . && pwd)
706 full_src_dir=$(cd $srcdir && pwd)
708 if test "$full_src_dir" = "$here_dir"; then
713 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
715 AC_MSG_CHECKING(for stepmake)
716 # Check for installed stepmake
717 if test -d $stepmake; then
718 AC_MSG_RESULT($stepmake)
720 stepmake="`cd $srcdir/stepmake; pwd`"
721 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
725 AC_SUBST(ugh_ugh_autoconf250_builddir)
727 # Use absolute directory for non-srcdir builds, so that build
729 if test "$srcdir_build" = "no" ; then
730 srcdir="`cd $srcdir; pwd`"
737 AC_SUBST(PACKAGE_NAME)
739 AC_SUBST(MAJOR_VERSION)
740 AC_SUBST(MINOR_VERSION)
741 AC_SUBST(MICRO_VERSION)
743 # stepmake nonstandard names
744 AC_SUBST(PATCH_LEVEL)
745 AC_SUBST(TOPLEVEL_VERSION)
747 # We don't need the upper case variant,
748 # so stick to macros are uppercase convention.
749 # AC_DEFINE_UNQUOTED(package, ["${package}"])
750 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
751 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
752 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
753 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
755 if test -z "$package_depth"; then
758 package_depth="../$package_depth"
761 AC_SUBST(package_depth)
763 AUTOGENERATE="This file was automatically generated by configure"
764 AC_SUBST(AUTOGENERATE)
767 AC_ARG_ENABLE(config,
768 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
769 do `make conf=CONF' to get output in ./out-CONF],
770 [CONFIGURATION=$enableval])
774 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
775 CONFIGFILE=config$CONFIGSUFFIX
776 AC_SUBST(CONFIGSUFFIX)
779 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
780 STEPMAKE_PROGS(FIND, find, REQUIRED)
782 STEPMAKE_PROGS(TAR, tar, REQUIRED)
784 if test "$(echo 2)" != "2" ||
785 test "x`uname`" = "xHP-UX"; then
786 AC_PATH_PROG(KSH, ksh, /bin/ksh)
787 AC_PATH_PROG(BASH, bash, $KSH)
788 STEPMAKE_WARN(avoiding buggy /bin/sh)
789 AC_PATH_PROG(SHELL, bash, $KSH)
792 AC_PATH_PROG(BASH, bash, $SHELL)
796 STEPMAKE_PYTHON(REQUIRED, 1.5)
798 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
799 $MAKE -v 2> /dev/null | grep GNU > /dev/null
800 if test "$?" = 1; then
801 warn='make (Please install *GNU* make)'
802 # STEPMAKE_WARN($warn)
803 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
814 AC_SUBST(program_prefix)
815 AC_SUBST(program_suffix)
819 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
820 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
830 AC_DEFUN(STEPMAKE_LIB, [
831 STEPMAKE_PROGS(AR, ar, $1)
833 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
837 AC_DEFUN(STEPMAKE_LIBTOOL, [
839 # **Never** try to set library version numbers so that they correspond
840 # to the release number of your package. This is an abuse that only
841 # fosters misunderstanding of the purpose of library versions.
843 REVISION=$PATCH_LEVEL
844 # CURRENT=$MINOR_VERSION
845 CURRENT=`expr $MINOR_VERSION + 1`
846 # AGE=`expr $MAJOR_VERSION + 1`
854 AC_DEFUN(STEPMAKE_LOCALE, [
859 AC_ARG_WITH(localedir,
860 [ --with-localedir=DIR location of locales. Default: PREFIX/share/locale ],
861 localedir=$with_localedir,
862 localedir='${prefix}/share/locale')
865 [ --with-lang=LANG use LANG as language to emit messages],
869 AC_MSG_CHECKING(language)
871 En* | en* | Am* | am* | US* | us*)
873 NL | nl | Du* | du* | Ned* | ned*)
882 if test "$lang" = "unknown" ; then
883 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
889 AC_DEFUN(STEPMAKE_MAKEINFO, [
890 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
894 AC_DEFUN(STEPMAKE_MAN, [
895 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
897 STEPMAKE_PROGS(TROFF, troff, $1)
899 STEPMAKE_PROGS(TBL, tbl, $1)
904 AC_DEFUN(STEPMAKE_MSGFMT, [
905 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
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
916 if test -n "$4"; then
917 STEPMAKE_CHECK_VERSION($1, $3, $4)
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)
935 AC_DEFUN(STEPMAKE_PERL, [
936 STEPMAKE_PATH_PROG(PERL, perl, $1)
940 AC_DEFUN(STEPMAKE_PYTHON, [
942 AC_MSG_CHECKING([for python])
943 for python in $PYTHON python python2 python2.4 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'
950 STEPMAKE_CHECK_VERSION(python, pv, $2)
951 if test -z "$pv"; then
957 if test -n "$pv"; then
958 STEPMAKE_ADD_ENTRY($1, $pv)
960 # clear cached value since arg 2 might point us to a new binary
961 unset ac_cv_path_PYTHON
963 AC_PATH_PROG(PYTHON, $PYTHON)
967 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
968 AC_ARG_WITH(python-include,
969 [ --with-python-include=DIR
970 location of the python include dir],[
971 if test "$withval" = "yes" -o "$withval" = "no"; then
972 AC_MSG_WARN(Usage: --with-python-include=includedir)
974 PYTHON_CFLAGS="-I${withval}"
978 AC_ARG_WITH(python-lib,
979 [ --with-python-lib=NAME name of the python lib],[
980 if test "$withval" = "yes" -o "$withval" = "no"; then
981 AC_MSG_WARN(Usage: --with-python-lib=name)
983 LDFLAGS="$LDFLAGS -l${withval}"
987 AC_CHECK_PROGS(PYTHON_CONFIG, python-config, no)
989 if test -z "$PYTHON_CFLAGS" -a "$PYTHON_CONFIG" != "no"; then
990 # Clean out junk: http://bugs.python.org/issue3290
991 # Python headers may need some -f* flags, leave them in.
992 # We want the sed commands to look like 's/-[WDOm][[:alnum:][:punct:]][[:alnum:][:punct:]]*//g' and 's/-arch [^[:space:]]*//g', but automake eats brackets.
993 PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags | sed -e 's/-[[WDOm]][[[:alnum:][:punct:]]][[[:alnum:][:punct:]]]*//g' | sed -e 's/-arch @<:@^@<:@:space:@:>@@:>@*//g'`
994 PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
997 if test -z "$PYTHON_CFLAGS" -a "$cross_compiling" = "no"; then
998 changequote(<<, >>)#dnl
999 # alternatively, for python >= 2.0
1000 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
1001 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
1002 PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
1003 changequote([, ])#dnl
1006 if test -z "$PYTHON_HEADER"; then
1007 CPPFLAGS="$PYTHON_CFLAGS $CPPFLAGS"
1008 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1011 if test -z "$PYTHON_HEADER"; then
1012 warn="Python.h (python-devel, python-dev or libpython-dev package)"
1013 STEPMAKE_ADD_ENTRY($1, $warn)
1019 AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [
1021 AC_CACHE_CHECK([for stl.data () method],
1022 [stepmake_cv_stl_data_method],
1023 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1025 using namespace std;
1027 void *p = v.data ();
1029 [stepmake_cv_stl_data_method=yes],
1030 [stepmake_cv_stl_data_method=no]))
1031 if test $stepmake_cv_stl_data_method = yes; then
1032 AC_DEFINE(HAVE_STL_DATA_METHOD, 1, [define if stl classes have data () method])
1038 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1040 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1043 AC_DEFUN(STEPMAKE_TEXMF, [
1044 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1045 STEPMAKE_PROGS(METAPOST, mpost, $1)
1046 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1048 AC_MSG_CHECKING(for working metafont mode)
1049 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1050 for MFMODE in $modelist; do
1051 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1052 if test -f mfput.tfm; then
1056 AC_MSG_RESULT($MFMODE)
1064 AC_DEFUN(STEPMAKE_WARN, [
1070 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1071 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1072 dnl also defines GSTUFF_PKG_ERRORS on error
1073 AC_DEFUN(PKG_CHECK_MODULES, [
1076 if test -z "$PKG_CONFIG"; then
1077 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1080 if test "$PKG_CONFIG" = "no" ; then
1081 echo "*** The pkg-config script could not be found. Make sure it is"
1082 echo "*** in your path, or set the PKG_CONFIG environment variable"
1083 echo "*** to the full path to pkg-config."
1084 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1086 PKG_CONFIG_MIN_VERSION=0.9.0
1087 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1088 AC_MSG_CHECKING(for $2)
1090 if $PKG_CONFIG --exists "$2" ; then
1094 AC_MSG_CHECKING($1_CFLAGS)
1095 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1096 AC_MSG_RESULT($$1_CFLAGS)
1098 AC_MSG_CHECKING($1_LIBS)
1099 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1100 AC_MSG_RESULT($$1_LIBS)
1104 ## If we have a custom action on failure, don't print errors, but
1105 ## do set a variable so people can do so.
1106 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1107 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1115 if test $succeeded = yes; then
1116 ifelse([$3], , :, [$3])
1118 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])
1122 AC_DEFUN(STEPMAKE_FREETYPE2, [
1123 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1124 if test "$have_freetype2" = yes; then
1125 AC_DEFINE(HAVE_FREETYPE2)
1126 save_CPPFLAGS="$CPPFLAGS"
1128 CPPFLAGS="$FREETYPE2_CFLAGS $CPPFLAGS"
1129 LIBS="$FREETYPE2_LIBS $LIBS"
1130 AC_SUBST(FREETYPE2_CFLAGS)
1131 AC_SUBST(FREETYPE2_LIBS)
1132 CPPFLAGS="$save_CPPFLAGS"
1136 #r="lib$1-dev or $1-devel"
1137 r="libfreetype6-dev or freetype?-devel"
1138 ver="`pkg-config --modversion $1`"
1139 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1143 AC_DEFUN(STEPMAKE_GTK2, [
1144 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1145 if test "$have_gtk2" = yes ; then
1146 AC_DEFINE(HAVE_GTK2)
1147 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1148 save_CPPFLAGS="$CPPFLAGS"
1150 CPPFLAGS="$GTK2_CFLAGS $CPPFLAGS"
1151 LIBS="$GTK2_LIBS $LIBS"
1152 AC_SUBST(GTK2_CFLAGS)
1154 CPPFLAGS="$save_CPPFLAGS"
1158 # r="lib$1-dev or $1-devel"
1159 r="libgtk2.0-dev or gtk2-devel"
1160 ver="`pkg-config --modversion $1`"
1161 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1165 AC_DEFUN(STEPMAKE_PANGO, [
1166 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1167 if test "$have_pango16" = yes ; then
1168 AC_DEFINE(HAVE_PANGO16)
1169 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1170 save_CPPFLAGS="$CPPFLAGS"
1172 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1173 LIBS="$PANGO_LIBS $LIBS"
1174 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1175 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1176 AC_SUBST(PANGO_CFLAGS)
1177 AC_SUBST(PANGO_LIBS)
1178 CPPFLAGS="$save_CPPFLAGS"
1182 #r="lib$1-dev or $1-devel"
1183 r="libpango1.0-dev or pango1.0-devel"
1184 ver="`pkg-config --modversion $1`"
1185 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1189 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1190 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1191 if test "$have_pangoft2" = yes ; then
1192 AC_DEFINE(HAVE_PANGO16)
1193 AC_DEFINE(HAVE_PANGO_FT2)
1194 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1195 save_CPPFLAGS="$CPPFLAGS"
1197 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1198 LIBS="$PANGO_FT2_LIBS $LIBS"
1199 AC_CHECK_HEADERS([pango/pangoft2.h])
1200 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1201 AC_SUBST(PANGO_FT2_CFLAGS)
1202 AC_SUBST(PANGO_FT2_LIBS)
1203 CPPFLAGS="$save_CPPFLAGS"
1207 #r="lib$1-dev or $1-devel"e
1208 r="libpango1.0-dev or pango?-devel"
1209 ver="`pkg-config --modversion $1`"
1210 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1214 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1215 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1216 if test "$have_fontconfig" = yes ; then
1217 AC_DEFINE(HAVE_FONTCONFIG)
1218 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1219 save_CPPFLAGS="$CPPFLAGS"
1221 CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1222 LIBS="$FONTCONFIG_LIBS $LIBS"
1223 AC_SUBST(FONTCONFIG_CFLAGS)
1224 AC_SUBST(FONTCONFIG_LIBS)
1225 CPPFLAGS="$save_CPPFLAGS"
1228 r="lib$1-dev or $1-devel"
1229 ver="`pkg-config --modversion $1`"
1230 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1234 AC_DEFUN(STEPMAKE_WINDOWS, [
1238 if test "$CYGWIN" = "yes"; then
1239 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1241 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1242 elif test "$MINGW32" = "yes"; then
1246 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1252 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1253 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1256 AC_SUBST(program_suffix)
1258 AC_MSG_CHECKING([for some flavor of Windows])
1259 if test "$CYGWIN$MINGW32" = "nono"; then
1262 PLATFORM_WINDOWS=yes
1264 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1265 AC_SUBST(PLATFORM_WINDOWS)
1266 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)