Add an initial autotools setup.

The main iperf binary is compiled, along with a static libiperf, the unit
tests, and a profiled iperf binary.

The tests, and the profiled iperf binary do not get installed.

To compile, run:

./bootstrap.sh
./configure
make

It has all the normal make options (they come mostly for free). e.g.:

You can run "make install" to install it.
You can run "make dist" which will create a distribution tarball.
You can run "make check" to run all the tests.

I backed up the existing Makefile as "src/Makefile.old" in case folks want to
use that still.
This commit is contained in:
AaronMatthewBrown 2009-12-08 21:36:24 +00:00
parent d768f73dce
commit f4a3ddaae6
8 changed files with 258 additions and 1 deletions

1
Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = src

47
bootstrap.sh Executable file
View File

@ -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

37
configure.ac Normal file
View File

@ -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])

107
src/Makefile.am Normal file
View File

@ -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

61
src/config.h.in Normal file
View File

@ -0,0 +1,61 @@
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> 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 <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> 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

View File

@ -9,6 +9,10 @@
#ifndef IPERF_H
#define IPERF_H
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
typedef uint64_t iperf_size_t;
struct iperf_interval_results

View File

@ -7,7 +7,7 @@
int
main(int argc, char **argv)
{
char *uuid;
char uuid[37];
get_uuid(uuid);
if (strlen(uuid) != 36)
{