[pulseaudio-discuss] [PATCH 5/6] Move -Ddefines from AM_CFLAGS to config.h
Maarten Bosmans
mkbosmans at gmail.com
Mon Mar 14 08:27:02 PDT 2011
This makes the length of the compiler command line a bit shorter.
---
configure.ac | 15 +++++++++------
m4/ax_define_dir.m4 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 6 ------
3 files changed, 58 insertions(+), 12 deletions(-)
create mode 100644 m4/ax_define_dir.m4
diff --git a/configure.ac b/configure.ac
index 4d42b17..fd76c6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -621,9 +621,10 @@ AC_SUBST(LIBSPEEX_LIBS)
AC_MSG_CHECKING([whether we need libatomic_ops])
if test "x$need_libatomic_ops" = "xyes"; then
AC_MSG_RESULT([yes])
- AC_CHECK_HEADERS([atomic_ops.h], [], [
- AC_MSG_ERROR([*** libatomic-ops headers not found])
- ])
+ AC_CHECK_HEADERS([atomic_ops.h],
+ [CFLAGS="$CFLAGS -DAO_REQUIRE_CAS"],
+ [AC_MSG_ERROR([*** libatomic-ops headers not found])]
+ )
# Win32 does not need the lib and breaks horribly if we try to include it
if test "x$os_is_win32" != "x1" ; then
@@ -1457,11 +1458,11 @@ fi
#### PulseAudio system runtime dir ####
PA_SYSTEM_RUNTIME_PATH="${localstatedir}/run/pulse"
-AC_SUBST(PA_SYSTEM_RUNTIME_PATH)
+AX_DEFINE_DIR(PA_SYSTEM_RUNTIME_PATH, PA_SYSTEM_RUNTIME_PATH, [System runtime dir])
PA_SYSTEM_CONFIG_PATH="${localstatedir}/lib/pulse"
-AC_SUBST(PA_SYSTEM_CONFIG_PATH)
+AX_DEFINE_DIR(PA_SYSTEM_CONFIG_PATH, PA_SYSTEM_CONFIG_PATH, [System config dir])
PA_SYSTEM_STATE_PATH="${localstatedir}/lib/pulse"
-AC_SUBST(PA_SYSTEM_STATE_PATH)
+AX_DEFINE_DIR(PA_SYSTEM_STATE_PATH, PA_SYSTEM_STATE_PATH, [System state dir])
###################################
# Output #
@@ -1499,6 +1500,7 @@ AC_ARG_WITH(
[modlibexecdir=$withval], [modlibexecdir="${libdir}/pulse-${PA_MAJORMINOR}/modules"])
AC_SUBST(modlibexecdir)
+AX_DEFINE_DIR(PA_DLSEARCHPATH, modlibexecdir, [Modules dir])
AC_ARG_WITH(
[udev-rules-dir],
@@ -1682,6 +1684,7 @@ echo "
prefix: ${prefix}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
+ modlibexecdir: ${modlibexecdir}
System Runtime Path: ${PA_SYSTEM_RUNTIME_PATH}
System State Path: ${PA_SYSTEM_STATE_PATH}
System Config Path: ${PA_SYSTEM_CONFIG_PATH}
diff --git a/m4/ax_define_dir.m4 b/m4/ax_define_dir.m4
new file mode 100644
index 0000000..b74d155
--- /dev/null
+++ b/m4/ax_define_dir.m4
@@ -0,0 +1,49 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_define_dir.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+#
+# DESCRIPTION
+#
+# This macro sets VARNAME to the expansion of the DIR variable, taking
+# care of fixing up ${prefix} and such.
+#
+# VARNAME is then offered as both an output variable and a C preprocessor
+# symbol.
+#
+# Example:
+#
+# AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+#
+# LICENSE
+#
+# Copyright (c) 2008 Stepan Kasal <kasal at ucw.cz>
+# Copyright (c) 2008 Andreas Schwab <schwab at suse.de>
+# Copyright (c) 2008 Guido U. Draheim <guidod at gmx.de>
+# Copyright (c) 2008 Alexandre Oliva
+#
+# 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. This file is offered as-is, without any
+# warranty.
+
+#serial 6
+
+AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR])
+AC_DEFUN([AX_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}. Thus we have to use `eval' twice.
+ eval ax_define_dir="\"[$]$2\""
+ eval ax_define_dir="\"$ax_define_dir\""
+ AC_SUBST($1, "$ax_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index e004a65..a4118fc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,13 +53,8 @@ AM_CFLAGS = \
-I$(top_builddir)/src/modules \
$(PTHREAD_CFLAGS) -D_POSIX_PTHREAD_SEMANTICS \
-DPA_BUILDDIR=\"$(abs_builddir)\" \
- -DPA_DLSEARCHPATH=\"$(modlibexecdir)\" \
-DPA_DEFAULT_CONFIG_DIR=\"$(PA_DEFAULT_CONFIG_DIR)\" \
-DPA_BINARY=\"$(PA_BINARY)\" \
- -DPA_SYSTEM_RUNTIME_PATH=\"$(PA_SYSTEM_RUNTIME_PATH)\" \
- -DPA_SYSTEM_CONFIG_PATH=\"$(PA_SYSTEM_CONFIG_PATH)\" \
- -DPA_SYSTEM_STATE_PATH=\"$(PA_SYSTEM_STATE_PATH)\" \
- -DAO_REQUIRE_CAS \
-DPULSE_LOCALEDIR=\"$(pulselocaledir)\" \
-DPA_MACHINE_ID=\"$(localstatedir)/lib/dbus/machine-id\" \
-DPA_ALSA_PATHS_DIR=\"$(alsapathsdir)\" \
@@ -1868,7 +1863,6 @@ AWK_in=$(AWK) -v configfile=$(top_builddir)/config.h -f $(top_srcdir)/process-in
PACTL_BINARY=$(bindir)/pactl \
PA_BINARY=$(PA_BINARY) \
PA_DEFAULT_CONFIG_FILE=$(PA_DEFAULT_CONFIG_DIR)/default.pa \
- PA_DLSEARCHPATH=$(modlibexecdir) \
PA_SOEXT=.so
esdcompat: daemon/esdcompat.in Makefile
--
1.7.1
More information about the pulseaudio-discuss
mailing list