automake: properly handle non-default expat installation
authorEmil Velikov <emil.l.velikov@gmail.com>
Tue, 29 Oct 2013 21:14:41 +0000 (21:14 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 29 Oct 2013 21:14:41 +0000 (21:14 +0000)
Use PKG_CHECK_MODULE over requesting the user to setup the
option at configure time. Drop unused EXPAT_INCLUDE and
update all targets.

NOTE: The this commit removes the --with-expat configure
option. One should ensure that the expat they wish to use
has expat.pc file accessible by pkg-config.

v2:
* Add note about the removal of --with-expat
(per Tom Stellard)
* Drop EXPAT_CFLAGS for targets that do not build DRI_COMMON
(spotted by Matt Turner)
v3:
* Rebase on top of megadrivers (drop EXPAT_CFLAGS from swrast)

Acked-by: Matt Turner <mattst88@gmail.com> (v2)
Reviewed-by: Tom Stellard <thomas.stellard@amd.com> (v2)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Conflicts:
configure.ac
src/mesa/drivers/dri/common/Makefile.am

configure.ac
src/gallium/targets/dri-swrast/Makefile.am
src/mesa/drivers/dri/common/Makefile.am

index 54ace41bad7c45b7f2f07d55926a28d47c3750b8..8ba4feef3a176b04f9829b7e9d9b56405a28104f 100644 (file)
@@ -1005,21 +1005,9 @@ if test "x$enable_dri" = xyes; then
     DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/  */ /g'`
 
     # Check for expat
-    EXPAT_INCLUDES=""
-    EXPAT_LIB=-lexpat
-    AC_ARG_WITH([expat],
-        [AS_HELP_STRING([--with-expat=DIR],
-            [expat install directory])],[
-        EXPAT_INCLUDES="-I$withval/include"
-        CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
-        LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
-        EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
-        ])
-    AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
-    save_LIBS="$LIBS"
-    AC_CHECK_LIB([expat],[XML_ParserCreate],[],
-        [AC_MSG_ERROR([Expat required for DRI.])])
-    LIBS="$save_LIBS"
+    PKG_CHECK_MODULES([EXPAT], [expat], [],
+                      AC_MSG_ERROR([Expat required for DRI.]))
+
 
     # If we are building any DRI driver other than swrast.
     if test -n "$DRI_DIRS"; then
@@ -1035,8 +1023,8 @@ if test "x$enable_dri" = xyes; then
     fi
 
     # put all the necessary libs together
-    DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
-    GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
+    DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
+    GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
 
     DRI_DRIVER_LDFLAGS="-module -avoid-version -shared -Wl,-Bsymbolic"
 fi
@@ -1045,7 +1033,6 @@ AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
 AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
                                   "x$enable_osmesa" = xyes -o \
                                   -n "$DRI_DIRS")
-AC_SUBST([EXPAT_INCLUDES])
 AC_SUBST([DRI_LIB_DEPS])
 AC_SUBST([DRI_DRIVER_LDFLAGS])
 AC_SUBST([GALLIUM_DRI_LIB_DEPS])
index 6b629df307d53b36464768744f58baf2aed6c081..cddbbe32bb449ea25c06df3463bb233afaa85176 100644 (file)
@@ -25,6 +25,7 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
        $(GALLIUM_CFLAGS) \
        $(PTHREAD_CFLAGS) \
+       $(EXPAT_CFLAGS) \
        $(LIBDRM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
 AM_CPPFLAGS = \
index 9f49ff3aee415d6082aaee64d3c0efe6ba3fb77f..7f87ed6f560afc791f9a5608f980d8f3bd4a929a 100644 (file)
@@ -27,6 +27,7 @@ AM_CFLAGS = \
        -I$(top_srcdir)/src/mapi \
        -I$(top_srcdir)/src/mesa/ \
        $(DEFINES) \
+       $(EXPAT_CFLAGS) \
        $(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \