]> jfr.im git - irc/rizon/znc.git/blob - configure.in
Increase the version number to 0.062
[irc/rizon/znc.git] / configure.in
1 dnl Keep the version number in sync with main.h!
2 AC_INIT([znc], [0.062])
3 AC_CONFIG_SRCDIR([znc.cpp])
4 AC_LANG([C++])
5
6 # AC_PROG_CXX sets CXXFLAGS to "-O2 -g" if it is unset which we don't want
7 CXXFLAGS="$CXXFLAGS "
8 AC_PROG_CXX
9 AC_CANONICAL_HOST
10
11 appendLib () {
12 if test "$LIBS" != ""; then
13 LIBS="$LIBS $*"
14 else
15 LIBS=$*
16 fi
17 }
18
19 appendCXX () {
20 if test "$CXXFLAGS" != ""; then
21 CXXFLAGS="$CXXFLAGS $*"
22 else
23 CXXFLAGS=$*
24 fi
25 }
26
27 appendMod () {
28 if test "$MODFLAGS" != ""; then
29 MODFLAGS="$MODFLAGS $*"
30 else
31 MODFLAGS=$*
32 fi
33 }
34
35 appendLD () {
36 if test "$LDFLAGS" != ""; then
37 LDFLAGS="$LDFLAGS $*"
38 else
39 LDFLAGS=$*
40 fi
41 }
42
43 appendCXX "-D_FORTIFY_SOURCE=2"
44
45 case "${host_os}" in
46 freebsd*)
47 # -D__GNU_LIBRARY__ makes this work on fbsd 4.11
48 appendCXX -I/usr/local/include -D__GNU_LIBRARY__
49 appendLib -L/usr/local/lib -lcompat
50 appendMod -L/usr/local/lib
51 ;;
52 solaris*)
53 appendLib -lsocket -lnsl
54 ISSUN=1
55 ;;
56 cygwin)
57 ISCYGWIN=1
58 ;;
59 darwin*)
60 ISDARWIN=1
61 ;;
62 esac
63
64 # cygwin
65 # warning: -fPIC ignored for target (all code is position independent)
66
67 if test -z "$ISCYGWIN" ; then
68 appendCXX -fPIC
69 fi
70
71 AC_ARG_WITH( [openssl],
72 AS_HELP_STRING([--with-openssl=DIR], [openssl's installation prefix]),
73 [OPENSSL=$withval],)
74 AC_ARG_ENABLE( [debug],
75 AS_HELP_STRING([--enable-debug], [enable debuging]),
76 [DEBUG="$enableval"],
77 [DEBUG="no"])
78 AC_ARG_ENABLE( [ipv6],
79 AS_HELP_STRING([--disable-ipv6], [disable ipv6 support]),
80 [IPV6="$enableval"],
81 [IPV6="yes"])
82 AC_ARG_ENABLE( [modules],
83 AS_HELP_STRING([--disable-modules], [disable modules]),
84 [MODULES="$enableval"],
85 [MODULES="yes"])
86 AC_ARG_ENABLE( [openssl],
87 AS_HELP_STRING([--disable-openssl], [disable openssl]),
88 [if test "$enableval" = "no" ; then NOSSL=1; fi],)
89 AC_ARG_ENABLE( [perl],
90 AS_HELP_STRING([--disable-perl], [disable perl]),
91 [if test "$enableval" = "no" ; then NOPERL=1; fi],)
92 AC_ARG_ENABLE( [sasl],
93 AS_HELP_STRING([--enable-sasl], [enable sasl]),
94 [if test "$enableval" = "yes" ; then SASL=1; fi],)
95 AC_ARG_ENABLE( [optimization],
96 AS_HELP_STRING([--disable-optimization], [Disable some compiler optimizations to
97 decrease memory usage while compiling]),
98 [OPTIMIZE="$enableval"],
99 [OPTIMIZE="yes"])
100
101 if test "$DEBUG" != "no"; then
102 appendCXX -ggdb -D_DEBUG
103 # These enable some debug options in g++'s STL, e.g. invalid use of iterators
104 appendCXX -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_CONCEPT_CHECKS
105 else
106 if test "x$OPTIMIZE" = "xyes"; then
107 appendCXX -O2
108 fi
109 fi
110
111 if test "$IPV6" != "no"; then
112 appendCXX -DHAVE_IPV6
113 fi
114
115 if test "x$GXX" = "xyes"; then
116 appendCXX -Wall -W -Wno-unused-parameter -Woverloaded-virtual -Wshadow
117 fi
118
119 AC_CHECK_LIB( gnugetopt, getopt_long,)
120 AC_CHECK_FUNCS( stat lstat chmod open, , AC_MSG_ERROR([missing required libc feature]))
121
122 if test -z "$NOSSL"; then
123 if test -n "$OPENSSL"; then
124 appendLib -L${OPENSSL}/lib
125 appendCXX -I${OPENSSL}/include
126 fi
127
128 # Don't reorder this!
129 # On some arches libssl depends on libcrypto without linking to it :(
130 AC_CHECK_LIB( crypto, BIO_new,,
131 AC_MSG_ERROR([could not find libcrypto. Try --disable-openssl or install the appropriate dependencies eg. libssl-dev.]), )
132 AC_CHECK_LIB( ssl, SSL_shutdown,,
133 AC_MSG_ERROR([could not find libssl. Try --disable-openssl or install the appropriate dependencies eg. libssl-dev.]), )
134
135 if test -z "$NOSSL"; then
136 appendCXX -DHAVE_LIBSSL
137 fi
138 fi
139
140 if test -z "$prefix" || test $prefix = "NONE"; then
141 prefix="/usr/local"
142 fi
143
144 AC_ARG_WITH( [module-prefix],
145 AS_HELP_STRING([--with-module-prefix], [module object code [[LIBDIR/znc]]]),
146 [MODDIR=$withval],
147 [MODDIR="${libdir}/znc"] )
148
149 AC_ARG_WITH( [module-data-prefix],
150 AS_HELP_STRING([--with-module-data-prefix=DIR],
151 [static module data (webadmin skins) [[DATADIR/znc]]]),
152 [DATADIR=$withval],
153 [DATADIR="${datadir}/znc"] )
154
155
156 if test "$MODULES" = "yes"; then
157 FOUND_DL=no
158
159 # Don't use any libs like -lssl -lcrypto when checking for dlopen(),
160 # because they might change the test results
161 SAVED_LIBS="$LIBS"
162 LIBS=""
163
164 AC_CHECK_FUNC(dlopen, FOUND_DL=yes,)
165 AC_CHECK_LIB( dl, dlopen, FOUND_DL=yes ; appendLib -ldl,)
166
167 appendLib "$SAVED_LIBS"
168
169 if test $FOUND_DL = "no" ; then
170 AC_MSG_ERROR([could not find dlopen. Try --disable-modules])
171 fi
172
173 appendCXX -D_MODULES
174 appendMod "$CXXFLAGS"
175
176 if test -z "$ISSUN" -a -z "$ISDARWIN"; then
177 # This is an unknown compiler flag on some OS
178 appendLD -Wl,--export-dynamic
179 fi
180 MODTARGET="modules"
181
182 # FIXME why do we need this for sun?
183 if test -n "$ISSUN"; then
184 appendMod -mimpure-text
185 fi
186
187 if test -z "$ISDARWIN"; then
188 MODLINK="-shared"
189 else
190 # Mac OS X differentiates between shared libs (-dynamiclib)
191 # and loadable modules (-bundle).
192 MODLINK="-bundle -flat_namespace -undefined suppress"
193 # TODO test if -twolevel_namespace and/or
194 # -undefined dynamic_lookup work
195 # (dynamic_lookup might only work on 10.4 and later)
196 fi
197
198 appendCXX "-D_MODDIR_=\\\"${MODDIR}\\\""
199 appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\""
200
201 if test -z "$NOPERL"; then
202 AC_PATH_PROG([PERL], [perl], [])
203 if test -n "$PERL"; then
204 AC_CHECK_LIB(perl, perl_alloc,unset NOPERL,
205 AC_MSG_ERROR([could not find libperl. Try --disable-perl]),
206 [`$PERL -MExtUtils::Embed -e ccopts -e ldopts`])
207 else
208 AC_MSG_ERROR([could not find perl binary. Try --disable-perl])
209 fi
210 fi
211
212 if test -n "$SASL"; then
213 AC_CHECK_LIB( sasl2, sasl_server_init,
214 [: Dont let autoconf add -lsasl2, Makefile handles that],
215 AC_MSG_ERROR([could not find libsasl2. Try --disable-sasl.]))
216 fi
217 fi
218
219 #
220 # Auto detect modules
221
222 AC_SUBST([CXXFLAGS])
223 AC_SUBST([CPPFLAGS])
224 AC_SUBST([MODFLAGS])
225 AC_SUBST([LDFLAGS])
226 AC_SUBST([LIBS])
227 AC_SUBST([MODLINK])
228 AC_SUBST([MODTARGET])
229 AC_SUBST([NOSSL])
230 AC_SUBST([PERL])
231 AC_SUBST([SASL])
232 AC_SUBST([MODDIR])
233 AC_SUBST([DATADIR])
234 AC_CONFIG_FILES([Makefile])
235 AC_CONFIG_FILES([znc-config])
236 AC_CONFIG_FILES([znc-buildmod])
237 AC_CONFIG_FILES([man/Makefile])
238 if test "$MODULES" = "yes"; then
239 AC_CONFIG_FILES([modules/Makefile])
240 fi
241 AC_OUTPUT
242
243 echo
244 echo znc AC_PACKAGE_VERSION configured
245 echo
246 echo "debug: $DEBUG"
247 echo "ipv6: $IPV6"
248 if test x"$NOSSL" = "x1" ; then
249 echo "openssl: no"
250 else
251 echo "openssl: yes"
252 fi
253 echo modules: $MODULES
254 if test x"$PERL" = "x" ; then
255 echo "perl: no"
256 else
257 echo "perl: yes"
258 fi
259 if test x"$SASL" = "x" ; then
260 echo "sasl: no"
261 else
262 echo "sasl: yes"
263 fi
264