From b3952a0d4fb8afb4716ccdd5313cfc53c506ec64 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Thu, 10 Dec 2015 01:54:45 +0100 Subject: Improve and tidy configure.ac --- configure.ac | 114 +++++++++++++++++++++++++++-------------------- libmatemixer/Makefile.am | 2 +- 2 files changed, 67 insertions(+), 49 deletions(-) diff --git a/configure.ac b/configure.ac index 8d30f80..ca4e410 100644 --- a/configure.ac +++ b/configure.ac @@ -2,10 +2,13 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.60]) +# ======================================================================= +# Versioning +# ======================================================================= + m4_define(libmatemixer_major_version, 1) m4_define(libmatemixer_minor_version, 12) m4_define(libmatemixer_micro_version, 1) -m4_define(libmatemixer_interface_age, 0) m4_define(libmatemixer_version, [libmatemixer_major_version.libmatemixer_minor_version.libmatemixer_micro_version]) @@ -13,6 +16,16 @@ AC_INIT([libmatemixer], [libmatemixer_version], [http://www.mate-desktop.org]) +# Before making a release, the LT_VERSION string should be modified. +# The string is of the form C:R:A. +# - If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# - If binary compatibility has been broken (eg removed or changed interfaces) +# change to C+1:0:0 +# - If the interface is the same as the previous version, change to C:R+1:A + +LT_VERSION=0:0:0 + AC_DEFINE(LIBMATEMIXER_MAJOR_VERSION, libmatemixer_major_version, [Libmatemixer major version]) AC_DEFINE(LIBMATEMIXER_MINOR_VERSION, libmatemixer_minor_version, [Libmatemixer minor version]) AC_DEFINE(LIBMATEMIXER_MICRO_VERSION, libmatemixer_micro_version, [Libmatemixer micro version]) @@ -22,6 +35,8 @@ AC_SUBST(LIBMATEMIXER_MINOR_VERSION, libmatemixer_minor_version) AC_SUBST(LIBMATEMIXER_MICRO_VERSION, libmatemixer_micro_version) AC_SUBST(LIBMATEMIXER_VERSION, libmatemixer_version) +AC_SUBST(LT_VERSION) + AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) @@ -30,6 +45,8 @@ AC_CONFIG_SRCDIR([libmatemixer/matemixer.c]) AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz foreign tar-ustar check-news]) # Use pretty build output with automake >= 1.11 +# Disable by either passing --disable-silent-rules to configure or passing +# V=1 to make m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)]) @@ -39,19 +56,9 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_INSTALL -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([string.h math.h sys/types.h unistd.h libintl.h locale.h]) - # ======================================================================= # Libtool # ======================================================================= -LT_CURRENT=0 -LT_REVISION=0 -LT_AGE=0 -AC_SUBST(LT_CURRENT) -AC_SUBST(LT_REVISION) -AC_SUBST(LT_AGE) LT_PREREQ([2.2]) LT_INIT @@ -91,13 +98,13 @@ GTK_DOC_CHECK([1.10], [--flavour no-tmpl]) AC_ARG_ENABLE([null], AS_HELP_STRING([--enable-null], [Enable Null backend module @<:@default=yes@:>@]), - enable_null=$enableval, enable_null=yes) + enable_null=$enableval, + enable_null=yes) +have_null=no if test "x$enable_null" != "xno" ; then AC_DEFINE(HAVE_NULL, [], [Define if we have Null module]) have_null=yes -else - have_null=no fi AM_CONDITIONAL(HAVE_NULL, test "x$have_null" = "xyes") @@ -111,24 +118,27 @@ PA_REQUIRED_VERSION=2.0.0 AC_ARG_ENABLE([pulseaudio], AS_HELP_STRING([--enable-pulseaudio], [Enable PulseAudio backend module @<:@default=auto@:>@]), - enable_pulseaudio=$enableval, enable_pulseaudio=auto) + enable_pulseaudio=$enableval, + enable_pulseaudio=auto) +have_pulseaudio=no if test "x$enable_pulseaudio" != "xno"; then - PKG_CHECK_MODULES(PULSEAUDIO, + PKG_CHECK_MODULES(PULSEAUDIO, [ libpulse >= $PA_REQUIRED_VERSION - libpulse-mainloop-glib >= $PA_REQUIRED_VERSION, + libpulse-mainloop-glib >= $PA_REQUIRED_VERSION + ], have_pulseaudio=yes, have_pulseaudio=no) - if test "x$enable_pulseaudio" = "xyes" -a "x$have_pulseaudio" = "xno"; then - AC_MSG_ERROR([PulseAudio support explicitly requested but dependencies not found]) - fi - - if test "x$have_pulseaudio" = "xyes" ; then + if test "x$have_pulseaudio" = "xyes"; then AC_DEFINE(HAVE_PULSEAUDIO, [], [Define if we have PulseAudio support]) + else + if test "x$enable_pulseaudio" = "xyes"; then + AC_MSG_ERROR([PulseAudio support explicitly requested but dependencies not found]) + else + AC_MSG_NOTICE([PulseAudio dependencies not found, the module will not be built]) + fi fi -else - have_pulseaudio=no fi AM_CONDITIONAL(HAVE_PULSEAUDIO, test "x$have_pulseaudio" = "xyes") @@ -146,25 +156,27 @@ ALSA_REQUIRED_VERSION=1.0.5 AC_ARG_ENABLE([alsa], AS_HELP_STRING([--enable-alsa], [Enable ALSA backend module @<:@default=auto@:>@]), - enable_alsa=$enableval, enable_alsa=auto) + enable_alsa=$enableval, + enable_alsa=auto) +have_alsa=no if test "x$enable_alsa" != "xno"; then PKG_CHECK_MODULES(ALSA, [ - alsa >= $ALSA_REQUIRED_VERSION - gthread-2.0 >= $GLIB_REQUIRED_VERSION - ], - have_alsa=yes, - have_alsa=no) - - if test "x$enable_alsa" = "xyes" -a "x$have_alsa" = "xno"; then - AC_MSG_ERROR([ALSA support explicitly requested but dependencies not found]) - fi + alsa >= $ALSA_REQUIRED_VERSION + gthread-2.0 >= $GLIB_REQUIRED_VERSION + ], + have_alsa=yes, + have_alsa=no) - if test "x$have_alsa" = "xyes" ; then + if test "x$have_alsa" = "xyes"; then AC_DEFINE(HAVE_ALSA, [], [Define if we have ALSA support]) + else + if test "x$enable_alsa" = "xyes"; then + AC_MSG_ERROR([ALSA support explicitly requested but dependencies not found]) + else + AC_MSG_NOTICE([ALSA dependencies not found, the module will not be built]) + fi fi -else - have_alsa=no fi AM_CONDITIONAL(HAVE_ALSA, test "x$have_alsa" = "xyes") @@ -179,28 +191,35 @@ AC_SUBST(ALSA_LIBS) AC_ARG_ENABLE([oss], AS_HELP_STRING([--enable-oss], [Enable OSS backend module @<:@default=no@:>@]), - enable_oss=$enableval, enable_oss=no) + enable_oss=$enableval, + enable_oss=no) +have_oss=no if test "x$enable_oss" != "xno"; then AC_CHECK_HEADERS([soundcard.h sys/soundcard.h machine/soundcard.h]) if test "x$ac_cv_header_soundcard_h" = "xyes" -o \ "x$ac_cv_header_sys_soundcard_h" = "xyes" -o \ "x$ac_cv_header_machine_soundcard_h" = "xyes"; then - AC_CHECK_LIB([ossaudio], [_oss_ioctl], [OSS_LIBS="-lossaudio"]) have_oss=yes - else - have_oss=no + AC_CHECK_HEADERS([sys/ioctl.h sys/stat.h sys/types.h errno.h fcntl.h],, [ + have_oss=no + break + ]) fi - if test "x$enable_oss" = "xyes" -a "x$have_oss" = "xno"; then - AC_MSG_ERROR([OSS support explicitly requested but dependencies not found]) - fi + if test "x$have_oss" = "xyes"; then + # NetBSD/OpenBSD require -lossaudio, other OSS implementations do not have + # this library + AC_CHECK_LIB([ossaudio], [_oss_ioctl], [OSS_LIBS="-lossaudio"]) - if test "x$have_oss" = "xyes" ; then AC_DEFINE(HAVE_OSS, [], [Define if we have OSS support]) + else + if test "x$enable_oss" = "xyes"; then + AC_MSG_ERROR([OSS support explicitly requested but dependencies not found]) + else + AC_MSG_NOTICE([OSS dependencies not found, the module will not be built]) + fi fi -else - have_oss=no fi AM_CONDITIONAL(HAVE_OSS, test "x$have_oss" = "xyes") @@ -289,5 +308,4 @@ echo " Build PulseAudio module: $have_pulseaudio Build ALSA module: $have_alsa Build OSS module: $have_oss - " diff --git a/libmatemixer/Makefile.am b/libmatemixer/Makefile.am index 59f0e63..f158737 100644 --- a/libmatemixer/Makefile.am +++ b/libmatemixer/Makefile.am @@ -56,7 +56,7 @@ libmatemixer_la_SOURCES = \ libmatemixer_la_LIBADD = $(GLIB_LIBS) libmatemixer_la_LDFLAGS = \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -version-info $(LT_VERSION) \ -no-undefined \ -export-dynamic -- cgit v1.2.1