X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=configure.ac;h=06b586850f3fe675de33be4b35dd947f4aab3474;hb=f06959bd6b25ca976e50abd739c3ecdfe5ea506d;hp=5011c89a503526720a6e600edc38a0b0f706620f;hpb=eea0aac32a3f522ea51d389f44dcd8abcfc5a6e0;p=stressapptest diff --git a/configure.ac b/configure.ac index 5011c89..06b5868 100644 --- a/configure.ac +++ b/configure.ac @@ -1,54 +1,68 @@ AC_PREREQ(2.61) -AC_INIT(stressapptest, 1.0.2_autoconf, opensource@google.com) +AC_INIT([stressapptest], [1.0.8_autoconf], [opensource@google.com]) + +AC_ARG_WITH(static, [ --with-static enable static linking]) + +if test "$with_static" = "yes" +then + AC_MSG_NOTICE([Compiling with staticaly linked libraries.]) + LIBS="$LIBS -static" +else + AC_MSG_NOTICE([Compiling with dynamically linked libraries.]) +fi AC_CANONICAL_HOST -AC_CANONICAL_BUILD # Checking for target cpu and setting custom configuration # for the different platforms -AC_CANONICAL_TARGET -case x"$target_cpu" in -"xx86_64") - AC_DEFINE([STRESSAPPTEST_CPU_X86_64],[], - [Defined if the target CPU is x86_64]) -;; -"xi686") - AC_DEFINE([STRESSAPPTEST_CPU_I686],[], - [Defined if the target CPU is i686]) -;; -"xpowerpc") - AC_DEFINE([STRESSAPPTEST_CPU_PPC],[], - [Defined if the target CPU is PowerPC]) -;; -esac - -_os=`uname` +AS_CASE(["$host_cpu"], + [*x86_64*], [ + AC_DEFINE([STRESSAPPTEST_CPU_X86_64],[], + [Defined if the target CPU is x86_64]) + ], + [*i686*], [ + AC_DEFINE([STRESSAPPTEST_CPU_I686],[], + [Defined if the target CPU is i686]) + ], + [*powerpc*], [ + AC_DEFINE([STRESSAPPTEST_CPU_PPC],[], + [Defined if the target CPU is PowerPC]) + ], + [*armv7a*], [ + AC_DEFINE([STRESSAPPTEST_CPU_ARMV7A],[], + [Defined if the target CPU is armv7a]) + ], + [*aarch64*], [ + AC_DEFINE([STRESSAPPTEST_CPU_AARCH64],[], + [Defined if the target CPU is aarch64]) + ], +[AC_MSG_WARN([Unsupported CPU: $host_cpu! Try x86_64, i686, powerpc, armv7a, or aarch64])] +) + ## The following allows like systems to share settings. This is not meant to ## imply that these OS are the same thing. From OpenOffice dmake configure.in -case "$_os" in - "Linux") - OS_VERSION=linux - AC_DEFINE([STRESSAPPTEST_OS_LINUX],[], - [Defined if the target OS is Linux]) - ;; - "Darwin") - OS_VERSION=macosx - AC_DEFINE([STRESSAPPTEST_OS_DARWIN],[], - [Defined if the target OS is OSX]) - ;; - "FreeBSD") - OS_VERSION=bsd - AC_DEFINE([STRESSAPPTEST_OS_BSD],[], - [Defined if the target OS is BSD based]) - ;; - "NetBSD") - OS_VERSION=bsd - AC_DEFINE([STRESSAPPTEST_OS_BSD],[], - [Defined if the target OS is BSD based]) - ;; - *) - AC_MSG_ERROR([$_os operating system is not suitable to build dmake!]) - ;; -esac +AS_CASE(["$host_os"], + [*linux*], [ + OS_VERSION=linux + AC_DEFINE([STRESSAPPTEST_OS_LINUX],[], + [Defined if the target OS is Linux]) + ], + [*darwin*], [ + OS_VERSION=macosx + AC_DEFINE([STRESSAPPTEST_OS_DARWIN],[], + [Defined if the target OS is OSX]) + ], + [*freebsd*], [ + OS_VERSION=bsd + AC_DEFINE([STRESSAPPTEST_OS_BSD],[], + [Defined if the target OS is BSD based]) + ], + [*netbsd*], [ + OS_VERSION=bsd + AC_DEFINE([STRESSAPPTEST_OS_BSD],[], + [Defined if the target OS is BSD based]) + ], + [AC_MSG_WARN([unsupported system: $host_os])] +) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_CONFIG_SRCDIR([src/]) @@ -75,19 +89,31 @@ AC_MSG_CHECKING([current timestamp]) AC_MSG_RESULT([$timestamp]) AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP], - "$username @ $hostname on $timestamp", - [Timestamp when ./configure was executed]) - -#Default cxxflags -CXXFLAGS="$CXXFLAGS -DCHECKOPTS" -CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall" -CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops -funroll-loops -DNDEBUG" + "$username @ $hostname on $timestamp", + [Timestamp when ./configure was executed]) + +AC_ARG_ENABLE([default-optimizations], + [AS_HELP_STRING([--disable-default-optimizations], [Disable default optimization flag overrides])]) +AS_IF([test x"$enable_default_optimizations" != xno], [ + #Default cxxflags + CXXFLAGS="$CXXFLAGS -DCHECKOPTS" + CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall" + CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops -funroll-loops -DNDEBUG" +]) # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h]) -AC_CHECK_HEADERS([pthread.h libaio.h]) +# Skip malloc.h to prevent redefinition of HAVE_MALLOC_H on some platforms +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h], [], [AC_MSG_FAILURE([Missing some header files.])]) +AC_CHECK_HEADERS([pthread.h]) +AC_SEARCH_LIBS([pthread_create], [pthread]) +AC_CHECK_TYPE([pthread_barrier_t], AC_DEFINE(HAVE_PTHREAD_BARRIERS, [1], [Define to 1 if the system has `pthread_barrier'.])) +AC_CHECK_HEADERS([libaio.h]) +AC_SEARCH_LIBS([io_setup], [aio]) +AC_CHECK_HEADERS([sys/shm.h]) +AC_SEARCH_LIBS([shm_open], [rt]) + # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL @@ -95,74 +121,12 @@ AC_C_CONST AC_C_INLINE AC_TYPE_PID_T AC_C_RESTRICT +AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_HEADER_TIME AC_TYPE_UINT16_T AC_C_VOLATILE -# Checking for pthreads -pthread_arg="not_available" -AC_MSG_CHECKING([which argument is required to compile pthreads]) - -pthread_header="#include" -pthread_body="pthread_create(0,0,0,0)" -# Check if compile with no extra argument -AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)], -pthread_arg="") - -if test x"$pthread_arg" = x"not_available"; then - # At first, only -pthread was tested, but this is the place - # to add extra pthread flags if someone can test them - bkp_LDFLAGS="$LDFLAGS" - for altheader in -pthread; do - LDFLAGS="$bkp_LDFLAGS $altheader" - AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)], - pthread_arg="$altheader") - LDFLAGS="$bkp_LDFLAGS" - done -fi - -if test x"$pthread_arg" = x"not_available"; then - AC_MSG_FAILURE([Cannot find a proper pthread library]) -else - if test x"$pthread_arg" = x; then - AC_MSG_RESULT([none]) - else - AC_MSG_RESULT([$pthread_arg]) - fi - LDFLAGS="$LDFLAGS $pthread_arg" -fi - -# Checking for libaio -libaio_arg="not_available" -AC_MSG_CHECKING([which argument is required to compile libaio]) - -libaio_header="#include" -libaio_body="io_submit(0,0,0)" -# Check if compile with no extra argument -AC_LINK_IFELSE([AC_LANG_PROGRAM($libaio_header, $libaio_body)], -libaio_arg="") - -if test x"$libaio_arg" = x"not_available"; then - bkp_LDFLAGS="$LDFLAGS" - for altheader in -laio; do - LDFLAGS="$bkp_LDFLAGS $altheader" - AC_LINK_IFELSE([AC_LANG_PROGRAM($libaio_header, $libaio_body)], - libaio_arg="$altheader") - LDFLAGS="$bkp_LDFLAGS" - done -fi - -if test x"$libaio_arg" = x"not_available"; then - AC_MSG_FAILURE([Cannot find libaio library, please install libaio-dev]) -else - if test x"$libaio_arg" = x; then - AC_MSG_RESULT([none]) - else - AC_MSG_RESULT([$libaio_arg]) - fi - LDFLAGS="$LDFLAGS $libaio_arg" -fi # Checks for library functions. AC_FUNC_CLOSEDIR_VOID @@ -171,7 +135,8 @@ AC_FUNC_SELECT_ARGTYPES AC_TYPE_SIGNAL AC_FUNC_STRERROR_R AC_FUNC_VPRINTF -AC_CHECK_FUNCS([gettimeofday memset select socket strtol strtoull]) +AC_CHECK_FUNCS([ftruncate gettimeofday memset munmap select socket strtol strtoull]) +AC_CHECK_FUNCS([mmap64 posix_memalign rand_r sched_getaffinity]) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT