Upstream tarball 20080324
[amule.git] / configure.in
blob12ceda64f0e263765dd498bc167200dcd08552b1
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_INIT([aMule],[SVN],[admin@amule.org])
5 AC_CANONICAL_HOST
6 AM_INIT_AUTOMAKE
8 AC_CONFIG_SRCDIR([src/amule.cpp])
9 AM_CONFIG_HEADER([config.h])
10 AM_MAINTAINER_MODE
12 # Removing -fomit since it causes problems with CryptoPP
13 CFLAGS="`echo $CFLAGS | sed "s/-fomit-frame-pointer//g"`"
14 CXXFLAGS="`echo $CXXFLAGS | sed "s/-fomit-frame-pointer//g"`"
16 # System detection, need AC_CANONICAL_HOST
17 case "${host_os}" in
18 "")
19         SYS=unknown
20         ;;
21 darwin*)
22         SYS=darwin
23         CFLAGS="${CFLAGS} -no-cpp-precomp -D_INTL_REDIRECT_MACROS -DNOPCH";
24         LDFLAGS="$LDFLAGS -bind_at_load"
25         touch src/Scanner.cpp
26         ;;
27 openbsd*) 
28         SYS=openbsd
29         LIBS="$LIBS -L/usr/local/lib"
30         X11LIBS="-lX11 -L/usr/X11R6/lib"
31         CXXFLAGS=" $CXXFLAGS -D__OPENBSD__"
32         if test "$DEBUG_FLAGS" != ""; then
33                 DEBUG_FLAGS="-Wall -g -fno-inline -D__DEBUG__"
34         fi
35         ;;
36 *cygwin* | *mingw32*)
37         SYS=win32
38         CFLAGS="$CFLAGS -DNOMINMAX"
39         CXXFLAGS="$CXXFLAGS -DNOMINMAX"
40         ;;
41 solaris*)
42         RESOLV_LIB="-lresolv -lnsl"
43         X11LIBS="-lX11"
44         LIBS="$LIBS -lrt"
45 esac
47 AC_SUBST(RESOLV_LIB)
48 AC_SUBST(X11LIBS)
50 # Checks for programs.
51 AC_PROG_CXX
52 AC_PROG_CXXCPP
53 AC_PROG_CC
54 AC_PROG_CPP
55 AC_PROG_AWK
56 AS_IF([test "$cross_compiling" = yes], [AC_PROG_BUILD_CC], [BUILD_CC="$CC" ; BUILD_EXEEXT=$EXEEXT])
57 AC_PROG_EGREP
58 AC_PROG_MAKE_SET
59 AC_PROG_LEX
60 AC_PROG_INSTALL
61 AC_PROG_RANLIB
62 AC_PROG_YACC
64 # Find the right ranlib, even when cross-compiling
65 # And for some other tools for cross compilation
66 AC_CHECK_TOOL(RANLIB, ranlib)
67 AC_CHECK_TOOL(STRIP, strip)
68 AC_CHECK_TOOL(AR, ar)
69 AC_CHECK_TOOL(LD, ld)
72 # Add args to configure
74 AC_ARG_ENABLE(
75         [ccache],
76         [AS_HELP_STRING(
77                 [--enable-ccache],
78                 [enable ccache support for fast recompilation])],
79         [ccache=$enableval], [ccache=no])
81 AC_ARG_ENABLE(
82         [debug],
83         [AS_HELP_STRING(
84                 [--disable-debug],
85                 [disable additional debugging output])],
86         [USE_DEBUG=$enableval], [USE_DEBUG=yes])
88 AC_ARG_ENABLE(
89         [optimize],
90         [AS_HELP_STRING(
91                 [--enable-optimize],
92                 [enable code optimizing])],
93         [USE_OPTIMIZE=$enableval], [USE_OPTIMIZE=no])
95 AC_ARG_ENABLE(
96         [profile],
97         [AS_HELP_STRING(
98                 [--enable-profile],
99                 [enable code profiling])],
100         [USE_PROFILE=$enableval], [USE_PROFILE=no])
102 AC_ARG_ENABLE(
103         [static],
104         [AS_HELP_STRING(
105                 [--enable-static],
106                 [produce a statically linked executable])],
107         [USE_DEBUG_STATIC=$enableval], [USE_DEBUG_STATIC=no])
109 AC_ARG_ENABLE(
110         [monolithic],
111         [AS_HELP_STRING(
112                 [--disable-monolithic],
113                 [disable building of the monolithic aMule app])],
114         [MONOLITHIC=$enableval], [MONOLITHIC=yes])
116 AC_ARG_ENABLE(
117         [amule-daemon],
118         [AS_HELP_STRING(
119                 [--enable-amule-daemon],
120                 [compile aMule daemon version])],
121         [AMULE_DAEMON=$enableval], [AMULE_DAEMON=no])
123 AC_ARG_ENABLE(
124         [amulecmd],
125         [AS_HELP_STRING(
126                 [--enable-amulecmd],
127                 [compile aMule command line client])],
128         [AMULECMD=$enableval], [AMULECMD=no])
130 AC_ARG_ENABLE(
131         [webserver],
132         [AS_HELP_STRING(
133                 [--enable-webserver],
134                 [compile aMule WebServer])],
135         [WEB=$enableval], [WEB=no])
137 AC_ARG_ENABLE(
138         [amule-gui],
139         [AS_HELP_STRING(
140                 [--enable-amule-gui],
141                 [compile aMule remote GUI (EXPERIMENTAL)])],
142         [AMULE_GUI=$enableval], [AMULE_GUI=no])
144 AC_ARG_ENABLE(
145         [cas],
146         [AS_HELP_STRING(
147                 [--enable-cas],
148                 [compile C aMule Statistics])],
149         [CAS=$enableval], [CAS=no])
151 AC_ARG_ENABLE(
152         [wxcas],
153         [AS_HELP_STRING(
154                 [--enable-wxcas],
155                 [compile aMule GUI Statistics])],
156         [WXCAS=$enableval], [WXCAS=no])
158 AC_ARG_ENABLE(
159         [ed2k],
160         [AS_HELP_STRING(
161                 [--disable-ed2k],
162                 [don't compile aMule ed2k links handler])],
163         [ED2K=$enableval], [ED2K=yes])
165 AC_ARG_ENABLE(
166         [alc],
167         [AS_HELP_STRING(
168                 [--enable-alc],
169                 [compile aMuleLinkCreator GUI version])],
170         [ALC=$enableval], [ALC=no])
171               
172 AC_ARG_ENABLE(
173         [alcc],
174         [AS_HELP_STRING(
175                 [--enable-alcc],
176                 [compile aMuleLinkCreator for console])],
177         [ALCC=$enableval], [ALCC=no])
179 AC_ARG_ENABLE(
180         [monolithic],
181         [AS_HELP_STRING(
182                 [--disable-monolithic],
183                 [disable building of the monolithic aMule app])],
184         [MONOLITHIC=$enableval], [MONOLITHIC=yes])
186 AC_ARG_ENABLE(
187         [upnp],
188         [AS_HELP_STRING(
189                 [--disable-upnp],
190                 [do not compile UPnP code])],
191         [ENABLE_UPNP=$enableval], [ENABLE_UPNP=yes])
193 AC_ARG_ENABLE(
194         [geoip],
195         [AS_HELP_STRING(
196                 [--enable-geoip],
197                 [compile with GeoIP IP2Country library])],
198         [ENABLE_IP2COUNTRY=$enableval], [ENABLE_IP2COUNTRY=no])
200 AC_ARG_WITH(
201         [geoip-headers],
202         AS_HELP_STRING([--with-geoip-headers=DIR],
203                 [GeoIP include files location]),
204         [GEOIP_INCLUDE="-I$withval"])
206 AC_ARG_WITH(
207         [geoip-lib],
208         AS_HELP_STRING([--with-geoip-lib=DIR],
209                 [GeoIP library location]),
210         [GEOIP_LIB="-L$withval $GEOIP_LIB"])
212 AC_ARG_WITH(
213         [geoip-static],
214         AS_HELP_STRING([--with-geoip-static],
215                 [Explicitly link GeoIP statically (default=no)]),
216         [if test "$withval" != "no"; then
217                 GEOIP_LIB="-Wl,-Bstatic $GEOIP_LIB -Wl,-Bdynamic"
218         fi])
220 AC_ARG_WITH(
221         [denoise-level],
222         [AS_HELP_STRING(
223                 [--with-denoise-level=<level>],
224                 [Specifies denoising level (0-4):])
225 AS_HELP_STRING([], [0 - Do nothing])
226 AS_HELP_STRING([], [4 - Suppress all normal output])
227 AS_HELP_STRING([], [(for more information see src/utils/scripts/denoiser.rules)])
228         ],
229         [denoiselevel="$withval"], [denoiselevel=yes])
231 dnl Default is yes, because they're most likely compatible.
232 dnl However, this is only used when cross-compiling.
233 AC_ARG_WITH(
234         [gnu-malloc],
235         [AS_HELP_STRING([--without-gnu-malloc],
236                 [Don't assume that we use GNU libc compatible malloc/realloc when cross-compiling])],
237         [gnumalloc=$withval], [gnumalloc=yes])
239 AC_ARG_WITH(
240         [language],
241         [AS_HELP_STRING([--with-language=<langs>],
242                 [Specify a comma-separated list of languages you want to have installed. See po/LINGUAS for available languages])],
243         [AS_IF([test "$withval" = "all"], [LINGUAS='%UNSET%'], [LINGUAS="`echo $withval | sed -e 's/,/ /g'`"])])
245 # Checking for libs before all other stuff to break
246 # configure as soon as possible in case of a missing one
247 # to avoid losing too much time
249 # Sets gettext version.
250 AM_GNU_GETTEXT_VERSION(0.11.5)
252 # Check for zlib
253 AC_OPTIONS_ZLIB
254 AC_CHECK_ZLIB([1.1.4], , [AC_MSG_ERROR([zlib >= 1.1.4 is required for aMule])])
256 if test x$CAS = xyes -o x$WEB = xyes; then
257 # Check for gd
258 AM_OPTIONS_GDLIBCONFIG
259 AM_PATH_GDLIBCONFIG([2.0.0],
261         CAS_DEFS="-D__GD__"
262         GDLIB_LIBS="-lgd $GDLIB_LIBS"
263 ], [
264     AC_MSG_NOTICE([
265         WARNING: gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found.
266         Please check that gdlib-config is in your default path, check out
267         LD_LIBRARY_PATH or equivalent variable.
268         Or this might also be that your gdlib-config has other name.
269         Please try again with --with-gdlib-config=/usr/bin/gdlib-config
270         (replace /usr/bin/gdlib-config with a valid path to your gdlib-config).
271         If you use compiled packages check if you have devel pack installed.
272         To download the latest version check http://www.boutell.com/gd
273         for sources.
274     ])
275         CAS_DEFS=""
278 else
279         CAS_DEFS=""
280         GDLIB_LIBS=""
281         GDLIB_CFLAGS=""
282         GDLIB_LDFLAGS=""
283         GDLIB_VERSION="not_needed"
286 AC_SUBST(CAS_DEFS)
288 AS_IF([test x$WEB = xyes], [AC_CHECK_REGEX(, [WEB=disabled])])
289 if test x$WEB = xyes; then
290 # Check for libpng
291 AM_OPTIONS_LIBPNGCONFIG
292 AM_PATH_LIBPNGCONFIG([1.2.0], [AMULEWEB_DEFS="-DWITH_LIBPNG"],
294     AC_MSG_NOTICE([
295         WARNING: libpng-devel >= 1.2.0 is needed for amuleweb
296     ])
297         AMULEWEB_DEFS=""
300 else
301         AMULEWEB_DEFS=""
302         LIBPNG_LIBS=""
303         LIBPNG_CFLAGS=""
304         LIBPNG_CXXFLAGS=""
305         LIBPNG_LDFLAGS=""
306         LIBPNG_VERSION="not_needed"
309 AC_SUBST(AMULEWEB_DEFS)
312 # Check for perl File::Copy
313 AC_MSG_CHECKING([for File::Copy])
314    if perl -e "require File::Copy" 2>/dev/null; then
315        AC_MSG_RESULT([ok])
316    else
317        AC_MSG_ERROR([File::Copy perl module is required])
318    fi
321 # Check if we need the GUI
322 AC_MSG_CHECKING([whether we need the GUI])
323 AS_IF([test x$MONOLITHIC = xyes], [need_gui=yes])
324 AS_IF([test x$WXCAS = xyes], [need_gui=yes])
325 AS_IF([test x$ALC = xyes], [need_gui=yes])
326 AS_IF([test x$AMULE_GUI = xyes], [need_gui=yes])
327 AS_IF([test ${need_gui:+set} != xset], [need_gui=no])
328 AC_MSG_RESULT($need_gui)
331 # Check for GeoIP (required for IP2Country capability)
332 if test x"$ENABLE_IP2COUNTRY" = x"yes" ; then
333         GEOIP_LIB="-lGeoIP"
334         CXXFLAGS="$CXXFLAGS $GEOIP_INCLUDE"
335         LIBS="$LIBS $GEOIP_LIB"
336         AC_CHECK_HEADER(GeoIP.h,,
337                 [AC_MSG_ERROR([--enable-geoip passed to configure, but the GeoIP header files were not found])])
338         AC_CHECK_LIB(GeoIP, GeoIP_open,
339                 [AC_DEFINE(SUPPORT_GEOIP, 1, Define if you want GeoIP support.)],
340                 [AC_MSG_ERROR([--enable-geoip passed to configure, but the GeoIP libraries were not found])])
342 AC_SUBST(GEOIP_INCLUDE)
343 AC_SUBST(GEOIP_LIB)
346 # Check if the compiler is broken, wrt. exceptions.
347 CHECK_EXCEPTIONS
349 # Check for wx
350 WX_CONFIG_OPTIONS
351 WX_STANDARD_OPTIONS([toolkit,wxshared,wxdebug,wxversion])
352 # Force using a static wxWidgets library if the executable is to be linked statically.
353 AS_IF([test "$USE_DEBUG_STATIC" = "yes"], [WX_SHARED=0])
354 # Force using a unicode build of the library
355 WX_UNICODE=1
356 DEBUG=$WX_DEBUG
357 WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
358 WX_CONFIG_CHECK([2.8.0], [wxWin=1],,, [$WXCONFIG_FLAGS])
359 if test "$wxWin" != 1; then
360         AC_MSG_ERROR([
361                 wxWidgets must be installed on your system but wx-config 
362                 script couldn't be found. Please check that wx-config is 
363                 in path or specified by --with-wx-config=path flag, the 
364                 directory where wxWidgets libraries are installed (returned 
365                 by 'wx-config --libs' command) is in LD_LIBRARY_PATH or
366                 equivalent variable and wxWidgets version is 2.8.0 or above.
367         ])
369 WX_DETECT_STANDARD_OPTION_VALUES
370 AM_WXCONFIG_LARGEFILE
372 dnl Get flags for windres
373 if test x$SYS = xwin32; then
374         AC_CHECK_TOOL([RC], [windres], [:])
375         AC_ARG_VAR([RC], [Win32 Resource Compiler])
376         RCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK ['{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }']`
377 else
378         RCFLAGS=""
380 AC_SUBST(RCFLAGS)
382 # Check for Crypto++
383 AM_OPTIONS_CRYPTO
385 CHECK_CRYPTO(5.1)
387 CXXFLAGS="$CXXFLAGS $CRYPTO_PP_CXXFLAGS"
388 LDFLAGS="$LDFLAGS $CRYPTO_PP_LDFLAGS"
389 CRYPTOLIBS="-l$CRYPTO_PP_LIB_NAME"
391 case "$CRYPTO_PP_STYLE" in
392         gentoo_debian | installed | sources)
393                 ;;
394         *) AC_MSG_ERROR([
395           WARNING: crypto++ >= $min_crypto_version is not found.
396           Please check that cryptopp-headers are in your default include path,
397           check out LD_LIBRARY_PATH or equivalent variable.
398           Or this might also be that your cryptopp is installed on other path.
399           Please try again with --with-crypto-prefix=/my_crypto_prefix
400           (replace /my_crypto_prefix with a valid path to your crypto directory).
401           To download the latest version check http://www.cryptopp.com for sources.
402           ])
403                 ;;
404 esac
406 # Check for CryptoPP >= 5.5
407 if test $CRYPTO_PP_VERSION_NUMBER -ge "5005000"; then
408         CXXFLAGS="$CXXFLAGS -D__WEAK_CRYPTO__"
412 AC_SUBST(CRYPTOLIBS)
414 # Check for bfd.h (to have proper backtraces without using wxExecute)
415 CHECK_BFD
417 # Ok, we have all needed libs, now checking for other stuff
418 CHECK_AUTOPOINT
420 if test "$LEX" = "flex"; then
421         CHECK_FLEX_EXTENDED
422 else
423         HAVE_FLEX_EXTENDED=no
426 # Flush standard test results for speeding cache
427 AC_CACHE_SAVE
429 dnl -------------------------------------------------------------------------------
430 dnl Start of autoscan stuff
431 dnl -------------------------------------------------------------------------------
432 # Checks for header files.
433 AC_PATH_X
434 AC_FUNC_ALLOCA
435 AC_HEADER_DIRENT
436 AC_HEADER_STDC
437 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/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])
438 AC_HEADER_SYS_WAIT
440 # Checks for typedefs, structures, and compiler characteristics.
441 AC_HEADER_STDBOOL
442 AC_C_CONST
443 AC_C_INLINE
444 AC_TYPE_MODE_T
445 AC_TYPE_OFF_T
446 AC_TYPE_SIZE_T
447 AC_HEADER_TIME
448 AC_STRUCT_TM
449 AC_TYPE_UID_T
450 AC_C_VOLATILE
451 AC_CHECK_TYPES([ptrdiff_t])
453 # Checks for library functions.
454 AC_FUNC_CLOSEDIR_VOID
455 AM_GNU_GETTEXT
456 AC_FUNC_GETMNTENT
457 AC_PROG_GCC_TRADITIONAL
458 AC_FUNC_FORK
459 if test x$SYS != xwin32; then
460 AC_FUNC_LSTAT
461 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
463 AC_FUNC_MEMCMP
464 AC_FUNC_MMAP
465 AC_FUNC_SELECT_ARGTYPES
466 AC_FUNC_SETVBUF_REVERSED
467 AC_TYPE_SIGNAL
468 AC_FUNC_STAT
469 AC_FUNC_STRFTIME
470 AC_FUNC_STRTOD
471 AC_FUNC_VPRINTF
472 dnl Some other functions that worth checking deeper:
473 dnl AC_FUNC_CLOSEDIR_VOID
474 dnl AC_FUNC_MEMCMP
475 dnl AC_FUNC_MMAP
476 dnl AC_FUNC_STAT
477 dnl AC_FUNC_STRTOD
478 dnl AC_FUNC_SETVBUF_REVERSED
479 dnl Anyways, do we actually USE them?
480 if test $cross_compiling = yes -a $gnumalloc = yes ; then
481         AC_MSG_WARN([
482     configure cannot check whether malloc() and realloc() are GNU libc
483     compatible. You have to be ABSOLUTELY sure that they are, otherwise
484     run configure with the --without-gnu-malloc switch.])
485         ac_cv_func_malloc_0_nonnull=yes
486         ac_cv_func_realloc_0_nonnull=yes
488 AC_FUNC_MALLOC
489 AC_FUNC_REALLOC
490 AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify endpwent floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getmntent getmntinfo getpass gettimeofday inet_ntoa localeconv memmove mempcpy memset munmap nl_langinfo pow select setlocale socket sqrt stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtoul])
491 #-------------------------------------------------------------------------------
492 # End of autoscan stuff
493 #-------------------------------------------------------------------------------
496 dnl autoscan has missed these ones. Maybe because it's win32 stuff?
498 AC_CHECK_FUNCS([mkdir getrlimit setrlimit])
500 # Flush standard test results for speeding cache
501 AC_CACHE_SAVE
503 # Other tests
505 case "$USE_DEBUG" in
506 yes)    DEBUG_FLAGS="-g -D__DEBUG__ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC"
507         AS_IF([test x$GCC = xyes], [DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0"])
508         AS_IF([test x$SYS = xwin32], [RCFLAGS="$RCFLAGS -D__DEBUG__"])
509     ;;
510 *)      DEBUG_FLAGS=""
511         AS_IF([test x$GCC = xyes], [DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef"])
512     ;;
513 esac
515 #aMule options
517 # Command line tools
518 case "$AMULECMD" in
519 yes)    ;;
520 *)      AMULECMD="no"
521         ;;
522 esac
524 # For proper compilation flags
526 WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net`
528 WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net`
529 WXBASE_CXXFLAGS="$WX_CXXFLAGS -DwxUSE_GUI=0"
530 WXBASE_CFLAGS="$WX_CFLAGS -DwxUSE_GUI=0"
532 WX_CFLAGS="`echo $WX_CFLAGS | sed "s#-I/#-isystem /#g"`"
533 WX_CXXFLAGS="`echo $WX_CXXFLAGS | sed "s#-I/#-isystem /#g"`"
534 WXBASE_CFLAGS="`echo $WXBASE_CFLAGS | sed "s#-I/#-isystem /#g"`"
535 WXBASE_CXXFLAGS="`echo $WXBASE_CXXFLAGS | sed "s#-I/#-isystem /#g"`"
537 AC_SUBST(WXBASE_LIBS)
538 AC_SUBST(WXBASE_CFLAGS)
539 AC_SUBST(WXBASE_CXXFLAGS)
541 case "$USE_OPTIMIZE" in
542 yes)    OPTIMIZE_FLAGS="-O2"
543         ;;
544 *)      OPTIMIZE_FLAGS=""
545         ;;
546 esac
548 # Profiling
549 case "$USE_PROFILE" in
550 yes)    PROFILE_FLAGS="-pg"
551         ;;
552 *)      PROFILE_FLAGS=""
553         ;;
554 esac
556 AC_MSG_CHECKING([if the applications should be statically linked])
557 case "$USE_DEBUG_STATIC" in
558 yes)    LDFLAGS="$LDFLAGS -static"
559         ;;
560 esac
561 AC_MSG_RESULT($USE_DEBUG_STATIC)
563 # autoconf >= 2.60 already defines ${docdir}, but we always need it.
564 AC_MSG_CHECKING([for docdir])
565 if test x"$docdir" = x; then
566         docdir="$datadir"/doc/"$PACKAGE_NAME"-"$PACKAGE_VERSION"
567         AC_SUBST(docdir)
569 AC_MSG_RESULT($docdir)
571 # Try to set the SVN checkout-date
572 AC_MSG_CHECKING([for SVNDATE])
573 if test -f "$srcdir/SVNDATE" # SVNDATE for tarballs
574 then
575         svndate=`cat $srcdir/SVNDATE`
576 elif test -d $srcdir/.svn # SVNDATE for svn
577 then
578         svndate="rev. `svnversion $srcdir | sed -e 's/[[0-9]][[0-9]]*:\(.*\)/\1/' -e 's/\([[0-9]][[0-9]]*\).*/\1/'`"
580 AC_MSG_RESULT(${svndate:-None required})
581 test "$svndate" && AC_DEFINE_UNQUOTED(SVNDATE, "$svndate", [The checkout date or svn revision number.])
582 test x$SYS = xwin32 && test "$svndate" && RCFLAGS="$RCFLAGS -D__PRERELEASE__"
583 SVNDATE="$svndate"
584 AC_SUBST(SVNDATE)
586 XRCFLAGS="-Isrc"
587 CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS"
588 CFLAGS="$CFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS"
590 LDFLAGS="$LDFLAGS $PROFILE_FLAGS"
591 dnl -lpthread is needed by Debian but FreeBSD < 5 doesnt support it
592 if test x$SYS != xwin32; then
593         AC_MSG_CHECKING([if this is a FreeBSD 4 or earlier system])
594         if test x"`uname -s`" = xFreeBSD && test 0`uname -r | cut -c 1` -lt 5; then
595                 LDFLAGS="$LDFLAGS -pthread"
596                 AC_MSG_RESULT(yes)
597         else
598                 LDFLAGS="$LDFLAGS -lpthread"
599                 AC_MSG_RESULT(no)
600         fi
603 case "$USE_NLS" in
605 yes)
606         AC_MSG_CHECKING([for requested languages])
607         Generate_Langs=`echo $LINGUAS | $AWK ['OFS="\\\\|" { for (i = 1; i <= NF; ++i) $i = "\\\\." $i; print }']`
608         GENERATE_MANS_TO_INSTALL(AMULE_DAEMON, docs/man/amuled)
609         GENERATE_MANS_TO_INSTALL(AMULECMD, docs/man/amulecmd)
610         GENERATE_MANS_TO_INSTALL(WEB, docs/man/amuleweb)
611         GENERATE_MANS_TO_INSTALL(AMULE_GUI, docs/man/amulegui)
612         GENERATE_MANS_TO_INSTALL(CAS, src/utils/cas/docs/cas)
613         GENERATE_MANS_TO_INSTALL(WXCAS, src/utils/wxCas/docs/wxcas)
614         GENERATE_MANS_TO_INSTALL(ED2K, docs/man/ed2k)
615         GENERATE_MANS_TO_INSTALL(ALC, src/utils/aLinkCreator/docs/alc)
616         GENERATE_MANS_TO_INSTALL(ALCC, src/utils/aLinkCreator/docs/alcc)
617         GENERATE_MANS_TO_INSTALL(MONOLITHIC, docs/man/amule)
618         AC_MSG_RESULT([${LINGUAS:-all}])
619         ;;
621         HAVE_GETTEXT="no"
622 esac
625 dnl Denoiser
627 AC_MSG_CHECKING([denoising level])
628 AS_IF([test "$denoiselevel" = "yes"], [denoiselevel=5])dnl
629 AS_IF([test "$denoiselevel" = "no"], [denoiselevel=0])dnl
630 AS_IF([test $denoiselevel -gt 4], [AS_IF([test "${svndate:+set}" = "set"], [denoiselevel=0], [denoiselevel=4])])dnl
631 AC_MSG_RESULT($denoiselevel)
633 AC_CONFIG_COMMANDS(denoiser, [[ if test $level -gt 0; then
634                 if test ! -d src/utils/scripts; then mkdir -p src/utils/scripts; fi
635                 sed -e "1{x;s/.*/1/;x;};/^[     ]*\$/d;/^#if /{/level.*$level/{x;s/^/1/;x;b0;};x;s/^/0/;x;:0;d;};/^#else/{x;/^1/{s/1/0/;b1;};s/0/1/;:1;x;d;};/^#endif/{x;s/.//;x;d;};/^[        ]*#/d;x;/^1/{x;b;};x;d" \
636                         $srcdir/src/utils/scripts/denoiser.rules > src/utils/scripts/denoiser.sed
637                 for i in `find . -name 'Makefile' -print`; do
638                         if test -n "`head -n 1 $i | grep '^#'`"; then
639                                 sed -f src/utils/scripts/denoiser.sed $i > $i.tmp && mv $i.tmp $i
640                         fi
641                 done
642         fi]], [level=$denoiselevel])
645 AM_CONDITIONAL(WEB, test x$WEB = xyes)
646 AM_CONDITIONAL(ED2K, test x$ED2K = xyes)
647 AM_CONDITIONAL(CAS, test x$CAS = xyes)
648 AM_CONDITIONAL(WXCAS, test x$WXCAS = xyes)
649 AM_CONDITIONAL(ALC, test x$ALC = xyes)
650 AM_CONDITIONAL(ALCC, test x$ALCC = xyes)
651 AM_CONDITIONAL(AMULE_GUI, test x$AMULE_GUI = xyes)
652 AM_CONDITIONAL(AMULE_DAEMON, test x$AMULE_DAEMON = xyes)
653 AM_CONDITIONAL(COMPILE_CMD, test x$AMULECMD = xyes)
654 AM_CONDITIONAL(MONOLITHIC, test x$MONOLITHIC = xyes)
655 AM_CONDITIONAL(ENABLE_UPNP, test x$ENABLE_UPNP = xyes -a x$SYS != xwin32)
656 AM_CONDITIONAL(ENABLE_IP2COUNTRY, test x$ENABLE_IP2COUNTRY = xyes)
657 AM_CONDITIONAL(SYS_WIN32, test x$SYS = xwin32)
658 AM_CONDITIONAL(NEED_RC, test x$SYS = xwin32 -a "$RC" != ":")
659 AM_CONDITIONAL(NEED_CORESERVICES, test x$SYS = xdarwin)
660 AM_CONDITIONAL(COMPILE_NLS, test x$HAVE_GETTEXT = xyes)
661 AM_CONDITIONAL(GENERATE_FLEX_HEADER, test x$HAVE_FLEX_EXTENDED = xyes)
664 dnl Check for readline library
666 if test x$AMULECMD = xyes -o x$WEB = xyes; then
667         VL_LIB_READLINE
670 # DO NOT MOVE UP... THERE'S A REASON TO BE HERE!!
672 AM_OPTIONS_CCACHE_PFX
674 AC_MSG_CHECKING([whether ccache support should be added])
675 AC_MSG_RESULT($ccache)
676 AC_SUBST(ccache)
678 case "$ccache" in
680 yes)
681         CHECK_CCACHE
682         if [[ $CCACHE = 0 ]]; then
683                 GCC="$ccache_prefix/ccache $GCC"
684                 CC="$ccache_prefix/ccache $CC"
685                 GXX="$ccache_prefix/ccache $GXX"
686                 CXX="$ccache_prefix/ccache $CXX"
687                 BUILD_CC="$ccache_prefix/ccache $BUILD_CC"
688         fi
689 esac
692 dnl Generate the Makefiles
694 AC_CONFIG_FILES([Makefile
695                  docs/Makefile
696                  docs/man/Makefile
697                  intl/Makefile
698                  src/Makefile
699                  src/kademlia/Makefile
700                  src/kademlia/utils/Makefile
701                  src/kademlia/kademlia/Makefile
702                  src/kademlia/routing/Makefile
703                  src/kademlia/net/Makefile
704                  src/pixmaps/Makefile
705                  src/pixmaps/flags_xpm/Makefile
706                  src/libs/Makefile
707                  src/libs/ec/Makefile
708                  src/libs/ec/cpp/Makefile
709                  src/libs/common/Makefile
710                  src/utils/Makefile
711                  src/utils/aLinkCreator/Makefile
712                  src/utils/aLinkCreator/docs/Makefile
713                  src/utils/aLinkCreator/src/Makefile
714                  src/utils/cas/Makefile
715                  src/utils/cas/docs/Makefile
716                  src/utils/wxCas/Makefile
717                  src/utils/wxCas/docs/Makefile
718                  src/utils/wxCas/src/Makefile
719                  src/utils/xas/Makefile
720                  src/utils/xas/autostart-xas
721                  src/utils/xas/docs/Makefile
722                  src/skins/Makefile
723                  src/webserver/Makefile
724                  src/webserver/src/Makefile
725                  src/webserver/default/Makefile
726                  src/webserver/php-default/Makefile
727                  src/webserver/chicane/Makefile
728                  unittests/Makefile
729                  unittests/muleunit/Makefile
730                  unittests/tests/Makefile])
732 dnl autoscan has missed these, i wonder why...
734 AC_CONFIG_FILES([po/Makefile.in
735                  Compilation.flags])
736 AS_IF([test x$SYS = xwin32], [AC_CONFIG_FILES([version.rc])])
737 AC_OUTPUT
739 echo
740 echo
741 echo "  Configure script has finished system check."
742 echo
743 echo "  Configured aMule ${PACKAGE_VERSION} for '${host}'."
744 echo
745 echo "  aMule enabled options:"
746 echo 
747 echo "  **** aMule Core ****" 
748 echo "  Prefix where aMule should be installed?                    ${prefix:-none}"
749 echo "  Should aMule be compiled with i18n support?                ${HAVE_GETTEXT:-no}"
750 echo "  Should aMule be compiled in debug mode?                    ${USE_DEBUG:-no}"
751 echo "  Should aMule be compiled with profiling?                   ${USE_PROFILE:-no}"
752 echo "  Should aMule be compiled with optimizations?               ${USE_OPTIMIZE:-no}"
753 echo "  Should aMule be compiled with UPnP support?                ${ENABLE_UPNP:-yes}"
754 echo "  Should aMule be compiled with IP2country support?          ${ENABLE_IP2COUNTRY:-yes}"
755 echo "  Should aMule monolithic application be built?              ${MONOLITHIC:-yes}"
756 echo "  Should aMule daemon version be built?                      ${AMULE_DAEMON:-no}"
757 echo "  Should aMule remote gui be built? (EXPERIMENTAL)           ${AMULE_GUI:-no}"
758 echo "  Crypto++ library/headers style?                            ${CRYPTO_PP_STYLE:-not found}"
760 echo
761 echo "  **** aMule TextClient ****"
762 echo "  Should aMule Command Line Client be built?                 ${AMULECMD:-no}"
763 echo
764 echo "  **** aMule WebServer ****"
765 echo "  Should aMule WebServer be built?                           ${WEB:-no}"
766 echo
767 echo "  **** aMule ED2K Links Handler ****"
768 echo "  Should aMule ED2K Links Handler be built?                  ${ED2K:-yes}"
769 echo
770 echo "  **** aMuleLinkCreator ****"
771 echo "  Should aMuleLinkCreator GUI version (alc) be built?        ${ALC:-no}"
772 echo "  Should aMuleLinkCreator for console (alcc) be built?       ${ALCC:-no}"
773 echo
774 echo "  **** aMule Statistics ****"
775 echo "  Should C aMule Statistics (CAS) be built?                  ${CAS:-no}"
776 echo "  Should aMule GUI Statistics (wxCas) be built?              ${WXCAS:-no}"
778 echo
779 echo "  **** General Libraries and Tools ****"
780 echo "  Should ccache support be enabled?                          ${ccache:-no}"
781 echo "  Libraries aMule will use to build:"
782 wxinfo="$WX_PORT"
783 AS_IF([test $WX_DEBUG -eq 1], [wxinfo="$wxinfo,debug"])
784 AS_IF([test $WX_SHARED -eq 1], [wxinfo="$wxinfo,shared"], [wxinfo="$wxinfo,static"])
785 echo "                                       wxWidgets             ${WX_VERSION_FULL} ($wxinfo)"
786 echo "                                       crypto++              ${CRYPTO_PP_VERSION_STRING} (${CRYPTO_PP_STYLE})"
787 if test x${WEB:-no} != xno; then
788 AS_IF([test $regex_found = no], [regex_found="Not detected"],
789 [AS_IF([test x$REGEX_LIB = x], [regex_found=system], [regex_found="standalone (in $REGEX_LIB)"])])
790 echo "                                       regex                 $regex_found"
792 if test x$LIBPNG_VERSION != xnot_needed; then
793 echo "                                       libpng                ${LIBPNG_VERSION:-Not detected}"
795 if test x$GDLIB_VERSION != xnot_needed; then
796 echo "                                       libgd                 ${GDLIB_VERSION:-Not detected}"
798 echo "                                       zlib                  ${ZLIB_VERSION:-Not detected}"
799 if test x$WEB = xdisabled; then
800 echo ""
801 echo ""
802 echo "WARNING! amuleweb has been disabled because configure could not find"
803 echo "a POSIX compliant regex library."
804 echo ""
806 if test x"$LIBPNG_VERSION" = x""; then
807 echo ""
808 echo ""
809 echo " WARNING! libpng >= 1.2.0 not found."
810 echo " amuleweb will be compiled but file download progress bar images will NOT be generated."
811 echo ""