forked from pujo/lacewing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
132 lines (96 loc) · 2.79 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
129
130
131
AC_PREREQ([2.49])
AC_INIT([liblacewing], [0.5.3], [])
VERSION_MAJOR="0.5"
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Build a debug version of the library @<:@default=disabled@:>@])],
[enable_debug="$enableval"],
[enable_debug=no]
)
AC_ARG_ENABLE([spdy],
[AS_HELP_STRING([--enable-spdy],
[Enable SPDY support @<:@default=enabled@:>@])],
[enable_spdy="$enableval"],
[enable_spdy=yes]
)
AC_ARG_ENABLE([cxx],
[AS_HELP_STRING([--enable-cxx],
[Build the C++ wrappers @<:@default=enabled@:>@])],
[enable_cxx="$enableval"],
[enable_cxx=yes]
)
AC_ARG_ENABLE([ssl],
[AS_HELP_STRING([--enable-ssl],
[Build with SSL support @<:@default=enabled@:>@])],
[enable_ssl="$enableval"],
[enable_ssl=yes]
)
CFLAGS="$CFLAGS -DHAVE_CONFIG_H -Wno-deprecated-declarations"
if test "x$enable_debug" = xyes; then
CFLAGS="$CFLAGS -DDEBUG -D_lacewing_debug -g -O0"
else
CFLAGS="$CFLAGS -O2"
fi
if test "x$enable_cxx" = xyes; then
AC_PROG_CXX
AC_SUBST(ENABLE_CXX, 1)
fi
if test "x$enable_ssl" = xyes; then
AC_SUBST(ENABLE_SSL, 1)
else
CFLAGS="$CFLAGS -D_lacewing_no_ssl"
fi
SO_EXT="so"
if test "x$enable_spdy" = xyes; then
AC_SUBST(ENABLE_SPDY, 1)
AC_CHECK_LIB([z], [inflate])
else
CFLAGS="$CFLAGS -D_lacewing_no_spdy"
fi
if test "x$EXEEXT" = "x.exe"; then
AC_SUBST(PLATFORM, windows)
SO_EXT="dll"
LIBS="$LIBS -lmswsock -lws2_32 -lcrypt32 -lsecur32"
else
AC_SUBST(PLATFORM, unix)
if test "x$enable_ssl" = xyes; then
AC_CHECK_LIB([ssl], [SSL_library_init])
AC_SEARCH_LIBS([MD5_Init], [ssl crypto])
fi
CFLAGS="$CFLAGS -fPIC -fvisibility=hidden"
AC_CHECK_HEADERS([malloc.h sys/epoll.h sys/prctl.h sys/sendfile.h \
netdb.h sys/timerfd.h])
AC_CHECK_HEADERS([CoreServices/CoreServices.h], [[LIBS="$LIBS -framework CoreServices"]
[SO_EXT="dylib"]])
AC_CHECK_FUNCS([timegm kqueue vasprintf])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_DECLS([PR_SET_NAME], [], [], [AC_INCLUDES_DEFAULT
[#include <sys/prctl.h>]])
AC_CHECK_DECLS([TCP_CORK, TCP_NOPUSH, MSG_NOSIGNAL, SO_NOSIGPIPE], [], [], [AC_INCLUDES_DEFAULT
[#include <sys/socket.h>
#include <netinet/tcp.h>]])
AC_CHECK_DECLS([EPOLLRDHUP], [], [], [AC_INCLUDES_DEFAULT
[#include <sys/epoll.h>]])
fi
CXXFLAGS="$CFLAGS -fno-exceptions -fno-rtti"
CFLAGS="-std=gnu99 -Wall -Wno-format $CFLAGS"
SO_NAME=liblacewing.$SO_EXT.$VERSION_MAJOR
AC_SUBST(SO_NAME, $SO_NAME)
AC_SUBST(SO_EXT, $SO_EXT)
if test "x$host_alias" = "x"; then
AC_SUBST(AR, ar)
else
AC_SUBST(AR, $host_alias-ar)
fi
if test $SO_EXT = "so"; then
AC_SUBST(SONAME_FLAGS, [-Wl,-soname,$SO_NAME])
else
AC_SUBST(SONAME_FLAGS, [ ])
fi
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT