]> git.street.me.uk Git - andy/viking.git/commitdiff
Add explicit dependency to expat library
authorGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Sun, 12 Nov 2006 21:08:07 +0000 (21:08 +0000)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Sun, 12 Nov 2006 21:08:07 +0000 (21:08 +0000)
ChangeLog
acinclude.m4 [new file with mode: 0644]
configure.ac
src/Makefile.am

index f7c97a409f0df37871c3856eda7a5ac07efa816e..06c3caf7fdb7cafeee0fe15fd9a7b9eb78faa96a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-11-12
+Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
+       * Add expat explicit dependency
+
 2006-10-31
 Alex Foobarian <foobarian@gmail.com>:
        * Visual feedback for moving waypoints
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..7c41102
--- /dev/null
@@ -0,0 +1,45 @@
+dnl Expat macro retrived on the Expat CVS
+
+dnl Check if --with-expat[=PREFIX] is specified and
+dnl Expat >= 1.95.0 is installed in the system.
+dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to
+dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX
+dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined.
+dnl If --with-expat has not been specified, set with_expat to 'no'.
+dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly.
+dnl This is necessary to adapt a whole lot of packages that have expat
+dnl bundled as a static library.
+AC_DEFUN(AM_WITH_EXPAT,
+[ AC_ARG_WITH(expat,
+             [  --with-expat=PREFIX     Use system Expat library],
+             , with_expat=yes)
+
+  AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no)
+
+  EXPAT_CFLAGS=
+  EXPAT_LIBS=
+  if test $with_expat != no; then
+       if test $with_expat != yes; then
+               EXPAT_CFLAGS="-I$with_expat/include"
+               EXPAT_LIBS="-L$with_expat/lib"
+       fi
+       AC_CHECK_LIB(expat, XML_ParserCreate,
+                    [ EXPAT_LIBS="$EXPAT_LIBS -lexpat"
+                      expat_found=yes ],
+                    [ expat_found=no ],
+                    "$EXPAT_LIBS")
+       if test $expat_found = no; then
+               AC_MSG_ERROR([Could not find the Expat library])
+       fi
+       expat_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS $EXPAT_CFLAGS"
+       AC_CHECK_HEADERS(expat.h, , expat_found=no)
+       if test $expat_found = no; then
+               AC_MSG_ERROR([Could not find expat.h])
+       fi
+       CFLAGS="$expat_save_CFLAGS"
+  fi
+
+  AC_SUBST(EXPAT_CFLAGS)
+  AC_SUBST(EXPAT_LIBS)
+])
index 8a70b4e35d1378dca435a4e185ecb8964831dcdf..21c9e773d01840076786b0bc9ad700c4cd2a9f4e 100644 (file)
@@ -11,15 +11,6 @@ AC_CONFIG_HEADERS([src/config.h])
 AC_PROG_CC
 AC_PROG_MAKE_SET
 
-AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
-if test $GDK_PIXBUF_CSOURCE != "yes"
-then
-  AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
-fi
-
-# Checks for libraries.
-AM_PATH_GTK_2_0(2.2.0,,AC_MSG_ERROR(needs GTK+ 2.2.0),gthread)
-
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([malloc.h netdb.h netinet/in.h stdlib.h string.h sys/param.h sys/socket.h unistd.h])
@@ -34,6 +25,16 @@ AC_FUNC_STRTOD
 AC_CHECK_FUNCS([bzero floor gethostbyname memset mkdir pow realpath socket sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
 
 # Expat
+AM_WITH_EXPAT
+
+AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
+if test $GDK_PIXBUF_CSOURCE != "yes"
+then
+  AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
+fi
+
+# Checks for libraries.
+AM_PATH_GTK_2_0(2.2.0,,AC_MSG_ERROR(needs GTK+ 2.2.0),gthread)
 
 # Options
 AC_ARG_ENABLE(alphabetized-trw, AC_HELP_STRING([--enable-alphabetized-trw],
index ae847f1380730c9ccdc51ee1d9f89375dec3f160..617385ee64a3b0efc4ed8f10d51daf25c98f9533 100644 (file)
@@ -52,6 +52,6 @@ viking_SOURCES = main.c \
        datasource_gc.c \
        datasources.h
 
-INCLUDES        = @GTK_CFLAGS@
-LDADD           = @GTK_LIBS@
+INCLUDES        = @GTK_CFLAGS@ @EXPAT_CFLAGS@
+LDADD           = @GTK_LIBS@ @EXPAT_LIBS@
 AM_CFLAGS              = -Wall -g