2 AC_INIT(stressapptest, 1.0.0_autoconf, opensource@gmail.com)
4 # Checking for target cpu and setting custom configuration
5 # for the different platforms
9 AC_DEFINE([STRESSAPPTEST_CPU_X86_64],[],
10 [Defined if the target CPU is x86_64])
13 AC_DEFINE([STRESSAPPTEST_CPU_I686],[],
14 [Defined if the target CPU is i686])
17 AC_DEFINE([STRESSAPPTEST_CPU_PPC],[],
18 [Defined if the target CPU is PowerPC])
22 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
23 AC_CONFIG_SRCDIR([src/])
24 AC_CONFIG_HEADER([src/stressapptest_config.h])
26 # Checks for programs.
30 #Getting user and host info
32 AC_MSG_CHECKING([user ID])
33 AC_MSG_RESULT([$username])
36 AC_MSG_CHECKING([host name])
37 AC_MSG_RESULT([$hostname])
40 AC_MSG_CHECKING([current timestamp])
41 AC_MSG_RESULT([$timestamp])
43 AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP],
44 "$username @ $hostname on $timestamp",
45 [Timestamp when ./configure was executed])
48 CXXFLAGS="$CXXFLAGS -DCHECKOPTS"
49 CXXFLAGS="$CXXFLAGS -Wreturn-type -Wunused -Wuninitialized -Wall"
50 CXXFLAGS="$CXXFLAGS -O3 -funroll-all-loops -funroll-loops -DNDEBUG"
52 # Checks for header files.
55 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])
57 # Checks for typedefs, structures, and compiler characteristics.
68 # Checking for pthreads
69 pthread_arg="not_available"
70 AC_MSG_CHECKING([which argument is required to compile pthreads])
72 pthread_header="#include<pthread.h>"
73 pthread_body="pthread_create(0,0,0,0)"
74 # Check if compile with no extra argument
75 AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
78 if test x"$pthread_arg" = x"not_available"; then
79 # At first, only -pthread was tested, but this is the place
80 # to add extra pthread flags if someone can test them
81 bkp_LDFLAGS="$LDFLAGS"
82 for altheader in -pthread; do
83 LDFLAGS="$bkp_LDFLAGS $altheader"
84 AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
85 pthread_arg="$altheader")
86 LDFLAGS="$bkp_LDFLAGS"
90 if test x"$pthread_arg" = x"not_available"; then
91 AC_MSG_FAILURE([Cannot find a proper pthread library])
93 if test x"$pthread_arg" = x; then
96 AC_MSG_RESULT([$pthread_arg])
98 LDFLAGS="$LDFLAGS $pthread_arg"
101 # Checks for library functions.
102 AC_FUNC_CLOSEDIR_VOID
103 AC_PROG_GCC_TRADITIONAL
104 AC_FUNC_SELECT_ARGTYPES
108 AC_CHECK_FUNCS([gettimeofday memset select socket strtol strtoull])
110 AC_CONFIG_FILES([Makefile src/Makefile])