From 93bc3d342b9360d7f94a74ed30d389b273cddc41 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Sat, 8 Nov 2025 21:42:56 -0300 Subject: [PATCH 1/3] .gitignore: Update --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b2d7832..c1f1ed8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ # Editor backups *~ +*.sw? + From c6af21494d8369fa2b9f673ceedba59a6956b375 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Sat, 8 Nov 2025 21:54:14 -0300 Subject: [PATCH 2/3] configure.in: Rename to configure.ac --- configure.in => configure.ac | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename configure.in => configure.ac (100%) diff --git a/configure.in b/configure.ac similarity index 100% rename from configure.in rename to configure.ac From 1bfd4b97abf35129ac9573f018649973576dce39 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Wed, 10 Dec 2025 10:30:07 -0300 Subject: [PATCH 3/3] Update to run with current autotools --- Makefile.am | 8 +++--- README.md | 12 ++++++++ config.h.in | 20 +++++++------ configure.ac | 80 +++++++++++++++++++++++++++++++++------------------- xdr.c | 2 +- 5 files changed, 79 insertions(+), 43 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9c2bbf3..82e13fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,16 +19,16 @@ bin_PROGRAMS = trickle trickled tricklectl trickle_DEPENDENCIES = @ERRO@ $(LIBOBJS) trickle_SOURCES = trickle.c util.c getopt.c -trickle_LDADD = @ERRO@ $(LIBOBJS) +trickle_LDADD = @ERRO@ @RPCLIB@ $(LIBOBJS) trickled_SOURCES = trickled.c atomicio.c print.c bwstat.c client.c conf.c \ util.c cleanup.c getopt.c xdr.c -trickled_LDADD = @EVENTLIB@ $(LIBOBJS) +trickled_LDADD = @EVENTLIB@ @RPCLIB@ $(LIBOBJS) tricklectl_SOURCES = tricklectl.c trickledu.c atomicio.c xdr.c -tricklectl_LDADD = @ERRO@ $(LIBOBJS) +tricklectl_LDADD = @ERRO@ @RPCLIB@ $(LIBOBJS) -AM_CFLAGS = -Wall -Icompat @EVENTINC@ +AM_CFLAGS = -Wall -Icompat @EVENTINC@ @RPCINC@ overloaddir = $(libdir) overload_DATA = libtrickle.so diff --git a/README.md b/README.md index a455333..6a5e6b7 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,18 @@ Description trickle is a voluntary, cooperative bandwidth shaper. trickle works entirely in userland and is cross platform compatible. +Pre-Install +----------- + +Ubuntu: + +```bash +sudo apt install autoconf automake libtool +sudo apt install libevent-dev +sudo apt install libtirpc-dev + +``` + Install ------- diff --git a/config.h.in b/config.h.in index b6ad807..4f11a3a 100644 --- a/config.h.in +++ b/config.h.in @@ -1,4 +1,4 @@ -/* config.h.in. Generated from configure.in by autoheader. */ +/* config.h.in. Generated from configure.ac by autoheader. */ #undef socklen_t #undef u_int16_t #undef u_int32_t @@ -38,9 +38,6 @@ /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H @@ -62,6 +59,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -101,8 +101,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ @@ -133,10 +132,13 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS -/* Define to 1 if you can safely include both and . */ +/* Define to 1 if you can safely include both and . This + macro is obsolete. */ #undef TIME_WITH_SYS_TIME /* Version number of package */ @@ -145,7 +147,7 @@ /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define to `int' if does not define. */ +/* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define to `unsigned int' if does not define. */ diff --git a/configure.ac b/configure.ac index f12af2a..aba1672 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,8 @@ dnl $Id: configure.in,v 1.22 2004/02/13 06:14:01 marius Exp $ -AC_INIT([trickle], [1.07]) +AC_INIT([trickle],[1.07]) AC_CONFIG_SRCDIR([trickle.c]) -AC_CANONICAL_SYSTEM -dnl AC_LIBTOOL_DLOPEN +AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) @@ -12,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC -AM_PROG_LIBTOOL +LT_INIT([dlopen]) AC_PROG_MAKE_SET dnl intitialization @@ -43,15 +42,13 @@ dnl ugly ugly hack AC_CHECK_LIB(c, err, [ ERRO="" ], [ ERRO="err.o" ],) AC_SUBST(ERRO) -dnl Checks for header files. -AC_HEADER_STDC AC_HEADER_SYS_WAIT dnl Checks for pthread threadsafe="yes" AC_ARG_ENABLE([threadsafe], - [AC_HELP_STRING([--disable-threadsafe],[disable trickle thread safety (default enabled)])], + [AS_HELP_STRING([--disable-threadsafe],[disable trickle thread safety (default enabled)])], [threadsafe=$enableval] ) @@ -62,11 +59,8 @@ fi dnl Check for __progname; from OpenSSHp AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [ - AC_TRY_LINK([], - [ extern char *__progname; printf("%s", __progname); ], - [ ac_cv_libc_defines___progname="yes" ], - [ ac_cv_libc_defines___progname="no" ] - ) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ extern char *__progname; printf("%s", __progname); ]])],[ ac_cv_libc_defines___progname="yes" ],[ ac_cv_libc_defines___progname="no" + ]) ]) if test "x$ac_cv_libc_defines___progname" = "xyes" ; then AC_DEFINE(HAVE___PROGNAME) @@ -78,7 +72,20 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T -AC_HEADER_TIME +m4_warn([obsolete], +[Update your code to rely only on HAVE_SYS_TIME_H, +then remove this warning and the obsolete code below it. +All current systems provide time.h; it need not be checked for. +Not all systems provide sys/time.h, but those that do, all allow +you to include it and time.h simultaneously.])dnl +AC_CHECK_HEADERS_ONCE([sys/time.h]) +# Obsolete code to be removed. +if test $ac_cv_header_sys_time_h = yes; then + AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both + and . This macro is obsolete.]) +fi +# End of obsolete code. + AC_CHECK_TYPE(u_int64_t, unsigned long long) AC_CHECK_TYPE(u_int32_t, unsigned int) AC_CHECK_TYPE(u_int16_t, unsigned short) @@ -87,7 +94,19 @@ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t],[unsigned long],[])], [#incl dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL -AC_TYPE_SIGNAL +m4_warn([obsolete], +[your code may safely assume C89 semantics that RETSIGTYPE is void. +Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl +AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include +#include +], + [return *(signal (0, 0)) (0) == 1;])], + [ac_cv_type_signal=int], + [ac_cv_type_signal=void])]) +AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers + (`int' or `void').]) + AC_CHECK_FUNCS(socket) AC_REPLACE_FUNCS(strlcat strlcpy daemon setenv strsep) @@ -115,7 +134,7 @@ AC_ARG_WITH(libevent, EVENTINC="-I$withval" EVENTLIB="-L$withval -levent" else - AC_ERROR(event.h or libevent.a not found in $withval) + AC_MSG_ERROR(event.h or libevent.a not found in $withval) fi ;; esac ], @@ -127,7 +146,7 @@ then EVENTLIB="-levent" else AC_MSG_RESULT(no) - AC_ERROR(libevent not found) + AC_MSG_ERROR(libevent not found) fi AC_MSG_RESULT(yes) ] ) @@ -136,8 +155,7 @@ AC_SUBST(EVENTLIB) dnl check if underscores are needed AC_MSG_CHECKING(if underscores are needed for symbols) -AC_TRY_RUN( -#include +AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include int underscoreprobe(void) { return (31415); } @@ -154,14 +172,13 @@ main(int argc, char **argv) exit(0); exit(1); -}, [AC_MSG_RESULT(yes) - AC_DEFINE(DL_NEED_UNDERSCORE)], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) +}]])],[AC_MSG_RESULT(yes) + AC_DEFINE(DL_NEED_UNDERSCORE)],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) HAVEMETHOD=no AC_MSG_CHECKING(if we can access libc without dlopen) -AC_TRY_RUN( -#include +AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include int @@ -175,9 +192,9 @@ main(int argc, char **argv) exit(0); exit(1); -}, [AC_MSG_RESULT(yes) +}]])],[AC_MSG_RESULT(yes) AC_DEFINE(NODLOPEN) - HAVEMETHOD=yes], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) + HAVEMETHOD=yes],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) if test "$HAVEMETHOD" = "no"; then dnl ugly, ugly hack @@ -195,8 +212,7 @@ if test "$HAVEMETHOD" = "no"; then for TESTLIB in libc.so `echo $USRLIBCGUESS` `echo $LIBCGUESS` do AC_MSG_CHECKING(if we can access libc with $TESTLIB) - AC_TRY_RUN( - #include + AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include int @@ -208,9 +224,9 @@ if test "$HAVEMETHOD" = "no"; then exit(0); exit(1); - }, [AC_MSG_RESULT(yes) + }]])],[AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(DLOPENLIBC, "$TESTLIB") - HAVEMETHOD=yes], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) + HAVEMETHOD=yes],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) if test "$HAVEMETHOD" = "yes"; then break @@ -239,5 +255,11 @@ if test "$havesendfile" = "yes"; then AC_DEFINE(HAVE_SENDFILE, 1, [Define if your system has the sendfile system call]) fi -AC_OUTPUT(Makefile) +RPCINC="-I${prefix}/include/tirpc" +RPCLIB="-L${prefix}/lib -ltirpc -lc" +AC_SUBST(RPCINC) +AC_SUBST(RPCLIB) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/xdr.c b/xdr.c index ed8bf5b..a5ddbdb 100644 --- a/xdr.c +++ b/xdr.c @@ -7,7 +7,7 @@ * $Id: xdr.c,v 1.3 2003/06/01 18:39:12 marius Exp $ */ -#include +#include #include "message.h"