Upstream tarball 20080425
[amule.git] / configure.in
blob7736449d8f237884e25297430e7f6db1fcde32ad
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
416 CHECK_EXECINFO
417 CHECK_CXXABI
419 # Ok, we have all needed libs, now checking for other stuff
420 CHECK_AUTOPOINT
422 if test "$LEX" = "flex"; then
423         CHECK_FLEX_EXTENDED
424 else
425         HAVE_FLEX_EXTENDED=no
428 # Flush standard test results for speeding cache
429 AC_CACHE_SAVE
431 dnl -------------------------------------------------------------------------------
432 dnl Start of autoscan stuff
433 dnl -------------------------------------------------------------------------------
434 # Checks for header files.
435 AC_PATH_X
436 AC_FUNC_ALLOCA
437 AC_HEADER_DIRENT
438 AC_HEADER_STDC
439 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])
440 AC_HEADER_SYS_WAIT
442 # Checks for typedefs, structures, and compiler characteristics.
443 AC_HEADER_STDBOOL
444 AC_C_CONST
445 AC_C_INLINE
446 AC_TYPE_MODE_T
447 AC_TYPE_OFF_T
448 AC_TYPE_SIZE_T
449 AC_HEADER_TIME
450 AC_STRUCT_TM
451 AC_TYPE_UID_T
452 AC_C_VOLATILE
453 AC_CHECK_TYPES([ptrdiff_t])
455 # Checks for library functions.
456 AC_FUNC_CLOSEDIR_VOID
457 AM_GNU_GETTEXT
458 AC_FUNC_GETMNTENT
459 AC_PROG_GCC_TRADITIONAL
460 AC_FUNC_FORK
461 if test x$SYS != xwin32; then
462 AC_FUNC_LSTAT
463 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
465 AC_FUNC_MEMCMP
466 AC_FUNC_MMAP
467 AC_FUNC_SELECT_ARGTYPES
468 AC_FUNC_SETVBUF_REVERSED
469 AC_TYPE_SIGNAL
470 AC_FUNC_STAT
471 AC_FUNC_STRFTIME
472 AC_FUNC_STRTOD
473 AC_FUNC_VPRINTF
474 dnl Some other functions that worth checking deeper:
475 dnl AC_FUNC_CLOSEDIR_VOID
476 dnl AC_FUNC_MEMCMP
477 dnl AC_FUNC_MMAP
478 dnl AC_FUNC_STAT
479 dnl AC_FUNC_STRTOD
480 dnl AC_FUNC_SETVBUF_REVERSED
481 dnl Anyways, do we actually USE them?
482 if test $cross_compiling = yes -a $gnumalloc = yes ; then
483         AC_MSG_WARN([
484     configure cannot check whether malloc() and realloc() are GNU libc
485     compatible. You have to be ABSOLUTELY sure that they are, otherwise
486     run configure with the --without-gnu-malloc switch.])
487         ac_cv_func_malloc_0_nonnull=yes
488         ac_cv_func_realloc_0_nonnull=yes
490 AC_FUNC_MALLOC
491 AC_FUNC_REALLOC
492 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])
493 #-------------------------------------------------------------------------------
494 # End of autoscan stuff
495 #-------------------------------------------------------------------------------
498 dnl autoscan has missed these ones. Maybe because it's win32 stuff?
500 AC_CHECK_FUNCS([mkdir getrlimit setrlimit])
502 # Flush standard test results for speeding cache
503 AC_CACHE_SAVE
505 # Other tests
507 case "$USE_DEBUG" in
508 yes)    DEBUG_FLAGS="-g -D__DEBUG__ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC"
509         AS_IF([test x$GCC = xyes], [DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0"])
510         AS_IF([test x$SYS = xwin32], [RCFLAGS="$RCFLAGS -D__DEBUG__"])
511     ;;
512 *)      DEBUG_FLAGS=""
513         AS_IF([test x$GCC = xyes], [DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef"])
514     ;;
515 esac
517 #aMule options
519 # Command line tools
520 case "$AMULECMD" in
521 yes)    ;;
522 *)      AMULECMD="no"
523         ;;
524 esac
526 # For proper compilation flags
528 WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net`
530 WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net`
531 WXBASE_CXXFLAGS="$WX_CXXFLAGS -DwxUSE_GUI=0"
532 WXBASE_CFLAGS="$WX_CFLAGS -DwxUSE_GUI=0"
534 AC_SUBST(WXBASE_LIBS)
535 AC_SUBST(WXBASE_CFLAGS)
536 AC_SUBST(WXBASE_CXXFLAGS)
538 case "$USE_OPTIMIZE" in
539 yes)    OPTIMIZE_FLAGS="-O2"
540         ;;
541 *)      OPTIMIZE_FLAGS=""
542         ;;
543 esac
545 # Profiling
546 case "$USE_PROFILE" in
547 yes)    PROFILE_FLAGS="-pg"
548         ;;
549 *)      PROFILE_FLAGS=""
550         ;;
551 esac
553 AC_MSG_CHECKING([if the applications should be statically linked])
554 case "$USE_DEBUG_STATIC" in
555 yes)    LDFLAGS="$LDFLAGS -static"
556         ;;
557 esac
558 AC_MSG_RESULT($USE_DEBUG_STATIC)
560 # autoconf >= 2.60 already defines ${docdir}, but we always need it.
561 AC_MSG_CHECKING([for docdir])
562 if test x"$docdir" = x; then
563         docdir="$datadir"/doc/"$PACKAGE_NAME"-"$PACKAGE_VERSION"
564         AC_SUBST(docdir)
566 AC_MSG_RESULT($docdir)
568 # Try to set the SVN checkout-date
569 AC_MSG_CHECKING([for SVNDATE])
570 if test -f "$srcdir/SVNDATE" # SVNDATE for tarballs
571 then
572         svndate=`cat $srcdir/SVNDATE`
573 elif test -d $srcdir/.svn # SVNDATE for svn
574 then
575         svndate="rev. `svnversion $srcdir | sed -e 's/[[0-9]][[0-9]]*:\(.*\)/\1/' -e 's/\([[0-9]][[0-9]]*\).*/\1/'`"
577 AC_MSG_RESULT(${svndate:-None required})
578 test "$svndate" && AC_DEFINE_UNQUOTED(SVNDATE, "$svndate", [The checkout date or svn revision number.])
579 test x$SYS = xwin32 && test "$svndate" && RCFLAGS="$RCFLAGS -D__PRERELEASE__"
580 SVNDATE="$svndate"
581 AC_SUBST(SVNDATE)
583 XRCFLAGS="-Isrc"
584 CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS"
585 CFLAGS="$CFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS"
587 LDFLAGS="$LDFLAGS $PROFILE_FLAGS"
588 dnl -lpthread is needed by Debian but FreeBSD < 5 doesnt support it
589 if test x$SYS != xwin32; then
590         AC_MSG_CHECKING([if this is a FreeBSD 4 or earlier system])
591         if test x"`uname -s`" = xFreeBSD && test 0`uname -r | cut -c 1` -lt 5; then
592                 LDFLAGS="$LDFLAGS -pthread"
593                 AC_MSG_RESULT(yes)
594         else
595                 LDFLAGS="$LDFLAGS -lpthread"
596                 AC_MSG_RESULT(no)
597         fi
600 case "$USE_NLS" in
602 yes)
603         AC_MSG_CHECKING([for requested languages])
604         Generate_Langs=`echo $LINGUAS | $AWK ['OFS="\\\\|" { for (i = 1; i <= NF; ++i) $i = "\\\\." $i; print }']`
605         GENERATE_MANS_TO_INSTALL(AMULE_DAEMON, docs/man/amuled)
606         GENERATE_MANS_TO_INSTALL(AMULECMD, docs/man/amulecmd)
607         GENERATE_MANS_TO_INSTALL(WEB, docs/man/amuleweb)
608         GENERATE_MANS_TO_INSTALL(AMULE_GUI, docs/man/amulegui)
609         GENERATE_MANS_TO_INSTALL(CAS, src/utils/cas/docs/cas)
610         GENERATE_MANS_TO_INSTALL(WXCAS, src/utils/wxCas/docs/wxcas)
611         GENERATE_MANS_TO_INSTALL(ED2K, docs/man/ed2k)
612         GENERATE_MANS_TO_INSTALL(ALC, src/utils/aLinkCreator/docs/alc)
613         GENERATE_MANS_TO_INSTALL(ALCC, src/utils/aLinkCreator/docs/alcc)
614         GENERATE_MANS_TO_INSTALL(MONOLITHIC, docs/man/amule)
615         AC_MSG_RESULT([${LINGUAS:-all}])
616         ;;
618         HAVE_GETTEXT="no"
619 esac
622 dnl Denoiser
624 AC_MSG_CHECKING([denoising level])
625 AS_IF([test "$denoiselevel" = "yes"], [denoiselevel=5])dnl
626 AS_IF([test "$denoiselevel" = "no"], [denoiselevel=0])dnl
627 AS_IF([test $denoiselevel -gt 4], [AS_IF([test "${svndate:+set}" = "set"], [denoiselevel=0], [denoiselevel=4])])dnl
628 AC_MSG_RESULT($denoiselevel)
630 AC_CONFIG_COMMANDS(denoiser, [[ if test $level -gt 0; then
631                 if test ! -d src/utils/scripts; then mkdir -p src/utils/scripts; fi
632                 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" \
633                         $srcdir/src/utils/scripts/denoiser.rules > src/utils/scripts/denoiser.sed
634                 for i in `find . -name 'Makefile' -print`; do
635                         if test -n "`head -n 1 $i | grep '^#'`"; then
636                                 sed -f src/utils/scripts/denoiser.sed $i > $i.tmp && mv $i.tmp $i
637                         fi
638                 done
639         fi]], [level=$denoiselevel])
642 AM_CONDITIONAL(WEB, test x$WEB = xyes)
643 AM_CONDITIONAL(ED2K, test x$ED2K = xyes)
644 AM_CONDITIONAL(CAS, test x$CAS = xyes)
645 AM_CONDITIONAL(WXCAS, test x$WXCAS = xyes)
646 AM_CONDITIONAL(ALC, test x$ALC = xyes)
647 AM_CONDITIONAL(ALCC, test x$ALCC = xyes)
648 AM_CONDITIONAL(AMULE_GUI, test x$AMULE_GUI = xyes)
649 AM_CONDITIONAL(AMULE_DAEMON, test x$AMULE_DAEMON = xyes)
650 AM_CONDITIONAL(COMPILE_CMD, test x$AMULECMD = xyes)
651 AM_CONDITIONAL(MONOLITHIC, test x$MONOLITHIC = xyes)
652 AM_CONDITIONAL(ENABLE_UPNP, test x$ENABLE_UPNP = xyes -a x$SYS != xwin32)
653 AM_CONDITIONAL(ENABLE_IP2COUNTRY, test x$ENABLE_IP2COUNTRY = xyes)
654 AM_CONDITIONAL(SYS_WIN32, test x$SYS = xwin32)
655 AM_CONDITIONAL(NEED_RC, test x$SYS = xwin32 -a "$RC" != ":")
656 AM_CONDITIONAL(NEED_CORESERVICES, test x$SYS = xdarwin)
657 AM_CONDITIONAL(COMPILE_NLS, test x$HAVE_GETTEXT = xyes)
658 AM_CONDITIONAL(GENERATE_FLEX_HEADER, test x$HAVE_FLEX_EXTENDED = xyes)
661 dnl Check for readline library
663 if test x$AMULECMD = xyes -o x$WEB = xyes; then
664         VL_LIB_READLINE
667 # DO NOT MOVE UP... THERE'S A REASON TO BE HERE!!
669 AM_OPTIONS_CCACHE_PFX
671 AC_MSG_CHECKING([whether ccache support should be added])
672 AC_MSG_RESULT($ccache)
673 AC_SUBST(ccache)
675 case "$ccache" in
677 yes)
678         CHECK_CCACHE
679         if [[ $CCACHE = 0 ]]; then
680                 GCC="$ccache_prefix/ccache $GCC"
681                 CC="$ccache_prefix/ccache $CC"
682                 GXX="$ccache_prefix/ccache $GXX"
683                 CXX="$ccache_prefix/ccache $CXX"
684                 BUILD_CC="$ccache_prefix/ccache $BUILD_CC"
685         fi
686 esac
689 dnl Generate the Makefiles
691 AC_CONFIG_FILES([Makefile
692                  docs/Makefile
693                  docs/man/Makefile
694                  intl/Makefile
695                  src/Makefile
696                  src/pixmaps/Makefile
697                  src/pixmaps/flags_xpm/Makefile
698                  src/libs/Makefile
699                  src/libs/ec/Makefile
700                  src/libs/ec/cpp/Makefile
701                  src/libs/common/Makefile
702                  src/utils/Makefile
703                  src/utils/aLinkCreator/Makefile
704                  src/utils/aLinkCreator/docs/Makefile
705                  src/utils/aLinkCreator/src/Makefile
706                  src/utils/cas/Makefile
707                  src/utils/cas/docs/Makefile
708                  src/utils/wxCas/Makefile
709                  src/utils/wxCas/docs/Makefile
710                  src/utils/wxCas/src/Makefile
711                  src/utils/xas/Makefile
712                  src/utils/xas/autostart-xas
713                  src/utils/xas/docs/Makefile
714                  src/skins/Makefile
715                  src/webserver/Makefile
716                  src/webserver/src/Makefile
717                  src/webserver/default/Makefile
718                  src/webserver/php-default/Makefile
719                  src/webserver/chicane/Makefile
720                  src/webserver/litoral/Makefile
721                  unittests/Makefile
722                  unittests/muleunit/Makefile
723                  unittests/tests/Makefile])
725 dnl autoscan has missed these, i wonder why...
727 AC_CONFIG_FILES([po/Makefile.in
728                  Compilation.flags])
729 AS_IF([test x$SYS = xwin32], [AC_CONFIG_FILES([version.rc])])
730 AC_OUTPUT
732 echo
733 echo
734 echo "  Configure script has finished system check."
735 echo
736 echo "  Configured aMule ${PACKAGE_VERSION} for '${host}'."
737 echo
738 echo "  aMule enabled options:"
739 echo 
740 echo "  **** aMule Core ****" 
741 echo "  Prefix where aMule should be installed?                    ${prefix:-none}"
742 echo "  Should aMule be compiled with i18n support?                ${HAVE_GETTEXT:-no}"
743 echo "  Should aMule be compiled in debug mode?                    ${USE_DEBUG:-no}"
744 echo "  Should aMule be compiled with profiling?                   ${USE_PROFILE:-no}"
745 echo "  Should aMule be compiled with optimizations?               ${USE_OPTIMIZE:-no}"
746 echo "  Should aMule be compiled with UPnP support?                ${ENABLE_UPNP:-yes}"
747 echo "  Should aMule be compiled with IP2country support?          ${ENABLE_IP2COUNTRY:-yes}"
748 echo "  Should aMule monolithic application be built?              ${MONOLITHIC:-yes}"
749 echo "  Should aMule daemon version be built?                      ${AMULE_DAEMON:-no}"
750 echo "  Should aMule remote gui be built? (EXPERIMENTAL)           ${AMULE_GUI:-no}"
751 echo "  Crypto++ library/headers style?                            ${CRYPTO_PP_STYLE:-not found}"
753 echo
754 echo "  **** aMule TextClient ****"
755 echo "  Should aMule Command Line Client be built?                 ${AMULECMD:-no}"
756 echo
757 echo "  **** aMule WebServer ****"
758 echo "  Should aMule WebServer be built?                           ${WEB:-no}"
759 echo
760 echo "  **** aMule ED2K Links Handler ****"
761 echo "  Should aMule ED2K Links Handler be built?                  ${ED2K:-yes}"
762 echo
763 echo "  **** aMuleLinkCreator ****"
764 echo "  Should aMuleLinkCreator GUI version (alc) be built?        ${ALC:-no}"
765 echo "  Should aMuleLinkCreator for console (alcc) be built?       ${ALCC:-no}"
766 echo
767 echo "  **** aMule Statistics ****"
768 echo "  Should C aMule Statistics (CAS) be built?                  ${CAS:-no}"
769 echo "  Should aMule GUI Statistics (wxCas) be built?              ${WXCAS:-no}"
771 echo
772 echo "  **** General Libraries and Tools ****"
773 echo "  Should ccache support be enabled?                          ${ccache:-no}"
774 echo "  Libraries aMule will use to build:"
775 wxinfo="$WX_PORT"
776 AS_IF([test $WX_DEBUG -eq 1], [wxinfo="$wxinfo,debug"])
777 AS_IF([test $WX_SHARED -eq 1], [wxinfo="$wxinfo,shared"], [wxinfo="$wxinfo,static"])
778 echo "                                       wxWidgets             ${WX_VERSION_FULL} ($wxinfo)"
779 echo "                                       crypto++              ${CRYPTO_PP_VERSION_STRING} (${CRYPTO_PP_STYLE})"
780 if test x${WEB:-no} != xno; then
781 AS_IF([test $regex_found = no], [regex_found="Not detected"],
782 [AS_IF([test x$REGEX_LIB = x], [regex_found=system], [regex_found="standalone (in $REGEX_LIB)"])])
783 echo "                                       regex                 $regex_found"
785 if test x$LIBPNG_VERSION != xnot_needed; then
786 echo "                                       libpng                ${LIBPNG_VERSION:-Not detected}"
788 if test x$GDLIB_VERSION != xnot_needed; then
789 echo "                                       libgd                 ${GDLIB_VERSION:-Not detected}"
791 echo "                                       zlib                  ${ZLIB_VERSION:-Not detected}"
792 if test x$WEB = xdisabled; then
793 echo ""
794 echo ""
795 echo "WARNING! amuleweb has been disabled because configure could not find"
796 echo "a POSIX compliant regex library."
797 echo ""
799 if test x"$LIBPNG_VERSION" = x""; then
800 echo ""
801 echo ""
802 echo " WARNING! libpng >= 1.2.0 not found."
803 echo " amuleweb will be compiled but file download progress bar images will NOT be generated."
804 echo ""