diff options
-rw-r--r-- | Makefile.am | 39 | ||||
-rw-r--r-- | acinclude.m4 | 388 | ||||
-rwxr-xr-x | bootstrap.sh | 64 | ||||
-rw-r--r-- | configure.ac | 374 | ||||
-rw-r--r-- | libsydney.pc.in | 11 | ||||
-rw-r--r-- | src/Makefile | 47 | ||||
-rw-r--r-- | src/Makefile.am | 115 | ||||
-rw-r--r-- | src/speex/speex_resampler.c (renamed from src/speex/resample.c) | 0 |
8 files changed, 991 insertions, 47 deletions
diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..25c6325 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,39 @@ +# $Id$ +# +# This file is part of libsydney. +# +# libsydney is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# libsydney is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with libsydney; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +EXTRA_DIST = bootstrap.sh LGPL +SUBDIRS=src + +MAINTAINERCLEANFILES = +noinst_DATA = + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libsydney.pc + +homepage: all dist doxygen + test -d $$HOME/homepage/private + mkdir -p $$HOME/homepage/private/projects/libsydney + cp libsydney-@PACKAGE_VERSION@.tar.gz $$HOME/homepage/private/projects/libsydney + +eolspace: + find \( -name '*.c' -o -name '*.h' -o -name 'Makefile.am' \) -exec perl -i -pe 's/\s+\n$$/\1\n/;' \{\} \; + +untabify: + find \( -name '*.c' -o -name '*.h' \) -exec perl -i -pe 's/\t/ /g;' \{\} \; + +.PHONY: homepage distcleancheck diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..723eb87 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,388 @@ +dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl +dnl @summary figure out how to build C programs using POSIX threads +dnl +dnl This macro figures out how to build C programs using POSIX threads. +dnl It sets the PTHREAD_LIBS output variable to the threads library and +dnl linker flags, and the PTHREAD_CFLAGS output variable to any special +dnl C compiler flags that are needed. (The user can also force certain +dnl compiler flags/libs to be tested by setting these environment +dnl variables.) +dnl +dnl Also sets PTHREAD_CC to any special C compiler that is needed for +dnl multi-threaded programs (defaults to the value of CC otherwise). +dnl (This is necessary on AIX to use the special cc_r compiler alias.) +dnl +dnl NOTE: You are assumed to not only compile your program with these +dnl flags, but also link it with them as well. e.g. you should link +dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS +dnl $LIBS +dnl +dnl If you are only building threads programs, you may wish to use +dnl these variables in your default LIBS, CFLAGS, and CC: +dnl +dnl LIBS="$PTHREAD_LIBS $LIBS" +dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +dnl CC="$PTHREAD_CC" +dnl +dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute +dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to +dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +dnl +dnl ACTION-IF-FOUND is a list of shell commands to run if a threads +dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to +dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the +dnl default action will define HAVE_PTHREAD. +dnl +dnl Please let the authors know if this macro fails on any platform, or +dnl if you have any other suggestions or comments. This macro was based +dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with +dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros +dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. +dnl We are also grateful for the helpful feedback of numerous users. +dnl +dnl @category InstalledPackages +dnl @author Steven G. Johnson <stevenj@alum.mit.edu> +dnl @version 2006-05-29 +dnl @license GPLWithACException +dnl +dnl Checks for GCC shared/pthread inconsistency based on work by +dnl Marcin Owsiany <marcin@owsiany.pl> + + +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;], + [attr_name=$attr; break]) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi + + # The next part tries to detect GCC inconsistency with -shared on some + # architectures and systems. The problem is that in certain + # configurations, when -shared is specified, GCC "forgets" to + # internally use various flags which are still necessary. + + AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies]) + check_inconsistencies=yes + case "${host_cpu}-${host_os}" in + *-darwin*) check_inconsistencies=no ;; + esac + if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then + AC_MSG_RESULT([no]) + else + AC_MSG_RESULT([yes]) + + # In order not to create several levels of indentation, we test + # the value of "$ok" until we find out the cure or run out of + # ideas. + ok="no" + + # + # Prepare the flags + # + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + save_CC="$CC" + # Try with the flags determined by the earlier checks. + # + # -Wl,-z,defs forces link-time symbol resolution, so that the + # linking checks with -shared actually have any value + # + # FIXME: -fPIC is required for -shared on many architectures, + # so we specify it here, but the right way would probably be to + # properly detect whether it is actually required. + CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CC="$PTHREAD_CC" + + AC_MSG_CHECKING([whether -pthread is sufficient with -shared]) + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [ok=yes]) + + if test "x$ok" = xyes; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + + # + # Linux gcc on some architectures such as mips/mipsel forgets + # about -lpthread + # + if test x"$ok" = xno; then + AC_MSG_CHECKING([whether -lpthread fixes that]) + LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [ok=yes]) + + if test "x$ok" = xyes; then + AC_MSG_RESULT([yes]) + PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" + else + AC_MSG_RESULT([no]) + fi + fi + # + # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc + # + if test x"$ok" = xno; then + AC_MSG_CHECKING([whether -lc_r fixes that]) + LIBS="-lc_r $PTHREAD_LIBS $save_LIBS" + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [ok=yes]) + + if test "x$ok" = xyes; then + AC_MSG_RESULT([yes]) + PTHREAD_LIBS="-lc_r $PTHREAD_LIBS" + else + AC_MSG_RESULT([no]) + fi + fi + if test x"$ok" = xno; then + # OK, we have run out of ideas + AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries]) + + # so it's not safe to assume that we may use pthreads + acx_pthread_ok=no + fi + + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" + CC="$save_CC" + fi +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD +AC_DEFUN([AC_CHECK_DEFINE],[ +AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1_$2])dnl +AC_CACHE_CHECK([for $1 in $2], ac_var, +AC_TRY_COMPILE([#include <$2>],[ + #ifdef $1 + int ok; + #else + choke me + #endif +],AS_VAR_SET(ac_var, yes),AS_VAR_SET(ac_var, no))) +AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl +AS_VAR_POPDEF([ac_var])dnl +]) + +AC_DEFUN([ACX_LIBWRAP], [ +LIBWRAP_LIBS= +saved_LIBS="$LIBS" +LIBS="$LIBS -lwrap" +AC_MSG_CHECKING([for tcpwrap library and headers]) +AC_LINK_IFELSE( +AC_LANG_PROGRAM( +[#include <tcpd.h> +#include <syslog.h> +int allow_severity = LOG_INFO; +int deny_severity = LOG_WARNING;], +[struct request_info *req; +return hosts_access (req);]), +[AC_DEFINE(HAVE_LIBWRAP, [], [Have tcpwrap?]) +LIBWRAP_LIBS="-lwrap" +AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no)]) +LIBS="$saved_LIBS" +]) + +AC_DEFUN([ACX_LIRC], [ +LIRC_CFLAGS= +LIRC_LIBS= +AC_CHECK_HEADER(lirc/lirc_client.h,[AC_CHECK_LIB(lirc_client,lirc_init,[HAVE_LIRC=1 +LIRC_LIBS=-llirc_client],HAVE_LIRC=0)],HAVE_LIRC=0) +]) diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..42b4ed9 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# $Id$ + +# This file is part of libsydney. +# +# libsydney is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# libsydney is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with libsydney; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +VERSION=1.9 + +run_versioned() { + local P + local V + + V=$(echo "$2" | sed -e 's,\.,,g') + + if [ -e "`which $1$V 2> /dev/null`" ] ; then + P="$1$V" + else + if [ -e "`which $1-$2 2> /dev/null`" ] ; then + P="$1-$2" + else + P="$1" + fi + fi + + shift 2 + "$P" "$@" +} + +set -ex + +if [ "x$1" = "xam" ] ; then + run_versioned automake "$VERSION" -a -c --foreign + ./config.status +else + rm -rf autom4te.cache + rm -f config.cache + + touch config.rpath + test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize + + "$LIBTOOLIZE" -c --force + run_versioned aclocal "$VERSION" + run_versioned autoconf 2.59 -Wall + run_versioned autoheader 2.59 + run_versioned automake "$VERSION" --copy --foreign --add-missing + + if test "x$NOCONFIGURE" = "x"; then + CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var "$@" + make clean + fi +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..5a3f555 --- /dev/null +++ b/configure.ac @@ -0,0 +1,374 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +# $Id$ + +# This file is part of libsydney. +# +# libsydney is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# libsydney is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with libsydney; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +AC_PREREQ(2.57) + +AC_INIT([libsydney], 0.1, [mzyvoflqarl (at) 0pointer (dot) de]) +AC_CONFIG_SRCDIR([src/common.c]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([foreign -Wall]) + +AC_SUBST(PACKAGE_URL, [https://tango.0pointer.de/mailman/listinfo/libsydney-discuss/]) + +AC_SUBST(LIBSYDNEY_VERSION_INFO, [0:0:0]) + +AC_CANONICAL_HOST + +if type -p stow > /dev/null && test -d /usr/local/stow ; then + AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) + ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}" +fi + +#### Checks for programs. #### + +# CC + +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_GCC_TRADITIONAL +AC_GNU_SOURCE + +# GCC flags + +test_gcc_flag() { + AC_LANG_CONFTEST([int main(int argc, char*argv[]) {}]) + $CC -c conftest.c $CFLAGS -o conftest.o > /dev/null 2> /dev/null + ret=$? + rm -f conftest.o + return $ret +} + +# If using GCC specify some additional parameters +if test "x$GCC" = "xyes" ; then + + # We use gnu99 instead of c99 because many have interpreted the standard + # in a way that int64_t isn't defined on non-64 bit platforms. + DESIRED_FLAGS="-std=gnu99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math" + + for flag in $DESIRED_FLAGS ; do + AC_MSG_CHECKING([whether $CC accepts $flag]) + if test_gcc_flag $flag ; then + CFLAGS="$CFLAGS $flag" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + done +fi + +#### libtool stuff #### + +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + +#### Determine build environment #### + +os_is_win32=0 + +case "$host_os" in + mingw*) + AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.]) + os_is_win32=1 + ;; + esac + +AM_CONDITIONAL(OS_IS_WIN32, test "x$os_is_win32" = "x1") + +################################### +# Basic environment checks # +################################### + +#### Checks for header files. #### + +# ISO +AC_HEADER_STDC + +# XPG4-UNIX +AC_CHECK_HEADERS([sys/poll.h]) + +# Other +AC_CHECK_HEADERS([sys/ioctl.h]) +AC_CHECK_HEADERS([byteswap.h]) + +#### Typdefs, structures, etc. #### + +AC_C_CONST +AC_C_BIGENDIAN +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long], + [Define ssize_t if it is not done by the standard libs.])]) +AC_TYPE_OFF_T +AC_TYPE_SIGNAL +AC_TYPE_UID_T + +#### Check for libs #### + +# ISO +AC_SEARCH_LIBS([pow], [m]) + +# POSIX +AC_SEARCH_LIBS([sched_setscheduler], [rt]) + +# Non-standard + +#### Check for functions #### + +# ISO +AC_CHECK_FUNCS([lrintf strtof]) + +# POSIX +AC_FUNC_SELECT_ARGTYPES +AC_CHECK_FUNCS([gettimeofday nanosleep posix_memalign sigaction sleep sysconf]) + +# SUSv3 +AC_CHECK_FUNCS([strerror_r]) + +# BSD +AC_CHECK_FUNCS([lstat]) + +#### POSIX threads #### + +ACX_PTHREAD + +AC_MSG_CHECKING([for PTHREAD_PRIO_INHERIT]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +#include <pthread.h> +int main() { int i = PTHREAD_PRIO_INHERIT; }]])]) +$PTHREAD_CC conftest.c $PTHREAD_CFLAGS $CFLAGS $PTHREAD_LIBS -o conftest > /dev/null 2> /dev/null +ret=$? +rm -f conftest.o conftest + +if test $ret -eq 0 ; then + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + + +#### Large File-Support (LFS) #### + +AC_SYS_LARGEFILE + +# Check for open64 to know if the current system does have open64() and similar functions +AC_CHECK_FUNCS([open64]) + +#### [lib]iconv #### + +AM_ICONV + +################################### +# 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 + +#### OSS support (optional) #### + +AC_ARG_ENABLE([oss], + AC_HELP_STRING([--disable-oss], [Disable optional OSS support]), + [ + case "${enableval}" in + yes) oss=yes ;; + no) oss=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-oss) ;; + esac + ], + [oss=auto]) + +if test "x${oss}" != xno ; then + AC_CHECK_HEADERS([sys/soundcard.h], + [ + HAVE_OSS=1 + AC_DEFINE([HAVE_OSS], 1, [Have OSS?]) + ], + [ + HAVE_OSS=0 + if test "x$oss" = xyes ; then + AC_MSG_ERROR([*** OSS support not found]) + fi + ]) +else + HAVE_OSS=0 +fi + +AC_SUBST(HAVE_OSS) +AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1]) + +#### ALSA support (optional) #### + +AC_ARG_ENABLE([alsa], + AC_HELP_STRING([--disable-alsa], [Disable optional ALSA support]), + [ + case "${enableval}" in + yes) alsa=yes ;; + no) alsa=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-alsa) ;; + esac + ], + [alsa=auto]) + +if test "x${alsa}" != xno ; then + PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.0 ], + [ + HAVE_ALSA=1 + AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?]) + ], + [ + HAVE_ALSA=0 + if test "x$alsa" = xyes ; then + AC_MSG_ERROR([*** ALSA support not found]) + fi + ]) +else + HAVE_ALSA=0 +fi + +AC_SUBST(ASOUNDLIB_CFLAGS) +AC_SUBST(ASOUNDLIB_LIBS) +AC_SUBST(HAVE_ALSA) +AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1]) + +#### Solaris audio support (optional) #### + +AC_ARG_ENABLE([solaris], + AC_HELP_STRING([--disable-solaris], [Disable optional Solaris audio support]), + [ + case "${enableval}" in + yes) solaris=yes ;; + no) solaris=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-solaris) ;; + esac + ], + [solaris=auto]) + +if test "x${solaris}" != xno ; then + AC_CHECK_HEADERS([sys/audio.h], + [ + HAVE_SOLARIS=1 + AC_DEFINE([HAVE_SOLARIS], 1, [Have Solaris audio?]) + ], + [ + HAVE_SOLARIS=0 + if test "x$solaris" = xyes ; then + AC_MSG_ERROR([*** Solaris audio support not found]) + fi + ]) +else + HAVE_SOLARIS=0 +fi + +AC_SUBST(HAVE_SOLARIS) +AM_CONDITIONAL([HAVE_SOLARIS], [test "x$HAVE_SOLARIS" = x1]) + +### LIBOIL #### + +PKG_CHECK_MODULES(LIBOIL, [ liboil-0.3 >= 0.3.0 ]) +AC_SUBST(LIBOIL_CFLAGS) +AC_SUBST(LIBOIL_LIBS) + +### JACK (optional) #### + +AC_ARG_ENABLE([jack], + AC_HELP_STRING([--disable-jack], [Disable optional JACK support]), + [ + case "${enableval}" in + yes) jack=yes ;; + no) jack=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-jack) ;; + esac + ], + [jack=auto]) + +if test "x${jack}" != xno ; then + PKG_CHECK_MODULES(JACK, [ jack >= 0.100 ], + HAVE_JACK=1, + [ + HAVE_JACK=0 + if test "x$jack" = xyes ; then + AC_MSG_ERROR([*** JACK support not found]) + fi + ]) +else + HAVE_JACK=0 +fi + +AC_SUBST(JACK_CFLAGS) +AC_SUBST(JACK_LIBS) +AC_SUBST(HAVE_JACK) +AM_CONDITIONAL([HAVE_JACK], [test "x$HAVE_JACK" = x1]) + +################################### +# Output # +################################### + +AC_CONFIG_FILES([ +Makefile +src/Makefile +libsydney.pc +]) +AC_OUTPUT + +# ========================================================================== +ENABLE_OSS=no +if test "x$HAVE_OSS" = "x1" ; then + ENABLE_OSS=yes +fi + +ENABLE_ALSA=no +if test "x$HAVE_ALSA" = "x1" ; then + ENABLE_ALSA=yes +fi + +ENABLE_SOLARIS=no +if test "x$HAVE_SOLARIS" = "x1" ; then + ENABLE_SOLARIS=yes +fi + +ENABLE_JACK=no +if test "x$HAVE_JACK" = "x1" ; then + ENABLE_JACK=yes +fi + +echo " + ---{ $PACKAGE_NAME $VERSION }--- + + prefix: ${prefix} + sysconfdir: ${sysconfdir} + localstatedir: ${localstatedir} + Compiler: ${CC} + CFLAGS: ${CFLAGS} + Enable OSS: ${ENABLE_OSS} + Enable Alsa: ${ENABLE_ALSA} + Enable Solaris: ${ENABLE_SOLARIS} + Enable Jack: ${ENABLE_JACK} +" diff --git a/libsydney.pc.in b/libsydney.pc.in new file mode 100644 index 0000000..c86d4b7 --- /dev/null +++ b/libsydney.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +includedir=${prefix}/include + +Name: libsydney +Description: Digital Audio Interface +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lsydney @PTHREAD_LIBS@ +Cflags: -D_REENTRANT -I${includedir} +Requires: diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index bd82b1f..0000000 --- a/src/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -CFLAGS=-Wall -O0 -g -W -Wno-unused-parameter `pkg-config --cflags liboil-0.3` -DRANDOM_PREFIX=saspeex -DOUTSIDE_SPEEX -D_GNU_SOURCE -pthread -LIBS=-lm `pkg-config --libs liboil-0.3` - -SOURCES=common.c malloc.c oss.c bbuffer.c format.c volscale.c byteswap.c continued-fraction.c zero.c add.c speex/resample.c resample.c interleave.c converter.c g711.c mutex.c once.c thread.c bufferq.c # asyncq.c -OBJS=$(SOURCES:.c=.o) - -all: test-bufferq test-llist test-sine test-pull #test-asyncq - -test-bufferq: test-bufferq.o bufferq.o malloc.o #$(OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - -test-llist: test-llist.o - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - -test-sine: $(OBJS) test-sine.o - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - -test-pull: $(OBJS) test-pull.o - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - -test-asyncq: $(OBJS) test-asyncq.o - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - -*.o: *.h - -indent: - indent -bdfa -brf -kr -nbbo -nbc -ip0 -ppi 4 -cs -nbfde -npsl -br -brs -bap -i4 -bs -cdw -ce -npcs -hnl -cli4 -nut -ci8 < oss.c -# astyle --indent=spaces=4 --brackets=attach --indent-switches --max-instatement-indent=40 --pad=oper --unpad=paren --convert-tabs --mode=c < oss.c - -clean: - rm -f *.o meta-name-table.h test-bufferq test-llist test-sine core test-pull speex/*.o - -common.o: meta-name-table.h - -meta-name-table.h: meta-name-table.gperf Makefile - gperf -t -N sa_lookup_meta_name -H sa_hash_meta_name -p -C < $< | sed -e 's/{""}/{"", 0}/g' > $@ - -fixme: - find -name '*.c' -exec fgrep -H -A 3 -B 3 -i FIXME \{\} \; - -update-speex: - wget -O speex/speex_resampler.h http://svn.xiph.org/trunk/speex/include/speex/speex_resampler.h - wget -O speex/resample.c http://svn.xiph.org/trunk/speex/libspeex/resample.c - wget -O speex/arch.h http://svn.xiph.org/trunk/speex/libspeex/arch.h - -warn-export: all - nm test-bufferq test-llist test-sine test-pull | grep " T " | awk '{print $$3}' | sort | uniq diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..b6b57ea --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,115 @@ +# $Id$ +# +# This file is part of libsydney. +# +# libsydney is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# libsydney is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with libsydney; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +AM_CFLAGS = $(PTHREAD_CFLAGS) +AM_LIBADD = $(PTHREAD_LIBS) +AM_LDADD = $(PTHREAD_LIBS) + +EXTRA_DIST = \ + meta-name-table.gperf + +lib_LTLIBRARIES = \ + libsydney.la + +noinst_PROGRAMS = \ + test-bufferq \ + test-llist \ + test-sine \ + test-pull +# test-asyncq + +libsydney_la_SOURCES = \ + common.c common.h \ + malloc.c malloc.h \ + oss.c oss.h \ + bbuffer.c bbuffer.h \ + format.c fomat.h \ + volscale.c volscale.h \ + byteswap.c byteswap.h \ + continued-fraction.c continued-fraction.h \ + zero.c zero.h \ + add.c add.h \ + speex/speex_resampler.c speex/speex_resampler.h speex/arch.h \ + resample.c resample.h \ + interleave.c interleave.h \ + converter.c converter.h \ + g711.c g711.h \ + mutex.c mutex.h \ + once.c once.h \ + thread.c thread.h \ + bufferq.c buffer.h \ + meta-name-table.h +# asyncq.c asyncq.h +libsydney_la_LIBADD = \ + $(AM_LIBADD) \ + $(LIBOIL_LIBS) +libsydney_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(LIBOIL_CFLAGS) \ + -DRANDOM_PREFIX=saspeex -DOUTSIDE_SPEEX + +test_bufferq_SOURCES = \ + test-bufferq.c +test_bufferq_LDADD = \ + $(AM_LDADD) \ + libsydney.la + +test_llist_SOURCES = \ + test-llist.c +test_llist_LDADD = \ + $(AM_LDADD) \ + libsydney.la + +test_sine_SOURCES = \ + test-sine.c +test_sine_LDADD = \ + $(AM_LDADD) \ + libsydney.la + +test_pull_SOURCES = \ + test-pull.c +test_pull_LDADD = \ + $(AM_LDADD) \ + libsydney.la + +#test_asyncq_SOURCES = \ +# test-asyncq.c +#test_asyncq_LDADD = \ +# $(AM_LDADD) \ +# libsydney.la + +BUILT_SOURCES = \ + meta-name-table.h + +meta-name-table.h: meta-name-table.gperf Makefile + gperf -t -N sa_lookup_meta_name -H sa_hash_meta_name -p -C < $< | sed -e 's/{""}/{"", 0}/g' > $@ + +fixme: + find -name '*.c' -exec fgrep -H -A 3 -B 3 -i FIXME \{\} \; + +indent: + indent -bdfa -brf -kr -nbbo -nbc -ip0 -ppi 4 -cs -nbfde -npsl -br -brs -bap -i4 -bs -cdw -ce -npcs -hnl -cli4 -nut -ci8 < oss.c +# astyle --indent=spaces=4 --brackets=attach --indent-switches --max-instatement-indent=40 --pad=oper --unpad=paren --convert-tabs --mode=c < oss.c + +update-speex: + wget -O speex/speex_resampler.h http://svn.xiph.org/trunk/speex/include/speex/speex_resampler.h + wget -O speex/speex_resample.c http://svn.xiph.org/trunk/speex/libspeex/resample.c + wget -O speex/arch.h http://svn.xiph.org/trunk/speex/libspeex/arch.h + +warn-export: all + nm test-bufferq test-llist test-sine test-pull | grep " T " | awk '{print $$3}' | sort | uniq diff --git a/src/speex/resample.c b/src/speex/speex_resampler.c index 1cc4d49..1cc4d49 100644 --- a/src/speex/resample.c +++ b/src/speex/speex_resampler.c |