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])
30 AC_CONFIG_SRCDIR([src/amule.cpp])
31 AC_CONFIG_HEADERS([config.h])
34 dnl Check host system.
37 dnl Checks for programs.
38 dnl Workaround for these checks may alter CFLAGS and CXXFLAGS, especially if they were empty
40 MULE_BACKUP([CXXFLAGS])
41 MULE_BACKUP([BUILD_CFLAGS])
46 AS_IF([test "$cross_compiling" = yes], [AC_PROG_BUILD_CC], [BUILD_CC="$CC" ; BUILD_EXEEXT=$EXEEXT])
47 MULE_RESTORE([CFLAGS])
48 MULE_RESTORE([CXXFLAGS])
49 MULE_RESTORE([BUILD_CFLAGS])
58 dnl Find the right ranlib, even when cross-compiling
59 dnl And for some other tools for cross compilation
60 AC_CHECK_TOOL(RANLIB, ranlib)
61 AC_CHECK_TOOL(STRIP, strip)
66 dnl Add args to configure
71 [--disable-monolithic],
72 [disable building of the monolithic aMule app])],
73 [MONOLITHIC=$enableval], [MONOLITHIC=yes])
78 [--enable-amule-daemon],
79 [compile aMule daemon version])],
80 [AMULE_DAEMON=$enableval], [AMULE_DAEMON=no])
86 [compile aMule command line client])],
87 [AMULECMD=$enableval], [AMULECMD=no])
93 [compile aMule WebServer])],
94 [WEB=$enableval], [WEB=no])
100 [compile aMule remote GUI (EXPERIMENTAL)])],
101 [AMULE_GUI=$enableval], [AMULE_GUI=no])
107 [compile C aMule Statistics])],
108 [CAS=$enableval], [CAS=no])
114 [compile aMule GUI Statistics])],
115 [WXCAS=$enableval], [WXCAS=no])
121 [don't compile aMule ed2k links handler])],
122 [ED2K=$enableval], [ED2K=yes])
128 [compile aMuleLinkCreator GUI version])],
129 [ALC=$enableval], [ALC=no])
135 [compile aMuleLinkCreator for console])],
136 [ALCC=$enableval], [ALCC=no])
141 [--disable-monolithic],
142 [disable building of the monolithic aMule app])],
143 [MONOLITHIC=$enableval], [MONOLITHIC=yes])
149 [do not compile UPnP code])],
150 [ENABLE_UPNP=$enableval], [ENABLE_UPNP=yes])
156 [install xas XChat2 plugin])],
157 [XAS=$enableval], [XAS=no])
163 [compile aMule file viewer for console (EXPERIMENTAL)])],
164 [FILEVIEW=$enableval], [FILEVIEW=no])
166 # Default is yes, because they're most likely compatible.
167 # However, this is only used when cross-compiling.
170 [AS_HELP_STRING([--without-gnu-malloc],
171 [Don't assume that we use GNU libc compatible malloc/realloc when cross-compiling])],
172 [gnumalloc=$withval], [gnumalloc=yes])
175 # Checking for libs before all other stuff to break
176 # configure as soon as possible in case of a missing one
177 # to avoid losing too much time
180 MULE_CHECK_ZLIB([1.1.4],, [AC_MSG_ERROR([zlib >= 1.1.4 is required for aMule])])
182 AS_IF([test x$CAS = xyes], [
184 MULE_CHECK_GDLIB([2.0.0], [
186 MULE_PREPEND([GDLIB_LIBS], [-lgd])
188 AS_IF([test -z "$CAS_DEFS"],
190 [gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found.
191 Please check that gdlib-config is in your default path, check out LD_LIBRARY_PATH or equivalent variable.
192 Or this might also be that your gdlib-config has other name.
193 Please try again with --with-gdlib-config=/usr/bin/gdlib-config (replace /usr/bin/gdlib-config with a valid path to your gdlib-config).
194 If you use compiled packages check if you have devel pack installed.
195 To download the latest version check http://www.boutell.com/gd for sources.])])
196 ], [GDLIB_VERSION="not_needed"])
197 AC_SUBST([CAS_DEFS])dnl
200 AS_IF([test x$WEB = xyes],
201 [MULE_CHECK_LIBPNG([1.2.0], [AMULEWEB_DEFS="-DWITH_LIBPNG"], [
203 [libpng >= 1.2.0 not found.
204 amuleweb will be compiled but file download progress bar images will NOT be generated.])
206 ], [LIBPNG_VERSION="not_needed"])
207 AC_SUBST([AMULEWEB_DEFS])dnl
210 # Check for perl File::Copy
211 AC_MSG_CHECKING([for File::Copy])
212 AS_IF([perl -e "require File::Copy" 2>/dev/null], [AC_MSG_RESULT([ok])], [AC_MSG_ERROR([File::Copy perl module is required])])
215 # Check if we need the GUI
216 AC_MSG_CHECKING([whether we need the GUI])
217 AS_IF([test x$MONOLITHIC = xyes], [need_gui=yes])
218 AS_IF([test x$WXCAS = xyes], [need_gui=yes])
219 AS_IF([test x$ALC = xyes], [need_gui=yes])
220 AS_IF([test x$AMULE_GUI = xyes], [need_gui=yes])
221 AS_IF([test x${need_gui:+set} != xset], [need_gui=no])
222 AC_MSG_RESULT($need_gui)
224 # Check if we need to install skins
225 AS_IF([test x$MONOLITHIC = xyes], [INSTALL_SKINS=yes])
226 AS_IF([test x$AMULE_GUI = xyes], [INSTALL_SKINS=yes])
227 AS_IF([test x${INSTALL_SKINS:+set} != xset], [INSTALL_SKINS=no])
229 # Check for GeoIP (required for IP2Country capability)
234 WX_STANDARD_OPTIONS([toolkit,wxshared,wxdebug,wxversion])
235 # Force using a static wxWidgets library if the executable is to be linked statically.
236 AS_IF([test ${enable_static:-no} = yes], [WX_SHARED=0])
237 # Force using a unicode build of the library
240 WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
241 WX_CONFIG_CHECK([2.8.8], [wxWin=1],,, [$WXCONFIG_FLAGS])
242 if test "$wxWin" != 1; then
244 wxWidgets must be installed on your system but wx-config
245 script couldn't be found. Please check that wx-config is
246 in path or specified by --with-wx-config=path flag, the
247 directory where wxWidgets libraries are installed (returned
248 by 'wx-config --libs' command) is in LD_LIBRARY_PATH or
249 equivalent variable and wxWidgets version is 2.8.8 or above.
252 WX_DETECT_STANDARD_OPTION_VALUES
254 # We also need wxBase
255 WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net`
256 WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net`
257 WXBASE_CPPFLAGS="$WX_CPPFLAGS -DwxUSE_GUI=0"
258 AC_SUBST([WXBASE_LIBS])
259 AC_SUBST([WXBASE_CPPFLAGS])
261 AS_IF([test ${need_gui} = yes -a "${WX_PORT}" = base],
263 The selected components need a wxWidgets library with GUI,
264 but your installation is base-only. Please install a GUI
265 enabled version of wxWidgets and then retry.
269 dnl Get flags for windres
270 AC_ARG_VAR([RC], [Resource Compiler])dnl
271 AC_ARG_VAR([RCFLAGS], [Resource Compiler Flags])dnl
272 AS_IF([test ${SYS:-unknown} = win32],
274 AC_CHECK_TOOL([RC], [windres], [:])
275 MULERCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK ['{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }']`
280 AS_IF([test "${ENABLE_UPNP:-yes}" = yes], [
283 [MULE_APPEND([LIBUPNP_CPPFLAGS], [-DENABLE_UPNP=1])],
284 [ENABLE_UPNP=disabled
285 MULE_WARNING([UPnP code has been disabled because ${libupnp_error}.])]
291 MULE_CHECK_CRYPTOPP([5.1], [
292 # Check for CryptoPP >= 5.5
293 AS_IF([test $CRYPTOPP_VERSION_NUMBER -ge "5005000"], [MULE_APPEND([CRYPTOPP_CPPFLAGS], [-D__WEAK_CRYPTO__])])
296 Could not find crypto++ header file "$cryptopp_file_with_version".
297 Please try again with --with-crypto-prefix=/my_crypto_prefix
298 (replace /my_crypto_prefix with a valid path to your crypto++
299 installation directory).])
302 dnl Checks requiring C++
305 MULE_CHECK_WX_SUPPORTS_LARGEFILE
307 # Check if the compiler is broken, wrt. exceptions.
308 MULE_CHECK_EXCEPTIONS
313 # Ok, we have all needed libs, now checking for other stuff
314 AS_IF([test "$LEX" = "flex"], [MULE_CHECK_FLEX_EXTENDED], [HAVE_FLEX_EXTENDED=no])
316 # Flush standard test results for speeding cache
319 dnl -------------------------------------------------------------------------------
320 dnl Start of autoscan stuff
321 dnl -------------------------------------------------------------------------------
322 # Checks for header files.
326 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])
329 # Checks for typedefs, structures, and compiler characteristics.
340 AC_CHECK_TYPES([ptrdiff_t])
342 # Checks for library functions.
343 AC_FUNC_CLOSEDIR_VOID
344 AC_PROG_GCC_TRADITIONAL
346 AS_IF([test x$SYS != xwin32], [
349 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
352 AC_FUNC_SELECT_ARGTYPES
353 AC_FUNC_SETVBUF_REVERSED
359 dnl Some other functions that worth checking deeper:
360 dnl AC_FUNC_CLOSEDIR_VOID
365 dnl AC_FUNC_SETVBUF_REVERSED
366 dnl Anyways, do we actually USE them?
367 AS_IF([test $cross_compiling = yes -a $gnumalloc = yes], [
368 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.])
369 ac_cv_func_malloc_0_nonnull=yes
370 ac_cv_func_realloc_0_nonnull=yes
374 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])
375 #-------------------------------------------------------------------------------
376 # End of autoscan stuff
377 #-------------------------------------------------------------------------------
380 dnl autoscan has missed these ones.
382 AC_CHECK_FUNCS([mkdir getrlimit setrlimit getopt_long])
384 dnl This must be *before* MULE_CHECK_NLS
385 AC_ARG_ENABLE([mmap],
386 [AS_HELP_STRING([--enable-mmap], [enable using mapped memory if supported])])
388 AS_IF([test ${enable_mmap:-no} = yes], [
389 AC_CHECK_HEADERS([sys/mman.h])
391 AC_CHECK_FUNCS([munmap sysconf])
392 AS_IF([test $ac_cv_func_sysconf = yes], [
393 AC_MSG_CHECKING([for pagesize constant for sysconf])
398 return sysconf(_SC_PAGESIZE);
401 AC_MSG_RESULT([_SC_PAGESIZE])
402 AC_DEFINE([HAVE__SC_PAGESIZE], [1], [Define to 1 if you have the _SC_PAGESIZE constant in <unistd.h>])
408 return sysconf(_SC_PAGE_SIZE);
411 AC_MSG_RESULT([_SC_PAGE_SIZE])
412 AC_DEFINE([HAVE__SC_PAGE_SIZE], [1], [Define to 1 if you have the _SC_PAGE_SIZE constant in <unistd.h>, but not _SC_PAGESIZE])
414 AC_MSG_RESULT([none])
419 # fake the result of the test for munmap() for the gettext macros
424 MULE_BACKUP([CPPFLAGS])
425 MULE_APPEND([CPPFLAGS], [-D_XOPEN_SOURCE=600])
427 MULE_RESTORE([CPPFLAGS])
429 # Look for a way to preallocate disk space for files.
432 # Checking Native Language Support
433 dnl Sets gettext version.
434 dnl AM_GNU_GETTEXT_VERSION *must not* be moved away from configure.in!
435 AM_GNU_GETTEXT_VERSION(0.11.5)
438 # Check for bfd.h (to have proper backtraces without using wxExecute)
442 # Flush standard test results for speeding cache
447 MULE_COMPILATION_FLAGS
449 # autoconf >= 2.60 already defines ${docdir}, but we always need it.
450 AC_MSG_CHECKING([for docdir])
451 AS_IF([test -z "$docdir"], [docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"])
452 AC_SUBST([docdir])dnl
453 AC_MSG_RESULT([$docdir])
455 # Try to set the SVN checkout-date
456 AC_MSG_CHECKING([for SVNDATE])
457 if test -f "$srcdir/.svn-revision" # SVNDATE for tarballs
459 svndate="rev. `cat $srcdir/.svn-revision`"
460 elif test -d $srcdir/.svn # SVNDATE for svn
462 svndate="rev. `svnversion $srcdir | sed -e 's/[[0-9]][[0-9]]*:\(.*\)/\1/' -e 's/\([[0-9]][[0-9]]*\).*/\1/'`"
464 AC_MSG_RESULT(${svndate:-None required})
465 AS_IF([test -n "$svndate"], [
466 AC_DEFINE_UNQUOTED([SVNDATE], ["$svndate"], [The checkout date or svn revision number.])
467 MULE_ADDFLAG([RC], [-D__PRERELEASE__])
469 AC_SUBST([SVNDATE], [$svndate])dnl
471 dnl Set up the denoiser
474 AM_CONDITIONAL(WEB, test x$WEB = xyes)
475 AM_CONDITIONAL(ED2K, test x$ED2K = xyes)
476 AM_CONDITIONAL(CAS, test x$CAS = xyes)
477 AM_CONDITIONAL(WXCAS, test x$WXCAS = xyes)
478 AM_CONDITIONAL(ALC, test x$ALC = xyes)
479 AM_CONDITIONAL(ALCC, test x$ALCC = xyes)
480 AM_CONDITIONAL(AMULE_GUI, test x$AMULE_GUI = xyes)
481 AM_CONDITIONAL(AMULE_DAEMON, test x$AMULE_DAEMON = xyes)
482 AM_CONDITIONAL(COMPILE_CMD, test x$AMULECMD = xyes)
483 AM_CONDITIONAL(MONOLITHIC, test x$MONOLITHIC = xyes)
484 AM_CONDITIONAL(XAS, test x$XAS = xyes)
485 AM_CONDITIONAL(FILEVIEW, test x$FILEVIEW = xyes)
486 AM_CONDITIONAL(ENABLE_UPNP, test x$ENABLE_UPNP = xyes)
487 AM_CONDITIONAL(ENABLE_IP2COUNTRY, test x$ENABLE_IP2COUNTRY = xyes)
488 AM_CONDITIONAL(SYS_WIN32, test x$SYS = xwin32)
489 AM_CONDITIONAL(NEED_RC, test x$SYS = xwin32 -a "$RC" != ":")
490 AM_CONDITIONAL(NEED_CORESERVICES, test x$SYS = xdarwin)
491 AM_CONDITIONAL(COMPILE_NLS, test x$USE_NLS = xyes)
492 AM_CONDITIONAL(GENERATE_FLEX_HEADER, test x$HAVE_FLEX_EXTENDED = xyes)
493 AM_CONDITIONAL(INSTALL_SKINS, test x$INSTALL_SKINS = xyes)
495 # Check for readline library
496 if test x$AMULECMD = xyes -o x$WEB = xyes; then
500 # DO NOT MOVE UP... THERE'S A REASON TO BE HERE!!
505 dnl Generate the Makefiles
507 AC_CONFIG_FILES([Makefile
513 src/pixmaps/flags_xpm/Makefile
516 src/libs/ec/cpp/Makefile
517 src/libs/common/Makefile
519 src/utils/aLinkCreator/Makefile
520 src/utils/aLinkCreator/docs/Makefile
521 src/utils/aLinkCreator/src/Makefile
522 src/utils/cas/Makefile
523 src/utils/cas/docs/Makefile
524 src/utils/fileview/Makefile
525 src/utils/wxCas/Makefile
526 src/utils/wxCas/docs/Makefile
527 src/utils/wxCas/src/Makefile
528 src/utils/xas/Makefile
529 src/utils/xas/autostart-xas
530 src/utils/xas/docs/Makefile
532 src/webserver/Makefile
533 src/webserver/src/Makefile
534 src/webserver/default/Makefile
536 unittests/muleunit/Makefile
537 unittests/tests/Makefile])
539 dnl autoscan has missed these, i wonder why...
541 AC_CONFIG_FILES([po/Makefile.in
543 AS_IF([test x$SYS = xwin32], [AC_CONFIG_FILES([version.rc])])
546 AS_IF([test -n "$svndate"], [SVN_REVISION=" ($svndate)"], [SVN_REVISION=])
550 echo " Configure script has finished system check."
552 echo " Configured aMule ${PACKAGE_VERSION}${SVN_REVISION} for '${host}'."
554 echo " aMule enabled options:"
556 echo " **** aMule Core ****"
557 echo " Prefix where aMule should be installed? ${prefix:-none}"
558 echo " Should aMule be compiled with i18n support? ${USE_NLS:-no}"
559 echo " Should aMule be compiled in debug mode? ${USE_DEBUG:-no}"
560 echo " Should aMule be compiled with profiling? ${USE_PROFILE:-no}"
561 echo " Should aMule be compiled with optimizations? ${USE_OPTIMIZE:-no}"
562 echo " Should aMule be compiled with UPnP support? ${ENABLE_UPNP:-yes}"
563 echo " Should aMule be compiled with IP2country support? ${ENABLE_IP2COUNTRY:-no}"
564 echo " Should aMule monolithic application be built? ${MONOLITHIC:-yes}"
565 echo " Should aMule daemon version be built? ${AMULE_DAEMON:-no}"
566 echo " Should aMule remote gui be built? (EXPERIMENTAL) ${AMULE_GUI:-no}"
567 echo " Crypto++ library/headers style? ${CRYPTOPP_STYLE:-not found}"
570 echo " **** aMule TextClient ****"
571 echo " Should aMule Command Line Client be built? ${AMULECMD:-no}"
573 echo " **** aMule WebServer ****"
574 echo " Should aMule WebServer be built? ${WEB:-no}"
576 echo " **** aMule ED2K Links Handler ****"
577 echo " Should aMule ED2K Links Handler be built? ${ED2K:-yes}"
579 echo " **** aMuleLinkCreator ****"
580 echo " Should aMuleLinkCreator GUI version (alc) be built? ${ALC:-no}"
581 echo " Should aMuleLinkCreator for console (alcc) be built? ${ALCC:-no}"
583 echo " **** aMule Statistics ****"
584 echo " Should C aMule Statistics (CAS) be built? ${CAS:-no}"
585 echo " Should aMule GUI Statistics (wxCas) be built? ${WXCAS:-no}"
586 echo " Should xas XChat2 plugin be installed? ${XAS:-yes}"
589 echo " **** General Libraries and Tools ****"
590 echo " Should ccache support be enabled? ${enable_ccache:-no}"
591 echo " Libraries aMule will use to build:"
593 AS_IF([test $WX_DEBUG -eq 1], [wxinfo="$wxinfo,debug"])
594 AS_IF([test $WX_SHARED -eq 1], [wxinfo="$wxinfo,shared"], [wxinfo="$wxinfo,static"])
595 echo " wxWidgets ${WX_VERSION_FULL} ($wxinfo)"
596 echo " crypto++ ${CRYPTOPP_VERSION_STRING} (${CRYPTOPP_STYLE}, in ${CRYPTOPP_PREFIX})"
597 AS_IF([test -n "$with_libupnp_prefix"], [libupnp_place=" (in $with_libupnp_prefix)"])
598 AS_IF([test x${ENABLE_UPNP} = xyes], [echo " libupnp ${LIBUPNP_VERSION:-Not detected}${libupnp_place:-}"])
599 if test ${enable_nls:-yes} = yes; then
600 AS_IF([test x$USE_NLS = xno],
601 [libintl_found="Not detected"],
602 [AS_IF([test x$USE_INCLUDED_LIBINTL = xyes],
603 [libintl_found="included"],
604 [libintl_found="system"])])
605 echo " libintl $libintl_found"
607 AS_IF([test -z "${with_geoip_headers:-}${with_geoip_lib:-}"], [geoip_style=system], [geoip_style=user])
608 AS_IF([test ${ENABLE_IP2COUNTRY:-no} = yes], [echo " libGeoIP ${geoip_style}"])
609 if test x$LIBPNG_VERSION != xnot_needed; then
610 echo " libpng ${LIBPNG_VERSION:-Not detected}"
612 if test x$GDLIB_VERSION != xnot_needed; then
613 echo " libgd ${GDLIB_VERSION:-Not detected}"
615 echo " zlib ${ZLIB_VERSION:-Not detected}"