]> git.donarmstrong.com Git - lilypond.git/commitdiff
* stepmake/aclocal.m4 (STEPMAKE_PANGO_FT2): Define HAVE_PANGO16 too.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 17 Apr 2005 09:38:04 +0000 (09:38 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 17 Apr 2005 09:38:04 +0000 (09:38 +0000)
* SConstruct (test_lib): New function.  Update pkg-config and some
other requirements.

* configure.in: Require pkg-config.  Enforce REQUIRE and version for
freetype, pangof2t.

ChangeLog
SConstruct
autogen.sh
configure.in
lily/font-config.cc
lily/include/all-font-metrics.hh
lily/include/pango-font.hh
lily/parser.yy
stepmake/aclocal.m4
stepmake/autogen.sh

index 9059d85ba9d75ca3dd79af79deb6555dae5c80cb..8c8708dd5041e79bbf7247b6b059e4b24dab3b5c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-04-17  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * stepmake/aclocal.m4 (STEPMAKE_PANGO_FT2): Define HAVE_PANGO16 too.
+
+       * lily/*: s/ifdef HAVE_*/if have/.
+
+       * SConstruct (test_lib): New function.  Update pkg-config and some
+       other requirements.
+
+       * configure.in: Require pkg-config.  Enforce REQUIRE and version for
+       freetype, pangof2t.
+
 2005-04-16  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * po/lilypond.pot, ...: Update using bison-CVS.
index 6246d5268ef9cdb61336fdb5db4ff3c14d808d64..a432db898cfc0e92fd4e74d75aae69fdc0f7fd5c 100644 (file)
@@ -237,12 +237,14 @@ def list_sort (lst):
 def configure (target, source, env):
        vre = re.compile ('^.*[^-.0-9]([0-9][0-9]*\.[0-9][.0-9]*).*$', re.DOTALL)
        def get_version (program):
-               command = '(%(program)s --version || %(program)s -V) 2>&1' % vars ()
+               command = '(pkg-config --modversion %(program)s || %(program)s --version || %(program)s -V) 2>&1' % vars ()
                pipe = os.popen (command)
                output = pipe.read ()
                if pipe.close ():
                        return None
                v = re.sub (vre, '\\1', output)
+               if v[-1] == '\n':
+                       v = v[:-1]
                return string.split (v, '.')
 
        def test_program (lst, program, minimal, description, package):
@@ -252,12 +254,28 @@ def configure (target, source, env):
                        print 'not found'
                        lst.append ((description, package, minimal, program,
                                     'not installed'))
-                       return
+                       return 0
                sys.stdout.write (string.join (actual, '.'))
                sys.stdout.write ('\n')
                if actual < string.split (minimal, '.'):
                        lst.append ((description, package, minimal, program,
                                     string.join (actual, '.')))
+                       return 0
+               return 1
+
+       def test_lib (lst, program, minimal, description):
+               # FIXME: test for Debian or RPM (or -foo?) based dists
+               # to guess (or get correct!: apt-cache search?)
+               # package name.
+               #if os.system ('pkg-config --atleast-version=0 freetype2'):
+               # barf
+               if test_program (lst, program, minimal, description,
+                                'lib%(program)s-dev or %(program)s-devel'
+                                % vars ()):
+                       env.ParseConfig ('pkg-config --cflags --libs %(program)s'
+                                        % vars ())
+                       return 1
+               return 0
 
        for i in ['bash', 'perl', 'python', 'sh']:
                sys.stdout.write ('Checking for %s... ' % i)
@@ -283,12 +301,10 @@ def configure (target, source, env):
                        'bison')
        test_program (required, 'flex', '0.0', 'Flex -- lexer generator', 'flex')
 
-
        optional = []
        test_program (optional, 'makeinfo', '4.7', 'Makeinfo tool', 'texinfo')
