2 AC_INIT(stressapptest, 1.0.1_autoconf, opensource@google.com)
6 # Checking for target cpu and setting custom configuration
7 # for the different platforms
11 AC_DEFINE([STRESSAPPTEST_CPU_X86_64],[],
12 [Defined if the target CPU is x86_64])
15 AC_DEFINE([STRESSAPPTEST_CPU_I686],[],
16 [Defined if the target CPU is i686])
19 AC_DEFINE([STRESSAPPTEST_CPU_PPC],[],
20 [Defined if the target CPU is PowerPC])
25 ## The following allows like systems to share settings. This is not meant to
26 ## imply that these OS are the same thing. From OpenOffice dmake configure.in
30 AC_DEFINE([STRESSAPPTEST_OS_LINUX],[],
31 [Defined if the target OS is Linux])
35 AC_DEFINE([STRESSAPPTEST_OS_DARWIN],[],
36 [Defined if the target OS is OSX])
40 AC_DEFINE([STRESSAPPTEST_OS_BSD],[],
41 [Defined if the target OS is BSD based])
45 AC_DEFINE([STRESSAPPTEST_OS_BSD],[],
46 [Defined if the target OS is BSD based])
49 AC_MSG_ERROR([$_os operating system is not suitable to build dmake!])
53 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
54 AC_CONFIG_SRCDIR([src/])
55 AC_CONFIG_HEADER([src/stressapptest_config.h])
57 # Checks for programs.
58 # Don't generate CXXFLAGS defaults: if CXXFLAGS are unset
59 # AC_PROG_CXX will override them with unwanted defaults.
64 #Getting user and host info
66 AC_MSG_CHECKING([user ID])
67 AC_MSG_RESULT([$username])
70 AC_MSG_CHECKING([host name])
71 AC_MSG_RESULT([$hostname])
74 AC_MSG_CHECKING([current timestamp])
75 AC_MSG_RESULT([$timestamp])
77 AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP],
78 "$username @ $hostname on $timestamp",
79 [Timestamp when ./configure was executed])
82 CXXFLAGS="$CXXFLAGS -DCHECKOPTS"
83 CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall"
84 CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops -funroll-loops -DNDEBUG"
86 # Checks for header files.
89 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])
91 # Checks for typedefs, structures, and compiler characteristics.
102 # Checking for pthreads
103 pthread_arg="not_available"
104 AC_MSG_CHECKING([which argument is required to compile pthreads])
106 pthread_header="#include<pthread.h>"
107 pthread_body="pthread_create(0,0,0,0)"
108 # Check if compile with no extra argument
109 AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
112 if test x"$pthread_arg" = x"not_available"; then
113 # At first, only -pthread was tested, but this is the place
114 # to add extra pthread flags if someone can test them
115 bkp_LDFLAGS="$LDFLAGS"
116 for altheader in -pthread; do
117 LDFLAGS="$bkp_LDFLAGS $altheader"
118 AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
119 pthread_arg="$altheader")
120 LDFLAGS="$bkp_LDFLAGS"
124 if test x"$pthread_arg" = x"not_available"; then
125 AC_MSG_FAILURE([Cannot find a proper pthread library])
127 if test x"$pthread_arg" = x; then
128 AC_MSG_RESULT([none])
130 AC_MSG_RESULT([$pthread_arg])
132 LDFLAGS="$LDFLAGS $pthread_arg"
135 # Checks for library functions.
136 AC_FUNC_CLOSEDIR_VOID
137 AC_PROG_GCC_TRADITIONAL
138 AC_FUNC_SELECT_ARGTYPES
142 AC_CHECK_FUNCS([gettimeofday memset select socket strtol strtoull])
144 AC_CONFIG_FILES([Makefile src/Makefile])