1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Use automake for libwidgetextra.

Replace the custom Makefile by automake. In addition drop the hacky
libwidgetextra-uninstalled.pc and configure the library like every other
optional library, but check if the library is not disabled.
This commit is contained in:
benjamin.drung@gmail.com 2013-11-07 21:00:56 +00:00
parent 0d30aad773
commit 6619f23305
7 changed files with 82 additions and 95 deletions

View File

@ -325,20 +325,11 @@ AC_CONFIG_SUBDIRS([lib-src/FileDialog])
LOCAL_LIBS="$LOCAL_LIBS FileDialog.a"
CXXFLAGS="$CXXFLAGS -I\$(top_srcdir)/lib-src/FileDialog"
dnl Include lib-widget-extra (via pkg-config). Doing this gets it configured as
dnl well, because it has to be configured in order to be found
AUDACITY_CHECKLIB_WIDGETEXTRA
dnl pull in flags for the library
BUILD_LDFLAGS="$BUILD_LDFLAGS $WIDGETEXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $WIDGETEXTRA_CFLAGS"
dnl Add the library to the list of libraries that need to be compiled
LIBSRC_BUILD="$LIBSRC_BUILD widgetextra"
dnl-------------------------------------------------------------
dnl Optional library support. Lots of things we could use, but
dnl can do without if they aren't available.
dnl-------------------------------------------------------------
LIBRARIES="FFMPEG LAME LIBFLAC LIBID3TAG LIBMAD LIBNYQUIST LIBRESAMPLE LIBSAMPLERATE LIBSBSMS LIBSNDFILE LIBSOUNDTOUCH LIBSOXR LIBTWOLAME LIBVAMP LIBVORBIS LV2 PORTAUDIO PORTSMF"
LIBRARIES="FFMPEG LAME LIBFLAC LIBID3TAG LIBMAD LIBNYQUIST LIBRESAMPLE LIBSAMPLERATE LIBSBSMS LIBSNDFILE LIBSOUNDTOUCH LIBSOXR LIBTWOLAME LIBVAMP LIBVORBIS LV2 PORTAUDIO PORTSMF WIDGETEXTRA"
AC_MSG_NOTICE([Determining what libraries are available in this tree and on the system])
@ -360,6 +351,7 @@ AUDACITY_CHECKLIB_LIBVORBIS
AUDACITY_CHECKLIB_LV2
AUDACITY_CHECKLIB_PORTAUDIO
AUDACITY_CHECKLIB_PORTSMF
AUDACITY_CHECKLIB_WIDGETEXTRA
dnl Decide what libraries to build with, and whether to use system or local libraries
dnl Set variables based on choices.
@ -412,10 +404,15 @@ for lib in $LIBRARIES ; do
done
# In some cases the choices made above might be inappropriate.
# * we need to have libwidgetextra one way or another
# * we need to have libsndfile one way or another
# * we need to have portaudio way or another
# * we can only use one of libsoxr, libsamplerate and libresample
if test "$WIDGETEXTRA_USE_LOCAL" != "yes" -a "$WIDGETEXTRA_USE_SYSTEM" != "yes"; then
AC_MSG_ERROR([Audacity requires libwidgetextra to be enabled.])
fi
if test "$LIBSNDFILE_USE_LOCAL" != "yes" && test "$LIBSNDFILE_USE_SYSTEM" != "yes" ; then
AC_MSG_ERROR([Audacity requires libsndfile to be enabled])
fi
@ -521,6 +518,7 @@ AUDACITY_CONFIG_SUBDIRS_LIBVORBIS
AUDACITY_CONFIG_SUBDIRS_LV2
AUDACITY_CONFIG_SUBDIRS_PORTAUDIO
AUDACITY_CONFIG_SUBDIRS_PORTSMF
AUDACITY_CONFIG_SUBDIRS_WIDGETEXTRA
dnl--------------------------------------------------------------------------
dnl Optional features (which don't use libraries - just compile-time on/off)

View File

@ -15,6 +15,8 @@ FileDialog.a: FileDialog-recursive
# libwidgetextra
widgetextra:
$(MAKE) -C lib-widget-extra
libwidgetextra.a: widgetextra
ln -sf lib-widget-extra/.libs/libwidgetextra.a libwidgetextra.a
# libogg
libogg-recursive:

View File

@ -0,0 +1,12 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = libwidgetextra.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libwidgetextra.pc
lib_LTLIBRARIES = libwidgetextra.la
libwidgetextra_la_CPPFLAGS = $(WX_CXXFLAGS)
libwidgetextra_la_LIBADD = $(WX_LIBS)
libwidgetextra_la_SOURCES = NonGuiThread.cpp NonGuiThread.h

View File

@ -7,21 +7,26 @@ dnl Richard Ash
dnl
dnl
dnl Instructions: to create "configure" from "configure.ac", run:
dnl Instructions: to create "configure" from "configure.ac", run: autoreconf
dnl
dnl Process this file with autoconf to produce a configure script.
dnl Require autoconf >= 2.60
AC_PREREQ([2.69])
AC_PREREQ([2.60])
dnl Init autoconf
AC_INIT
AC_INIT([libwidgetextra], [1.0])
dnl check we have some source (are in the right directory)
AC_CONFIG_SRCDIR([NonGuiThread.h])
AC_CONFIG_AUX_DIR([autotools])
dnl we have some extra macros in m4/
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 dist-xz foreign no-dist-gzip -Wall])
AM_MAINTAINER_MODE([disable])
AM_PROG_AR
LT_INIT
dnl -------------------------------------------------------
dnl Checks for programs.
dnl -------------------------------------------------------
@ -38,22 +43,6 @@ CFLAGS="$cflags_save"
CPPFLAGS="$cppflags_save"
CXXFLAGS="$cxxflags_save"
dnl we will need an "install" program to be available
AC_PROG_INSTALL
dnl We have some extra variables which we need to subsitute into output files
AC_SUBST(INSTALL_PREFIX)
dnl Make the install prefix available to the program so that the pkg-config file
dnl can be created correctly
AC_PREFIX_DEFAULT(/usr/local)
if [[ $prefix = "NONE" ]] ; then
AC_DEFINE(INSTALL_PREFIX, "/usr/local",
[define as prefix where Audacity is installed])
else
AC_DEFINE_UNQUOTED(INSTALL_PREFIX, "$prefix")
fi
dnl Build Options
AC_ARG_ENABLE(static-wx,
@ -85,7 +74,7 @@ dnl ----------------------------------------------------
dnl If user asked for debug, put debug in compiler flags
dnl ----------------------------------------------------
if test x"$debug_preference" = "xyes" ; then
if test "$debug_preference" = "yes"; then
dnl we want debuging on
AC_MSG_NOTICE([Adding -g for debugging to CFLAGS and CXXFLAGS ...])
CFLAGS="${CFLAGS} -g "
@ -157,28 +146,19 @@ esac
dnl Gather wx arguments
LIBS="$LIBS `$WX_CONFIG $wxconfigargs --libs`"
CPPFLAGS="$CPPFLAGS `$WX_CONFIG $wxconfigargs --cxxflags`"
WX_CXXFLAGS=$($WX_CONFIG $wxconfigargs --cxxflags)
WX_LIBS=$($WX_CONFIG $wxconfigargs --libs)
AC_SUBST([WX_CXXFLAGS])
AC_SUBST([WX_LIBS])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_CONFIG_FILES([Makefile libwidgetextra.pc libwidgetextra-uninstalled.pc])
AC_CONFIG_FILES([libwidgetextra.pc Makefile])
AC_OUTPUT
echo ""
echo "Run 'configure --help' for an explanation of the possible options,"
echo "otherwise run 'make' to build libwidgetextra."
dnl Indentation settings for Vim and Emacs and unique identifier for Arch, a
dnl version control system. Please do not modify past this point.
# Local Variables:
# c-basic-offset: 3
# indent-tabs-mode: nil
# End:
#
# vim: et sts=3 sw=3

View File

@ -1,17 +0,0 @@
# This pkg-config file lets you use the compiled lib without having to first
# install it anywhere. Simply put the directory the pkg-config file is in on the
# PKG_CONFIG_PATH and look for libwidgetextra as normal - the uninstalled file
# is prefered to the installed one if both are found
libdir=@abs_builddir@
# The library always ends up in the build dir.
includedir=@abs_srcdir@
# The headers are always in the source dir
Name: lib-widget-extra
Description: Extras for wxwidgets
Requires:
Version: 1
Libs: -L${libdir} -lwidgetextra
Libs.private: @LIBS@
Cflags: -I${includedir}

View File

@ -1,11 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: lib-widget-extra
Name: @PACKAGE@
Description: Extras for wxwidgets
Requires:
Version: 1
Libs: -L${libdir} -lwidgetextra
Libs.private: @LIBS@
Cflags: -I${includedir}
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lwidgetextra

View File

@ -1,37 +1,50 @@
dnl Add Audacity/WX license?
dnl Please increment the serial number below whenever you alter this macro
dnl for the benefit of automatic macro update systems
# audacity_checklib_widgetextra.m4 serial 1
# audacity_checklib_widgetextra.m4 serial 2
dnl A function to check for the correct presence of lib-widget-extra in the
dnl lib-src tree. Note that this is a mandatory library, and
dnl that because we maintain it, we don't support system copies.
dnl You would have thought you could use pkg-config for this. But the
dnl pkg-config file doesn't exist until configure has been run for
dnl lib-widget-extra. Using AC_CONFIG_SUBDIRS, that doesn't happen until
dnl after everything in the main configure script has happened, so
dnl we can't detect anything about the configured library, because it isn't
dnl configured when this runs.
dnl To get round this we have created our own subdirectory configuration
dnl function, AX_CONFIG_DIR based on a subset of the code that implements
dnl AC_CONFIG_SUBDIRS.
AC_DEFUN([AUDACITY_CHECKLIB_WIDGETEXTRA], [
dnl we always need to configure libwidgetextra, so just call the script
dnl regardless.
AX_CONFIG_DIR(["${srcdir}/lib-src/lib-widget-extra"])
dnl having done that we get a pkg-config file we can use
dnl add the directory with lib-widget-extra in to the pkg-config search path
PKG_CONFIG_PATH="${srcdir}/lib-src/lib-widget-extra/:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
PKG_CHECK_MODULES(WIDGETEXTRA, libwidgetextra,
widgetextra_available="yes",
widgetextra_available="no")
AC_ARG_WITH(widgetextra,
[AS_HELP_STRING([--with-widgetextra],
[which libwidgetextra to use (required): [system,local]])],
WIDGETEXTRA_ARGUMENT=$withval,
WIDGETEXTRA_ARGUMENT="unspecified")
if test "x$widgetextra_available" != "xyes" ; then
AC_MSG_ERROR([lib-widget-extra is required to build audacity. A copy is included in the audacity source distribution at lib-src/lib-widget-extra/.])
dnl see if libwidgetextra is installed on the system
PKG_CHECK_MODULES(WIDGETEXTRA, libwidgetextra,
WIDGETEXTRA_SYSTEM_AVAILABLE="yes",
WIDGETEXTRA_SYSTEM_AVAILABLE="no")
if test "$WIDGETEXTRA_SYSTEM_AVAILABLE" = "yes"; then
WIDGETEXTRA_SYSTEM_LIBS=$WIDGETEXTRA_LIBS
WIDGETEXTRA_SYSTEM_CXXFLAGS=$WIDGETEXTRA_CFLAGS
AC_MSG_NOTICE([libwidgetextra library is available as system library.])
else
AC_MSG_NOTICE([libwidgetextra library is NOT available as system library.])
fi
dnl see if libwidgetextra is available locally
AC_CHECK_FILE(${srcdir}/lib-src/lib-widget-extra/NonGuiThread.h,
WIDGETEXTRA_LOCAL_AVAILABLE="yes",
WIDGETEXTRA_LOCAL_AVAILABLE="no")
if test "$WIDGETEXTRA_LOCAL_AVAILABLE" = "yes"; then
WIDGETEXTRA_LOCAL_LIBS="libwidgetextra.a"
WIDGETEXTRA_LOCAL_CXXFLAGS='-I$(top_srcdir)/lib-src/lib-widget-extra'
AC_MSG_NOTICE([libwidgetextra library is available in the local tree])
else
AC_MSG_NOTICE([libwidgetextra library is NOT available in the local tree])
fi
])
AC_DEFUN([AUDACITY_CONFIG_SUBDIRS_WIDGETEXTRA], [
if test "$WIDGETEXTRA_USE_LOCAL" = yes; then
AC_CONFIG_SUBDIRS([lib-src/lib-widget-extra])
fi
dnl otherwise good - got it. Flags will be available for use in
dnl WIDGETEXTRA_LIBS and friends
])