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