X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=stepmake%2Faclocal.m4;h=07bb56d3b9f58b4c9b714467ba8f1a5c6afaae90;hb=36f6766b9de37adb09d2a27e3f925b356cbc0849;hp=6308424a7b17e911e323fc6817b88179dcf9bafb;hpb=26633bbfbf821a7cfdfe7a0367d1ea94a440be2e;p=lilypond.git diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 6308424a7b..07bb56d3b9 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -24,12 +24,25 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [ ## gcc (GCC) 3.1.1 20020606 (Debian prerelease) ## ## -V: Workaround for python - ## - ## Assume, and hunt for, dotted version multiplet. changequote(<<, >>)dnl - ("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' | head -n 1 | \ - sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' + ##set -x + ## Assume and hunt for dotted version multiplet. + ## use eval trickery, because we cannot use multi-level $() instead of `` + ## for compatibility reasons. + ## FIXME: what systems still do not have $() in /bin/sh? + eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \ + | head -n 1 \ + | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \ + -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\" + if test -z "$_ver"; then + ## If empty, try date [fontforge] + eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \ + | head -n 1 \ + | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\" + fi + echo "$_ver" + ##set +x changequote([, ])dnl ]) @@ -41,7 +54,7 @@ AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [ if ([$]3) {three = [$]3} else {three = 0} } - {printf "%d\n", [$]1*1000000 + [$]2*1000 + three}' + {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}' ]) @@ -84,19 +97,27 @@ AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [ # Check version of program ($1) -# If version is smaller than requested ($3), -# add entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED'). +# If version ($4: optional argument, supply if version cannot be +# parsed using --version or -V ) is smaller than requested ($3), add +# entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED'). AC_DEFUN(STEPMAKE_CHECK_VERSION, [ r="`eval echo '$'"$1"`" AC_MSG_CHECKING([$r version]) exe=`STEPMAKE_GET_EXECUTABLE($r)` - ver=`STEPMAKE_GET_VERSION($exe)` + if test -n "$4"; then + ver="$4" + else + ver=`STEPMAKE_GET_VERSION($exe)` + fi num=`STEPMAKE_NUMERIC_VERSION($ver)` req=`STEPMAKE_NUMERIC_VERSION($3)` AC_MSG_RESULT([$ver]) if test "$num" -lt "$req"; then STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"]) fi + vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION" + eval `echo $vervar=$num` +## AC_SUBST(`eval echo $vervar`) ]) # Check version of program ($1) @@ -148,14 +169,10 @@ AC_DEFUN(STEPMAKE_COMPILE, [ CFLAGS=${CFLAGS-""} CXXFLAGS=${CXXFLAGS-$CFLAGS} LDFLAGS=${LDFLAGS-""} - checking_b=yes optimise_b=yes profile_b=no debug_b=yes - - AC_ARG_ENABLE(checking, - [ --enable-checking set runtime checks (assert calls). Default: on], - [checking_b=$enableval] ) + pipe_b=yes AC_ARG_ENABLE(debugging, [ --enable-debugging compile with debugging info. Default: on], @@ -169,33 +186,45 @@ AC_DEFUN(STEPMAKE_COMPILE, [ [ --enable-profiling compile with gprof support. Default: off], [profile_b=$enableval]) + AC_ARG_ENABLE(pipe, + [ --enable-pipe compile with -pipe. Default: on], + [pipe_b=$enableval]) - if test "$checking_b" = no; then - # ugh + if test "$optimise_b" = yes; then AC_DEFINE(NDEBUG) DEFINES="$DEFINES -DNDEBUG" - fi - - if test "$optimise_b" = yes; then OPTIMIZE="-O2 -finline-functions" fi - if test $profile_b = yes; then EXTRA_LIBES="-pg" OPTIMIZE="$OPTIMIZE -pg" fi - if test $debug_b = yes; then + if test $debug_b = yes; then OPTIMIZE="$OPTIMIZE -g" fi - - + AC_PROG_CC STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1) LD='$(CC)' AC_SUBST(LD) + # If -pipe requested, test if it works and add to CFLAGS. + if test "$pipe_b" = yes; then + save_cflags="$CFLAGS" + CFLAGS="-pipe $CFLAGS"; + AC_CACHE_CHECK([whether compiler understands -pipe], + [stepmake_cflags_pipe], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])], + [stepmake_cflags_pipe=yes], + [stepmake_cflags_pipe=no])) + CFLAGS=$save_cflags + if test $stepmake_cflags_pipe = yes; then + OPTIMIZE="$OPTIMIZE -pipe" + fi + fi + CFLAGS="$CFLAGS $OPTIMIZE" CPPFLAGS=${CPPFLAGS-""} @@ -211,6 +240,7 @@ AC_DEFUN(STEPMAKE_COMPILE, [ AC_MSG_RESULT([none]) ;; esac + AC_SUBST(cross_compiling) AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) @@ -380,7 +410,7 @@ class yy_flex_lexer: public yyFlexLexer fi AC_LANG_POP(C++) ]) - + AC_DEFUN(STEPMAKE_GCC, [ if test "$GCC" = "yes"; then @@ -409,8 +439,8 @@ AC_DEFUN(STEPMAKE_GETTEXT, [ GCC_UNSUPPORTED= STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3) if test -n "$GCC_UNSUPPORTED"; then - AC_MSG_WARN([autoconf <= 2.57 with g++ >= 3.3 gettext test broken.]) - AC_MSG_WARN([Trying gcc, cross thumbs.]) + AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.]) + AC_MSG_WARN([Trying gcc, cross fingers.]) AC_LANG_PUSH(C) fi AC_CHECK_LIB(intl, gettext) @@ -461,8 +491,10 @@ AC_DEFUN([STEPMAKE_GUILE_FLAGS], [ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ ## First, let's just see if we can find Guile at all. + test -n "$target_alias" && target_guile_config=$target_alias-guile-config + test -n "$host_alias" && host_guile_config=$host_alias-guile-config AC_MSG_CHECKING([for guile-config]) - for guile_config in $GUILE_CONFIG guile-config $target-guile-config $build-guile-config; do + for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do AC_MSG_RESULT([$guile_config]) if ! $guile_config --version > /dev/null 2>&1 ; then AC_MSG_WARN([cannot execute $guile_config]) @@ -493,12 +525,31 @@ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'` changequote([, ])dnl STEPMAKE_GUILE_FLAGS + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS" + LIBS="$GUILE_LDFLAGS $LIBS" + AC_CHECK_HEADERS([libguile.h]) + AC_CHECK_LIB(guile, scm_boot_guile) + AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no) + if test "$libguile_b" = "no"; then + warn='libguile (libguile-dev, guile-devel or guile-dev + package).' + STEPMAKE_ADD_ENTRY(REQUIRED, $warn) + fi + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION) AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION) AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL) ]) +AC_DEFUN(STEPMAKE_DLOPEN, [ + AC_CHECK_LIB(dl, dlopen) + AC_CHECK_FUNCS(dlopen) +]) + AC_DEFUN(STEPMAKE_GXX, [ if test "$GXX" = "yes"; then STEPMAKE_CHECK_VERSION(CXX, $1, $2) @@ -517,7 +568,7 @@ AC_DEFUN(STEPMAKE_INIT, [ if test x$MY_PATCH_LEVEL != x; then FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL fi - + export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:] changequote(<<, >>)dnl PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'` @@ -596,6 +647,9 @@ AC_DEFUN(STEPMAKE_INIT, [ AC_SUBST(package) AC_SUBST(PACKAGE) AC_SUBST(PACKAGE_NAME) + AC_SUBST(MAJOR_VERSION) + AC_SUBST(MINOR_VERSION) + # We don't need the upper case variant, # so stick to macros are uppercase convention. # AC_DEFINE_UNQUOTED(package, ["${package}"]) @@ -720,31 +774,62 @@ AC_DEFUN(STEPMAKE_KPATHSEA, [ [ --with-kpathsea use kpathsea lib. Default: on], [kpathsea_b=$with_kpathsea]) + save_LIBS="$LIBS" if test "$kpathsea_b" != "no"; then - AC_CHECK_HEADERS([kpathsea/kpathsea.h]) + AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no) AC_CHECK_LIB(kpathsea, kpse_find_file) AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no) if test "$kpathsea_b" = "no"; then warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel package). - Else, please specify the location of your kpathsea using - --with-kpathsea-include and --with-kpathsea-lib options. You should - install kpathsea; see INSTALL.txt. Rerun ./configure - --without-kpathsea only if kpathsea is not available for your - platform.' + Else, please specify the directories where kpathsea/kpathsea.h and + libkpathsea.a are installed using --with-kpathsea-include and + --with-kpathsea-lib options. You should install kpathsea; see + INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea + is not available for your platform.' STEPMAKE_ADD_ENTRY(REQUIRED, $warn) fi fi + + save_CFLAGS="$CFLAGS" + CFLAGS="-shared $CFLAGS" + AC_MSG_CHECKING([for shared libkpathsea]) + AC_TRY_LINK([#include ], + [kpse_var_expand ("\$TEXMF");], + [have_libkpathsea_so=maybe; + shared_size=`wc -c conftest | sed 's/ .*//g'`] + [have_libkpathsea_so=no]) + + if test "$have_libkpathsea_so" = "maybe"; then + if test $shared_size -lt 40000 ; then + have_libkpathsea_so=yes + else + have_libkpathsea_so=no + fi + fi + + AC_MSG_RESULT($have_libkpathsea_so) + if test "$have_libkpathsea_so" = "yes"; then + AC_DEFINE(HAVE_LIBKPATHSEA_SO) + fi + CFLAGS="$save_CFLAGS" + + KPATHSEA_LIBS="$LIBS" + LIBS="$save_LIBS" AC_MSG_CHECKING(whether to use kpathsea) if test "$kpathsea_b" != no; then AC_MSG_RESULT(yes) KPATHSEA=1 + if "$have_libkpathsea_so" = "no" ; then + KPATHSEA_LIBS="-lkpathsea" + fi else AC_MSG_RESULT(no) KPATHSEA=0 fi AC_SUBST(KPATHSEA) + AC_SUBST(KPATHSEA_LIBS) AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA) ]) @@ -966,15 +1051,13 @@ AC_DEFUN(STEPMAKE_TEXMF_DIRS, [ AC_DEFUN(STEPMAKE_TEXMF, [ - # urg, never know what names these teTeX guys will think up - - STEPMAKE_PROGS(METAFONT, mf mfont, $1) - STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1) + STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1) + # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1) AC_MSG_CHECKING(for working metafont mode) modelist='ljfour lj4 lj3 lj2 ljet laserjet' for MFMODE in $modelist; do - $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1 + $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1 if test -f mfput.tfm; then break; fi @@ -993,3 +1076,115 @@ AC_DEFUN(STEPMAKE_WARN, [ ]) +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + 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]) + fi +]) + + +AC_DEFUN(STEPMAKE_FREETYPE2, [ + PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true) + if $have_freetype2 ; then + AC_DEFINE(HAVE_FREETYPE2) + AC_SUBST(FREETYPE2_CFLAGS) + AC_SUBST(FREETYPE2_LIBS) + fi +]) + +AC_DEFUN(STEPMAKE_GTK2, [ + PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true) + if $have_gtk2 ; then + AC_DEFINE(HAVE_GTK2) + AC_SUBST(GTK2_CFLAGS) + AC_SUBST(GTK2_LIBS) + fi +]) + +AC_DEFUN(STEPMAKE_PANGO, [ + PKG_CHECK_MODULES(PANGO, pango >= 1.6.0, have_pango16=true, true) + if $have_pango16 ; then + AC_DEFINE(HAVE_PANGO16) + PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS" + PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS" + # Do not pollute user-CPPFLAGS with configure-CPPFLAGS + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + AC_CHECK_HEADERS([pango/pangofc-fontmap.h]) + AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func]) + AC_SUBST(PANGO_CFLAGS) + AC_SUBST(PANGO_LIBS) + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" +fi +]) + + +AC_DEFUN(STEPMAKE_PANGO_FT2, [ + PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true) + if $have_pangoft2 ; then + AC_DEFINE(HAVE_PANGO_FT2) + PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS" + PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS" + # Do not pollute user-CPPFLAGS with configure-CPPFLAGS + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS" + LIBS="$PANGO_FT2_LIBS $LIBS" + AC_CHECK_HEADERS([pango/pangoft2.h]) + AC_CHECK_FUNCS([pango_ft2_font_map_create_context]) + AC_SUBST(PANGO_FT2_CFLAGS) + AC_SUBST(PANGO_FT2_LIBS) + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" +fi +])