1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-06-16 06:15:24 +00:00

Make common a separate library

This commit is contained in:
Marvin Scholz 2018-10-11 15:04:44 +02:00
parent ad5fc10061
commit d8885f5668
19 changed files with 768 additions and 18 deletions

37
.gitignore vendored
View File

@ -1,7 +1,34 @@
*.in
*.la
*.lo
*.o
.deps
# Ignore generated config.h
config.h
# Ignore binaries/temporary stuff
.libs
.deps
*.o
*.lo
*.la
# Autofoo stuff
stamp-h1
libtool
config.h.in
config.h.in~
config.log
config.status
configure
build-aux/
autom4te.cache/
aclocal.m4
# Ignore generated Makefiles
Makefile
Makefile.in
# Ignore auxiliary files
/tap-driver.sh
# Ignore vim swap files
.*.swp
# Other
.DS_Store

21
Makefile.am Normal file
View File

@ -0,0 +1,21 @@
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = avl httpp log net thread timing
lib_LTLIBRARIES = libpermafrost.la
libpermafrost_la_SOURCES = libpermafrost.c
libpermafrost_la_LIBADD = \
avl/libiceavl.la \
httpp/libicehttpp.la \
log/libicelog.la \
net/libicenet.la \
thread/libicethread.la \
timing/libicetiming.la
pkgconfig_DATA = permafrost.pc
static:
$(MAKE) all LDFLAGS="${LDFLAGS} -all-static"

10
autogen.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Run this to generate the configure script
set -e
srcdir=$(dirname "$0")
test -n "$srcdir" && cd "$srcdir"
echo "Updating build configuration files for permafrost, please wait..."
autoreconf -isf

View File

@ -5,10 +5,9 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = BUILDING COPYING README TODO avl.dsp test.c
noinst_LTLIBRARIES = libiceavl.la
noinst_HEADERS = avl.h
pkginclude_HEADERS = avl.h
libiceavl_la_SOURCES = avl.c
libiceavl_la_CFLAGS = @XIPH_CFLAGS@
AM_CPPFLAGS = -I$(srcdir)/..

163
configure.ac Normal file
View File

@ -0,0 +1,163 @@
AC_INIT([permafrost], [0.0.1], [icecast@xiph.org])
AC_PREREQ([2.54])
AC_CONFIG_SRCDIR([httpp/httpp.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_PROG_CC
PKG_INSTALLDIR
AX_CHECK_COMPILE_FLAG([-std=c99], [
AX_APPEND_FLAG([-std=c99])
], [
AC_MSG_WARN([Compiler does not accept -std=c99 flag!])
])
AC_PROG_CC_C99
AS_IF([test "${ac_cv_prog_cc_c99}" = "no"], [
AC_MSG_ERROR([No C99 compiler found!])
])
AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Wno-unused-parameter])
dnl With clang, we want an error for unknown flags instead of just warn
AX_APPEND_COMPILE_FLAGS([-Werror=unknown-warning-option -Werror=invalid-command-line-argument])
AC_SYS_LARGEFILE
AC_DEFINE([_GNU_SOURCE], 1, [Define to include GNU extensions to POSIX])
dnl Set build/host to default values
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
dnl Check for which host we are compiling
AS_CASE("${host_os}",
[linux*], [SYS="linux"],
[darwin*], [SYS="darwin"],
[SYS="${host_os}"]
)
AM_INIT_AUTOMAKE([tar-ustar foreign dist-zip subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE([enable])
LT_INIT
dnl Sanitizer flags
AC_ARG_WITH([sanitizer],
[AS_HELP_STRING([--with-sanitizer=(address/memory/undefined/thread)],
[build with sanitizer flags (default disabled)])],
[],
[with_sanitizer=no])
AS_VAR_IF(with_sanitizer, no, [], [
AX_CHECK_COMPILE_FLAG([-fsanitize=${with_sanitizer}], [
AX_APPEND_FLAG([-fsanitize=${with_sanitizer}])
AX_APPEND_FLAG([-fsanitize=${with_sanitizer}], [LDFLAGS])
], [
AC_MSG_ERROR(["-fsanitize=${with_sanitizer} not supported!"])
])
AX_APPEND_FLAG([-g])
AS_CASE("${with_sanitizer}",
[address], [
AX_APPEND_COMPILE_FLAGS([-fsanitize-address-use-after-scope -fno-omit-frame-pointer -fsanitize=pointer-compare -fsanitize=pointer-subtract])
],
[memory], [
AX_APPEND_COMPILE_FLAGS([-fPIE -pie])
],
[thread], [
AX_APPEND_COMPILE_FLAGS([-fPIE -pie])
],
[]
)
])
dnl Check for attributes
AX_GCC_TYPE_ATTRIBUTE([transparent_union])
dnl Checks for header files.
AC_HEADER_ASSERT
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([stdint.h inttypes.h], [
ice_found_int_headers="yes";
break;
])
AS_IF([test "$ice_found_int_headers" != "yes"], [
AC_MSG_ERROR([Unable to find the standard integers headers])
])
AC_CHECK_HEADER([winsock2.h], [
AC_DEFINE([HAVE_WINSOCK2_H], [1], [Define if you have winsock2.h on MINGW])
LIBS="$LIBS -lwsock32"
])
AC_CHECK_HEADERS([sys/select.h sys/uio.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([pwd.h grp.h])
dnl Check for functions
AC_FUNC_FORK
AC_FUNC_CHOWN
AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([gettimeofday ftime])
dnl Do not check for poll on Darwin, it is broken in some versions
AS_IF([test "${SYS}" != "darwin"], [
AC_CHECK_FUNCS([poll])
])
AC_SEARCH_LIBS([nanosleep], [rt], [
AC_DEFINE([HAVE_NANOSLEEP], [1], [Define if you have nanosleep])
])
dnl Checks for types and typedefs
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
dnl These tests are ordered based on solaris 8 tests
AC_SEARCH_LIBS([sethostent], [nsl], [
AC_DEFINE([HAVE_SETHOSTENT], [1], [Define if you have the sethostent function])
])
AC_SEARCH_LIBS([getnameinfo], [socket], [
AC_DEFINE([HAVE_GETNAMEINFO], [1], [Define if you have the getnameinfo function])
])
AC_CHECK_FUNCS([endhostent getaddrinfo inet_aton writev])
ACX_PTHREAD([], [AC_MSG_ERROR([POSIX threads missing])])
CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PTHREAD_CPPFLAGS}"
LIBS="${LIBS} ${PTHREAD_LIBS}"
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
avl/Makefile
httpp/Makefile
thread/Makefile
log/Makefile
net/Makefile
timing/Makefile
permafrost.pc
])
AC_OUTPUT

View File

@ -3,11 +3,10 @@
AUTOMAKE_OPTIONS = foreign
noinst_LTLIBRARIES = libicehttpp.la
noinst_HEADERS = httpp.h encoding.h
pkginclude_HEADERS = httpp.h encoding.h
libicehttpp_la_SOURCES = httpp.c encoding.c
libicehttpp_la_CFLAGS = @XIPH_CFLAGS@
AM_CPPFLAGS = -I$(srcdir)/.. @XIPH_CPPFLAGS@
AM_CPPFLAGS = -I$(srcdir)/..
# SCCS stuff (for BitKeeper)
GET = true

1
libpermafrost.c Normal file
View File

@ -0,0 +1 @@

View File

@ -5,10 +5,9 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = test.c
noinst_LTLIBRARIES = libicelog.la
noinst_HEADERS = log.h
pkginclude_HEADERS = log.h
libicelog_la_SOURCES = log.c
AM_CFLAGS = $(XIPH_CFLAGS)
debug:
$(MAKE) all CFLAGS="@DEBUG@"

5
m4/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4

199
m4/acx_pthread.m4 Normal file
View File

@ -0,0 +1,199 @@
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
dnl
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_CPPFLAGS="$flag $PTHREAD_CPPFLAGS"
fi
AC_CHECK_FUNCS([pthread_spin_lock])
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
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CPPFLAGS)
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

View File

@ -0,0 +1,65 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
# flag. If it does, the flag is added FLAGS-VARIABLE
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. During the check the flag is always added to the
# current language's flags.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
# AX_APPEND_LINK_FLAGS.
#
# LICENSE
#
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program 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 General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 4
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
done
])dnl AX_APPEND_COMPILE_FLAGS

72
m4/ax_append_flag.m4 Normal file
View File

