chiark / gitweb /
Update to stressapptest 1.0.4
[stressapptest] / configure.ac
1 AC_PREREQ(2.61)
2 AC_INIT(stressapptest, 1.0.4_autoconf, opensource@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 AC_CANONICAL_BUILD
16 # Checking for target cpu and setting custom configuration
17 # for the different platforms
18 AC_CANONICAL_TARGET
19 case x"$target_cpu" in
20   "xx86_64")
21     AC_DEFINE([STRESSAPPTEST_CPU_X86_64],[],
22               [Defined if the target CPU is x86_64])
23     ;;
24   "xi686")
25     AC_DEFINE([STRESSAPPTEST_CPU_I686],[],
26               [Defined if the target CPU is i686])
27     ;;
28   "xpowerpc")
29     AC_DEFINE([STRESSAPPTEST_CPU_PPC],[],
30               [Defined if the target CPU is PowerPC])
31     ;;
32   "xarmv7a")
33     AC_DEFINE([STRESSAPPTEST_CPU_ARMV7A],[],
34               [Defined if the target CPU is armv7a])
35     ;;
36   *)
37     AC_MSG_ERROR([$target_cpu is not supported! Try x86_64, i686, powerpc, or armv7a])
38     ;;
39 esac
40
41 _os=`uname`
42 ## The following allows like systems to share settings. This is not meant to
43 ## imply that these OS are the same thing. From OpenOffice dmake configure.in
44 case "$_os" in
45   "Linux")
46     OS_VERSION=linux
47     AC_DEFINE([STRESSAPPTEST_OS_LINUX],[],
48               [Defined if the target OS is Linux])
49     ;;
50   "Darwin")
51     OS_VERSION=macosx
52     AC_DEFINE([STRESSAPPTEST_OS_DARWIN],[],
53               [Defined if the target OS is OSX])
54     ;;
55   "FreeBSD")
56     OS_VERSION=bsd
57     AC_DEFINE([STRESSAPPTEST_OS_BSD],[],
58               [Defined if the target OS is BSD based])
59     ;;
60   "NetBSD")
61     OS_VERSION=bsd
62     AC_DEFINE([STRESSAPPTEST_OS_BSD],[],
63               [Defined if the target OS is BSD based])
64     ;;
65   *)
66     AC_MSG_ERROR([$_os operating system is not suitable to build dmake!])
67     ;;
68 esac
69
70 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
71 AC_CONFIG_SRCDIR([src/])
72 AC_CONFIG_HEADER([src/stressapptest_config.h])
73
74 # Checks for programs.
75 #  Don't generate CXXFLAGS defaults: if CXXFLAGS are unset
76 #  AC_PROG_CXX will override them with unwanted defaults.
77 CXXFLAGS="$CXXFLAGS"
78 AC_PROG_CXX
79 AC_PROG_CC
80
81 #Getting user and host info
82 username=$(whoami)
83 AC_MSG_CHECKING([user ID])
84 AC_MSG_RESULT([$username])
85
86 hostname=$(uname -n)
87 AC_MSG_CHECKING([host name])
88 AC_MSG_RESULT([$hostname])
89
90 timestamp=$(date)
91 AC_MSG_CHECKING([current timestamp])
92 AC_MSG_RESULT([$timestamp])
93
94 AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP],
95                    "$username @ $hostname on $timestamp",
96                    [Timestamp when ./configure was executed])
97
98 #Default cxxflags
99 CXXFLAGS="$CXXFLAGS -DCHECKOPTS"
100 CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall -Wno-psabi"
101 CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops  -funroll-loops -DNDEBUG"
102
103 # Checks for header files.
104 AC_HEADER_DIRENT
105 AC_HEADER_STDC
106 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_MSG_FAILURE([Missing some header files.])])
107 AC_CHECK_HEADERS([pthread.h], [], [AC_MSG_FAILURE([Missing pthread.h.])])
108 AC_CHECK_HEADERS([libaio.h], [], [AC_MSG_FAILURE([Missing libaio.h.])])
109 AC_CHECK_HEADERS([sys/shm.h], [], [AC_MSG_FAILURE([Missing sys/shm.h from librt.])])
110
111 # Checks for typedefs, structures, and compiler characteristics.
112 AC_HEADER_STDBOOL
113 AC_C_CONST
114 AC_C_INLINE
115 AC_TYPE_PID_T
116 AC_C_RESTRICT
117 AC_TYPE_SSIZE_T
118 AC_HEADER_TIME
119 AC_TYPE_UINT16_T
120 AC_C_VOLATILE
121
122
123 # These are the libraries stressapptest requires to build.
124 # We'll check that they work, and fail otherwise.
125 # In the future we may provide for testing alternate
126 # arguments, but that's not necessary now.
127 LIBS="$LIBS -lrt -pthread -laio"
128
129 # Checking for pthreads
130 pthread_arg="not_available"
131 AC_MSG_CHECKING([if pthreads is supported])
132
133 pthread_header="#include<pthread.h>"
134 pthread_body="pthread_create(0,0,0,0)"
135 # Check if compile with no extra argument
136 AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
137 pthread_arg="")
138
139 if test x"$pthread_arg" = x"not_available"; then
140   AC_MSG_FAILURE([Cannot find a proper pthread library])
141 else
142   AC_MSG_RESULT([yes])
143 fi
144
145 # Checking for libaio
146 libaio_arg="not_available"
147 AC_MSG_CHECKING([if libaio is supported])
148
149 libaio_header="#include<libaio.h>"
150 libaio_body="io_submit(0,0,0)"
151 # Check if compile with no extra argument
152 AC_LINK_IFELSE([AC_LANG_PROGRAM($libaio_header, $libaio_body)],
153 libaio_arg="")
154
155 if test x"$libaio_arg" = x"not_available"; then
156   AC_MSG_FAILURE([Cannot find libaio library, please install libaio-dev])
157 else
158   AC_MSG_RESULT([yes])
159 fi
160
161 # Checking for librt
162 librt_arg="not_available"
163 AC_MSG_CHECKING([if librt is supported])
164
165 librt_header="#include<sys/shm.h>"
166 librt_body="shm_open(0, 0, 0)"
167 # Check if compile with no extra argument
168 AC_LINK_IFELSE([AC_LANG_PROGRAM($librt_header, $librt_body)],
169 librt_arg="")
170
171 if test x"$librt_arg" = x"not_available"; then
172   AC_MSG_FAILURE([Cannot find librt library])
173 else
174   AC_MSG_RESULT([yes])
175 fi
176
177
178 # Checks for library functions.
179 AC_FUNC_CLOSEDIR_VOID
180 AC_PROG_GCC_TRADITIONAL
181 AC_FUNC_SELECT_ARGTYPES
182 AC_TYPE_SIGNAL
183 AC_FUNC_STRERROR_R
184 AC_FUNC_VPRINTF
185 AC_CHECK_FUNCS([gettimeofday memset select socket strtol strtoull])
186
187 AC_CONFIG_FILES([Makefile src/Makefile])
188 AC_OUTPUT