summaryrefslogtreecommitdiff
path: root/configure.ac
blob: b88fc7512c4b58c53dfc2be9c1374284083b34cf (plain)
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
148
149
# configure.ac
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([bitz-server], [1.0.0], [https://github.com/uditha-atukorala/bitz-server/issues])
AC_CONFIG_AUX_DIR([aux-build])
AC_CONFIG_MACRO_DIR([aux-build/m4])
AC_CONFIG_HEADERS([include/config.h])

# Versioning rules ( C:R:A )
#
# 1. Start with version 0:0:0.
# 2. If any of the sources have changed, increment R. This is a new revision
#    of the current interface.
# 3. If the interface has changed, increment C and set R to 0. This is the
#    first revision of a new interface.
# 4. If the new interface is a superset of the previous interface
#    (that is, if the previous interface has not been broken by the
#    changes in this new release), increment A. This release is backwards
#    compatible with the previous release.
# 5. If the new interface has removed elements with respect to the
#    previous interface, then backward compatibility is broken; set A to 0.
#    This release has a new, but backwards incompatible interface.
#
# For more info see section 6.3 of the GNU Libtool Manual.
#
# In short;
# +1 : ? : +1  == new interface that does not break old one
# +1 : ? : 0   == new interface that breaks old one
#  ? : ? : 0   == no new interfaces, but breaks apps
#  ? :+1 : ?   == just some internal changes, nothing breaks but might work
#                 better
# CURRENT : REVISION : AGE

# lib versions
ICAP_LT_VERSION=1:0:0
AC_SUBST(ICAP_LT_VERSION)

# Init
AM_INIT_AUTOMAKE([foreign])
LT_INIT()

# Check for programs
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_MKDIR_P
AC_PROG_LIBTOOL

# Language
AC_LANG(C++)

# Options
AC_ARG_WITH([config],
	[AS_HELP_STRING([--with-config],
		[specify the config file to be used])],
	[], [with_config=no])

AC_ARG_ENABLE([modpy],
	[AS_HELP_STRING([--enable-modpy],[Enable modpy module (default is yes)])],
	[case "${enableval}" in
		yes) modpy=true ;;
		no)  modpy=false ;;
		*) AC_MSG_ERROR([bad value ${enableval} for --enable-modpy]) ;;
	esac],
	[modpy=true]
)
AM_CONDITIONAL([MODPY], [test x$modpy = xtrue])


# Checks for libraries
AM_PROG_LIBTOOL

PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([libconfig], [libconfig++ >= 1.4],,
	AC_MSG_ERROR([libconfig++ 1.4 or newer not found.])
)
PKG_CHECK_MODULES([log4cpp], [log4cpp >= 1.0],,
	AC_MSG_ERROR([log4cpp 1.0 or newer not found.])
)
PKG_CHECK_MODULES([psocksxx], [psocksxx >= 0.0.6],,
	AC_MSG_ERROR([psocksxx 0.0.6 or newer not found.])
)


# Checks for header files.
#AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/socket.h syslog.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_CHECK_FUNCS([gethostbyname inet_ntoa memmove memset select socket strchr strerror])

# conditional statements
AS_IF([test x$modpy = xtrue],
	[
		AM_PATH_PYTHON([2.7])
		AM_CHECK_PYTHON_HEADERS
		AM_CHECK_PYTHON_LIBS
	]
)

# defines / substitutes
AS_IF([test "x$with_config" != xno],
	AC_DEFINE_UNQUOTED([BITZ_SERVER_CONFIG_FILE],
		["$with_config"],
		[server configuration file]
	),
	[
		AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
		AC_DEFINE_UNQUOTED(
			[BITZ_SERVER_CONFIG_FILE],
			["${SYSCONFDIR}/bitz/bitz-server.conf"],
			[server configuration file]
		)
	]
)

# doxygen
AC_CHECK_PROGS([DOXYGEN], [doxygen], [false])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != xfalse])
AM_COND_IF([HAVE_DOXYGEN],,
	AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
)


AC_CONFIG_FILES([ \
	Makefile \
	conf/Makefile \
	doc/doxygen.cfg \
	doc/Makefile \
	include/Makefile \
	lib/Makefile \
	lib/icap/Makefile \
	src/Makefile \
	modules/Makefile \
	modules/echo/Makefile \
	modules/modpy/Makefile \
	modules/modpy/modules/Makefile \
])

AC_OUTPUT