From dd9ca70759b8370db5df50ae8e84f86d01555106 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 7 Jan 2009 16:33:43 +0200 Subject: [PATCH] build: use pkg-config for X11 According to Daniel, AC_PATH_XTRA is sort-of deprecated. This patch changes the configure arguments, --x-includes=dir and --x-libraries=dir, which are now removed and use standard pkg-config. It also replaces --with{,out}-x with --{dis,en}able-x11, which is the same as other optionnal dependencies. (this patch was done in an attempt to solve a build issue on maemo, it turns out it didn't help) --- configure.ac | 61 +++++++++++++++++++++++++++++++++++++-------------------- src/Makefile.am | 28 +++++++++++++------------- 2 files changed, 54 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 82f9205..ae6dd96 100644 --- a/configure.ac +++ b/configure.ac @@ -411,21 +411,52 @@ AC_SUBST(pulselocaledir) # External libraries # ################################### +#### pkg-config #### + +# Check for pkg-config manually first, as if its not installed the +# PKG_PROG_PKG_CONFIG macro won't be defined. +AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no) + +if test x"$have_pkg_config" = "xno"; then + AC_MSG_ERROR(pkg-config is required to install this program) +fi + +PKG_PROG_PKG_CONFIG + #### X11 (optional) #### -HAVE_X11=0 +AC_ARG_ENABLE([x11], + AS_HELP_STRING([--disable-x11],[Disable optional X11 support]), + [ + case "${enableval}" in + yes) x11=yes ;; + no) x11=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;; + esac + ], + [x11=auto]) + +if test "x${x11}" != xno ; then + PKG_CHECK_MODULES(X11, [ x11 ], + HAVE_X11=1, + [ + HAVE_X11=0 + if test "x$x11" = xyes ; then + AC_MSG_ERROR([*** X11 not found]) + fi + ]) +else + HAVE_X11=0 +fi -# The macro tests the host, not the build target -if test "x$os_is_win32" != "x1" ; then - AC_PATH_XTRA - test "x$no_x" != "xyes" && HAVE_X11=1 +if test "x${HAVE_X11}" = x1 ; then + AC_DEFINE([HAVE_X11], 1, [Have X11?]) fi +AC_SUBST(X11_CFLAGS) +AC_SUBST(X11_LIBS) AC_SUBST(HAVE_X11) -AM_CONDITIONAL(HAVE_X11, test "x$HAVE_X11" = "x1") -if test "x$HAVE_X11" = "x1" ; then - AC_DEFINE([HAVE_X11], 1, [Have X11]) -fi +AM_CONDITIONAL([HAVE_X11], [test "x$HAVE_X11" = x1]) #### Capabilities (optional) #### @@ -450,18 +481,6 @@ fi AC_CHECK_HEADERS([valgrind/memcheck.h]) -#### pkg-config #### - -# Check for pkg-config manually first, as if its not installed the -# PKG_PROG_PKG_CONFIG macro won't be defined. -AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no) - -if test x"$have_pkg_config" = "xno"; then - AC_MSG_ERROR(pkg-config is required to install this program) -fi - -PKG_PROG_PKG_CONFIG - #### Sound file #### PKG_CHECK_MODULES(LIBSNDFILE, [ sndfile >= 1.0.10 ]) diff --git a/src/Makefile.am b/src/Makefile.am index f3bd550..0b5abb2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -204,8 +204,8 @@ pacmd_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la pacmd_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) pax11publish_SOURCES = utils/pax11publish.c -pax11publish_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) -pax11publish_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) +pax11publish_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS) +pax11publish_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(X11_LIBS) pax11publish_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) pabrowse_SOURCES = utils/pabrowse.c @@ -531,8 +531,8 @@ endif if HAVE_X11 libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/x11prop.c pulsecore/x11prop.h -libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(X_CFLAGS) -libpulsecommon_@PA_MAJORMINORMICRO@_la_LDFLAGS += $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) +libpulsecommon_@PA_MAJORMINORMICRO@_la_CFLAGS += $(X11_CFLAGS) +libpulsecommon_@PA_MAJORMINORMICRO@_la_LDFLAGS += $(X11_LIBS) endif if HAVE_LIBASYNCNS @@ -630,8 +630,8 @@ libpulse_la_LIBADD = $(AM_LIBADD) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon-@ if HAVE_X11 libpulse_la_SOURCES += pulse/client-conf-x11.c pulse/client-conf-x11.h -libpulse_la_CFLAGS += $(X_CFLAGS) -libpulse_la_LDFLAGS += $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) +libpulse_la_CFLAGS += $(X11_CFLAGS) +libpulse_la_LDFLAGS += $(X11_LIBS) endif libpulse_simple_la_SOURCES = pulse/simple.c pulse/simple.h @@ -721,8 +721,8 @@ libpulsecore_@PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPL if HAVE_X11 libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES += pulsecore/x11wrap.c pulsecore/x11wrap.h -libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS += $(X_CFLAGS) -libpulsecore_@PA_MAJORMINORMICRO@_la_LDFLAGS += $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) +libpulsecore_@PA_MAJORMINORMICRO@_la_CFLAGS += $(X11_CFLAGS) +libpulsecore_@PA_MAJORMINORMICRO@_la_LDFLAGS += $(X11_LIBS) endif ################################### @@ -1172,19 +1172,19 @@ module_tunnel_source_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINORMICRO@. # X11 module_x11_bell_la_SOURCES = modules/module-x11-bell.c -module_x11_bell_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) +module_x11_bell_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS) module_x11_bell_la_LDFLAGS = -module -avoid-version -module_x11_bell_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la +module_x11_bell_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la module_x11_publish_la_SOURCES = modules/module-x11-publish.c -module_x11_publish_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) +module_x11_publish_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS) module_x11_publish_la_LDFLAGS = -module -avoid-version -module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la +module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libprotocol-native.la libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la module_x11_xsmp_la_SOURCES = modules/module-x11-xsmp.c -module_x11_xsmp_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) +module_x11_xsmp_la_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS) module_x11_xsmp_la_LDFLAGS = -module -avoid-version -module_x11_xsmp_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la +module_x11_xsmp_la_LIBADD = $(AM_LIBADD) $(X11_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la # OSS -- 2.7.4