Austin Schuh | 24adb6b | 2015-09-06 17:37:40 -0700 | [diff] [blame] | 1 | m4_include([scripts/c++11.m4]) |
| 2 | |
| 3 | AC_PREREQ(2.63) |
| 4 | AC_INIT([SeaSocks], [0.1], [matt@godbolt.org], [], [https://github.com/mattgodbolt/seasocks]) |
| 5 | AC_CONFIG_SRCDIR([src/main/c/seasocks/Server.h]) |
| 6 | |
| 7 | AC_ARG_WITH([gmock], |
| 8 | [AS_HELP_STRING([--with-gmock], |
| 9 | [Build tests too, with supplied gmock directory. SeaSocks will |
| 10 | build gmock and its embedded gtest automatically])], |
| 11 | [], |
| 12 | [AC_MSG_WARN([dnl |
| 13 | Building without tests enabled. Use --with-gmock=PATH_TO_GMOCK])]) |
| 14 | |
| 15 | AS_IF([test "x${with_gmock}" != "xno" -a "x${with_gmock}" != "x"], |
| 16 | [ |
| 17 | AS_IF([test -e "${with_gmock}/include/gmock/gmock.h"], |
| 18 | [GMOCK_DIR="${with_gmock}"], |
| 19 | [AC_MSG_ERROR([dnl |
| 20 | Unable to locate gmock source at '${with_gmock}'.])]) |
| 21 | ]) |
| 22 | AC_SUBST(GMOCK_DIR) |
| 23 | |
| 24 | dnl Basic setup |
| 25 | AC_LANG(C++) |
| 26 | AC_PROG_CC |
| 27 | AC_PROG_CPP |
| 28 | AC_PROG_CXX |
| 29 | AX_CXX_COMPILE_STDCXX_11([noext]) |
| 30 | AC_DEFUN([AX_CXX_CHECK_UNORDERED_MAP_EMPLACE], [ |
| 31 | AC_LANG_PUSH([C++]) |
| 32 | AC_MSG_CHECKING([whether std::unordered_map supports emplace]) |
| 33 | AC_COMPILE_IFELSE([AC_LANG_SOURCE[ |
| 34 | #include <unordered_map> |
| 35 | void test() { std::unordered_map<int, int> a; a.emplace(2,3); } |
| 36 | ]], |
| 37 | [eval unordered_map_emplace=yes],[eval unordered_map_emplace=no]) |
| 38 | AC_MSG_RESULT([$unordered_map_emplace]) |
| 39 | AC_LANG_POP([C++]) |
| 40 | if test x$unordered_map_emplace = xyes; then |
| 41 | AC_DEFINE(HAVE_UNORDERED_MAP_EMPLACE,1, [define if unordered_map supports emplace]) |
| 42 | fi |
| 43 | AC_SUBST(HAVE_UNORDERED_MAP_EMPLACE) |
| 44 | ]) |
| 45 | AX_CXX_CHECK_UNORDERED_MAP_EMPLACE |
| 46 | AC_PATH_PROG(VALGRIND, valgrind) |
| 47 | |
| 48 | dnl Basic headers and features |
| 49 | AC_HEADER_STDBOOL |
| 50 | AC_C_INLINE |
| 51 | AC_TYPE_PID_T |
| 52 | AC_C_RESTRICT |
| 53 | AC_TYPE_SIZE_T |
| 54 | AC_TYPE_UINT16_T |
| 55 | AC_TYPE_UINT32_T |
| 56 | AC_TYPE_UINT64_T |
| 57 | AC_TYPE_UINT8_T |
| 58 | AC_FUNC_ERROR_AT_LINE |
| 59 | AC_FUNC_FORK |
| 60 | AC_FUNC_STRERROR_R |
| 61 | AC_CHECK_TYPES([ptrdiff_t]) |
| 62 | |
| 63 | dnl pthreads; better if we detect this somehow |
| 64 | CXXFLAGS="$CXXFLAGS -pthread" |
| 65 | |
| 66 | dnl System headers and functions used |
| 67 | AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h unistd.h getopt.h]) |
| 68 | AC_CHECK_FUNCS([dup2 eventfd syscall gethostname memset rmdir socket sqrt strcasecmp strchr strdup strerror getopt]) |
| 69 | |
| 70 | AC_CONFIG_HEADERS([src/main/c/internal/Config.h]) |
| 71 | AC_OUTPUT([Makefile]) |