-       test_program (optional, 'guile', '1.6', 'GUILE scheme',
-                       'libguile-dev or guile-devel')
-       test_program (optional, 'mftrace', '1.0.27', 'Metafont tracing Type1',
+       test_program (optional, 'guile', '1.6', 'GUILE scheme', 'guile')
+       test_program (optional, 'mftrace', '1.1.0', 'Metafont tracing Type1',
                        'mftrace')
        test_program (optional, 'perl', '4.0',
                        'Perl practical efficient readonly language', 'perl')
@@ -315,12 +331,10 @@ def configure (target, source, env):
        defines = {
           'DIRSEP' : "'%s'" % os.sep,
           'PATHSEP' : "'%s'" % os.pathsep,
-          'TOPLEVEL_VERSION' : '"' + version + '"',
-          'PACKAGE': '"' + package.name + '"',
-          'DATADIR' : '"' + sharedir + '"',
-          'LILYPOND_DATADIR' : '"' + sharedir_package + '"',
-          'LOCAL_LILYPOND_DATADIR' : '"' + sharedir_package_version + '"',
-          'LOCALEDIR' : '"' + localedir + '"',
+          'PACKAGE': '"%s"' % package.name,
+          'DATADIR' : '"%s"' % sharedir,
+          'PACKAGE_DATADIR' : '"%s"' % sharedir_package,
+          'LOCALEDIR' : '"%s"' %localedir,
        }
        conf.env.Append (DEFINES = defines)
 
@@ -378,27 +392,32 @@ def configure (target, source, env):
        #this could happen after flower...
        env.ParseConfig ('guile-config compile')
 
-       ## FIXME: pkg-test to required/optional
-       if os.system ('pkg-config --atleast-version=1.6.0 pango'):
-               barf
-       env.ParseConfig ('pkg-config --cflags --libs pango')
-       conf.env['DEFINES']['HAVE_PANGO16'] = '1'
-       
-       if os.system ('pkg-config --atleast-version=1.6.0 pangoft2'):
-               barf
-       env.ParseConfig ('pkg-config --cflags --libs pangoft2')
-       conf.env['DEFINES']['HAVE_PANGO_FT2'] = '1'
+       if test_lib (required, 'freetype2', '0.0',
+                    'Development files for FreeType 2 font engine'):
+               conf.env['DEFINES']['HAVE_FREETYPE2'] = '1'
+               
+       if test_lib (required, 'pangoft2', '1.6.0',
+                    'Development files for pango, with fontconfig2'):
+               conf.env['DEFINES']['HAVE_PANGO_FT2'] = '1'
+               conf.env['DEFINES']['HAVE_PANGO16'] = '1'
+
+       if test_lib (optional, 'fontconfig', '2.2.0',
+                    'Development files for fontconfig'):
+               conf.env['DEFINES']['HAVE_FONTCONFIG'] = '1'
        
        #this could happen only for compiling pango-*
        if env['gui']:
-               env.ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
-               env.ParseConfig ('pkg-config --cflags --libs pango')
+               test_lib (required, 'gtk+-2.0', '2.4.0',
+                         'Development files for GTK+')
+               if test_lib (required, 'pango', '1.6.0',
+                         'Development files for pango'):
+                       conf.env['DEFINES']['HAVE_PANGO16'] = '1'
+                       
                if conf.CheckCHeader ('pango/pangofc-fontmap.h'):
                        conf.env['DEFINES']['HAVE_PANGO_PANGOFC_FONTMAP_H'] = '1'
-
                if conf.CheckLib ('pango-1.0',
                                  'pango_fc_font_map_add_decoder_find_func'):
-                       conf.env['DEFINES']['HAVE_PANGO_CVS'] = '1'
+                       conf.env['DEFINES']['HAVE_PANGO16'] = '1'
                        conf.env['DEFINES']['HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC'] = '1'
 
        if env['fast']:
index 6678367b65a4f46648ecb5b9b2db2aacd61a60a2..1d4c1b61ef3de361e602ccd440df5c9338e14f70 100755 (executable)
@@ -8,12 +8,12 @@ case $1 in
 esac
 
 if [ ! -f aclocal.m4 -o stepmake/aclocal.m4 -nt aclocal.m4 ]; then
-    echo "stepmake/aclocal.m4 is newer. Copying file." 
+    echo "stepmake/aclocal.m4 is newer.  Copying file." 
     cp -f stepmake/aclocal.m4 aclocal.m4
 fi
 
 if [ ! -f autogen.sh -o stepmake/autogen.sh -nt autogen.sh ]; then
-    echo "stepmake/autogen.sh is newer. Copying file." 
+    echo "stepmake/autogen.sh is newer.  Copying file." 
     cp -f stepmake/autogen.sh autogen.sh
     exec ./autogen.sh "$@"
 fi
index 2ca40bae7dcbe34a858719b170aae3b7af19cafe..b99fff5fa3e588be5b5a9db5d4cc69661839c449 100644 (file)
@@ -54,7 +54,7 @@ STEPMAKE_GUILE_DEVEL(REQUIRED, 1.6.5)
 STEPMAKE_MAKEINFO(REQUIRED)
 STEPMAKE_PYTHON_DEVEL(REQUIRED)
 
-STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs,  OPTIONAL, 8.15)  
+STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs, OPTIONAL, 8.14)
 
 STEPMAKE_PROGS(MFTRACE, mftrace, REQUIRED, 1.1.1)
 STEPMAKE_PATH_PROG(FONTFORGE, fontforge, REQUIRED, 20041208)
