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