From 492322211c6a432d000bc18fe57a659e910a05e5 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Wed, 20 Jul 2016 14:21:24 +0200 Subject: Adjust autoconf/make config for using gnulib + use config.h --- .gitignore | 2 + mcastseed/Makefile.am | 10 ++--- mcastseed/configure.ac | 41 +++++++++++++++----- mcastseed/lib/Makefile.am | 93 ++++++++++++++++++++++++++++++++++++++++++++++ mcastseed/src/Makefile.am | 1 + mcastseed/src/dgrambuf.c | 4 +- mcastseed/src/mcastleech.c | 1 + mcastseed/src/mcastseed.c | 1 + 8 files changed, 136 insertions(+), 17 deletions(-) create mode 100644 mcastseed/lib/Makefile.am diff --git a/.gitignore b/.gitignore index 32d416f..654fa13 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ mcastseed/src/Makefile.in mcastseed/src/*.o mcastseed/src/gmon.out mcastseed/src/gmon.txt +mcastseed/autoscan.log +mcastseed/configure.scan diff --git a/mcastseed/Makefile.am b/mcastseed/Makefile.am index 0f59806..b07663c 100644 --- a/mcastseed/Makefile.am +++ b/mcastseed/Makefile.am @@ -1,7 +1,5 @@ ## Process this file with automake to produce Makefile.in - - -SUBDIRS = \ - src - - +SUBDIRS = lib src +# For Gnulib +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = m4/gnulib-cache.m4 diff --git a/mcastseed/configure.ac b/mcastseed/configure.ac index ad1db27..e9e292f 100644 --- a/mcastseed/configure.ac +++ b/mcastseed/configure.ac @@ -1,14 +1,14 @@ -dnl Process this file with autoconf to produce a configure script. +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. -AC_INIT(mcastseeder, 0.1) +AC_PREREQ([2.69]) +AC_INIT(mcastseeder, 0.1, ludovic@pouzenc.fr) # Args deprecated http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation AM_INIT_AUTOMAKE #(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE - - AC_CANONICAL_HOST case $host_os in darwin*) @@ -23,8 +23,6 @@ case $host_os in ;; esac - - if test "$HOST_IS_WINDOWS" = "yes"; then WSOCKLIB="-lws2_32" AC_SUBST(WSOCKLIB) @@ -34,15 +32,38 @@ fi AM_CONDITIONAL(MINGW, [ test "$HOST_IS_WINDOWS" = "yes" ]) AM_CONDITIONAL(DARWIN, [ test "$HOST_IS_DARWIN" = "yes" ]) +# Checks for programs. AC_ISC_POSIX AC_HEADER_STDC AC_PROG_CPP AC_PROG_CC +# Gnulib +gl_EARLY AM_PROG_CC_STDC AM_PROG_CC_C_O +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([OS.h fcntl.h limits.h netdb.h stddef.h stdint.h stdlib.h string.h sys/socket.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T + +# Checks for library functions. +AC_FUNC_MALLOC +AC_CHECK_FUNCS([alarm memset select socket]) + +AC_CONFIG_FILES([Makefile + lib/Makefile + src/Makefile]) + +# Gnulib +gl_INIT -AC_OUTPUT([ -Makefile -src/Makefile -]) +AC_OUTPUT diff --git a/mcastseed/lib/Makefile.am b/mcastseed/lib/Makefile.am new file mode 100644 index 0000000..17e7205 --- /dev/null +++ b/mcastseed/lib/Makefile.am @@ -0,0 +1,93 @@ +## DO NOT EDIT! GENERATED AUTOMATICALLY! +## Process this file with automake to produce Makefile.in. +# Copyright (C) 2002-2016 Free Software Foundation, Inc. +# +# This file 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 file 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 file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl rbtree-oset + +AUTOMAKE_OPTIONS = 1.9.6 gnits + +SUBDIRS = +noinst_HEADERS = +noinst_LIBRARIES = +noinst_LTLIBRARIES = +EXTRA_DIST = +BUILT_SOURCES = +SUFFIXES = +MOSTLYCLEANFILES = core *.stackdump +MOSTLYCLEANDIRS = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = + +AM_CPPFLAGS = +AM_CFLAGS = + +noinst_LIBRARIES += libgnu.a + +libgnu_a_SOURCES = +libgnu_a_LIBADD = $(gl_LIBOBJS) +libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) +EXTRA_libgnu_a_SOURCES = + +## begin gnulib module oset + +libgnu_a_SOURCES += gl_oset.h gl_oset.c + +## end gnulib module oset + +## begin gnulib module rbtree-oset + +libgnu_a_SOURCES += gl_rbtree_oset.h gl_rbtree_oset.c gl_anytree_oset.h + +## end gnulib module rbtree-oset + +## begin gnulib module stdbool + +BUILT_SOURCES += $(STDBOOL_H) + +# We need the following in order to create when the system +# doesn't have one that works. +if GL_GENERATE_STDBOOL_H +stdbool.h: stdbool.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdbool.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdbool.h stdbool.h-t + +EXTRA_DIST += stdbool.in.h + +## end gnulib module stdbool + + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : diff --git a/mcastseed/src/Makefile.am b/mcastseed/src/Makefile.am index 7af38c9..1e3351c 100644 --- a/mcastseed/src/Makefile.am +++ b/mcastseed/src/Makefile.am @@ -1,5 +1,6 @@ ## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I ../lib AM_CFLAGS =\ -Wall \ -Wextra \ diff --git a/mcastseed/src/dgrambuf.c b/mcastseed/src/dgrambuf.c index e4c5e09..4863bb7 100644 --- a/mcastseed/src/dgrambuf.c +++ b/mcastseed/src/dgrambuf.c @@ -4,9 +4,10 @@ * Copyright 2016 by Ludovic Pouzenc */ #define _GNU_SOURCE /* See feature_test_macros(7) */ - #include "dgrambuf.h" +#include "config.h" + #include /* recvmmsg() _GNU_SOURCE */ #include /* calloc(), free(), qsort() */ #include /* perror() */ @@ -17,6 +18,7 @@ #include /* sigaction() */ #include /* alarm() */ #include /* SSIZE_MAX */ +#include "gl_rbtree_oset.h" /* Red-Black Tree Ordered Set, gnulib-tool --import rbtree-oset */ struct uint_pair { unsigned int index; diff --git a/mcastseed/src/mcastleech.c b/mcastseed/src/mcastleech.c index bbdcf20..9bba7aa 100644 --- a/mcastseed/src/mcastleech.c +++ b/mcastseed/src/mcastleech.c @@ -7,6 +7,7 @@ * http://cboard.cprogramming.com/showthread.php?t=67469 */ #define _GNU_SOURCE /* See feature_test_macros(7) */ +#include "config.h" #include /* close() */ #include /* fprintf(), stderr */ diff --git a/mcastseed/src/mcastseed.c b/mcastseed/src/mcastseed.c index 04d5575..3e8b50c 100644 --- a/mcastseed/src/mcastseed.c +++ b/mcastseed/src/mcastseed.c @@ -7,6 +7,7 @@ * http://cboard.cprogramming.com/showthread.php?t=67469 */ #define _GNU_SOURCE /* See feature_test_macros(7) */ +#include "config.h" #include /* close() */ #include /* fprintf(), stderr */ -- cgit v1.2.3