diff --git a/Makefile b/Makefile deleted file mode 100644 index b62013e..0000000 --- a/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -CC := $(CROSS_COMPILE)gcc -LD := $(CROSS_COMPILE)gcc -STRIP := $(CROSS_COMPILE)strip - -# -Wno-multichar is used for vban.h:25 define. -CFLAGS := -DLINUX -ansi -Wpedantic -Wall -Wno-multichar -LDFLAGS := -lasound - -# Defaultly compiles release version of the application -CONFIG := release - -ifneq ($(filter release%,$(CONFIG)),) - LDFLAGS += -O3 -endif - -ifneq ($(filter debug%,$(CONFIG)),) - CFLAGS += -g -endif - -SOURCES := main.c \ - socket.c \ - audio.c \ - -OBJECTS := $(SOURCES:.c=.o) -DEPENDENCIES:= $(SOURCES:.c=.d) -EXECUTABLE := vban_receptor - -all: $(EXECUTABLE) - -$(EXECUTABLE): $(OBJECTS) - @echo "Linking $@" - @$(LD) $(LDFLAGS) -o "$@" $^ -ifneq ($(filter release%,$(CONFIG)),) - @echo "Stripping $@" - @$(STRIP) "$@" -endif - -%.o:%.c - @echo "Compiling $<" - @$(CC) -c $(CFLAGS) -MMD -MF "$(patsubst %.o,%.d,$@)" -o "$@" "$<" - --include $(DEPENDENCIES) - -install: - @mkdir -p $(DESTDIR)/usr/sbin - @cp $(EXECUTABLE) $(DESTDIR)/usr/sbin - -clean: - @echo "Cleaning artifacts and objects" - @rm -f $(OBJECTS) $(DEPENDENCIES) $(EXECUTABLE) - @rm -f *~* - -distclean: clean - diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..05e36c8 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,5 @@ +# We want to avoid GNU potential warnings +AUTOMAKE_OPTIONS = foreign +# We want to compile source in src, so let's go there +SUBDIRS = src + diff --git a/README.md b/README.md index b9e59a8..7c8197d 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,15 @@ VBAN is a simple audio over UDP protocol proposed by VB-Audio, see [VBAN Audio w Compilation and installation ---------------------------- -vban_receptor doesn't have a configure script. Nevertheless the makefile is very simple and has some basic variables (CC, LD, STRIP, CROSS_COMPILE, DESTDIR) to define whatever compilation toolchain you wish to use and where you want to install. This will probably evolve in future releases. -So simply use: +vban_receptor uses ALSA, therefore you need to have ALSA library and headers available on your platform. +In standard Linux distributions, ALSA library package is usually named libasound(X) and header files come in package named libasound(X)-dev. - $ make +vban_receptor is distributed with autotools build scripts, therefore, to build, you need to invoke: + $ ./autogen.sh # probably only once for ever + $ ./configure # with or without options + $ make # with or without options + +To install, simply invoke: # make install Usage diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a220b80 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,6 @@ +#! /bin/sh + +aclocal \ +&& automake --add-missing \ +&& autoconf + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..6201c14 --- /dev/null +++ b/configure.ac @@ -0,0 +1,28 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([vban_receptor], [v0.5], [quiniouben@yahoo.fr]) +AM_INIT_AUTOMAKE + +# Checks for programs. +AC_PROG_CC +AC_LANG(C) + +# Checks for libraries. +AC_CHECK_HEADERS([alsa/asoundlib.h], [], [AC_MSG_ERROR(Missing ALSA headers)]) +AC_CHECK_LIB([asound], [snd_pcm_open], [], [AC_MSG_ERROR(Missing ALSA library)]) + +# Checks for header files. +AC_CHECK_HEADERS([arpa/inet.h inttypes.h netinet/in.h stddef.h stdlib.h string.h sys/socket.h unistd.h], [], [AC_MSG_ERROR(Missing some system headers)]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_SIZE_T +AC_TYPE_UINT32_T +AC_TYPE_UINT8_T + +# Checks for library functions. +AC_FUNC_MALLOC +AC_CHECK_FUNCS([inet_ntoa memset socket strerror], [], [AC_MSG_ERROR(Missing some system functions)]) + +AC_OUTPUT(Makefile src/Makefile) diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..8d40efb --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,6 @@ +# Let's define some things here +AM_CFLAGS = -ansi -Wpedantic -Wall -Wno-multichar -O2 +AM_LDFLAGS = -lasound + +bin_PROGRAMS = vban_receptor +vban_receptor_SOURCES = main.c audio.h audio.c socket.h socket.c vban.h diff --git a/audio.c b/src/audio.c similarity index 100% rename from audio.c rename to src/audio.c diff --git a/audio.h b/src/audio.h similarity index 100% rename from audio.h rename to src/audio.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/socket.c b/src/socket.c similarity index 100% rename from socket.c rename to src/socket.c diff --git a/socket.h b/src/socket.h similarity index 100% rename from socket.h rename to src/socket.h diff --git a/vban.h b/src/vban.h similarity index 100% rename from vban.h rename to src/vban.h