@@ -69,14 +69,17 @@ AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([fopencookie funopen gettext isinf memmem snprintf vsnprintf])
 AC_CHECK_HEADERS([utf8/wchar.h], LIBS="$LIBS -lutf8")
 
-
+STEPMAKE_PROGS(PKG_CONFIG, pkg-config, REQUIRED, 0.9.0)
 if test "$gui_b" = "yes"; then
-    STEPMAKE_GTK2
+    STEPMAKE_GTK2(gtk+-2.0, REQUIRED, 2.4.0)
+else
+    STEPMAKE_GTK2(gtk+-2.0, OPTIONAL, 2.4.0)
 fi
 
-STEPMAKE_FREETYPE2
-STEPMAKE_PANGO_FT2
-STEPMAKE_FONTCONFIG
+STEPMAKE_FREETYPE2(freetype2, REQUIRED, 0)
+#STEPMAKE_PANGO(pango, REQUIRED, 1.6.0)
+STEPMAKE_PANGO_FT2(pangoft2, REQUIRED, 1.6.0)
+STEPMAKE_FONTCONFIG(fontconfig, OPTIONAL, 2.2.0)
 
 ## TTFTOOL stuff
 AC_C_BIGENDIAN(TTFTOOL_ENDIAN="-DBIGENDIAN",
@@ -90,8 +93,6 @@ STEPMAKE_GUILE(OPTIONAL)
 # perl for help2man.
 STEPMAKE_PERL(OPTIONAL)
 
-
-
 # New makeinfo for multi-page website docs Simply always require new
 # makeinfo should avoid bug reports; if people want to build lily
 # without the docs, they can find this comment and use an older
index aac1eeb7094f7657572e32f7beee63f3495ab665..b9ba8b41a3cfc9714dd18d3b0f2a141d62171d1d 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "config.hh"
 
-#ifdef HAVE_FONTCONFIG
+#if HAVE_FONTCONFIG
 
 #include <fontconfig/fontconfig.h>
 #include <sys/stat.h>
index f7af1bb4b94103cccbd41fe35eaa6f3ca4c4767e..a9982d7ba52d16e11e95450b5f05d01ad33ef54b 100644 (file)
@@ -13,7 +13,7 @@
 #include "font-metric.hh"
 #include "config.hh"
 
-#ifdef HAVE_PANGO16
+#if HAVE_PANGO16
 #include <pango/pango.h>
 #include <pango/pangoft2.h>
 #endif
@@ -28,7 +28,7 @@ class All_font_metrics
   Scheme_hash_table *otf_dict_;
   File_path search_path_;
 
-#ifdef HAVE_PANGO_FT2
+#if HAVE_PANGO_FT2
   PangoFT2FontMap *pango_ft2_fontmap_;
   Scheme_hash_table *pango_dict_;
   int pango_dpi_;
@@ -39,7 +39,7 @@ public:
   All_font_metrics (String search_path);
   ~All_font_metrics ();
 
-#ifdef HAVE_PANGO_FT2
+#if HAVE_PANGO_FT2
   Pango_font *find_pango_font (PangoFontDescription *description,
                               Real magnification,
                               Real scale);
index 68a55f65b883addf008c948bfe83d8f8f2412711..b8119b746aa57e885922ac1982b194008eee8757 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "config.hh"
 
-#ifdef HAVE_PANGO16
+#if HAVE_PANGO16
 
 #include <pango/pango.h>
 #include <pango/pangoft2.h>
index 3623abc0c63ed9cf6a7aa5500229b5137ea48492..f55a4c76e4be9edb7915265a51b7abf1568ea5d1 100644 (file)
@@ -257,13 +257,11 @@ or
 %pure_parser
 %locations
 
-/* FIXME: The third option is an alias that will be used to display
-   the syntax error.  There's a bug (reported with patch) in bison CVS
-   that prints double backslashes
+/* The third option is an alias that will be used to display the
+   syntax error.  Bison CVS now correctly handles backslash escapes.
+
+   FIXME: Bison needs to translate some of these, eg, STRING.
 
-   bison.ly:1:5: error: syntax error, unexpected \\book", expecting '{'
-   \book
-       \book %expect \book error here
 */     
    
 /* Keyword tokens with plain escaped name.  */
index b05f9a4cacf52a6937f9e93d54a90c4bef6c18e0..31ddaed991943d0bc2c2166203e5daefb3a8070a 100644 (file)
@@ -1095,9 +1095,6 @@ AC_DEFUN(PKG_CHECK_MODULES, [
 
         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
 
@@ -1108,28 +1105,35 @@ AC_DEFUN(PKG_CHECK_MODULES, [
   fi
 ])
 
-
 AC_DEFUN(STEPMAKE_FREETYPE2, [
-    PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
-    if $have_freetype2 ; then
+    PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
+    if test "$have_freetype2" = yes; then
        AC_DEFINE(HAVE_FREETYPE2)
        AC_SUBST(FREETYPE2_CFLAGS)
        AC_SUBST(FREETYPE2_LIBS)
+    else
+       r="lib$1-dev or $1-devel"
+       ver="$(pkg-config --modversion $1)"
+       STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
     fi
 ])
 
 AC_DEFUN(STEPMAKE_GTK2, [
-    PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
-    if $have_gtk2 ; then
+    PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
+    if test "$have_gtk2" = yes ; then
        AC_DEFINE(HAVE_GTK2)
        AC_SUBST(GTK2_CFLAGS)
        AC_SUBST(GTK2_LIBS)
+    else
+       r="lib$1-dev or $1-devel"
+       ver="$(pkg-config --modversion $1)"
+       STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
     fi
 ])
 
 AC_DEFUN(STEPMAKE_PANGO, [
-    PKG_CHECK_MODULES(PANGO, pango >= 1.6.0, have_pango16=true, true)
-    if $have_pango16 ; then
+    PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
+    if test "$have_pango16" = yes ; then
        AC_DEFINE(HAVE_PANGO16)
        PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
        PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
@@ -1142,13 +1146,17 @@ AC_DEFUN(STEPMAKE_PANGO, [
        AC_SUBST(PANGO_LIBS)
        CPPFLAGS="$save_CPPFLAGS"
        LIBS="$save_LIBS"
-fi
+    else
+       r="lib$1-dev or $1-devel"
+       ver="$(pkg-config --modversion $1)"
+       STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
+    fi
 ])
 
-
 AC_DEFUN(STEPMAKE_PANGO_FT2, [
-    PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true)
-    if $have_pangoft2 ; then
+    PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
+    if test "$have_pangoft2" = yes ; then
+       AC_DEFINE(HAVE_PANGO16)
        AC_DEFINE(HAVE_PANGO_FT2)
        PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
        PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
@@ -1163,12 +1171,16 @@ AC_DEFUN(STEPMAKE_PANGO_FT2, [
        AC_SUBST(PANGO_FT2_LIBS)
        CPPFLAGS="$save_CPPFLAGS"
        LIBS="$save_LIBS"
-fi
+    else
+       r="lib$1-dev or $1-devel"
+       ver="$(pkg-config --modversion $1)"
+       STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
+    fi
 ])
 
 AC_DEFUN(STEPMAKE_FONTCONFIG, [
-    PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, have_fontconfig=true, true)
-    if $have_fontconfig ; then
+    PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
+    if test "$have_fontconfig" = yes ; then
        AC_DEFINE(HAVE_FONTCONFIG)
        FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
        FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
@@ -1181,5 +1193,9 @@ AC_DEFUN(STEPMAKE_FONTCONFIG, [
        AC_SUBST(FONTCONFIG_LIBS)
        CPPFLAGS="$save_CPPFLAGS"
        LIBS="$save_LIBS"
-fi
+    else
+       r="lib$1-dev or $1-devel"
+       ver="$(pkg-config --modversion $1)"
+       STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
+    fi
 ])
index 6678367b65a4f46648ecb5b9b2db2aacd61a60a2..1d4c1b61ef3de361e602ccd440df5c9338e14f70 100755 (executable)
@@ -8,12 +8,12 @@ case $1 in
 esac
 
 if [ ! -f aclocal.m4 -o stepmake/aclocal.m4 -nt aclocal.m4 ]; then
-    echo "stepmake/aclocal.m4 is newer. Copying file." 
+    echo "stepmake/aclocal.m4 is newer.  Copying file." 
     cp -f stepmake/aclocal.m4 aclocal.m4
 fi
 
 if [ ! -f autogen.sh -o stepmake/autogen.sh -nt autogen.sh ]; then
-    echo "stepmake/autogen.sh is newer. Copying file." 
+    echo "stepmake/autogen.sh is newer.  Copying file." 
     cp -f stepmake/autogen.sh autogen.sh
     exec ./autogen.sh "$@"
 fi