eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot configure.in extras/contrib/Makefile game...


From: Olivier Teulière
Subject: [Eliot-dev] eliot configure.in extras/contrib/Makefile game...
Date: Sun, 06 Dec 2009 00:07:36 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       09/12/06 00:07:36

Modified files:
        .              : configure.in 
        extras/contrib : Makefile 
        game           : Makefile.am 
        qt             : Makefile.am 
        utils          : Makefile.am 
Added files:
        m4             : ax_lib_expat.m4 

Log message:
        Use expat instead of libxml2: it is much smaller, and is easier to use 
with Arabica when cross-compiling for Windows

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/configure.in?cvsroot=eliot&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/eliot/extras/contrib/Makefile?cvsroot=eliot&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/eliot/game/Makefile.am?cvsroot=eliot&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/eliot/m4/ax_lib_expat.m4?cvsroot=eliot&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/Makefile.am?cvsroot=eliot&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/Makefile.am?cvsroot=eliot&r1=1.13&r2=1.14

Patches:
Index: configure.in
===================================================================
RCS file: /cvsroot/eliot/eliot/configure.in,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- configure.in        29 Nov 2009 16:01:31 -0000      1.39
+++ configure.in        6 Dec 2009 00:07:35 -0000       1.40
@@ -113,12 +113,15 @@
                    AC_DEFINE(HAVE_LIBCONFIG, 1, [Define to 1 if you have the 
libconfig library])],
                   [has_libconfig=0])
 
+dnl Check for Expat
+AX_LIB_EXPAT([2.0.1])
+
 dnl Check for arabica and libxml2
 PKG_CHECK_MODULES(ARABICA, [arabica], [],
                   [AC_MSG_ERROR([Could not find Arabica on your system (using 
pkg-config)])])
 
-PKG_CHECK_MODULES(LIBXML2, [libxml-2.0], [],
-                  [AC_MSG_ERROR([Could not find libxml2 on your system (using 
pkg-config)])])
+dnl PKG_CHECK_MODULES(LIBXML2, [libxml-2.0], [],
+dnl                   [AC_MSG_ERROR([Could not find libxml2 on your system 
(using pkg-config)])])
 
 dnl Check for ncurses
 dnl We enable it if asked by the user, or if ncursesw is found

Index: extras/contrib/Makefile
===================================================================
RCS file: /cvsroot/eliot/eliot/extras/contrib/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- extras/contrib/Makefile     5 Dec 2009 17:07:49 -0000       1.8
+++ extras/contrib/Makefile     6 Dec 2009 00:07:35 -0000       1.9
@@ -2,8 +2,10 @@
 LIBCONFIG_VERSION = 1.3.2
 BOOST_VERSION = 1_39_0
 QT_VERSION = 4.5.3
-LIBXML2_VERSION = 2.7.5
+EXPAT_VERSION = 2.0.1
 ARABICA_VERSION = 2009-march
+LIBXML2_VERSION = 2.7.5
+XERCES_VERSION = 3.0.1
 
 
 PREFIX = $(shell pwd)/inst
@@ -18,7 +20,7 @@
 
 .PHONY: help all
 
-all: .iconv .boost .qt .libconfig .libxml2 .arabica
+all: .iconv .boost .qt .libconfig .expat .arabica
 
 help:
        @echo "Usage: make all"
@@ -105,6 +107,42 @@
        touch $@
 
 
