2 # Process this file with autoconf to produce a configure script.
4 # This file is part of the aMule Project.
6 # Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
8 # Any parts of this program derived from the xMule, lMule or eMule project,
9 # or contributed by third-party developers are copyrighted by their
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 AC_INIT([aMule],[SVN],[admin@amule.org])
32 AC_CONFIG_SRCDIR([src/amule.cpp])
33 AC_CONFIG_HEADERS([config.h])
36 dnl Check host system.
39 dnl Checks for programs.
40 dnl Workaround for these checks may alter CFLAGS and CXXFLAGS, especially if they were empty
42 MULE_BACKUP([CXXFLAGS])
43 MULE_BACKUP([BUILD_CFLAGS])
48 AS_IF([test "$cross_compiling" = yes], [AC_PROG_BUILD_CC], [BUILD_CC="$CC" ; BUILD_EXEEXT=$EXEEXT])
49 MULE_RESTORE([CFLAGS])
50 MULE_RESTORE([CXXFLAGS])
51 MULE_RESTORE([BUILD_CFLAGS])
60 dnl Find the right ranlib, even when cross-compiling
61 dnl And for some other tools for cross compilation
62 AC_CHECK_TOOL(RANLIB, ranlib)
63 AC_CHECK_TOOL(STRIP, strip)
67 dnl Selectable components
68 MULE_ARG_ENABLE([monolithic], [yes], [disable building of the monolithic aMule app], [MONOLITHIC])
69 MULE_ARG_ENABLE([amule-daemon], [no], [compile aMule daemon version], [AMULE_DAEMON])
70 MULE_ARG_ENABLE([amulecmd], [no], [compile aMule command line client], [COMPILE_CMD])
71 MULE_ARG_ENABLE([webserver], [no], [compile aMule WebServer], [WEB])
72 MULE_ARG_ENABLE([amule-gui], [no], [compile aMule remote GUI (EXPERIMENTAL)], [AMULE_GUI])
73 MULE_ARG_ENABLE([cas], [no], [compile C aMule Statistics], [CAS])
74 MULE_ARG_ENABLE([wxcas], [no], [compile aMule GUI Statistics], [WXCAS])
75 MULE_ARG_ENABLE([ed2k], [yes], [don't compile aMule ed2k links handler], [ED2K])
76 MULE_ARG_ENABLE([alc], [no], [compile aMuleLinkCreator GUI version], [ALC])
77 MULE_ARG_ENABLE([alcc], [no], [compile aMuleLinkCreator for console], [ALCC])
78 MULE_ARG_ENABLE([xas], [no], [install xas XChat2 plugin], [XAS])
79 MULE_ARG_ENABLE([fileview], [no], [compile aMule file viewer for console (EXPERIMENTAL)], [FILEVIEW])
80 MULE_ARG_ENABLE([plasmamule], [no], [compile aMule plasma applet and engine])
82 # Run all the tests with static linkage if we want a statically linked binary
83 MULE_ARG_ENABLE([static], [no], [produce a statically linked executable])
84 MULE_IF_ENABLED([static], [MULE_APPEND([LDFLAGS], [-static])])
89 # Default is yes, because they're most likely compatible.
90 # However, this is only used when cross-compiling.
93 [AS_HELP_STRING([--without-gnu-malloc],
94 [Don't assume that we use GNU libc compatible malloc/realloc when cross-compiling])],
95 [gnumalloc=$withval], [gnumalloc=yes])
98 # Checking for libs before all other stuff to break
99 # configure as soon as possible in case of a missing one
100 # to avoid losing too much time
103 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amulecmd, webserver, amule-gui],
104 [MULE_CHECK_ZLIB([1.1.4],, [AC_MSG_ERROR([zlib >= 1.1.4 is required for aMule])])])
106 MULE_IF_ENABLED([cas], [
108 MULE_CHECK_GDLIB([2.0.0], [
110 MULE_PREPEND([GDLIB_LIBS], [-lgd])
112 AS_IF([test -z "$CAS_DEFS"],
114 [gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found.
115 Please check that gdlib-config is in your default path, check out LD_LIBRARY_PATH or equivalent variable.
116 Or this might also be that your gdlib-config has other name.
117 Please try again with --with-gdlib-config=/usr/bin/gdlib-config (replace /usr/bin/gdlib-config with a valid path to your gdlib-config).
118 If you use compiled packages check if you have devel pack installed.
119 To download the latest version check http://www.boutell.com/gd for sources.])])
121 AC_SUBST([CAS_DEFS])dnl
123 MULE_IF_ENABLED([webserver],
124 [MULE_CHECK_LIBPNG([1.2.0], [AMULEWEB_DEFS="-DWITH_LIBPNG"], [
126 [libpng >= 1.2.0 not found.
127 amuleweb will be compiled but file download progress bar images will NOT be generated.])
130 AC_SUBST([AMULEWEB_DEFS])dnl
132 # Check for perl File::Copy
133 AC_MSG_CHECKING([for File::Copy])
134 AS_IF([perl -e "require File::Copy" 2>/dev/null], [AC_MSG_RESULT([ok])],
136 [File::Copy perl module is required by the mldonkey_importer script.
137 If you want to use this script please install File::Copy from CPAN.])])
139 # Check if we need to install skins
140 MULE_IF_ENABLED_ANY([monolithic, amule-gui], [INSTALL_SKINS=yes], [INSTALL_SKINS=no])
142 # Check for GeoIP (required for IP2Country capability)
143 MULE_IF_ENABLED_ANY([monolithic, amule-gui], [MULE_CHECK_GEOIP])
146 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amule-gui, amulecmd, webserver, alc, alcc, wxcas, fileview],
148 WX_STANDARD_OPTIONS([toolkit,wxshared,wxdebug,wxversion])
149 # Force using a static wxWidgets library if the executable is to be linked statically.
150 MULE_IF_ENABLED([static], [WX_SHARED=0])
151 # Force using a unicode build of the library
152 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amule-gui, amulecmd, webserver, fileview], [WX_UNICODE=1])
154 WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
155 WX_CONFIG_CHECK([2.8.8], [wxWin=1],,, [$WXCONFIG_FLAGS])
156 AS_IF([test "$wxWin" != 1],
158 wxWidgets must be installed on your system but wx-config
159 script couldn't be found. Please check that wx-config is
160 in path or specified by --with-wx-config=path flag, the
161 directory where wxWidgets libraries are installed (returned
162 by 'wx-config --libs' command) is in LD_LIBRARY_PATH or
163 equivalent variable and wxWidgets version is 2.8.8 or above.
166 AS_IF([test "${WX_VERSION_FULL}" = "2.9.0"], [AC_MSG_ERROR([
167 This version of wxWidgets is known to not work with aMule.
168 Please upgrade to a newer version.]
171 WX_DETECT_STANDARD_OPTION_VALUES
173 # We also need wxBase
174 WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net`
175 WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net`
176 WXBASE_CPPFLAGS="$WX_CPPFLAGS -DwxUSE_GUI=0"
178 MULERCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK ['{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }']`
180 AC_SUBST([WXBASE_LIBS])dnl
181 AC_SUBST([WXBASE_CPPFLAGS])dnl
183 MULE_IF_ENABLED_ANY([monolithic, amule-gui, wxcas, alc],
184 [AS_IF([test "${WX_PORT}" = base],
186 The selected components need a wxWidgets library with GUI,
187 but your installation is base-only. Please install a GUI
188 enabled version of wxWidgets and then retry.
192 dnl Resource compiler for W32
193 AC_ARG_VAR([RC], [Resource Compiler])dnl
194 AC_ARG_VAR([RCFLAGS], [Resource Compiler Flags])dnl
195 AS_IF([test ${SYS:-unknown} = win32], [AC_CHECK_TOOL([RC], [windres], [:])])
199 MULE_ARG_ENABLE([upnp], [yes], [do not compile UPnP code])
200 MULE_IF_ENABLED_ANY([monolithic, amule-daemon],, [MULE_ENABLEVAR([upnp])=no])
201 MULE_IF_ENABLED([upnp], [
204 [MULE_APPEND([LIBUPNP_CPPFLAGS], [-DENABLE_UPNP=1])],
205 [MULE_ENABLEVAR([upnp])=disabled
206 MULE_WARNING([UPnP code has been disabled because ${libupnp_error}.])]
212 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amule-gui, fileview],
213 [MULE_CHECK_CRYPTOPP([5.1], [
214 # Check for CryptoPP >= 5.5
215 AS_IF([test $CRYPTOPP_VERSION_NUMBER -ge "5005000"], [MULE_APPEND([CRYPTOPP_CPPFLAGS], [-D__WEAK_CRYPTO__])])
218 Could not find crypto++ header file "$cryptopp_file_with_version".
219 Please try again with --with-crypto-prefix=/my_crypto_prefix
220 (replace /my_crypto_prefix with a valid path to your crypto++
221 installation directory).])
224 dnl Checks requiring C++
225 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amule-gui, amulecmd, webserver, ed2k, alc, alcc, wxcas, fileview],
228 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, alc, alcc], [MULE_CHECK_WX_SUPPORTS_LARGEFILE])
230 # Check if the compiler is broken, wrt. exceptions.
231 MULE_CHECK_EXCEPTIONS
237 # Ok, we have all needed libs, now checking for other stuff
238 AS_IF([test "$LEX" = "flex"], [MULE_CHECK_FLEX_EXTENDED], [HAVE_FLEX_EXTENDED=no])
240 # Flush standard test results for speeding cache
243 dnl -------------------------------------------------------------------------------
244 dnl Start of autoscan stuff
245 dnl -------------------------------------------------------------------------------
246 # Checks for header files.
250 AC_CHECK_HEADERS([argz.h arpa/inet.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h mntent.h netdb.h netinet/in.h stddef.h nl_types.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/ioctl.h sys/mntent.h sys/mnttab.h sys/mount.h sys/param.h sys/resource.h sys/select.h sys/socket.h sys/statvfs.h sys/time.h sys/timeb.h sys/types.h unistd.h errno.h signal.h])
253 # Checks for typedefs, structures, and compiler characteristics.
264 AC_CHECK_TYPES([ptrdiff_t])
266 # Checks for library functions.
267 AC_FUNC_CLOSEDIR_VOID
268 AC_PROG_GCC_TRADITIONAL
270 AS_IF([test x$SYS != xwin32], [
273 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
276 AC_FUNC_SELECT_ARGTYPES
277 AC_FUNC_SETVBUF_REVERSED
283 dnl Some other functions that worth checking deeper:
284 dnl AC_FUNC_CLOSEDIR_VOID
289 dnl AC_FUNC_SETVBUF_REVERSED
290 dnl Anyways, do we actually USE them?
291 AS_IF([test $cross_compiling = yes -a $gnumalloc = yes], [
292 MULE_WARNING([configure cannot check whether malloc() and realloc() are GNU libc compatible. You have to be ABSOLUTELY sure that they are, otherwise run configure with the --without-gnu-malloc switch.])
293 ac_cv_func_malloc_0_nonnull=yes
294 ac_cv_func_realloc_0_nonnull=yes
298 AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify endpwent floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getpass gettimeofday inet_ntoa localeconv memmove mempcpy memset nl_langinfo pow select setlocale socket sqrt stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtoul sigaction])
299 #-------------------------------------------------------------------------------
300 # End of autoscan stuff
301 #-------------------------------------------------------------------------------
304 dnl autoscan has missed these ones.
306 AC_CHECK_FUNCS([mkdir getrlimit setrlimit getopt_long])
308 dnl This must be *before* MULE_CHECK_NLS
309 MULE_IF_ENABLED_ANY([monolithic, amule-daemon], [MULE_CHECK_MMAP])
311 MULE_BACKUP([CPPFLAGS])
312 MULE_APPEND([CPPFLAGS], [-D_XOPEN_SOURCE=600])
314 MULE_RESTORE([CPPFLAGS])
316 # Look for a way to preallocate disk space for files.
317 MULE_IF_ENABLED_ANY([monolithic, amule-daemon], [MULE_CHECK_FALLOCATE])
319 # Checking Native Language Support
320 dnl Sets gettext version.
321 dnl AM_GNU_GETTEXT_VERSION *must not* be moved away from configure.in!
322 AM_GNU_GETTEXT_VERSION(0.11.5)
325 # Check for bfd.h (to have proper backtraces without using wxExecute)
329 # Flush standard test results for speeding cache
334 MULE_COMPILATION_FLAGS
336 # autoconf >= 2.60 already defines ${docdir}, but we always need it.
337 AC_MSG_CHECKING([for docdir])
338 AS_IF([test -z "$docdir"], [docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"])
339 AC_SUBST([docdir])dnl
340 AC_MSG_RESULT([$docdir])
342 # Try to set the SVN checkout-date
343 AC_MSG_CHECKING([for SVNDATE])
344 if test -f "$srcdir/.svn-revision" # SVNDATE for tarballs
346 svndate="rev. `cat $srcdir/.svn-revision`"
347 elif test -d $srcdir/.svn # SVNDATE for svn
349 svndate="rev. `svnversion $srcdir | sed -e 's/[[0-9]][[0-9]]*:\(.*\)/\1/' -e 's/\([[0-9]][[0-9]]*\).*/\1/'`"
351 AC_MSG_RESULT(${svndate:-None required})
352 AS_IF([test -n "$svndate"], [
353 AC_DEFINE_UNQUOTED([SVNDATE], ["$svndate"], [The checkout date or svn revision number.])
354 MULE_ADDFLAG([RC], [-D__PRERELEASE__])
356 AC_SUBST([SVNDATE], [$svndate])dnl
358 dnl Set up the denoiser
361 MULE_IF_ENABLED([plasmamule], [PLASMAMULE_CHECKS])
363 AM_CONDITIONAL(SYS_WIN32, test x$SYS = xwin32)
364 AM_CONDITIONAL(NEED_RC, test x$SYS = xwin32 -a "$RC" != ":")
365 AM_CONDITIONAL(NEED_CORESERVICES, test x$SYS = xdarwin)
366 AM_CONDITIONAL(COMPILE_NLS, test x$USE_NLS = xyes)
367 AM_CONDITIONAL(GENERATE_FLEX_HEADER, test x$HAVE_FLEX_EXTENDED = xyes)
368 AM_CONDITIONAL(INSTALL_SKINS, test x$INSTALL_SKINS = xyes)
369 AM_CONDITIONAL(PLASMAMULE, test MULE_IS_ENABLED([plasmamule]))
371 AM_CONDITIONAL([COMPILE_LIB_COMMON], [test MULE_IS_ENABLED_ANY([monolithic, amule-daemon, amulecmd, webserver, amule-gui, fileview])])
372 AM_CONDITIONAL([COMPILE_LIB_EC], [test MULE_IS_ENABLED_ANY([monolithic, amule-daemon, amulecmd, webserver, amule-gui])])
374 # Check for readline library
375 MULE_IF_ENABLED_ANY([amulecmd, webserver], [VL_LIB_READLINE])
377 # DO NOT MOVE UP... THERE'S A REASON TO BE HERE!!
382 dnl Generate the Makefiles
384 AC_CONFIG_FILES([Makefile
390 src/pixmaps/flags_xpm/Makefile
393 src/libs/ec/cpp/Makefile
394 src/libs/common/Makefile
396 src/utils/aLinkCreator/Makefile
397 src/utils/aLinkCreator/docs/Makefile
398 src/utils/aLinkCreator/src/Makefile
399 src/utils/cas/Makefile
400 src/utils/cas/docs/Makefile
401 src/utils/fileview/Makefile
402 src/utils/plasmamule/Makefile
403 src/utils/wxCas/Makefile
404 src/utils/wxCas/docs/Makefile
405 src/utils/wxCas/src/Makefile
406 src/utils/xas/Makefile
407 src/utils/xas/autostart-xas
408 src/utils/xas/docs/Makefile
410 src/webserver/Makefile
411 src/webserver/src/Makefile
412 src/webserver/default/Makefile
414 unittests/muleunit/Makefile
415 unittests/tests/Makefile])
417 dnl autoscan has missed these, i wonder why...
419 AC_CONFIG_FILES([po/Makefile.in
421 AS_IF([test x$SYS = xwin32], [AC_CONFIG_FILES([version.rc])])
424 AS_IF([test -n "$svndate"], [SVN_REVISION=" ($svndate)"], [SVN_REVISION=])
428 echo " Configure script has finished system check."
430 echo " Configured aMule ${PACKAGE_VERSION}${SVN_REVISION} for '${host}'."
432 echo " aMule enabled options:"
434 echo " **** aMule Core ****"
435 echo " Prefix where aMule should be installed? ${prefix:-none}"
436 echo " Should aMule be compiled with i18n support? ${USE_NLS:-no}"
437 echo " Should aMule be compiled in debug mode? MULE_STATUSOF([debug])"
438 echo " Should aMule be compiled with profiling? MULE_STATUSOF([profile])"
439 echo " Should aMule be compiled with optimizations? MULE_STATUSOF([optimize])"
440 echo " Should aMule be compiled with UPnP support? MULE_STATUSOF([upnp])"
441 echo " Should aMule be compiled with IP2country support? MULE_STATUSOF([geoip])"
442 echo " Should aMule monolithic application be built? MULE_STATUSOF([monolithic])"
443 echo " Should aMule daemon version be built? MULE_STATUSOF([amule-daemon])"
444 echo " Should aMule remote gui be built? (EXPERIMENTAL) MULE_STATUSOF([amule-gui])"
445 echo " Crypto++ library/headers style? ${CRYPTOPP_STYLE:-not found}"
448 echo " **** aMule TextClient ****"
449 echo " Should aMule Command Line Client be built? MULE_STATUSOF([amulecmd])"
451 echo " **** aMule WebServer ****"
452 echo " Should aMule WebServer be built? MULE_STATUSOF([webserver])"
454 echo " **** aMule ED2K Links Handler ****"
455 echo " Should aMule ED2K Links Handler be built? MULE_STATUSOF([ed2k])"
457 echo " **** aMuleLinkCreator ****"
458 echo " Should aMuleLinkCreator GUI version (alc) be built? MULE_STATUSOF([alc])"
459 echo " Should aMuleLinkCreator for console (alcc) be built? MULE_STATUSOF([alcc])"
461 echo " **** aMule Statistics ****"
462 echo " Should C aMule Statistics (CAS) be built? MULE_STATUSOF([cas])"
463 echo " Should aMule GUI Statistics (wxCas) be built? MULE_STATUSOF([wxcas])"
464 echo " Should xas XChat2 plugin be installed? MULE_STATUSOF([xas])"
465 echo " Should plasmaMule plasma-applet be build? MULE_STATUSOF([plasmamule])"
468 echo " **** General Libraries and Tools ****"
469 echo " Should ccache support be enabled? MULE_STATUSOF([ccache])"
470 echo " Libraries aMule will use to build:"
471 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amule-gui, amulecmd, webserver, alc, alcc, wxcas, fileview], [
473 AS_IF([test $WX_DEBUG -eq 1], [wxinfo="$wxinfo,debug"])
474 AS_IF([test $WX_SHARED -eq 1], [wxinfo="$wxinfo,shared"], [wxinfo="$wxinfo,static"])
475 echo " wxWidgets ${WX_VERSION_FULL} ($wxinfo)"
477 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amule-gui, fileview],
478 [echo " crypto++ ${CRYPTOPP_VERSION_STRING} (${CRYPTOPP_STYLE}, in ${CRYPTOPP_PREFIX})"])
479 MULE_IF_ENABLED([upnp], [
480 AS_IF([test -n "$with_libupnp_prefix"], [libupnp_place=" (in $with_libupnp_prefix)"])
481 echo " libupnp ${LIBUPNP_VERSION:-Not detected}${libupnp_place:-}"
483 if test ${enable_nls:-yes} = yes; then
484 AS_IF([test x$USE_NLS = xno],
485 [libintl_found="Not detected"],
486 [AS_IF([test x$USE_INCLUDED_LIBINTL = xyes],
487 [libintl_found="included"],
488 [libintl_found="system"])])
489 echo " libintl $libintl_found"
491 MULE_IF_ENABLED([geoip],
492 [AS_IF([test -z "${with_geoip_headers:-}${with_geoip_lib:-}"], [geoip_style=system], [geoip_style=user])
493 MULE_IF_ENABLED_ANY([monolithic, amule-gui],
494 [echo " libGeoIP ${geoip_style}"])])
495 MULE_IF_ENABLED([webserver],
496 [echo " libpng ${LIBPNG_VERSION:-Not detected}"])
497 MULE_IF_ENABLED([cas],
498 [echo " libgd ${GDLIB_VERSION:-Not detected}"])
499 MULE_IF_ENABLED_ANY([monolithic, amule-daemon, amulecmd, webserver, amule-gui],
500 [echo " zlib ${ZLIB_VERSION:-Not detected}"])
501 MULE_IF_ENABLED([plasmamule],
502 [echo " qt-moc ${QT_MOC} ${QT_MOC_VERSION}"
503 echo " qt-core-libs ${QT_CORE_LIBS}"
504 echo " qt-gui-libs ${QT_GUI_LIBS}"
505 echo " kde4-config ${KDE4_CONFIG} (${KDE_CONF_VER})"
506 echo " kde-headers ${KDE_HEADER_DIR}"
507 echo " kde-services-path ${KDE_SERVICE_PATH}"
508 echo " kde-module-path ${KDE_MODULE_PATH}"
509 echo " kde-icon-path ${KDE_ICON_PATH}"
510 echo " kde-mime-path ${KDE_MIME_PATH}"
511 echo " kde-applinks-path ${KDE_APPLNK_PATH}"
512 echo " **** You have to run kbuildsycoca after installing to let plasma know the changes ****"
513 echo " **** You have to run \"update-mime-database ${KDE_MIME_PATH}\" to register the mimetype ****"])