1 dnl Keep the version number in sync with main.h!
2 AC_INIT([znc], [0.062])
3 AC_CONFIG_SRCDIR([znc.cpp])
6 # AC_PROG_CXX sets CXXFLAGS to "-O2 -g" if it is unset which we don't want
12 if test "$LIBS" != ""; then
20 if test "$CXXFLAGS" != ""; then
21 CXXFLAGS="$CXXFLAGS $*"
28 if test "$MODFLAGS" != ""; then
29 MODFLAGS="$MODFLAGS $*"
36 if test "$LDFLAGS" != ""; then
43 appendCXX "-D_FORTIFY_SOURCE=2"
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
53 appendLib -lsocket -lnsl
65 # warning: -fPIC ignored for target (all code is position independent)
67 if test -z "$ISCYGWIN" ; then
71 AC_ARG_WITH( [openssl],
72 AS_HELP_STRING([--with-openssl=DIR], [openssl's installation prefix]),
74 AC_ARG_ENABLE( [debug],
75 AS_HELP_STRING([--enable-debug], [enable debuging]),
78 AC_ARG_ENABLE( [ipv6],
79 AS_HELP_STRING([--disable-ipv6], [disable ipv6 support]),
82 AC_ARG_ENABLE( [modules],
83 AS_HELP_STRING([--disable-modules], [disable modules]),
84 [MODULES="$enableval"],
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"],
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
106 if test "x$OPTIMIZE" = "xyes"; then
111 if test "$IPV6" != "no"; then
112 appendCXX -DHAVE_IPV6
115 if test "x$GXX" = "xyes"; then
116 appendCXX -Wall -W -Wno-unused-parameter -Woverloaded-virtual -Wshadow
119 AC_CHECK_LIB( gnugetopt, getopt_long,)
120 AC_CHECK_FUNCS( stat lstat chmod open, , AC_MSG_ERROR([missing required libc feature]))
122 if test -z "$NOSSL"; then
123 if test -n "$OPENSSL"; then
124 appendLib -L${OPENSSL}/lib
125 appendCXX -I${OPENSSL}/include
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.]), )
135 if test -z "$NOSSL"; then
136 appendCXX -DHAVE_LIBSSL
140 if test -z "$prefix" || test $prefix = "NONE"; then
144 AC_ARG_WITH( [module-prefix],
145 AS_HELP_STRING([--with-module-prefix], [module object code [[LIBDIR/znc]]]),
147 [MODDIR="${libdir}/znc"] )
149 AC_ARG_WITH( [module-data-prefix],
150 AS_HELP_STRING([--with-module-data-prefix=DIR],
151 [static module data (webadmin skins) [[DATADIR/znc]]]),
153 [DATADIR="${datadir}/znc"] )
156 if test "$MODULES" = "yes"; then
159 # Don't use any libs like -lssl -lcrypto when checking for dlopen(),
160 # because they might change the test results
164 AC_CHECK_FUNC(dlopen, FOUND_DL=yes,)
165 AC_CHECK_LIB( dl, dlopen, FOUND_DL=yes ; appendLib -ldl,)
167 appendLib "$SAVED_LIBS"
169 if test $FOUND_DL = "no" ; then
170 AC_MSG_ERROR([could not find dlopen. Try --disable-modules])
174 appendMod "$CXXFLAGS"
176 if test -z "$ISSUN" -a -z "$ISDARWIN"; then
177 # This is an unknown compiler flag on some OS
178 appendLD -Wl,--export-dynamic
182 # FIXME why do we need this for sun?
183 if test -n "$ISSUN"; then
184 appendMod -mimpure-text
187 if test -z "$ISDARWIN"; then
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)
198 appendCXX "-D_MODDIR_=\\\"${MODDIR}\\\""
199 appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\""
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`])
208 AC_MSG_ERROR([could not find perl binary. Try --disable-perl])
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.]))
220 # Auto detect modules
228 AC_SUBST([MODTARGET])
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])
244 echo znc AC_PACKAGE_VERSION configured
248 if test x"$NOSSL" = "x1" ; then
253 echo modules: $MODULES
254 if test x"$PERL" = "x" ; then
259 if test x"$SASL" = "x" ; then