• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  [*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  [*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])]
39)
40
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
43AS_CASE(["$host_os"],
44  [*linux*], [
45    OS_VERSION=linux
46    AC_DEFINE([STRESSAPPTEST_OS_LINUX],[],
47              [Defined if the target OS is Linux])
48    ],
49  [*darwin*], [
50    OS_VERSION=macosx
51    AC_DEFINE([STRESSAPPTEST_OS_DARWIN],[],
52              [Defined if the target OS is OSX])
53    ],
54  [*freebsd*], [
55    OS_VERSION=bsd
56    AC_DEFINE([STRESSAPPTEST_OS_BSD],[],
57              [Defined if the target OS is BSD based])
58    ],
59  [*netbsd*], [
60    OS_VERSION=bsd
61    AC_DEFINE([STRESSAPPTEST_OS_BSD],[],
62              [Defined if the target OS is BSD based])
63    ],
64  [AC_MSG_WARN([unsupported system: $host_os])]
65)
66
67AM_INIT_AUTOMAKE([-Wall -Werror foreign])
68AC_CONFIG_SRCDIR([src/])
69AC_CONFIG_HEADER([src/stressapptest_config.h])
70
71# Checks for programs.
72#  Don't generate CXXFLAGS defaults: if CXXFLAGS are unset
73#  AC_PROG_CXX will override them with unwanted defaults.
74CXXFLAGS="$CXXFLAGS"
75AC_PROG_CXX
76AC_PROG_CC
77
78#Getting user and host info
79username=$(whoami)
80AC_MSG_CHECKING([user ID])
81AC_MSG_RESULT([$username])
82
83hostname=$(uname -n)
84AC_MSG_CHECKING([host name])
85AC_MSG_RESULT([$hostname])
86
87timestamp=$(date)
88AC_MSG_CHECKING([current timestamp])
89AC_MSG_RESULT([$timestamp])
90
91AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP],
92                   "$username @ $hostname on $timestamp",
93                   [Timestamp when ./configure was executed])
94
95AC_ARG_ENABLE([default-optimizations],
96    [AS_HELP_STRING([--disable-default-optimizations], [Disable default optimization flag overrides])])
97AS_IF([test x"$enable_default_optimizations" != xno], [
98    #Default cxxflags
99    CXXFLAGS="$CXXFLAGS -DCHECKOPTS"
100    CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall"
101    CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops  -funroll-loops -DNDEBUG"
102])
103
104# Checks for header files.
105AC_HEADER_DIRENT
106AC_HEADER_STDC
107# Skip malloc.h to prevent redefinition of HAVE_MALLOC_H on some platforms
108AC_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.])])
109AC_CHECK_HEADERS([pthread.h])
110AC_SEARCH_LIBS([pthread_create], [pthread])
111AC_CHECK_TYPE([pthread_barrier_t], AC_DEFINE(HAVE_PTHREAD_BARRIERS, [1], [Define to 1 if the system has `pthread_barrier'.]))
112AC_CHECK_HEADERS([libaio.h])
113AC_SEARCH_LIBS([io_setup], [aio])
114AC_CHECK_HEADERS([sys/shm.h])
115AC_SEARCH_LIBS([shm_open], [rt])
116
117
118# Checks for typedefs, structures, and compiler characteristics.
119AC_HEADER_STDBOOL
120AC_C_CONST
121AC_C_INLINE
122AC_TYPE_PID_T
123AC_C_RESTRICT
124AC_TYPE_SIZE_T
125AC_TYPE_SSIZE_T
126AC_HEADER_TIME
127AC_TYPE_UINT16_T
128AC_C_VOLATILE
129
130
131# Checks for library functions.
132AC_FUNC_CLOSEDIR_VOID
133AC_PROG_GCC_TRADITIONAL
134AC_FUNC_SELECT_ARGTYPES
135AC_TYPE_SIGNAL
136AC_FUNC_STRERROR_R
137AC_FUNC_VPRINTF
138AC_CHECK_FUNCS([ftruncate gettimeofday memset munmap select socket strtol strtoull])
139AC_CHECK_FUNCS([mmap64 posix_memalign rand_r sched_getaffinity])
140
141AC_CONFIG_FILES([Makefile src/Makefile])
142AC_OUTPUT
143