+### Expat ###
+
+EXPAT_DIR = expat-$(EXPAT_VERSION)
+EXPAT_DIR_FLAG = $(EXPAT_DIR)/.flag
+EXPAT_ARCHIVE = expat-$(EXPAT_VERSION).tar.gz
+
+$(EXPAT_ARCHIVE): $(PREFIX_FLAG)
+       $(WGET) 
http://downloads.sourceforge.net/project/expat/expat/$(EXPAT_VERSION)/address@hidden
+
+$(EXPAT_DIR_FLAG): $(EXPAT_ARCHIVE)
+       tar xzf $<
+       touch $@
+
+.expat: $(EXPAT_DIR_FLAG)
+       (cd $(EXPAT_DIR) && $(CONFIGURE) --enable-static --disable-shared && 
make install)
+       touch $@
+
+
+### Arabica ###
+
+ARABICA_DIR = arabica-$(ARABICA_VERSION)
+ARABICA_DIR_FLAG = $(ARABICA_DIR)/.flag
+ARABICA_ARCHIVE = arabica-$(ARABICA_VERSION).tar.bz2
+
+$(ARABICA_ARCHIVE): $(PREFIX_FLAG)
+       $(WGET) 
http://downloads.sourceforge.net/project/arabica/arabica/March-09/address@hidden
+
+$(ARABICA_DIR_FLAG): $(ARABICA_ARCHIVE)
+       tar xjf $<
+       touch $@
+
+.arabica: $(ARABICA_DIR_FLAG)
+       (cd $(ARABICA_DIR) && patch -p0 < ../arabica-no-example.patch && 
$(CONFIGURE) --enable-static --disable-shared --with-parser=expat 
--with-expat=$(PREFIX) --with-boost=$(PREFIX) --with-tests=no --with-dom=no && 
make install)
+       touch $@
+
+
 ### LibXML 2 ###
 
 LIBXML2_DIR = libxml2-$(LIBXML2_VERSION)
@@ -125,20 +163,20 @@
        touch $@
 
 
-### Arabica ###
+### Xerces ###
 
-ARABICA_DIR = arabica-$(ARABICA_VERSION)
-ARABICA_DIR_FLAG = $(ARABICA_DIR)/.flag
-ARABICA_ARCHIVE = arabica-$(ARABICA_VERSION).tar.bz2
+XERCES_DIR = xerces-c-$(XERCES_VERSION)
+XERCES_DIR_FLAG = $(XERCES_DIR)/.flag
+XERCES_ARCHIVE = xerces-c-$(XERCES_VERSION).tar.gz
 
-$(ARABICA_ARCHIVE): $(PREFIX_FLAG)
-       $(WGET) 
http://downloads.sourceforge.net/project/arabica/arabica/March-09/address@hidden
+$(XERCES_ARCHIVE): $(PREFIX_FLAG)
+       $(WGET) 
http://mirrors.24-7-solutions.net/pub/apache/xerces/c/3/sources/$@
 
-$(ARABICA_DIR_FLAG): $(ARABICA_ARCHIVE)
-       tar xjf $<
+$(XERCES_DIR_FLAG): $(XERCES_ARCHIVE)
+       tar xzf $<
        touch $@
 
-.arabica: $(ARABICA_DIR_FLAG)
-       (cd $(ARABICA_DIR) && patch -p0 < ../arabica-no-example.patch && 
$(CONFIGURE) --enable-static --disable-shared --with-parser=libxml2 
--with-libxml2=$(PREFIX) --with-boost=$(PREFIX) --with-tests=no --with-dom=no 
&& make install)
+.xerces: $(XERCES_DIR_FLAG)
+       (cd $(XERCES_DIR) && $(CONFIGURE) --enable-static --disable-shared 
--disable-network && make install)
        touch $@
 

Index: game/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/game/Makefile.am,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- game/Makefile.am    29 Nov 2009 16:01:32 -0000      1.26
+++ game/Makefile.am    6 Dec 2009 00:07:35 -0000       1.27
@@ -19,7 +19,7 @@
 
 noinst_LIBRARIES = libgame.a
 
-AM_CPPFLAGS = -I$(top_srcdir)/dic -I../intl -I$(top_srcdir)/intl 
@LIBCONFIG_CFLAGS@ @ARABICA_CFLAGS@ @LIBXML2_CFLAGS@
+AM_CPPFLAGS = -I$(top_srcdir)/dic -I../intl -I$(top_srcdir)/intl 
@LIBCONFIG_CFLAGS@ @ARABICA_CFLAGS@ @EXPAT_CFLAGS@
 
 libgame_a_SOURCES= \
     game_exception.cpp game_exception.h \

