configure.ac 4.8 KB

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