@ -0,0 +1,72 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program 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 General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 7
AC_DEFUN([AX_APPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS,[" $1"])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG

View File

@ -0,0 +1,75 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program 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 General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 5
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS

View File

@ -0,0 +1,71 @@
#
# SYNOPSIS
#
# AX_GCC_TYPE_ATTRIBUTE(ATTRIBUTE)
#
# DESCRIPTION
#
# This macro checks if the compiler supports one of GCC's type
# attributes; many other compilers also provide type attributes with
# the same syntax. Compiler warnings are used to detect supported
# attributes as unsupported ones are ignored by default so quieting
# warnings when using this macro will yield false positives.
#
# The ATTRIBUTE parameter holds the name of the attribute to be checked.
#
# If ATTRIBUTE is supported define HAVE_TYPE_ATTRIBUTE_<ATTRIBUTE>.
#
# The macro caches its result in the ax_cv_have_type_attribute_<attribute>
# variable.
#
# The macro currently supports the following type attributes:
#
# transparent_union
#
# Unsupported type attributes will cause an error.
#
# LICENSE
#
# AX_GCC_TYPE_ATTRIBUTE is nearly identical to the AX_GCC_VAR_ATTRIBUTE
# macro, by Gabriele Svelto:
#
# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
#
# 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.
#
# Modified by Marvin Scholz <epirat07@gmail.com>
#serial 5
AC_DEFUN([AX_GCC_TYPE_ATTRIBUTE], [
AS_VAR_PUSHDEF([ac_var], [ax_cv_have_type_attribute_$1])
AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([
m4_case([$1],
[transparent_union], [
union __attribute__((__$1__)) { void *vp; } tu;
],
[
m4_fatal([Unsupported attribute $1])
]
)], [])
],
dnl GCC doesn't exit with an error if an unknown attribute is
dnl provided but only outputs a warning, so accept the attribute
dnl only if no warning were issued.
[AS_IF([test -s conftest.err],
[AS_VAR_SET([ac_var], [no])],
[AS_VAR_SET([ac_var], [yes])])],
[AS_VAR_SET([ac_var], [no])])
])
AS_IF([test yes = AS_VAR_GET([ac_var])],
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_TYPE_ATTRIBUTE_$1), 1,
[Define to 1 if the system has the `$1' type attribute])], [])
AS_VAR_POPDEF([ac_var])
])

37
m4/ax_require_defined.m4 Normal file
View File

@ -0,0 +1,37 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_DEFINED(MACRO)
#
# DESCRIPTION
#
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
# been defined and thus are available for use. This avoids random issues
# where a macro isn't expanded. Instead the configure script emits a
# non-fatal:
#
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
#
# It's like AC_REQUIRE except it doesn't expand the required macro.
#
# Here's an example:
#
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
#
# LICENSE
#
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
#
# 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 1
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
])dnl AX_REQUIRE_DEFINED

View File

@ -5,10 +5,9 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = BUILDING COPYING README TODO test_resolver.c
noinst_LTLIBRARIES = libicenet.la
noinst_HEADERS = resolver.h sock.h
pkginclude_HEADERS = resolver.h sock.h
libicenet_la_SOURCES = sock.c resolver.c
libicenet_la_CFLAGS = @XIPH_CFLAGS@
AM_CPPFLAGS = -I$(srcdir)/..

10
permafrost.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: permafrost
Description: Common used helpers for Icecast and related projects
Version: @VERSION@
Cflags: -I${includedir} -pthread
Libs: -L${libdir} -lpermafrost -pthread

View File

@ -5,10 +5,9 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = BUILDING COPYING README TODO
noinst_LTLIBRARIES = libicethread.la
noinst_HEADERS = thread.h
pkginclude_HEADERS = thread.h
libicethread_la_SOURCES = thread.c
libicethread_la_CFLAGS = @XIPH_CFLAGS@
AM_CPPFLAGS = -I$(srcdir)/..

View File

@ -5,10 +5,9 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = BUILDING COPYING README TODO
noinst_LTLIBRARIES = libicetiming.la
noinst_HEADERS = timing.h
pkginclude_HEADERS = timing.h
libicetiming_la_SOURCES = timing.c
libicetiming_la_CFLAGS = @XIPH_CFLAGS@
debug:
$(MAKE) all CFLAGS="@DEBUG@"