From a6be1200567767c52814e81033db66a8b6eb2946 Mon Sep 17 00:00:00 2001 From: Luotao Fu Date: Wed, 15 Apr 2009 15:30:23 +0200 Subject: [PATCH 1/4] autotoolize iozone This one adds autoconf and automake buildsystem to iozone. It supports only linux platforms. The original handmade makefile was crappy, supports different *nix/macos/windows though. Signed-off-by: Luotao Fu --- Makefile.am | 3 + autogen.sh | 22 +++++++++ configure.ac | 111 ++++++++++++++++++++++++++++++++++++++++++++++++ src/current/Makefile.am | 28 ++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 src/current/Makefile.am Index: b/Makefile.am =================================================================== --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = \ + src/current + Index: b/autogen.sh =================================================================== --- /dev/null +++ b/autogen.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# +# usage: +# +# banner +# +banner() { + echo + TG=`echo $1 | sed -e "s,/.*/,,g"` + LINE=`echo $TG |sed -e "s/./-/g"` + echo $LINE + echo $TG + echo $LINE + echo +} + +banner "autoreconf" + +autoreconf --force --install --symlink -Wall || exit $? + +banner "Finished" Index: b/configure.ac =================================================================== --- /dev/null +++ b/configure.ac @@ -0,0 +1,111 @@ +AC_PREREQ(2.59) + +AC_INIT([iozone], [trunk], [bugs@pengutronix.de]) +AC_CONFIG_SRCDIR([src/current/iozone.c]) +AC_CANONICAL_BUILD +AC_CANONICAL_HOST + +IOZONE_CPPFLAGS="-Dunix -DHAVE_ANSIC_C -DASYNC_IO -DSHARED_MEM -Dlinux -D_LARGEFILE64_SOURCE" +case "$host_cpu" in + i[[3456]]86) IOZONE_CPPFLAGS="${IOZONE_CPPFLAGS} -DNAME='\"linux\"'";; + x86_64) IOZONE_CPPFLAGS="${IOZONE_CPPFLAGS} -DNAME='\"linux-AMD64\"' -D__AMD64__";; + powerpc*) IOZONE_CPPFLAGS="${IOZONE_CPPFLAGS} -DNAME='\"linux-powerpc\"'";; + arm*) IOZONE_CPPFLAGS="${IOZONE_CPPFLAGS} -DNAME='\"linux-arm\"' -DLINUX_ARM";; + *) AC_MSG_ERROR([unsupported CPU type]) ;; +esac +AC_SUBST(IOZONE_CPPFLAGS) + +AM_MAINTAINER_MODE + +CFLAGS="${CFLAGS} -W -Wall" + +# +# libtool library versioning stuff +# +# Library code modified: REVISION++ +# Interfaces changed/added/removed: CURRENT++ REVISION=0 +# Interfaces added: AGE++ +# Interfaces removed: AGE=0 +LT_CURRENT=0 +LT_REVISION=0 +LT_AGE=0 +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) + + +# +# Checks for programs. +# +AC_PROG_CC +AC_PROG_LIBTOOL + +AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2]) + + +# +# Debugging +# +AC_MSG_CHECKING([whether to enable debugging]) +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], [enable debugging @<:@default=no@:>@]), + [case "$enableval" in + y | yes) CONFIG_DEBUG=yes ;; + *) CONFIG_DEBUG=no ;; + esac], + [CONFIG_DEBUG=no]) +AC_MSG_RESULT([${CONFIG_DEBUG}]) +if test "${CONFIG_DEBUG}" = "yes"; then + CFLAGS="${CFLAGS} -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1" + AC_DEFINE(DEBUG, 1, [debugging]) +else + CFLAGS="${CFLAGS} -O2" +fi + + +# +# header file checks +# + +AC_CHECK_HEADER([pmap_clnt.h],[CFLAGS="${CFLAGS} -DHAVE_pmap_clnt_h"]) + + +# +# type checks +# + +AC_CHECK_TYPE([uint],[CFLAGS="${CFLAGS} -DHAVE_uint"]) +AC_CHECK_TYPE([uint64],[CFLAGS="${CFLAGS} -DHAVE_uint64"]) +AC_CHECK_TYPE([uint64_t],[CFLAGS="${CFLAGS} -DHAVE_uint64_t"]) +AC_CHECK_TYPE([int64],[CFLAGS="${CFLAGS} -DHAVE_int64"]) +AC_CHECK_TYPE([int64_t],[CFLAGS="${CFLAGS} -DHAVE_int64_t"]) +AC_CHECK_TYPE([socklen_t],[CFLAGS="${CFLAGS} -DHAVE_socklen_t"]) +AC_CHECK_TYPE([off64_t],[CFLAGS="${CFLAGS} -DHAVE_off64_t"]) + +AC_COMPILE_IFELSE( +[ + #include + main() { srand48(973); return (int)(1.0E9 * drand48()); } +], +[CFLAGS="${CFLAGS} -DHAVE_DRAND48"]) + +AC_COMPILE_IFELSE( +[ + #include + main() { srand(973); return (10 * rand()) / RAND_MAX; } +], +[CFLAGS="${CFLAGS} -DHAVE_RAND"]) + +AC_COMPILE_IFELSE( +[ + #include + main() { srandom(973); return (10 * random()) / RAND_MAX; } +], +[CFLAGS="${CFLAGS} -DHAVE_RANDOM"]) + +AC_CONFIG_FILES([ + Makefile + src/current/Makefile +]) +AC_OUTPUT + Index: b/src/current/Makefile.am =================================================================== --- /dev/null +++ b/src/current/Makefile.am @@ -0,0 +1,28 @@ +bin_PROGRAMS = \ + fileop \ + iozone + +AM_CPPFLAGS = + +EXTRA_DIST = \ + autogen.sh + +MAINTAINERCLEANFILES = \ + configure \ + aclocal.m4 \ + Makefile.in + +fileop_SOURCES = \ + fileop.c + +iozone_SOURCES = \ + libbif.c \ + libasync.c \ + iozone.c + +iozone_CPPFLAGS = \ + @IOZONE_CPPFLAGS@ + +iozone_LDADD = \ + -lpthread \ + -lrt