Skip to content

Commit

Permalink
Add an initial autotools setup.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AaronMatthewBrown committed Dec 8, 2009
1 parent d768f73 commit f4a3dda
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = src
47 changes: 47 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 37 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Initialize the autoconf system for the specified tool, version and mailing list
AC_INIT(iperf, 3.0a4, [email protected])

# 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 changes: 107 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
61 changes: 61 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/iperf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/t_uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
int
main(int argc, char **argv)
{
char *uuid;
char uuid[37];
get_uuid(uuid);
if (strlen(uuid) != 36)
{
Expand Down

0 comments on commit f4a3dda

Please sign in to comment.