forked from rurban/cmph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
138 lines (129 loc) · 4.48 KB
/
configure.ac
File metadata and controls
138 lines (129 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
dnl Process this file with autoconf to produce a configure script.
AC_INIT([cmph], [2.1.0], [https://sourceforge.net/projects/cmph/support], [cmph],
[https://github.com/rurban/cmph/])
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
LT_INIT
dnl weed out MSVC
AC_PROG_CC_C99
AC_SYS_EXTRA_LARGEFILE
if test "x$ac_cv_prog_cc_c99" != "xno"; then
AC_DEFINE([HAVE_C99], 1,
[Define if the C compiler supports C99 for named initializers])
fi
if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
ac_cv_sys_largefile_CFLAGS=""
fi
if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
ac_cv_sys_largefile_LDFLAGS=""
fi
if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
ac_cv_sys_largefile_LIBS=""
fi
AC_MSG_CHECKING(for -march=native support)
if $(${CC} ${CFLAGS} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1)
then
AC_MSG_RESULT(yes)
ac_cv_march_native_CFLAGS=-march=native
NATIVE_ARCH=1
else
AC_MSG_RESULT(no)
NATIVE_ARCH=
fi
AC_SUBST(NATIVE_ARCH)
CFLAGS="$ac_cv_sys_largefile_CFLAGS $CFLAGS $ac_cv_march_native_CFLAGS"
LDFLAGS="$ac_cv_sys_largefile_LDFLAGS $LDFLAGS"
LIBS="$LIBS $ac_cv_sys_largefile_LIBS"
AC_CACHE_CHECK([for crc32c intrinsics],
ac_cv_crc32_hw, [
ac_cv_crc32_hw=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#if defined(__aarch64__)
# include "sse2neon.h"
#elif defined __SSE4_2__ && \
(defined __x86_64__ || defined __i686_64__ || defined _M_AMD64 || \
defined _M_IX86)
# include <smmintrin.h>
#endif]], [[
(void)_mm_crc32_u8(0L, 0L);
]])],
[ac_cv_crc32_hw=yes])
])
if test x$ac_cv_crc32_hw = xyes;
then
AC_DEFINE(HAVE_CRC32_HW, 1,
[Define if crc32c-ni is supported.])
fi
AM_CONDITIONAL([CRC32_HW], [test -n "$HAVE_CRC32_HW"])
dnl Checks for headers
AC_CHECK_HEADERS([stdint.h stdbool.h stdio.h stdlib.h string.h inttypes.h
unistd.h dlfcn.h strings.h getopt.h math.h sys/stat.h sys/types.h])
dnl Checks for libraries.
LT_LIB_M
LDFLAGS="$LIBS $LIBM $LDFLAGS"
CFLAGS="-Wall -Wextra $CFLAGS"
AC_PROG_CXX
CXXFLAGS="-Wall -Wno-unused-function -DNDEBUG -O3 -fomit-frame-pointer $CXXFLAGS"
AC_ENABLE_CXXMPH
if test x$cxxmph = xtrue; then
AC_COMPILE_STDCXX_0X
if test x$ac_cv_cxx_compile_cxx0x_native = "xno"; then
if test x$ac_cv_cxx_compile_cxx11_cxx = "xyes"; then
CXXFLAGS="$CXXFLAGS -std=c++11"
elif test x$ac_cv_cxx_compile_cxx0x_cxx = "xyes"; then
CXXFLAGS="$CXXFLAGS -std=c++0x"
elif test x$ac_cv_cxx_compile_cxx0x_gxx = "xyes"; then
CXXFLAGS="$CXXFLAGS -std=gnu++0x"
else
AC_MSG_ERROR("cxxmph demands a working c++0x compiler.")
fi
fi
AC_SUBST([CXXMPH], "cxxmph")
fi
AM_CONDITIONAL([USE_CXXMPH], [test "$cxxmph" = true])
AC_ENABLE_BENCHMARKS
if test x$benchmarks = xtrue; then
AC_LANG_PUSH([C++])
CXXFLAGS="$CXXFLAGS -I/usr/local/include/tsl"
AC_CHECK_HEADERS([hopscotch_map.h])
AC_LANG_POP([C++])
fi
AM_CONDITIONAL([USE_BENCHMARKS], [test "$benchmarks" = true])
# Unit tests based on the check library. Disabled by default.
# We do not use pkg-config because it is inconvenient for all developers to
# have check library installed.
AC_ARG_ENABLE(check, AS_HELP_STRING(
[--enable-check],
[Build unit tests depending on check library (default: disabled)]))
AS_IF([test "x$enable_check" = "xyes"],
[ old_LIBS="$LIBS"
AC_CHECK_LIB([check], [tcase_create])
AS_IF([test "$ac_cv_lib_check_tcase_create" = yes], [CHECK_LIBS="-lcheck"],
[AC_MSG_ERROR("Failed to find check library (http://check.sf.net).")])
AC_CHECK_HEADER(check.h,[],
[AC_MSG_ERROR("Failed to find check library header (http://check.sf.net).")])
case $CHECK_LIBS in
dnl wrong order
"-lsubunit -lcheck") CHECK_LIBS="-lcheck -lsubunit" ;;
*-lsubunit*) ;;
*) CHECK_LIBS="$CHECK_LIBS -lsubunit" ;;
esac
LIBS="$old_LIBS"
])
AM_CONDITIONAL([USE_LIBCHECK], [test "$ac_cv_lib_check_tcase_create" = yes])
AC_SUBST(CHECK_LIBS)
AC_SUBST(CHECK_CFLAGS)
AC_CHECK_SPOON
AC_CONFIG_FILES([Makefile src/Makefile cxxmph/Makefile tests/Makefile examples/Makefile docs/Makefile man/Makefile cmph.pc cxxmph.pc])
AC_CONFIG_FILES([tests/cmph_tests], [chmod +x tests/cmph_tests])
AC_CONFIG_FILES([tests/cmph_compile_tests], [chmod +x tests/cmph_compile_tests])
AC_CONFIG_FILES([tests/cmph_benchmark_tests], [chmod +x tests/cmph_benchmark_tests])
AC_CONFIG_FILES([tests/compile_run], [chmod +x tests/compile_run])
AC_OUTPUT