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 | grep '\(^\| \)[0-9][0-9]*\.[0-9]' \
37 | tr ' ' '\n' | sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' | grep '\(^\| \)[0-9][0-9]*\.[0-9]' | head -n 1\`\"
39 if test -z "$_ver"; then
40 ## If empty, try date [fontforge]
41 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
43 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
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, [
54 if ([$]3) {three = [$]3}
57 {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
61 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
62 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
63 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
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?
77 command="- echo $2 not found"
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
93 ##STEPMAKE_WARN(cannot find $2. $3)
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
110 ver=`STEPMAKE_GET_VERSION($exe)`
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)"])
118 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
119 eval `echo $vervar=$num`
120 ## AC_SUBST(`eval echo $vervar`)
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)"])
139 ### Macros to build configure.in
142 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
143 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
144 if test "$BIBTEX2HTML" = "bib2html"; then
145 BIBTEX2HTML_FLAGS='$< $(@)'
147 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
149 AC_SUBST(BIBTEX2HTML)
150 AC_SUBST(BIBTEX2HTML_FLAGS)
154 AC_DEFUN(STEPMAKE_BISON, [
155 # ugh, automake: we want (and check for) bison
158 STEPMAKE_PROGS(BISON, bison, $1)
160 # urg. should test functionality rather than version.
161 if test "$BISON" = "bison" -a -n "$2"; then
162 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
167 AC_DEFUN(STEPMAKE_COMPILE, [
168 # -O is necessary to get inlining
170 CXXFLAGS=${CXXFLAGS-$CFLAGS}
171 LDFLAGS=${LDFLAGS-""}
177 AC_ARG_ENABLE(debugging,
178 [ --enable-debugging compile with debugging info. Default: on],
179 [debug_b=$enableval])
181 AC_ARG_ENABLE(optimising,
182 [ --enable-optimising compile with optimising. Default: on],
183 [optimise_b=$enableval])
185 AC_ARG_ENABLE(profiling,
186 [ --enable-profiling compile with gprof support. Default: off],
187 [profile_b=$enableval])
190 [ --enable-pipe compile with -pipe. Default: on],
193 if test "$optimise_b" = yes; then
195 DEFINES="$DEFINES -DNDEBUG"
196 OPTIMIZE=" -O2 -finline-functions"
199 if test $profile_b = yes; then
201 OPTIMIZE="$OPTIMIZE -pg"
204 if test $debug_b = yes; then
205 OPTIMIZE="$OPTIMIZE -g"
209 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
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_cv_cflags_pipe],
219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
220 [stepmake_cv_cflags_pipe=yes],
221 [stepmake_cv_cflags_pipe=no]))
223 if test $stepmake_cv_cflags_pipe = yes; then
224 OPTIMIZE="$OPTIMIZE -pipe"
228 CFLAGS="$CFLAGS $OPTIMIZE"
229 CPPFLAGS=${CPPFLAGS-""}
231 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
232 save_cflags="$CFLAGS"
235 dnl should do compile test?
236 AC_MSG_RESULT(-mieee)
237 CFLAGS=" -mieee $CFLAGS"
240 AC_MSG_RESULT([none])
244 AC_SUBST(cross_compiling)
252 AC_DEFUN(STEPMAKE_CXX, [
255 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
257 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
266 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
267 AC_CACHE_CHECK([whether explicit instantiation is needed],
268 stepmake_cv_need_explicit_instantiation,
269 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
270 template <class T> struct foo { static int baz; };
271 template <class T> int foo<T>::baz = 1;
272 ]], [[ return foo<int>::baz; ]])],[stepmake_cv_need_explicit_instantiation=no],[stepmake_cv_need_explicit_instantiation=yes]))
273 if test x"$stepmake_cv_need_explicit_instantiation"x = x"yes"x; then
274 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
279 AC_DEFUN(STEPMAKE_DATADIR, [
280 if test "$datadir" = "\${prefix}/share"; then
281 datadir='${prefix}/share'
284 if test "$prefix" = "NONE"; then
285 presome=${ac_default_prefix}
288 build_package_datadir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/share/$package
290 DATADIR=`echo ${datadir} | sed "s!\\\${datarootdir}!${prefix}/share!"`
291 DATADIR=`echo ${DATADIR} | sed "s!\\\${prefix}!$presome!"`
292 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
295 AC_SUBST(datarootdir)
296 AC_SUBST(build_package_datadir)
297 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
298 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
301 ## ugh: cut & paste programming from datadir.
302 AC_DEFUN(STEPMAKE_LIBDIR, [
304 if test "$libdir" = "\${exec_prefix}/lib"; then
305 libdir='${exec_prefix}/lib'
308 build_package_libdir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/lib/$package
310 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
311 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
314 AC_SUBST(build_package_libdir)
315 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
316 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
320 AC_DEFUN(STEPMAKE_PREFIX_EXPAND_FIXUP, [
321 # undo expanding of explicit --infodir=/usr/share
322 # to ease install-time override with prefix=...
323 strip=`echo $includedir | eval sed s@^$prefix@@`
324 if test "$includedir" = "`eval echo $prefix$strip`"; then
325 includedir='${prefix}'$strip''
327 strip=`echo $libdir | eval sed s@^$exec_prefix@@`
328 if test "$libdir" = "`eval echo $exec_prefix$strip`"; then
329 libdir='${exec_prefix}'$strip''
331 strip=`echo $infodir | eval sed s@^$datarootdir@@`
332 if test "$infodir" = "`eval echo $datarootdir$strip`"; then
333 infodir='${datarootdir}'$strip''
335 strip=`echo $mandir | eval sed s@^$datarootdir@@`
336 if test "$mandir" = "`eval echo $datarootdir$strip`"; then
337 mandir='${datarootdir}'$strip''
342 AC_DEFUN(STEPMAKE_END, [
343 STEPMAKE_PREFIX_EXPAND_FIXUP
348 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
351 if test -n "$OPTIONAL"; then
353 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
356 if test -n "$REQUIRED"; then
358 echo "ERROR: Please install required programs: $REQUIRED"
361 if test -n "$UNSUPPORTED"; then
363 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
366 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
368 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
369 if test -f config.cache ; then
370 echo "Remove config.cache before rerunning ./configure"
374 if test -n "$REQUIRED$UNSUPPORTED"; then
375 rm -f $srcdir/GNUmakefile
379 # regular in-place build
380 # test for srcdir_build = yes ?
381 if test "$srcdir_build" = "yes"; then
382 rm -f $srcdir/GNUmakefile
383 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
384 chmod 444 $srcdir/GNUmakefile
386 if test -f $srcdir/GNUmakefile; then
388 Source directory already configured. Please clean the source directory
390 make -C $srcdir distclean
398 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name GNUmakefile`; do
399 mkdir -p $(dirname $mf)
400 cat <<EOF | $PYTHON - > $mf
401 print 'depth=' + ('../' * ( $d-1 ) )
402 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
403 print 'include \$(configure-srcdir)/$mf'
404 print 'MODULE_INCLUDES += \$(src-dir)/\$(outbase)'
407 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name '*.make' | grep -v config.make `; do
408 mkdir -p $(dirname $mf)
409 cat <<EOF | $PYTHON - > $mf
410 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
411 print 'include \$(configure-srcdir)/$mf'
417 cat <<EOF > GNUmakefile
419 include config\$(if \$(conf),-\$(conf),).make
420 include \$(configure-srcdir)/GNUmakefile.in
427 AC_DEFUN(STEPMAKE_FLEX, [
428 # ugh, automake: we want (and check for) flex
430 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
434 ac_cv_prog_lex_root=lex.yy
435 STEPMAKE_PROGS(FLEX, flex, $1)
439 AC_DEFUN(STEPMAKE_FLEXLEXER, [
440 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
441 if test $? -ne 0; then
442 warn='FlexLexer.h (flex package)'
443 STEPMAKE_ADD_ENTRY($1, $warn)
445 # check for yyFlexLexer.yy_current_buffer,
446 # in 2.5.4 <= flex < 2.5.29
448 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
449 [stepmake_cv_flexlexer_yy_current_buffer],
450 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
452 #include <FlexLexer.h>
453 class yy_flex_lexer: public yyFlexLexer
458 yy_current_buffer = 0;
462 [stepmake_cv_flexlexer_yy_current_buffer=yes],
463 [stepmake_cv_flexlexer_yy_current_buffer=no]))
464 if test $stepmake_cv_flexlexer_yy_current_buffer = yes; then
465 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
472 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
473 AC_MSG_CHECKING([FlexLexer.h location])
476 cat <<EOF > conftest.cc
478 #include <FlexLexer.h>
480 FLEXLEXER_FILE=`eval $ac_cpp conftest.cc | \
481 sed 's!# 1 "\(.*FlexLexer.h\)"!@FLEXLEXER@\1@@!g' | grep '@@' | \
482 sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` 1> /dev/null 2> /dev/null
484 AC_SUBST(FLEXLEXER_FILE)
485 AC_MSG_RESULT($FLEXLEXER_FILE)
488 AC_DEFUN(STEPMAKE_GCC, [
489 if test "$GCC" = "yes"; then
490 STEPMAKE_CHECK_VERSION(CC, $1, $2)
492 warn="$CC (Please install *GNU* cc)"
493 STEPMAKE_ADD_ENTRY($1, $warn)
497 AC_DEFUN(STEPMAKE_GETTEXT, [
499 if test "$prefix" = "NONE"; then
500 presome=${ac_default_prefix}
502 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
505 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
506 # ouch. autoconf <= 2.57's gettext check fails for
507 # g++ >= 3.3 (with -std=gnu++98, the default).
508 # While the check is OK for g++ -std=c++98,
509 # LilyPond needs GNU g++, so who is to blame here?
510 # Use a workaround until this is resolved:
511 # for g++ >= 3.3, select C language.
513 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
514 if test -n "$GCC_UNSUPPORTED"; then
515 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
516 AC_MSG_WARN([Trying gcc, cross fingers.])
519 AC_CHECK_LIB(intl, gettext)
520 AC_CHECK_FUNCS(gettext)
521 if test -n "$GCC_UNSUPPORTED"; then
527 AC_DEFUN(STEPMAKE_GUILE, [
528 STEPMAKE_PATH_PROG(GUILE, guile, $1)
532 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
534 # This macro runs the guile-config script, installed with Guile,
535 # to find out where Guile's header files and libraries are
536 # installed. It sets two variables, marked for substitution, as
539 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
540 # code that uses Guile header files. This is almost
541 # always just a -I flag.
543 # GUILE_LDFLAGS --- flags to pass to the linker to link a
544 # program against Guile. This includes -lguile for
545 # the Guile library itself, any libraries that Guile
546 # itself requires (like -lqthreads), and so on. It may
547 # also include a -L flag to tell the compiler where to
548 # find the libraries.
550 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
551 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
552 if test -x $exe; then
553 AC_MSG_CHECKING([guile compile flags])
554 GUILE_CFLAGS="`$guile_config compile`"
555 AC_MSG_RESULT($GUILE_CFLAGS)
556 AC_MSG_CHECKING([guile link flags])
557 GUILE_LDFLAGS="`$guile_config link`"
558 AC_MSG_RESULT($GUILE_LDFLAGS)
560 AC_SUBST(GUILE_CFLAGS)
561 AC_SUBST(GUILE_LDFLAGS)
565 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
566 ## First, let's just see if we can find Guile at all.
567 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
568 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
569 AC_MSG_CHECKING([for guile-config])
570 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
571 AC_MSG_RESULT([$guile_config])
572 if ! $guile_config --version > /dev/null 2>&1 ; then
573 AC_MSG_WARN([cannot execute $guile_config])
574 AC_MSG_CHECKING([if we are cross compiling])
575 GUILE_CONFIG='echo no guile-config'
577 GUILE_CONFIG=$guile_config
581 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
582 if test $? -ne 0; then
583 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
586 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
587 # urg. should test functionality rather than version.
588 if test $? -eq 0 -a -n "$2"; then
589 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
592 AC_SUBST(GUILE_CONFIG)
595 changequote(<<, >>)#dnl
596 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
597 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
598 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
599 changequote([, ])#dnl
601 save_CPPFLAGS="$CPPFLAGS"
603 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
604 LIBS="$GUILE_LDFLAGS $LIBS"
605 AC_CHECK_HEADERS([libguile.h])
606 AC_CHECK_LIB(guile, scm_boot_guile)
607 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
608 if test "$libguile_b" = "no"; then
609 warn='libguile (libguile-dev, guile-devel or guile-dev
611 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
613 CPPFLAGS="$save_CPPFLAGS"
615 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
616 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
617 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
621 AC_DEFUN(STEPMAKE_DLOPEN, [
622 AC_CHECK_LIB(dl, dlopen)
623 AC_CHECK_FUNCS(dlopen)
626 AC_DEFUN(STEPMAKE_GXX, [
627 if test "$GXX" = "yes"; then
628 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
630 warn="$CXX (Please install *GNU* c++)"
631 STEPMAKE_ADD_ENTRY($1, $warn)
636 AC_DEFUN(STEPMAKE_INIT, [
640 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
641 MICRO_VERSION=$PATCH_LEVEL
642 TOPLEVEL_VERSION=$FULL_VERSION
643 if test x$MY_PATCH_LEVEL != x; then
644 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
646 VERSION=$FULL_VERSION
647 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
648 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
649 changequote(<<, >>)#dnl
650 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
651 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
652 changequote([, ])#dnl
654 # No versioning on directory names of sub-packages
656 stepmake=${datadir}/stepmake
658 if test "$prefix" = "NONE"; then
659 presome=${ac_default_prefix}
661 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
663 # urg, how is this supposed to work?
664 if test "$program_prefix" = "NONE"; then
667 if test "$program_suffix" = "NONE"; then
671 AC_MSG_CHECKING(Package)
672 if test "$PACKAGE" = "STEPMAKE"; then
673 AC_MSG_RESULT(Stepmake package!)
675 AC_MSG_CHECKING(builddir)
677 ugh_ugh_autoconf250_builddir="`pwd`"
679 if test "$srcdir" = "."; then
683 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
684 package_srcdir="`dirname $srcdir`"
686 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
688 (cd stepmake 2>/dev/null || mkdir stepmake)
689 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
692 AC_MSG_RESULT($PACKAGE)
694 AC_MSG_CHECKING(builddir)
695 ugh_ugh_autoconf250_builddir="`pwd`"
697 here_dir=$(cd . && pwd)
698 full_src_dir=$(cd $srcdir && pwd)
700 if test "$full_src_dir" = "$here_dir"; then
705 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
707 AC_MSG_CHECKING(for stepmake)
708 # Check for installed stepmake
709 if test -d $stepmake; then
710 AC_MSG_RESULT($stepmake)
712 stepmake="`cd $srcdir/stepmake; pwd`"
713 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
717 AC_SUBST(ugh_ugh_autoconf250_builddir)
719 # Use absolute directory for non-srcdir builds, so that build
721 if test "$srcdir_build" = "no" ; then
722 srcdir="`cd $srcdir; pwd`"
729 AC_SUBST(PACKAGE_NAME)
731 AC_SUBST(MAJOR_VERSION)
732 AC_SUBST(MINOR_VERSION)
733 AC_SUBST(MICRO_VERSION)
735 # stepmake nonstandard names
736 AC_SUBST(PATCH_LEVEL)
737 AC_SUBST(TOPLEVEL_VERSION)
739 # We don't need the upper case variant,
740 # so stick to macros are uppercase convention.
741 # AC_DEFINE_UNQUOTED(package, ["${package}"])
742 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
743 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
744 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
745 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
747 if test -z "$package_depth"; then
750 package_depth="../$package_depth"
753 AC_SUBST(package_depth)
755 AUTOGENERATE="This file was automatically generated by configure"
756 AC_SUBST(AUTOGENERATE)
759 AC_ARG_ENABLE(config,
760 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
761 do `make conf=CONF' to get output in ./out-CONF],
762 [CONFIGURATION=$enableval])
766 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
767 CONFIGFILE=config$CONFIGSUFFIX
768 AC_SUBST(CONFIGSUFFIX)
771 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
772 STEPMAKE_PROGS(FIND, find, REQUIRED)
774 STEPMAKE_PROGS(TAR, tar, REQUIRED)
776 if test "$(echo 2)" != "2" ||
777 test "x`uname`" = "xHP-UX"; then
778 AC_PATH_PROG(KSH, ksh, /bin/ksh)
779 AC_PATH_PROG(BASH, bash, $KSH)
780 STEPMAKE_WARN(avoiding buggy /bin/sh)
781 AC_PATH_PROG(SHELL, bash, $KSH)
784 AC_PATH_PROG(BASH, bash, $SHELL)
788 STEPMAKE_PYTHON(REQUIRED, 1.5)
790 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
791 $MAKE -v 2> /dev/null | grep GNU > /dev/null
792 if test "$?" = 1; then
793 warn='make (Please install *GNU* make)'
794 # STEPMAKE_WARN($warn)
795 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
806 AC_SUBST(program_prefix)
807 AC_SUBST(program_suffix)
811 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
812 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
822 AC_DEFUN(STEPMAKE_LIB, [
823 STEPMAKE_PROGS(AR, ar, $1)
825 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
829 AC_DEFUN(STEPMAKE_LIBTOOL, [
831 # **Never** try to set library version numbers so that they correspond
832 # to the release number of your package. This is an abuse that only
833 # fosters misunderstanding of the purpose of library versions.
835 REVISION=$PATCH_LEVEL
836 # CURRENT=$MINOR_VERSION
837 CURRENT=`expr $MINOR_VERSION + 1`
838 # AGE=`expr $MAJOR_VERSION + 1`
846 AC_DEFUN(STEPMAKE_LOCALE, [
851 AC_ARG_WITH(localedir,
852 [ --with-localedir=DIR location of locales. Default: PREFIX/share/locale ],
853 localedir=$with_localedir,
854 localedir='${prefix}/share/locale')
857 [ --with-lang=LANG use LANG as language to emit messages],
861 AC_MSG_CHECKING(language)
863 En* | en* | Am* | am* | US* | us*)
865 NL | nl | Du* | du* | Ned* | ned*)
874 if test "$lang" = "unknown" ; then
875 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
881 AC_DEFUN(STEPMAKE_MAKEINFO, [
882 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
886 AC_DEFUN(STEPMAKE_MAN, [
887 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
889 STEPMAKE_PROGS(TROFF, troff, $1)
891 STEPMAKE_PROGS(TBL, tbl, $1)
896 AC_DEFUN(STEPMAKE_MSGFMT, [
897 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
901 # Check for program ($2), set full path result to ($1).
902 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
903 AC_DEFUN(STEPMAKE_PATH_PROG, [
904 AC_CHECK_PROGS($1, $2, no)
905 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
906 if test $? -eq 0; then
908 if test -n "$4"; then
909 STEPMAKE_CHECK_VERSION($1, $3, $4)
915 # Check for program in set of names ($2), set result to ($1) .
916 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
917 # If exists, and a minimal version ($4) is required
918 AC_DEFUN(STEPMAKE_PROGS, [
919 AC_CHECK_PROGS($1, $2, no)
920 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
921 if test $? -eq 0 -a -n "$4"; then
922 STEPMAKE_CHECK_VERSION($1, $3, $4)
927 AC_DEFUN(STEPMAKE_PERL, [
928 STEPMAKE_PATH_PROG(PERL, perl, $1)
932 AC_DEFUN(STEPMAKE_PYTHON, [
934 AC_MSG_CHECKING([for python])
935 for python in $PYTHON python python2 python2.4 python2.3 python2.2 python2.1 python2.0; do
936 AC_MSG_RESULT([$python])
937 if ! $python -V > /dev/null 2>&1 ; then
938 #AC_MSG_WARN([cannot execute $python])
939 PYTHON='echo no python'
942 STEPMAKE_CHECK_VERSION(python, pv, $2)
943 if test -z "$pv"; then
949 if test -n "$pv"; then
950 STEPMAKE_ADD_ENTRY($1, $pv)
952 # clear cached value since arg 2 might point us to a new binary
953 unset ac_cv_path_PYTHON
955 AC_PATH_PROG(PYTHON, $PYTHON)
959 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
960 AC_ARG_WITH(python-include,
961 [ --with-python-include=DIR
962 location of the python include dir],[
963 if test "$withval" = "yes" -o "$withval" = "no"; then
964 AC_MSG_WARN(Usage: --with-python-include=includedir)
966 PYTHON_CFLAGS="-I${withval}"
970 AC_ARG_WITH(python-lib,
971 [ --with-python-lib=NAME name of the python lib],[
972 if test "$withval" = "yes" -o "$withval" = "no"; then
973 AC_MSG_WARN(Usage: --with-python-lib=name)
975 LDFLAGS="$LDFLAGS -l${withval}"
979 AC_CHECK_PROGS(PYTHON_CONFIG, python-config, no)
981 if test -z "$PYTHON_CFLAGS" -a "$PYTHON_CONFIG" != "no"; then
982 # Clean out junk: http://bugs.python.org/issue3290
983 # Python headers may need some -f* flags, leave them in.
984 PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags | sed -e 's/ -\(W\|D\|O\|m\)\(\w\|-\|=\|,\)\+//g'`
985 PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
988 if test -z "$PYTHON_CFLAGS" -a "$cross_compiling" = "no"; then
989 changequote(<<, >>)#dnl
990 # alternatively, for python >= 2.0
991 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
992 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
993 PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
994 changequote([, ])#dnl
997 if test -z "$PYTHON_HEADER"; then
998 CPPFLAGS="$PYTHON_CFLAGS $CPPFLAGS"
999 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1002 if test -z "$PYTHON_HEADER"; then
1003 warn="Python.h (python-devel, python-dev or libpython-dev package)"
1004 STEPMAKE_ADD_ENTRY($1, $warn)
1010 AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [
1012 AC_CACHE_CHECK([for stl.data () method],
1013 [stepmake_cv_stl_data_method],
1014 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1016 using namespace std;
1018 void *p = v.data ();
1020 [stepmake_cv_stl_data_method=yes],
1021 [stepmake_cv_stl_data_method=no]))
1022 if test $stepmake_cv_stl_data_method = yes; then
1023 AC_DEFINE(HAVE_STL_DATA_METHOD, 1, [define if stl classes have data () method])
1029 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1031 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1034 AC_DEFUN(STEPMAKE_TEXMF, [
1035 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1036 STEPMAKE_PROGS(METAPOST, mpost, $1)
1037 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1039 AC_MSG_CHECKING(for working metafont mode)
1040 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1041 for MFMODE in $modelist; do
1042 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1043 if test -f mfput.tfm; then
1047 AC_MSG_RESULT($MFMODE)
1055 AC_DEFUN(STEPMAKE_WARN, [
1061 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1062 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1063 dnl also defines GSTUFF_PKG_ERRORS on error
1064 AC_DEFUN(PKG_CHECK_MODULES, [
1067 if test -z "$PKG_CONFIG"; then
1068 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1071 if test "$PKG_CONFIG" = "no" ; then
1072 echo "*** The pkg-config script could not be found. Make sure it is"
1073 echo "*** in your path, or set the PKG_CONFIG environment variable"
1074 echo "*** to the full path to pkg-config."
1075 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1077 PKG_CONFIG_MIN_VERSION=0.9.0
1078 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1079 AC_MSG_CHECKING(for $2)
1081 if $PKG_CONFIG --exists "$2" ; then
1085 AC_MSG_CHECKING($1_CFLAGS)
1086 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1087 AC_MSG_RESULT($$1_CFLAGS)
1089 AC_MSG_CHECKING($1_LIBS)
1090 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1091 AC_MSG_RESULT($$1_LIBS)
1095 ## If we have a custom action on failure, don't print errors, but
1096 ## do set a variable so people can do so.
1097 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1098 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1106 if test $succeeded = yes; then
1107 ifelse([$3], , :, [$3])
1109 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])
1113 AC_DEFUN(STEPMAKE_FREETYPE2, [
1114 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1115 if test "$have_freetype2" = yes; then
1116 AC_DEFINE(HAVE_FREETYPE2)
1117 save_CPPFLAGS="$CPPFLAGS"
1119 CPPFLAGS="$FREETYPE2_CFLAGS $CPPFLAGS"
1120 LIBS="$FREETYPE2_LIBS $LIBS"
1121 AC_SUBST(FREETYPE2_CFLAGS)
1122 AC_SUBST(FREETYPE2_LIBS)
1123 CPPFLAGS="$save_CPPFLAGS"
1127 #r="lib$1-dev or $1-devel"
1128 r="libfreetype6-dev or freetype?-devel"
1129 ver="`pkg-config --modversion $1`"
1130 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1134 AC_DEFUN(STEPMAKE_GTK2, [
1135 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1136 if test "$have_gtk2" = yes ; then
1137 AC_DEFINE(HAVE_GTK2)
1138 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1139 save_CPPFLAGS="$CPPFLAGS"
1141 CPPFLAGS="$GTK2_CFLAGS $CPPFLAGS"
1142 LIBS="$GTK2_LIBS $LIBS"
1143 AC_SUBST(GTK2_CFLAGS)
1145 CPPFLAGS="$save_CPPFLAGS"
1149 # r="lib$1-dev or $1-devel"
1150 r="libgtk2.0-dev or gtk2-devel"
1151 ver="`pkg-config --modversion $1`"
1152 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1156 AC_DEFUN(STEPMAKE_PANGO, [
1157 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1158 if test "$have_pango16" = yes ; then
1159 AC_DEFINE(HAVE_PANGO16)
1160 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1161 save_CPPFLAGS="$CPPFLAGS"
1163 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1164 LIBS="$PANGO_LIBS $LIBS"
1165 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1166 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1167 AC_SUBST(PANGO_CFLAGS)
1168 AC_SUBST(PANGO_LIBS)
1169 CPPFLAGS="$save_CPPFLAGS"
1173 #r="lib$1-dev or $1-devel"
1174 r="libpango1.0-dev or pango1.0-devel"
1175 ver="`pkg-config --modversion $1`"
1176 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1180 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1181 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1182 if test "$have_pangoft2" = yes ; then
1183 AC_DEFINE(HAVE_PANGO16)
1184 AC_DEFINE(HAVE_PANGO_FT2)
1185 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1186 save_CPPFLAGS="$CPPFLAGS"
1188 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1189 LIBS="$PANGO_FT2_LIBS $LIBS"
1190 AC_CHECK_HEADERS([pango/pangoft2.h])
1191 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1192 AC_SUBST(PANGO_FT2_CFLAGS)
1193 AC_SUBST(PANGO_FT2_LIBS)
1194 CPPFLAGS="$save_CPPFLAGS"
1198 #r="lib$1-dev or $1-devel"e
1199 r="libpango1.0-dev or pango?-devel"
1200 ver="`pkg-config --modversion $1`"
1201 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1205 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1206 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1207 if test "$have_fontconfig" = yes ; then
1208 AC_DEFINE(HAVE_FONTCONFIG)
1209 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1210 save_CPPFLAGS="$CPPFLAGS"
1212 CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1213 LIBS="$FONTCONFIG_LIBS $LIBS"
1214 AC_SUBST(FONTCONFIG_CFLAGS)
1215 AC_SUBST(FONTCONFIG_LIBS)
1216 CPPFLAGS="$save_CPPFLAGS"
1219 r="lib$1-dev or $1-devel"
1220 ver="`pkg-config --modversion $1`"
1221 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1225 AC_DEFUN(STEPMAKE_WINDOWS, [
1229 if test "$CYGWIN" = "yes"; then
1230 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1232 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1233 elif test "$MINGW32" = "yes"; then
1237 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1243 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1244 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1247 AC_SUBST(program_suffix)
1249 AC_MSG_CHECKING([for some flavor of Windows])
1250 if test "$CYGWIN$MINGW32" = "nono"; then
1253 PLATFORM_WINDOWS=yes
1255 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1256 AC_SUBST(PLATFORM_WINDOWS)
1257 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)