-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathconfigure.ac
147 lines (130 loc) · 3.98 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.60])
AC_INIT([LWQQ], [0.1], [[email protected]], [lwqq], [http://github.com/mathslinux/lwqq])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
# libtools
LT_INIT
AC_PROG_LIBTOOL
# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create])
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h\
stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h zlib.h])
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# checks for zlib
PKG_CHECK_MODULES(ZLIB, [zlib >= 1.2], [
AC_DEFINE(USE_ZLIB, 1, [Use ZLIB])
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
],
)
LIBEV_CFLAGS=""
LIBEV_LIBS=""
PKG_CHECK_MODULES([LIBEV], [libev], [], [
# no pkg-config for libev, searching manually:
AC_CHECK_HEADERS([ev.h],[
AC_CHECK_LIB([ev], [ev_time], [
LIBEV_LIBS="-lev"
],[
AC_MSG_ERROR([libev not found])
]
)],[
AC_MSG_ERROR([libev not found])
]
)
])
AC_SUBST([LIBEV_CFLAGS])
AC_SUBST([LIBEV_LIBS])
# checks for gtk+3.0
PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0], [
AC_DEFINE(USE_GTK, 1, [Use GTK])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
],
)
# checks for glib2.0
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30], [
AC_DEFINE(USE_GLIB, 1, [Use GLIB])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
],
)
# checks for libsqlite3
PKG_CHECK_MODULES(SQLITE3, [sqlite3 > 3.3], [
AC_DEFINE(USE_SQLITE3, 1, [Use sqlite3])
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)
] , [
echo ""
echo "configure: error: "
echo "libsqlite3 development headers not found."
echo ""
exit -1
])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
# AC_FUNC_STRNLEN
AC_CHECK_FUNCS([bzero gethostbyname memset mkdir select socket strstr strtol])
# Set build CFLAGS
CFLAGS="$CFLAGS -fno-strict-aliasing -Wall"
######################################################################
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror],[enable compilation abort on warning (default is no)])],
[if test "$enableval" == "yes"; then
CFLAGS="$CFLAGS -Werror"
fi
])
######################################################################
AC_ARG_ENABLE(async-http,
[AS_HELP_STRING([--enable-async-http], [Use asynchronous http translation])],
enable_async_http="$enableval", enable_async_http="no")
if test "x$enable_async_http" != "xno" ; then
PKG_CHECK_MODULES(CURL, [libcurl], [
AC_DEFINE(USE_CURL, 1, [Use CURL])
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)
] , [
echo ""
echo "configure: error: "
echo "libcurl development headers not found."
echo ""
exit -1
])
CFLAGS="$CFLAGS $CURL_CFLAGS -DUSE_ASYNC_HTTP"
LDFLAGS="$LDFLAGS $CURL_LIBS"
else
enable_async_http="no"
fi
AC_CONFIG_FILES([Makefile
src/Makefile
src/include/Makefile
src/include/lwqq/Makefile
src/liblwqq/Makefile
src/liblwqq/libghttp/Makefile
src/lwdb/Makefile
src/gui/Makefile
src/cli/Makefile
test/Makefile
icons/Makefile
icons/qqfaces/Makefile
icons/status/Makefile
])
AC_OUTPUT
echo ============================== OPTIONS ==============================
echo Build CFLAGS: $CFLAGS
echo Build LDFLAGS: $LDFLAGS
echo =====================================================================