1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Added basic files for library building

This adds the basic infrastructure to create library out of the
subdirectories. Most of the code is stolen from libshout.

libicecast.c is a dummy file that is currently needed to
build the library. If someone finds a ways to build without it
please fix and delete the file.
This commit is contained in:
Philipp Schafft 2015-01-16 11:13:50 +00:00
parent a3e6a937fe
commit ed89ba2b46
5 changed files with 287 additions and 0 deletions

7
Makefile.am Normal file
View File

@ -0,0 +1,7 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = avl net thread httpp log timing
lib_LTLIBRARIES = libicecast.la
libshout_la_SOURCES = libicecast.c
libicecast_la_LIBADD = net/libicenet.la timing/libicetiming.la avl/libiceavl.la httpp/libicehttpp.la thread/libicethread.la

116
autogen.sh Executable file
View File

@ -0,0 +1,116 @@
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
package="libicecast"
olddir=`pwd`
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
cd "$srcdir"
DIE=0
echo "checking for autoconf... "
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]*\).*/\1/"
VERSIONMKINT="sed -e s/[^0-9]//"
# do we need automake?
if test -r Makefile.am; then
AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
if test "$AM_NEEDED" = "$AM_OPTIONS"; then
AM_NEEDED=""
fi
if test -z $AM_NEEDED; then
echo -n "checking for automake... "
AUTOMAKE=automake
ACLOCAL=aclocal
if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
echo "yes"
else
echo "no"
AUTOMAKE=
fi
else
echo -n "checking for automake $AM_NEEDED or later... "
for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
($am --version < /dev/null > /dev/null 2>&1) || continue
ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
if test $ver -ge $verneeded; then
AUTOMAKE=$am
echo $AUTOMAKE
break
fi
done
test -z $AUTOMAKE && echo "no"
echo -n "checking for aclocal $AM_NEEDED or later... "
for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
($ac --version < /dev/null > /dev/null 2>&1) || continue
ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
if test $ver -ge $verneeded; then
ACLOCAL=$ac
echo $ACLOCAL
break
fi
done
test -z $ACLOCAL && echo "no"
fi
test -z $AUTOMAKE || test -z $ACLOCAL && {
echo
echo "You must have automake installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
exit 1
}
fi
echo -n "checking for libtool... "
for LIBTOOLIZE in libtoolize glibtoolize nope; do
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
done
if test x$LIBTOOLIZE = xnope; then
echo "nope."
LIBTOOLIZE=libtoolize
else
echo $LIBTOOLIZE
fi
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $package."
echo "Download the appropriate package for your system,"
echo "or get the source from one of the GNU ftp sites"
echo "listed in http://www.gnu.org/order/ftp.html"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
echo "Generating configuration files for $package, please wait...."
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
echo " $ACLOCAL $ACLOCAL_FLAGS"
$ACLOCAL $ACLOCAL_FLAGS || exit 1
echo " autoheader"
autoheader || exit 1
echo " $LIBTOOLIZE --automake"
$LIBTOOLIZE --automake || exit 1
echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
echo " autoconf"
autoconf || exit 1
cd $olddir
$srcdir/configure "$@" && echo

149
configure.ac Normal file
View File

@ -0,0 +1,149 @@
# Process this file with autoconf to produce a configure script.
# $Id$
m4_define(libicecast_major, 2)
m4_define(libicecast_minor, 3)
m4_define(libicecast_micro, 1)
m4_define(libicecast_version, libicecast_major.libicecast_minor.libicecast_micro)
AC_INIT([libicecast], libicecast_version, [icecast-dev@xiph.org])
AC_PREREQ([2.54])
dnl AC_CONFIG_SRCDIR([src/shout.c])
AM_CONFIG_HEADER(config.h)
# config.h guard
AH_TOP([#ifndef __CONFIG_H__
#define __CONFIG_H__ 1])
AH_BOTTOM([#endif])
AC_DEFINE([LIBICECAST_MAJOR], libicecast_major, [Icecast library major version])
AC_DEFINE([LIBICECAST_MINOR], libicecast_minor, [Icecast library minor version])
AC_DEFINE([LIBICECAST_MICRO], libicecast_micro, [Icecast library patch version])
VERSION=libicecast_version
AM_INIT_AUTOMAKE([libicecast], libicecast_version)
AM_MAINTAINER_MODE
dnl create our name mangling macro
dnl the prefix must be hardwired because of AH limitations
AH_VERBATIM([_mangle], [
/* name mangling to protect code we share with other libraries */
#define _mangle(proc) _icecast_ ## proc
])
AC_PROG_CC
AM_PROG_LIBTOOL
dnl Set some options based on environment
dnl openbsd headers break when _XOPEN_SOURCE is defined but without it seems
dnl to be fine
case "$ac_cv_host" in
*openbsd* | *solaris* | *irix*)
;;
*) AC_DEFINE(_XOPEN_SOURCE, 600, [Define if you have POSIX and XPG specifications])
;;
esac
if test -z "$GCC"; then
case $host in
*-*-irix*)
DEBUG="-g -signed"
CFLAGS="-O2 -w -signed"
PROFILE="-p -g3 -O2 -signed"
;;
sparc-sun-solaris*)
DEBUG="-v -g"
CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
;;
*)
DEBUG="-g"
CFLAGS="-O"
PROFILE="-g -p"
;;
esac
else
XIPH_CFLAGS="-Wall -ffast-math -fsigned-char"
AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications])
DEBUG="-g"
PROFILE="-pg -g"
fi
dnl Checks for programs.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([strings.h sys/timeb.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
XIPH_C99_INTTYPES
dnl Checks for library functions.
AC_CHECK_FUNCS([gettimeofday ftime])
dnl Module checks
XIPH_NET
ACX_PTHREAD([
LIBS="$LIBS $PTHREAD_LIBS"
XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS"
CC="$PTHREAD_CC"
])
dnl If pkgconfig is found, install a icecast.pc file.
AC_ARG_ENABLE([pkgconfig],
AC_HELP_STRING([--disable-pkgconfig],[disable pkgconfig data files (auto)]),
[dopkgconfig="$enableval"], [dopkgconfig="maybe"])
if test "$dopkgconfig" = "maybe"
then
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes], [no])
else
AC_MSG_CHECKING([whether pkgconfig should be used])
PKGCONFIG="$dopkgconfig"
AC_MSG_RESULT([$PKGCONFIG])
fi
AM_CONDITIONAL([HAVE_PKGCONFIG], [test "$PKGCONFIG" != "no"])
# Collect flags for icecast.pc
# I hate myself for doing this.
save_prefix="$prefix"
if test "$prefix" = "NONE"
then
prefix="$ac_default_prefix"
fi
eval icecast_includedir="$includedir"
prefix="$save_prefix"
ICECAST_VERSION="$VERSION"
ICECAST_CPPFLAGS="-I$icecast_includedir $VORBIS_CFLAGS $PTHREAD_CPPFLAGS"
ICECAST_CFLAGS="$PTHREAD_CFLAGS"
ICECAST_LIBS="-licecast"
XIPH_CLEAN_CCFLAGS([$ICECAST_CPPFLAGS], [ICECAST_CPPFLAGS])
XIPH_CLEAN_CCFLAGS([$ICECAST_CFLAGS], [ICECAST_CFLAGS])
XIPH_CLEAN_CCFLAGS([$PTHREAD_LIBS $LIBS], [ICECAST_LIBDEPS])
AC_SUBST(PTHREAD_CPPFLAGS)
AC_SUBST(ICECAST_LIBDEPS)
AC_SUBST(ICECAST_REQUIRES)
AC_SUBST(ICECAST_CPPFLAGS)
AC_SUBST(ICECAST_CFLAGS)
dnl Make substitutions
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
AC_SUBST(XIPH_CFLAGS)
AC_SUBST(XIPH_CPPFLAGS)
AC_OUTPUT([Makefile
net/Makefile timing/Makefile
thread/Makefile avl/Makefile httpp/Makefile log/Makefile
icecast.pc])

15
icecast.pc.in Normal file
View File

@ -0,0 +1,15 @@
# libicecast pkg-config source file
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
cppflags=@ICECAST_CPPFLAGS@
cflags_only=@ICECAST_CFLAGS@
Name: Icecast
Description: icecast common code library
Version: @VERSION@
Requires.private: @ICECAST_REQUIRES@
Libs: -L${libdir} -lshout
Cflags: -I${includedir} @PTHREAD_CPPFLAGS@ @ICECAST_CFLAGS@

0
libicecast.c Normal file
View File