-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathconfigure.ac
128 lines (108 loc) · 4.22 KB
/
configure.ac
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
AC_INIT([notbit], 0.7)
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build/autotools])
AC_CONFIG_SRCDIR([src/main.c])
AM_CONFIG_HEADER([config.h])
AC_GNU_SOURCE
AC_PROG_CC
AC_PROG_LN_S
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz tar-ustar])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
NOTBIT_EXTRA_CFLAGS=""
NOTBIT_EXTRA_LIBS=""
AC_C_BIGENDIAN([AC_DEFINE([HAVE_BIG_ENDIAN], [1], [System is big-endian])],
[AC_DEFINE([HAVE_LITTLE_ENDIAN], [1],
[System is little-endian])])
alignof_name=""
AC_MSG_CHECKING([for alignof])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([const int thing = alignof (int);],
[(void) 0])],
[alignof_name="alignof"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for __alignof__])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([const int thing = __alignof__ (int);],
[(void) 0])],
[alignof_name="__alignof__"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AS_IF([test "x$alignof_name" = "x"],
[AC_MSG_ERROR([No operator for alignof found])])
AC_DEFINE_UNQUOTED([ALIGNOF_NAME], [$alignof_name],
[The name of the alignof operator])
have_sync_ref_count=yes
AC_MSG_CHECKING([for __sync_fetch_and_add])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int x;],
[__sync_fetch_and_add(&x, 1);])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
have_sync_ref_count=no])
AC_MSG_CHECKING([for __sync_fetch_and_sub])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int x;],
[__sync_fetch_and_sub(&x, 1);])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
have_sync_ref_count=no])
AS_IF([test "x$have_sync_ref_count" = "xyes"],
[AC_DEFINE([HAVE_SYNC_REF_COUNT], [1],
[GCC extensions for atomic ref-counting are available])])
AC_MSG_CHECKING([for _Static_assert])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Static_assert (1, "");],
[(void) 0])],
[AC_DEFINE([HAVE_STATIC_ASSERT], [1],
[Whether _Static_assert can be used or not])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
have_clock_gettime=no
AC_CHECK_FUNC([clock_gettime], [have_clock_gettime=yes])
AS_IF([test "x$have_clock_gettime" = "xno"],
[AC_CHECK_LIB([rt], [clock_gettime],
[NOTBIT_EXTRA_LIBS="$NOTBIT_EXTRA_LIBS -lrt"],
[clock_gettime required but not found])])
AC_CHECK_FUNCS([getpeereid])
dnl ============================================================
dnl Enable strict compiler flags
dnl ============================================================
# use strict compiler flags only when building from git; the rules for
# distcheck will take care of turning this on when making a release
m4_define([maintainer_default], [yes])
AC_ARG_ENABLE(
[maintainer-flags],
[AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes/error@:>@],
[Use strict compiler flags @<:@default=]maintainer_default[@:>@])],
[],
enable_maintainer_flags=maintainer_default
)
MAINTAINER_COMPILER_FLAGS="-Wall -Wcast-align -Wuninitialized
-Wno-strict-aliasing -Wempty-body -Wformat
-Wformat-security -Winit-self -Wundef
-Wpointer-arith -Wmissing-declarations"
AS_CASE(
[$enable_maintainer_flags],
[yes],
[
AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
],
[no],
[
],
[error],
[
MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror"
AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
],
[*],
[AC_MSG_ERROR([Invalid option for --enable-maintainer-flags])]
)
# strip leading spaces
NOTBIT_EXTRA_CFLAGS="$NOTBIT_EXTRA_CFLAGS ${MAINTAINER_CFLAGS#* }"
PKG_CHECK_MODULES(LIBCRYPTO, [libcrypto])
AC_SUBST(NOTBIT_EXTRA_CFLAGS)
AC_SUBST(NOTBIT_EXTRA_LIBS)
AC_CONFIG_FILES([
Makefile
build/Makefile
doc/Makefile
src/Makefile
])
AC_OUTPUT