diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..af437a6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..93099c3 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# $Id: bootstrap.sh 446 2008-04-21 04:07:15Z boote $ +# +######################################################################### +# # +# Copyright (C) 2003 # +# Internet2 # +# All Rights Reserved # +# # +######################################################################### +# +# File: bootstrap +# +# Author: Jeff Boote +# Internet2 +# +# Date: Tue Sep 16 14:21:57 MDT 2003 +# +# Description: +# This script is used to bootstrap the autobuild +# process. +# +# RUNNING THIS SCRIPT IS NOT RECOMMENDED +# (You should just use the "configure" script +# that was bundled with the distribution if +# at all possible.) +# +case "$1" in + ac257) + alias autoconf=autoconf257 + alias autoheader=autoheader257 + alias automake=automake17 + alias aclocal=aclocal17 + export AUTOCONF=autoconf257 + ;; + *) + ;; +esac + +set -x +libtoolize --copy --force --automake +aclocal -I config +autoheader +automake --foreign --add-missing --copy +autoconf +rm -rf config.cache diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..d107b9d --- /dev/null +++ b/configure.ac @@ -0,0 +1,37 @@ +# Initialize the autoconf system for the specified tool, version and mailing list +AC_INIT(iperf, 3.0a4, iperf-users@lists.sourceforge.net) + +# Specify where the auxiliary files created by configure should go. The config +# directory is picked so that they don't clutter up more useful directories. +AC_CONFIG_AUX_DIR(config) + + +# Initialize the automake system +AM_INIT_AUTOMAKE + +AM_CONFIG_HEADER(src/config.h) + +AC_CANONICAL_HOST + +# Checks for tools: c compiler, ranlib (used for creating static libraries), +# symlinks and libtool +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LN_S +AC_PROG_LIBTOOL + +# Sets a conditional makefile variable so that certain Makefile tasks will be +# performed only on linux (currently, add -luuid to LD_FLAGS) +AM_CONDITIONAL([LINUX], [case $host_os in linux*) true;; *) false;; esac]) + +# Checks for header files. +AC_HEADER_STDC + +# Check for uuid.h and a valid libuuid +AC_CHECK_HEADER(uuid/uuid.h, ,AC_MSG_ERROR([uuid/uuid.h is not available])) +AC_CHECK_LIB(uuid, uuid_generate, ,AC_MSG_ERROR([libuuid is not available])) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +AC_OUTPUT([Makefile src/Makefile]) diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..d2a10fe --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,107 @@ +lib_LIBRARIES = libiperf.a # Build and install a static iperf library +bin_PROGRAMS = iperf3 # Build and install an iperf binary +noinst_PROGRAMS = t_timer t_units t_uuid iperf3_profile # Build, but don't install the test programs and a profiled version of iperf3 +include_HEADERS = iperf_api.h iperf_server_api.h # Defines the headers that get installed with the program + + +# Specify the source files and flags for the iperf library +libiperf_a_SOURCES = \ + iperf_api.c \ + iperf_server_api.c \ + iperf_tcp.c \ + iperf_udp.c \ + timer.c \ + net.c \ + tcp_window_size.c \ + units.c \ + uuid.c \ + tcp_info.c \ + locale.c \ + iperf_api.h \ + iperf.h \ + iperf_server_api.h \ + iperf_tcp.h \ + iperf_udp.h \ + locale.h \ + net.h \ + tcp_window_size.h \ + timer.h \ + units.h \ + uuid.h \ + version.h +libiperf_a_CFLAGS = -I../include + +# Specify the sources and various flags for the iperf binary +iperf3_SOURCES = main.c +iperf3_CFLAGS = -g -Wall +iperf3_LDADD = libiperf.a + +# Linux installs require the uuid library explicitly linked in +if LINUX +iperf3_LDFLAGS = -luuid +else +iperf3_LDFLAGS = +endif + +# Specify the sources and various flags for the profiled iperf binary. This +# binary recompiles all the source files to make sure they are all profiled. +iperf3_profile_SOURCES = main.c \ + iperf_api.c \ + iperf_server_api.c \ + iperf_tcp.c \ + iperf_udp.c \ + timer.c \ + net.c \ + tcp_window_size.c \ + units.c \ + uuid.c \ + tcp_info.c \ + locale.c \ + iperf_api.h \ + iperf.h \ + iperf_server_api.h \ + iperf_tcp.h \ + iperf_udp.h \ + locale.h \ + net.h \ + tcp_window_size.h \ + timer.h \ + units.h \ + uuid.h \ + version.h +iperf3_profile_CFLAGS = -pg -Wall +iperf3_profile_LDADD = libiperf.a + +# Linux installs require the uuid library explicitly linked in +if LINUX +iperf3_profile_LDFLAGS = -luuid +else +iperf3_profile_LDFLAGS = +endif + +# Specify the sources and various flags for the test cases +t_timer_SOURCES = t_timer.c +t_timer_CFLAGS = -g -Wall +t_timer_LDFLAGS = +t_timer_LDADD = libiperf.a + +t_units_SOURCES = t_units.c +t_units_CFLAGS = -g -Wall +t_units_LDFLAGS = +t_units_LDADD = libiperf.a + +t_uuid_SOURCES = t_uuid.c +t_uuid_CFLAGS = -g -Wall +t_uuid_LDFLAGS = +t_uuid_LDADD = libiperf.a + + + + +# Specify which tests to run during a "make check" +TESTS = \ + t_timer \ + t_units \ + t_uuid + +dist_man1_MANS = iperf.1 diff --git a/src/Makefile b/src/Makefile.old similarity index 100% rename from src/Makefile rename to src/Makefile.old diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..9e9fa68 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,61 @@ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `uuid' library (-luuid). */ +#undef HAVE_LIBUUID + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const diff --git a/src/iperf.h b/src/iperf.h index 1fcdc23..96d6222 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -9,6 +9,10 @@ #ifndef IPERF_H #define IPERF_H +#include +#include +#include + typedef uint64_t iperf_size_t; struct iperf_interval_results diff --git a/src/t_uuid.c b/src/t_uuid.c index 3714581..fb8ef4d 100644 --- a/src/t_uuid.c +++ b/src/t_uuid.c @@ -7,7 +7,7 @@ int main(int argc, char **argv) { - char *uuid; + char uuid[37]; get_uuid(uuid); if (strlen(uuid) != 36) {