-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
114 lines (95 loc) · 3.02 KB
/
configure.in
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT(libircclient, 1.3, gyunaev@ulduzsoft.com)
AC_CONFIG_SRCDIR([include/libircclient.h])
AC_CONFIG_HEADER([src/config.h])
# Check for command-line
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[compile with debug information (no)])],
[use_debug=$enableval],
[use_debug=no])
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared],
[build a shared library (no)])],
[build_shared=$enableval],
[build_shared=no])
AC_ARG_ENABLE([threads],
[AS_HELP_STRING([--enable-threads],
[compile with multithread support (yes)])],
[use_threads=$enableval],
[use_threads=yes])
AC_ARG_ENABLE([ipv6],
[AS_HELP_STRING([--enable-ipv6],
[compile with IPv6 support (no)])],
[use_ipv6=$enableval],
[use_ipv6=no])
AC_ARG_ENABLE([openssl],
[AS_HELP_STRING([--enable-openssl],
[compile with OpenSSL support (no)])],
[use_openssl=$enableval],
[use_openssl=no])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_CHECK_TOOL(AR, ar, :)
AC_PROG_RANLIB
# Checks for header files.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_CHECK_FUNCS([localtime_r socket])
AC_CHECK_LIB(socket, socket, AC_DEFINE(HAVE_SOCKET) LIBS="$LIBS -lsocket")
if test "$use_debug" = "yes"; then
CFLAGS="${CFLAGS} -g -DENABLE_DEBUG"
else
CFLAGS="${CFLAGS} -O3"
fi
# Choosing the target
TARGET="static"
if test "$build_shared" = "yes"; then
CFLAGS="$CFLAGS -fpic"
TARGET="shared"
fi
if test "$use_ipv6" = "yes"; then
AC_CHECK_FUNCS([getaddrinfo inet_pton])
AC_CHECK_LIB(nsl, getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) LIBS="$LIBS -lnsl")
CFLAGS="$CFLAGS -DENABLE_IPV6"
else
AC_CHECK_FUNCS([gethostbyname_r inet_ntoa])
AC_CHECK_LIB(nsl, inet_ntoa, AC_DEFINE(HAVE_INET_NTOA) LIBS="$LIBS -lnsl")
fi
if test "$use_threads" = "yes"; then
CFLAGS="$CFLAGS -DENABLE_THREADS -D_REENTRANT"
fi
# Checking for mingw
AC_MSG_CHECKING([For MinGW32])
case "$host" in
*-*-mingw*)
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -DWIN32_DLL"
LIBS="$LIBS -lz -lwsock32 -lgdi32 -lkernel32" # for openssl
TARGET="shared_mingw"
;;
*) AC_MSG_RESULT([no]) ;;
esac
if test "$use_openssl" = "yes"; then
AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([OpenSSL not found])])
AC_CHECK_LIB(ssl, [SSL_library_init], [], [AC_MSG_ERROR([OpenSSL not found])])
AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([OpenSSL headers not found; did you install the -dev package?])])
CFLAGS="$CFLAGS -DENABLE_SSL"
fi
AC_SUBST(TARGET)
AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
AC_SUBST(PREFIX)
AC_CONFIG_FILES([examples/Makefile src/Makefile])
AC_OUTPUT