Index: qt/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- qt/Makefile.am      29 Nov 2009 16:01:33 -0000      1.11
+++ qt/Makefile.am      6 Dec 2009 00:07:36 -0000       1.12
@@ -80,7 +80,7 @@
     main.cpp
 eliot_SOURCES += $(BUILT_SOURCES)
 
-eliot_LDADD = ../game/libgame.a ../dic/libdic.a @QT_LIBS@ @LIBINTL@ 
@LIBCONFIG_LIBS@ @ARABICA_LIBS@
+eliot_LDADD = ../game/libgame.a ../dic/libdic.a @QT_LIBS@ @LIBINTL@ 
@LIBCONFIG_LIBS@ @ARABICA_LIBS@ @EXPAT_CFLAGS@
 
 # Generate a cpp file from the resources
 resources.cpp: eliot.qrc $(RESOURCES)

Index: utils/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- utils/Makefile.am   29 Nov 2009 16:01:34 -0000      1.13
+++ utils/Makefile.am   6 Dec 2009 00:07:36 -0000       1.14
@@ -25,7 +25,7 @@
 if BUILD_TEXT
 noinst_PROGRAMS += eliottxt
 eliottxt_SOURCES = game_io.h game_io.cpp eliottxt.cpp
-eliottxt_LDADD = $(top_builddir)/game/libgame.a $(top_builddir)/dic/libdic.a 
@LIBINTL@ @LIBCONFIG_LIBS@ @ARABICA_LIBS@
+eliottxt_LDADD = $(top_builddir)/game/libgame.a $(top_builddir)/dic/libdic.a 
@LIBINTL@ @LIBCONFIG_LIBS@ @ARABICA_LIBS@ @EXPAT_LDFLAGS@
 
 if HAS_READLINE
 eliottxt_LDADD += -lreadline
@@ -35,6 +35,6 @@
 if BUILD_NCURSES
 bin_PROGRAMS += eliotcurses
 eliotcurses_SOURCES = ncurses.cpp ncurses.h
-eliotcurses_LDADD = ../game/libgame.a ../dic/libdic.a -lncursesw @LIBINTL@ 
@LIBCONFIG_LIBS@ @ARABICA_LIBS@
+eliotcurses_LDADD = ../game/libgame.a ../dic/libdic.a -lncursesw @LIBINTL@ 
@LIBCONFIG_LIBS@ @ARABICA_LIBS@ @EXPAT_LDFLAGS@
 endif
 

Index: m4/ax_lib_expat.m4
===================================================================
RCS file: m4/ax_lib_expat.m4
diff -N m4/ax_lib_expat.m4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ m4/ax_lib_expat.m4  6 Dec 2009 00:07:36 -0000       1.1
@@ -0,0 +1,272 @@
+# ===========================================================================
+#          http://www.nongnu.org/autoconf-archive/ax_lib_expat.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_LIB_EXPAT([MINIMUM-VERSION])
+#
+# DESCRIPTION
+#
+#   This macro provides tests of availability of Expat XML Parser of
+#   particular version or newer. This macro checks for Expat XML Parser
+#   headers and libraries and defines compilation flags
+#
+#   Macro supports following options and their values:
+#
+#   1) Single-option usage:
+#
+#     --with-expat      -- yes, no, or path to Expat XML Parser
+#                          installation prefix
+#
+#   2) Three-options usage (all options are required):
+#
+#     --with-expat=yes
+#     --with-expat-inc  -- path to base directory with Expat headers
+#     --with-expat-lib  -- linker flags for Expat
+#
+#   This macro calls:
+#
+#     AC_SUBST(EXPAT_CFLAGS)
+#     AC_SUBST(EXPAT_LDFLAGS)
+#     AC_SUBST(EXPAT_VERSION)  -- only if version requirement is used
+#
+#   And sets:
+#
+#     HAVE_EXPAT
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Mateusz Loskot <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_LIB_EXPAT],
+[
+    AC_ARG_WITH([expat],
+        AC_HELP_STRING([--with-expat=@<:@ARG@:>@],
+            [use Expat XML Parser from given prefix (ARG=path); check standard 
prefixes (ARG=yes); disable (ARG=no)]
+        ),
+        [
+        if test "$withval" = "yes"; then
+            if test -f /usr/local/include/expat.h ; then
+                expat_prefix=/usr/local
+            elif test -f /usr/include/expat.h ; then
+                expat_prefix=/usr
+            else
+                expat_prefix=""
+            fi
+            expat_requested="yes"
+        elif test -d "$withval"; then
+            expat_prefix="$withval"
+            expat_requested="yes"
+        else
+            expat_prefix=""
+            expat_requested="no"
+        fi
+        ],
+        [
+        dnl Default behavior is implicit yes
+        if test -f /usr/local/include/expat.h ; then
+            expat_prefix=/usr/local
+        elif test -f /usr/include/expat.h ; then
+            expat_prefix=/usr
+        else
+            expat_prefix=""
+        fi
+        ]
+    )
+
+    AC_ARG_WITH([expat-inc],
+        AC_HELP_STRING([--with-expat-inc=@<:@DIR@:>@],
+            [path to Expat XML Parser headers]
+        ),
+        [expat_include_dir="$withval"],
+        [expat_include_dir=""]
+    )
+    AC_ARG_WITH([expat-lib],
+        AC_HELP_STRING([--with-expat-lib=@<:@ARG@:>@],
+            [link options for Expat XML Parser libraries]
+        ),
+        [expat_lib_flags="$withval"],
+        [expat_lib_flags=""]
+    )
+
+    EXPAT_CFLAGS=""
+    EXPAT_LDFLAGS=""
+    EXPAT_VERSION=""
+
+    dnl
+    dnl Collect include/lib paths and flags
+    dnl
+    run_expat_test="no"
+
+    if test -n "$expat_prefix"; then
+        expat_include_dir="$expat_prefix/include"
+        expat_lib_flags="-L$expat_prefix/lib -lexpat"
+        run_expat_test="yes"
+    elif test "$expat_requested" = "yes"; then
+        if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
+            run_expat_test="yes"
+        fi
+    else
+        run_expat_test="no"
+    fi
+
+    dnl
+    dnl Check Expat XML Parser files
+    dnl
+    if test "$run_expat_test" = "yes"; then
+
+        saved_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
+
+        saved_LIBS="$LIBS"
+        LIBS="$LIBS $expat_lib_flags"
+
+        dnl
+        dnl Check Expat headers
+        dnl
+        AC_MSG_CHECKING([for Expat XML Parser headers in $expat_include_dir])
+
+        AC_LANG_PUSH([C++])
+        AC_COMPILE_IFELSE([
+            AC_LANG_PROGRAM(
+                [[
address@hidden:@include <expat.h>
+                ]],
+                [[]]
+            )],
+            [
+            EXPAT_CFLAGS="-I$expat_include_dir"
+            expat_header_found="yes"
+            AC_MSG_RESULT([found])
+            ],
+            [
+            expat_header_found="no"
+            AC_MSG_RESULT([not found])
+            ]
+        )
+        AC_LANG_POP([C++])
+
+        dnl
+        dnl Check Expat libraries
+        dnl
+        if test "$expat_header_found" = "yes"; then
+
+            AC_MSG_CHECKING([for Expat XML Parser libraries])
+
+            AC_LANG_PUSH([C++])
+            AC_LINK_IFELSE([
+                AC_LANG_PROGRAM(
+                    [[
address@hidden:@include <expat.h>
+                    ]],
+                    [[
+XML_Parser p = XML_ParserCreate(NULL);
+XML_ParserFree(p);
+p = NULL;
+                    ]]
+                )],
+                [
+                EXPAT_LDFLAGS="$expat_lib_flags"
+                expat_lib_found="yes"
+                AC_MSG_RESULT([found])
+                ],
+                [
+                expat_lib_found="no"
+                AC_MSG_RESULT([not found])
+                ]
+            )
+            AC_LANG_POP([C++])
+        fi
+
+        CPPFLAGS="$saved_CPPFLAGS"
+        LIBS="$saved_LIBS"
+    fi
+
+    AC_MSG_CHECKING([for Expat XML Parser])
+
+    if test "$run_expat_test" = "yes"; then
+        if test "$expat_header_found" = "yes" -a "$expat_lib_found" = "yes"; 
then
+
+            AC_SUBST([EXPAT_CFLAGS])
+            AC_SUBST([EXPAT_LDFLAGS])
+
+            HAVE_EXPAT="yes"
+        else
+            HAVE_EXPAT="no"
+        fi
+
+        AC_MSG_RESULT([$HAVE_EXPAT])
+
+        dnl
+        dnl Check Expat version
+        dnl
+        if test "$HAVE_EXPAT" = "yes"; then
+
+            expat_version_req=ifelse([$1], [], [], [$1])
+
+            if test  -n "$expat_version_req"; then
+
+                AC_MSG_CHECKING([if Expat XML Parser version is >= 
$expat_version_req])
+
+                if test -f "$expat_include_dir/expat.h"; then
+
+                    expat_major=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MAJOR_VERSION.*[0-9]$' 
| \
+                                    sed -e 's/#define XML_MAJOR_VERSION.//'`
+
+                    expat_minor=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MINOR_VERSION.*[0-9]$' 
| \
+                                    sed -e 's/#define XML_MINOR_VERSION.//'`
+
+                    expat_revision=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MICRO_VERSION.*[0-9]$' 
| \
+                                    sed -e 's/#define XML_MICRO_VERSION.//'`
+
+                    EXPAT_VERSION="$expat_major.$expat_minor.$expat_revision"
+                    AC_SUBST([EXPAT_VERSION])
+
+                    dnl Decompose required version string and calculate 
numerical representation
+                    expat_version_req_major=`expr $expat_version_req : 
'\([[0-9]]*\)'`
+                    expat_version_req_minor=`expr $expat_version_req : 
'[[0-9]]*\.\([[0-9]]*\)'`
+                    expat_version_req_revision=`expr $expat_version_req : 
'[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+                    if test "x$expat_version_req_revision" = "x"; then
+                        expat_version_req_revision="0"
+                    fi
+
+                    expat_version_req_number=`expr $expat_version_req_major \* 
10000 \
+                                               \+ $expat_version_req_minor \* 
100 \
+                                               \+ $expat_version_req_revision`
+
+                    dnl Calculate numerical representation of detected version
+                    expat_version_number=`expr $expat_major \* 10000 \
+                                          \+ $expat_minor \* 100 \
+                                           \+ $expat_revision`
+
+                    expat_version_check=`expr $expat_version_number \>\= 
$expat_version_req_number`
+                    if test "$expat_version_check" = "1"; then
+                        AC_MSG_RESULT([yes])
+                    else
+                        AC_MSG_RESULT([no])
+                        AC_MSG_WARN([Found Expat XML Parser $EXPAT_VERSION, 
which is older than required. Possible compilation failure.])
+                    fi
+                else
+                    AC_MSG_RESULT([no])
+                    AC_MSG_WARN([Missing expat.h header. Unable to determine 
Expat version.])
+                fi
+            fi
+        fi
+
+    else
+        HAVE_EXPAT="no"
+        AC_MSG_RESULT([$HAVE_EXPAT])
+
+        if test "$expat_requested" = "yes"; then
+            AC_MSG_WARN([Expat XML Parser support requested but headers or 
library not found. Specify valid prefix of Expat using --with-expat=@<:@DIR@:>@ 
or provide include directory and linker flags using --with-expat-inc and 
--with-expat-lib])
+        fi
+    fi
+])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]