1AC_PREREQ(2.61) 2AC_INIT([stressapptest], [1.0.9_autoconf], [opensource@google.com]) 3 4AC_ARG_WITH(static, [ --with-static enable static linking]) 5 6if test "$with_static" = "yes" 7then 8 AC_MSG_NOTICE([Compiling with staticaly linked libraries.]) 9 LIBS="$LIBS -static" 10else 11 AC_MSG_NOTICE([Compiling with dynamically linked libraries.]) 12fi 13 14AC_CANONICAL_HOST 15# Checking for target cpu and setting custom configuration 16# for the different platforms 17AS_CASE(["$host_cpu"], 18 [*x86_64*], [ 19 AC_DEFINE([STRESSAPPTEST_CPU_X86_64],[], 20 [Defined if the target CPU is x86_64]) 21 ], 22 [*i686*], [ 23 AC_DEFINE([STRESSAPPTEST_CPU_I686],[], 24 [Defined if the target CPU is i686]) 25 ], 26 [*mips*], [ 27 AC_DEFINE([STRESSAPPTEST_CPU_MIPS],[], 28 [Defined if the target CPU is MIPS]) 29 ], 30 [*powerpc*], [ 31 AC_DEFINE([STRESSAPPTEST_CPU_PPC],[], 32 [Defined if the target CPU is PowerPC]) 33 ], 34 [*armv7a*], [ 35 AC_DEFINE([STRESSAPPTEST_CPU_ARMV7A],[], 36 [Defined if the target CPU is armv7a]) 37 ], 38 [*aarch64*], [ 39 AC_DEFINE([STRESSAPPTEST_CPU_AARCH64],[], 40 [Defined if the target CPU is aarch64]) 41 ], 42[AC_MSG_WARN([Unsupported CPU: $host_cpu! Try x86_64, i686, mips, powerpc, armv7a, or aarch64])] 43) 44 45## The following allows like systems to share settings. This is not meant to 46## imply that these OS are the same thing. From OpenOffice dmake configure.in 47AS_CASE(["$host_os"], 48 [*linux*], [ 49 OS_VERSION=linux 50 AC_DEFINE([STRESSAPPTEST_OS_LINUX],[], 51 [Defined if the target OS is Linux]) 52 ], 53 [*darwin*], [ 54 OS_VERSION=macosx 55 AC_DEFINE([STRESSAPPTEST_OS_DARWIN],[], 56 [Defined if the target OS is OSX]) 57 ], 58 [*freebsd*], [ 59 OS_VERSION=bsd 60 AC_DEFINE([STRESSAPPTEST_OS_BSD],[], 61 [Defined if the target OS is BSD based]) 62 ], 63 [*netbsd*], [ 64 OS_VERSION=bsd 65 AC_DEFINE([STRESSAPPTEST_OS_BSD],[], 66 [Defined if the target OS is BSD based]) 67 ], 68 [AC_MSG_WARN([unsupported system: $host_os])] 69) 70 71AM_INIT_AUTOMAKE([-Wall -Werror foreign]) 72AC_CONFIG_SRCDIR([src/]) 73AC_CONFIG_HEADER([src/stressapptest_config.h]) 74 75# Checks for programs. 76# Don't generate CXXFLAGS defaults: if CXXFLAGS are unset 77# AC_PROG_CXX will override them with unwanted defaults. 78CXXFLAGS="$CXXFLAGS" 79AC_PROG_CXX 80AC_PROG_CC 81 82#Getting user and host info 83username=$(whoami) 84AC_MSG_CHECKING([user ID]) 85AC_MSG_RESULT([$username]) 86 87hostname=$(uname -n) 88AC_MSG_CHECKING([host name]) 89AC_MSG_RESULT([$hostname]) 90 91timestamp=$(date) 92AC_MSG_CHECKING([current timestamp]) 93AC_MSG_RESULT([$timestamp]) 94 95if test -n "$SOURCE_DATE_EPOCH" 96then 97 timestamp=$(date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null || date -u) 98 username=reproducible 99 hostname=reproducible 100fi 101 102AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP], 103 "$username @ $hostname on $timestamp", 104 [Timestamp when ./configure was executed]) 105 106AC_ARG_ENABLE([default-optimizations], 107 [AS_HELP_STRING([--disable-default-optimizations], [Disable default optimization flag overrides])]) 108AS_IF([test x"$enable_default_optimizations" != xno], [ 109 #Default cxxflags 110 CXXFLAGS="$CXXFLAGS -DCHECKOPTS" 111 CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall" 112 CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops -funroll-loops -DNDEBUG" 113]) 114 115AC_SYS_LARGEFILE 116 117# Checks for header files. 118AC_HEADER_DIRENT 119AC_HEADER_STDC 120# Skip malloc.h to prevent redefinition of HAVE_MALLOC_H on some platforms 121AC_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.])]) 122AC_CHECK_HEADERS([pthread.h]) 123AC_SEARCH_LIBS([pthread_create], [pthread]) 124AC_CHECK_TYPE([pthread_barrier_t], AC_DEFINE(HAVE_PTHREAD_BARRIERS, [1], [Define to 1 if the system has `pthread_barrier'.])) 125AC_CHECK_HEADERS([libaio.h]) 126AC_SEARCH_LIBS([io_setup], [aio]) 127AC_CHECK_HEADERS([sys/shm.h]) 128AC_SEARCH_LIBS([shm_open], [rt]) 129 130 131# Checks for typedefs, structures, and compiler characteristics. 132AC_HEADER_STDBOOL 133AC_C_CONST 134AC_C_INLINE 135AC_TYPE_PID_T 136AC_C_RESTRICT 137AC_TYPE_SIZE_T 138AC_TYPE_SSIZE_T 139AC_HEADER_TIME 140AC_TYPE_UINT16_T 141AC_C_VOLATILE 142 143 144# Checks for library functions. 145AC_FUNC_CLOSEDIR_VOID 146AC_PROG_GCC_TRADITIONAL 147AC_FUNC_SELECT_ARGTYPES 148AC_TYPE_SIGNAL 149AC_FUNC_STRERROR_R 150AC_FUNC_VPRINTF 151AC_CHECK_FUNCS([ftruncate gettimeofday memset munmap select socket strtol strtoull]) 152AC_CHECK_FUNCS([mmap64 posix_memalign rand_r sched_getaffinity]) 153 154AC_CONFIG_FILES([Makefile src/Makefile]) 155AC_OUTPUT 156