do not link statically to system libs (glibc, threads, etc)
[mldonkey.git] / config / configure.in
blobdc165b24912c39f4b0cfb305432a8ef71b57f235
2 # **********                                                                                  **********
3 # **********                            Autoconf, configure internals                         **********
4 # **********                                                                                  **********
6 AC_REVISION(norev)
7 AC_PREREQ(2.53)
8 AC_INIT(Makefile.config.in)
9 AC_CONFIG_HEADER(config.h)
11 CONFIGURE_RUN=yes
12 CONFIGURE_ARGUMENTS=$ac_configure_args
13 echo "Arguments to configure: $CONFIGURE_ARGUMENTS"
15 cd ..
16 SOURCE_DIR=`pwd`
17 cd config
19 # **********                                                                                  **********
20 # **********                                   MLDonkey version                               **********
21 # **********                                                                                  **********
23 MAJOR_VERSION=3
24 MINOR_VERSION=0
25 SUB_VERSION=7   # range 0-7 due to eMule limitations
27 # **********                                                                                  **********
28 # **********                                  check for C compiler                            **********
29 # **********                                                                                  **********
31 AC_PROG_CC
32 CC_VERSION=`$CC -dumpversion`
33 AC_EXEEXT
34 AC_PROG_CPP
36 # **********                                                                                  **********
37 # **********                                    System checks                                 **********
38 # **********                                                                                  **********
40 AC_CANONICAL_HOST
42 OS_FILES=unix
43 OS_FILES2=unix
44 SYSTEM=unknown
45 FIX_BROKEN_CPP=
46 case $host in
47   *mingw*)
48     SYSTEM=mingw
49     OS_FILES=mingw
50     OS_FILES2=mingw
51     PTHREAD_LIBS="-lpthreadGC2 -lwsock32"
52     PTHREAD_MINGW_CFLAGS="-DPTW32_STATIC_LIB"
53     AC_MSG_CHECKING(for mingw-runtime version)
54       
55 cat >mingw_rt_ver.c <<'END'
56 #include <stdio.h>
57 #include <_mingw.h>
58 main(int argc, char *argv[[]])  {
60 int required_runtime_major=3;       /**********     change required mingw-runtime   **********/
61 int required_runtime_minor=10;      /**********              version here           **********/
63 #ifdef __MINGW32_MAJOR_VERSION
64 #  ifdef __MINGW32_MINOR_VERSION
65      switch(argv[[1]][[0]]) {
66        case 'x':
67          printf("%d.%d", __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION);
68          break;
69        case 'y':
70          if ((__MINGW32_MAJOR_VERSION == required_runtime_major && __MINGW32_MINOR_VERSION < required_runtime_minor) || 
71              (__MINGW32_MAJOR_VERSION < required_runtime_major)) {
72            printf("no");
73            break; }
74          else {
75            printf("yes");
76            break; }
77        case 'z':
78          printf("%d.%d", required_runtime_major, required_runtime_minor);
79          break;
80      }
81      return 0;
82 #  else
83    printf("__MINGW32_MINOR_VERSION not defined in _mingw.h");
84    return 0;
85 #  endif
86 #else
87  printf("__MINGW32_MAJOR_VERSION not defined in _mingw.h");
88  return 0;
89 #endif
91 END
93     $CC -o mingw_rt_ver ./mingw_rt_ver.c
94     MINGW_RT_VER="`./mingw_rt_ver x`"
95     MINGW_RT_VER_OK="`./mingw_rt_ver y`"
96     MINGW_RT_VER_REQ="`./mingw_rt_ver z`"
97     rm -f mingw_rt_ver mingw_rt_ver.*
98     AC_MSG_RESULT($MINGW_RT_VER)
99     if test "$MINGW_RT_VER_OK" = "no"; then
100       echo "********  mingw-runtime version $MINGW_RT_VER_REQ is required  *********" 1>&2;
101       exit 1
102     fi
103     ;;
104   *cygwin*)
105     SYSTEM=cygwin
106     OS_FILES2=cygwin
107     ;;
108   *kfreebsd*)
109     SYSTEM=kfreebsd
110     ;;
111   *freebsd*|*dragonfly*)
112     SYSTEM=freebsd
113     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
114     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
115     ;;
116   *openbsd*)
117     SYSTEM=openbsd
118     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
119     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
120     ;;
121   *netbsd*)
122     SYSTEM=netbsd
123     ;;
124   *linux*)
125     SYSTEM=linux
126     ;;
127   *solaris*)
128     SYSTEM=solaris
129     ;;
130   *morphos*|*amigaos*)
131     SYSTEM=morphos
132     ;;
133   *aix*)
134     SYSTEM=aix
135     ;;
136   *beos*)
137     SYSTEM=beos
138     ;;
139   *osf*)
140     SYSTEM=osf
141     ;;
142   *irix*)
143     SYSTEM=irix
144     ;;
145   *hppa*|*hpux*)
146     SYSTEM=hpux
147     ;;
148   *darwin*|*rhapsody*|*macosx*)
149     SYSTEM=macos
150     AC_CHECK_PROG(SED, sed, sed)
151     if test "$ac_cv_prog_SED" = "sed"; then
152       FIX_BROKEN_CPP="| sed -n '/^\#pragma/!p'"
153     else
154       AC_CHECK_PROG(GREP, grep, grep)
155       if test "$ac_cv_prog_GREP" = "grep"; then
156         FIX_BROKEN_CPP="| grep -v '^\#pragma'"
157       fi
158     fi
159     if test "xFIX_BROKEN_CPP" = "x"; then
160       echo "Apple cpp produces broken files, your system lacks sed or grep to fix it"
161       exit 1
162     fi
163     ;;
164 esac
165 if test "x$SYSTEM" = "xunknown"; then
166   echo "Unknown build system, please report to the MLDonkey development team at http://mldonkey.sourceforge.net/forums/"
167   exit 1
170 case "$host" in
171   alpha*-*-osf*)                arch=alpha; system=digital;;
172   alpha*-*-linux*)              arch=alpha; system=linux;;
173   alpha*-*-freebsd*)            arch=alpha; system=freebsd;;
174   alpha*-*-netbsd*)             arch=alpha; system=netbsd;;
175   alpha*-*-openbsd*)            arch=alpha; system=openbsd;;
176   sparc-*-sunos4.*)             arch=sparc; system=sunos;;
177   sparc-*-solaris2.*)           arch=sparc; system=solaris;;
178   sparc-*-*bsd*)                arch=sparc; system=bsd;;
179   sparc-*-linux*)               arch=sparc; system=linux;;
180   i?86-*-linux*)           arch=i386; system=linux;;
181   i386-*-*bsd*)            arch=i386; system=bsd;;
182   i486-*-*bsd*)            arch=i486; system=bsd;;
183   i586-*-*bsd*)            arch=i586; system=bsd;;
184   i686-*-*bsd*)            arch=i686; system=bsd;;
185   i?86-*-nextstep*)        arch=i386; system=nextstep;;
186   i?86-*-solaris*)         arch=i386; system=solaris;;
187   i?86-*-beos*)            arch=i386; system=beos;;
188   i?86-*-cygwin*)          arch=i386; system=cygwin;;
189   mips-*-irix6*)                arch=mips; system=irix;;
190   hppa1.1-*-hpux*)              arch=hppa; system=hpux;;
191   hppa1.1-*-nextstep*)          arch=hppa; system=nextstep;;
192   rs6000-*-aix*)                arch=power; model=rs6000; system=aix;;
193   powerpc-*-aix*)               arch=power; model=ppc; system=aix;;
194   powerpc-*-linux*)             arch=power; model=ppc; system=elf;;
195   powerpc-*-rhapsody*)          arch=power; model=ppc; system=rhapsody;;
196   powerpc-*-darwin*)            arch=power; model=ppc; system=rhapsody;;
197   arm*-*-linux*)                arch=arm; system=linux;;
198   ia64-*-linux*)                arch=ia64; system=linux;;
199 esac
201 MD4ARCH=$arch
202 case $host in
203   i386-pc-linux*|i386-*-*bsd*) MD4COMP=as; MD4ARCH=i386;;
204   i486-pc-linux*|i486-*-*bsd*) MD4COMP=as; MD4ARCH=i486;;
205   i586-pc-linux*|i586-*-*bsd*) MD4COMP=as; MD4ARCH=i586;;
206   i686-pc-linux*|i686-*-*bsd*) MD4COMP=as; MD4ARCH=i686;;
207   i386-pc-mingw32*) MD4COMP=cc; MD4ARCH=i386;;
208   i486-pc-mingw32*) MD4COMP=cc; MD4ARCH=i486;;
209   i586-pc-mingw32*) MD4COMP=cc; MD4ARCH=i586;;
210   i686-pc-mingw32*) MD4COMP=cc; MD4ARCH=i686;;
211   *) MD4COMP=cc;;
212 esac
214 ARCH=$arch
216 # **********                                                                                  **********
217 # **********               Parse checkout date (CVS) or revision (SVN) if available           **********
218 # **********                                                                                  **********
220 if test -d .svn; then
221   AC_MSG_NOTICE(checking SVN revision)
222   AC_CHECK_PROG(SVNVERSION,svnversion,svnversion)
223   if test "$ac_cv_prog_SVNVERSION" = "svnversion"; then
224     SUB_VERSION3="SVN"
225     SCM_VERSION=`svnversion -n .`
226   else AC_MSG_NOTICE(cannot checking SVN revision... no SVNVERSION)
227     SCM_VERSION="cannot find out SVN revision (no SVNVERSION)"  
228   fi     
231 if test -f ./CVS/Entries ; then
232   AC_MSG_NOTICE(checking CVS checkout date)
233   AC_CHECK_PROGS(STAT, stat gstat, stat)
234   if [ test "$ac_cv_prog_STAT" = "stat" ] || [ test "$ac_cv_prog_STAT" = "gstat" ]; then
235     AC_CHECK_PROG(SED, sed, sed)
236     if test "$ac_cv_prog_SED" = "sed"; then
237       AC_CHECK_PROG(CUT, cut, cut)
238       if test "$ac_cv_prog_CUT" = "cut"; then
239         SUB_VERSION3="CVS"
240         if [ test "$SYSTEM" = "freebsd"] || [ test "$SYSTEM" = "netbsd"] || ( [ test "$SYSTEM" = "macos" ] && [ test "$ac_cv_prog_STAT" != "gstat" ] ); then
241           SCM_VERSION=`$STAT -f "%Sm" ./CVS/Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\4-\1-\2 \3/'`
242         else
243         if [ test "$SYSTEM" = "openbsd"]; then
244           AC_CHECK_PROG(GREP, grep, grep)
245           if test "$ac_cv_prog_GREP" = "grep"; then
246             SCM_VERSION=`$STAT -f %a ./CVS/Entries | $GREP -v Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\1-\2-\4 \3/'`
247           fi
248         else
249         if [ test "$SYSTEM" = "mingw"] || [ test "$SYSTEM" = "cygwin"]; then
250           AC_CHECK_PROG(GREP, grep, grep)
251           if test "$ac_cv_prog_GREP" = "grep"; then
252             SCM_VERSION=`$STAT ./CVS/Entries  | $GREP Modify | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/\5-\2-\3 \4/'`
253           fi
254         else
255           SCM_VERSION=`$STAT -Lc %y ./CVS/Entries | $SED -e 's#\.[0-9]*##' | $CUT -c 1-19`
256         fi  #if [ test "$SYSTEM" = "mingw"] || ...
257         fi  #if [ test "$SYSTEM" = "openbsd"]
258         fi  #if [ test "$SYSTEM" = "freebsd"] || ...
259       else
260         AC_MSG_NOTICE(cannot checking CVS checkout date... no CUT)
261         SCM_VERSION="cannot find out SCM Version (no CUT)"
262       fi
263     else
264       AC_MSG_NOTICE(cannot checking CVS checkout date... no SED)
265       SCM_VERSION="cannot find out SCM Version (no SED)"
266     fi
267   else
268     AC_MSG_NOTICE(cannot checking CVS checkout date... no STAT)
269     SCM_VERSION="cannot find out SCM Version (no STAT)"
270   fi
273 # **********                                                                                  **********
274 # **********             build MLDonkey version, Required Ocaml and LablGTK versions          **********
275 # **********                                                                                  **********
277 MLDONKEY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$SUB_VERSION
278 if test -f ./subrelease; then
279   MLDONKEY_VERSION=$MLDONKEY_VERSION`cat ./subrelease`
281 if test ! -z "$SUB_VERSION3"; then
282   MLDONKEY_VERSION=$MLDONKEY_VERSION.$SUB_VERSION3
285 REQUIRED_OCAML=3.12.0
286 DOWNLOAD_OCAML_MAJOR=3.12
287 DOWNLOAD_OCAML=3.12.0
289 REQUIRED_LABLGTK=1.2.7
291 touch install-sh
293 LABLGTK_NAME=lablgtk
295 # **********                                                                                  **********
296 # **********                    Network and Feature configure switch variables                **********
297 # **********                                                                                  **********
299 # **********   currently not working Networks, can't be enabled
301 SOULSEEK=no
302 OPEN_NAPSTER=no
303 OPENFT=no
305 # **********   working Networks, enabled by default
307 DONKEY=yes
308 BITTORRENT=yes
309 GNUTELLA=no
310 GNUTELLA2=no
311 FASTTRACK=yes
312 FILETP=yes
313 DIRECT_CONNECT=yes
315 # **********   predefined configure variations
317 MULTINET=yes
318 MINIMUM=no
320 # **********   Features, enabled by default
322 DONKEY_SUI=yes
323 DONKEY_SUI_FILE=DonkeySui2
324 GD=yes
325 BZIP2=yes
326 MAGIC=yes
327 ICONV=yes
328 USE_PTHREAD=yes
329 UPNP_NATPMP=no
330 UPNP_NATPMP_FORCE=no
332 # **********
334 BATCH=no
335 FORCE_OCAML=no
336 FORCE_MINGW=no
337 PROFILE=no
338 DEBUG=no
339 GUI=no
340 CHECKBOUNDS=false
342 # **********                                                                                  **********
343 # **********                Network and Feature configure switches and dependency             **********
344 # **********                                                                                  **********
346 AC_ARG_ENABLE(multinet,
347   AS_HELP_STRING([--disable-multinet], [disable all networks except eDonkey (with Overnet and Kademlia)]),
348   [MULTINET="$enableval"])
349 AC_ARG_ENABLE(minimum,
350   AS_HELP_STRING([--enable-minimum], [enable minimum set of features and networks (eDonkey, iconv and threads enabled)]),
351   [MINIMUM="$enableval"])
352 AC_ARG_ENABLE(minimum,
353   AS_HELP_STRING([--enable-minimum=all], [enable only eDonkey network and disable all optional features (not recommended)]),
354   [MINIMUM="$enableval"])
356 if [ test ! "$MULTINET" = "yes" ] || [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
357   GNUTELLA=no
358   GNUTELLA2=no
359   FASTTRACK=no
360   DIRECT_CONNECT=no
361   FILETP=no
362   BITTORRENT=no
364 if [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
365   DONKEY_SUI=no
366   GD=no
367   BZIP2=no
368   MAGIC=no
370 if [ test "$MINIMUM" = "all" ]; then
371   USE_PTHREAD=no
372   ICONV=no
375 #AC_ARG_ENABLE(soulseek,      [  --disable-soulseek      disable support for SoulSeek], [SOULSEEK="$enableval"])
376 #AC_ARG_ENABLE(opennap,       [  --disable-opennap       disable support for Open Napster], [OPEN_NAPSTER="$enableval"])
377 AC_ARG_ENABLE(directconnect,
378   AS_HELP_STRING([--disable-directconnect], [disable support for Direct Connect]),
379   [DIRECT_CONNECT="$enableval"])
380 #AC_ARG_ENABLE(openft,        [  --disable-openft        disable support for OpenFT], [OPENFT="$enableval"])
382 AC_ARG_ENABLE(donkey,
383   AS_HELP_STRING([--disable-donkey], [disable support for eDonkey]),
384   [DONKEY="$enableval"])
385 AC_ARG_ENABLE(donkeysui,
386   AS_HELP_STRING([--disable-donkeysui], [disable support for eMule SecureUserIdent]),
387   [DONKEY_SUI="$enableval"])
388 AC_ARG_ENABLE(bittorrent,
389   AS_HELP_STRING([--disable-bittorrent], [disable support for Bittorent]),
390   [BITTORRENT="$enableval"])
391 AC_ARG_ENABLE(filetp,
392   AS_HELP_STRING([--disable-filetp], [disable support for fileTP]),
393   [FILETP="$enableval"])
394 AC_ARG_ENABLE(gnutella,
395   AS_HELP_STRING([--disable-gnutella], [disable support for Gnutella]),
396   [GNUTELLA="$enableval"])
397 AC_ARG_ENABLE(gnutella2,
398   AS_HELP_STRING([--disable-gnutella2], [disable support for Gnutella2]),
399   [GNUTELLA2="$enableval"])
400 AC_ARG_ENABLE(fasttrack,
401   AS_HELP_STRING([--disable-fasttrack], [disable support for FastTrack]),
402   [FASTTRACK="$enableval"])
404 AC_ARG_ENABLE(batch,
405   AS_HELP_STRING([--enable-batch], [reply YES to all queries in this script]),
406   [BATCH="$enableval"])
407 AC_ARG_ENABLE(force-ocaml,
408   AS_HELP_STRING([--enable-force-ocaml], [force usage of self-compiled Ocaml]),
409   [FORCE_OCAML="$enableval"])
410 AC_ARG_ENABLE(ocamlver,
411   AS_HELP_STRING([--enable-ocamlver=VER], [force usage of specific Ocaml version (3.10.1|CVS), ]),
412   [REQUIRED_OCAML="$enableval"])
413 AC_ARG_ENABLE(mingw,
414   AS_HELP_STRING([--enable-mingw], [force compilation with MINGW on Cygwin]),
415   [FORCE_MINGW="$enableval"])
416 AC_ARG_ENABLE(checks,
417   AS_HELP_STRING([--enable-checks], [enable bounds-checking for array/string accesses]),
418   [CHECKBOUNDS="$enableval"])
419 if test "$CHECKBOUNDS" = "yes"; then
420   CHECKBOUNDS=true
423 AC_ARG_ENABLE(profile,
424   AS_HELP_STRING([--enable-profile], [compile with gprof profiling support (enables debug)]),
425   [PROFILE="$enableval"])
426 AC_ARG_ENABLE(debug,
427   AS_HELP_STRING([--enable-debug], [compile with debugging information]),
428   [DEBUG="$enableval"])
429 if test "$PROFILE" = "yes"; then
430   DEBUG="yes"
432 AC_ARG_ENABLE(gui,
433   AS_HELP_STRING([--disable-gui], [disable GUI build (default)]),
434   [GUI="$enableval"])
435 AC_ARG_ENABLE(gui,
436   AS_HELP_STRING([--enable-gui=oldgui|newgui1|newgui2], 
437                  [enable GUI (newgui2 uses GTK2 (default), other GUIs use GTK1)]),
438   [GUI="$enableval"])
439 if test "$GUI" = "yes"; then
440   GUI=newgui2
442 if test ! "$GUI" = "newgui2"; then
443   if test ! "$GUI" = "newgui1"; then
444     if test ! "$GUI" = "oldgui"; then
445       GUI=no
446     fi
447   fi
450 AC_ARG_ENABLE(pthread,
451   AS_HELP_STRING([--disable-pthread], [disable the use of pthread, hurts performance!]),
452   [USE_PTHREAD="$enableval"])
453 AC_ARG_ENABLE(pthread-lib,
454   AS_HELP_STRING([--enable-pthread-lib], [legacy option]),
455   [USE_PTHREAD="$enableval"])
456 AC_ARG_ENABLE(iconv,
457   AS_HELP_STRING([--disable-iconv], [disable the use of iconv]),
458   [ICONV="$enableval"])
459 AC_ARG_ENABLE(gd,
460   AS_HELP_STRING([--disable-gd], [disable the use of gd]),
461   [GD="$enableval"])
462 AC_ARG_ENABLE(bzip2,
463   AS_HELP_STRING([--disable-bzip2], [disable the use of bzip2]),
464   [BZIP2="$enableval"])
465 AC_ARG_ENABLE(magic,
466   AS_HELP_STRING([--disable-magic], [disable the use of libmagic (GNU file)]),
467   [MAGIC="$enableval"])
468 AC_ARG_ENABLE(upnp-natpmp,
469   AS_HELP_STRING([--enable-upnp-natpmp], [enable the use of libminiupnpc and libnatpmp]),
470   [UPNP_NATPMP="$enableval"])
471 AC_ARG_ENABLE(force-upnp-natpmp,
472   AS_HELP_STRING([--enable-force-upnp-natpmp], [force local compilation of libminiupnpc and libnatpmp]),
473   [UPNP_NATPMP_FORCE="$enableval"])
475 if test "$FORCE_MINGW" = "yes"; then
476     CC="$CC -mno-cygwin"
477     CPP="$CPP -mno-cygwin"
478     OS_FILES=mingw
479     OS_FILES2=mingw
480     SYSTEM=mingw
483 OCAML_PATH=
485 echo -e "\n--------------------------------"
486 echo "     Checking system tools."
487 echo "--------------------------------"
489 AC_PROG_RANLIB
490 AC_CHECK_PROG(GNU_MAKE, gmake, gmake)
491 AC_CHECK_PROG(GNU_MAKE, make, make)
493 if test "x$GNU_MAKE" != "x"; then
494   AC_MSG_CHECKING( [if $GNU_MAKE is GNU make] )
495   $GNU_MAKE --version > /dev/null 2>&1
496   if test "$?" != "0"; then
497     AC_MSG_RESULT([no])
498         AC_MSG_ERROR(GNU make not found)
499   else
500     AC_MSG_RESULT([yes])
501   fi
502 else
503   AC_MSG_ERROR(GNU make not found)
506 AC_CHECK_PROG(COMPRESS, bzip2, bzip2)
507 AC_CHECK_PROG(COMPRESS, gzip, gzip)
509 if test "$ac_cv_prog_COMPRESS" = "bzip2"; then
510    COMPRESS_EXT=bz2
511 else
512    COMPRESS_EXT=gz
515 AC_PATH_PROG(PERL, perl, perl)
516 AC_CHECK_PROG(RPMBUILD,rpmbuild,rpmbuild)
517 AC_CHECK_PROG(RPMBUILD,rpm,rpm)
519 AC_CHECK_PROG(WGET, wget, wget)
520 if test -z "$ac_cv_prog_WGET"; then
521   $CC -o wget wget.c || echo "Cannot compile wget.c"
522   AC_PATH_PROG(WGET, wget,,$SOURCE_DIR/config)
523   ac_cv_prog_WGET="$ac_cv_path_WGET"
525 WGET="$ac_cv_prog_WGET"
527 echo "----------------------------------------"
528 echo "     Checking system tools finished."
529 echo -e "----------------------------------------\n"
531 echo "--------------------------------"
532 echo "     Checking Ocaml compiler."
533 echo "--------------------------------"
535 CONFIG_DIR=$SOURCE_DIR/config
536 PATCH_DIR=$SOURCE_DIR/patches
537 LOCAL_DIR=$PATCH_DIR/local
538 BUILD_DIR=$PATCH_DIR/build
540 AC_ARG_ENABLE(local-prefix,
541   AS_HELP_STRING([--enable-local-prefix=DIR], [specify path for temporary tools installation (DIR must be absolute)]),
542   [LOCAL_DIR="$enableval"])
544 LOCAL=$LOCAL_DIR
545 LOCAL_OCAML=$LOCAL_DIR/bin
547 AC_PATH_PROG(OCAMLC,ocamlc.opt,"",[$LOCAL_DIR/bin:$PATH])
548 AC_CHECK_TOOL(OCAMLC,ocamlc,ocamlrun ocamlc)
549 AC_PATH_PROG(CAMLP4, camlp4,"",[$LOCAL_DIR/bin:$PATH])
551 BUILD_OCAML=no
552 if [ test -z "$OCAMLC" ] || [ test -z "$CAMLP4" ] || [ test "$REQUIRED_OCAML" = "CVS" ]; then
553    BUILD_OCAML=yes
554 else
555   OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
556   case "$OCAMLVERSION" in
557     "$REQUIRED_OCAML"*|3.12.*|3.11.*|3.10.1*|3.10.2*) ;;
558     *)
559         echo "Need build"
560         BUILD_OCAML=yes
561         ;;
562   esac
564 case "$REQUIRED_OCAML" in
565   3.10.0|3.0*)
566     echo "Need build"
567     REQUIRED_OCAML=3.12.0
568     BUILD_OCAML=yes
569     ;;
570 esac
571 if [ test "$BUILD_OCAML" = "yes" ] || [ test "$FORCE_OCAML" = "yes" ]; then
573   if [ test "$SYSTEM" = "mingw" ]; then
574     echo "********         Objective-Caml $REQUIRED_OCAML is required               *********" 1>&2;
575     echo "********     no valid Ocaml compiler found on your system        *********" 1>&2;
576     echo "********   on MinGW there is no possibility to let configure     *********" 1>&2;
577     echo "********   build the Ocaml compiler with the included script     *********" 1>&2;
578     echo "********    check http://mldonkey.sourceforge.net/Windows        *********" 1>&2;
579     echo "********   for instuctions how to compile Ocaml under MinGW      *********" 1>&2;
580     exit 1
581   else  
582     
583   echo "********  Objective-Caml $REQUIRED_OCAML is required  *********" 1>&2;
584   if [ test "$WGET" = "" ] && [ test "$REQUIRED_OCAML" != "CVS" ]; then
585     echo "********          wget is missing          *********" 1>&2;
586     echo "********       cannot download Ocaml       *********" 1>&2;
587     exit 1
588   fi
589   echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
590   echo "Do you want this script to try to download and install ocaml"
591   echo "LOCALLY in mldonkey directory ?"
592   if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
593   case "$i" in
594    y* | Y*)
595       cd $PATCH_DIR
596       if [ test "$REQUIRED_OCAML" = "CVS" ]; then
597         rm -rf $BUILD_DIR
598         mkdir -p $BUILD_DIR
599         cd $BUILD_DIR
600         cvs -d:pserver:anoncvs:""@camlcvs.inria.fr:/caml login
601         cvs -z3 -d:pserver:anoncvs@camlcvs.inria.fr:/caml co -P ocaml
602         cd ocaml
603       else
604         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
605           echo Downloading ...
606           $WGET http://caml.inria.fr/pub/distrib/ocaml-"$DOWNLOAD_OCAML_MAJOR"/ocaml-"$REQUIRED_OCAML".tar.gz
607         fi
608         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
609           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-"$REQUIRED_OCAML".tar.gz
610         fi
611         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
612           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-"$REQUIRED_OCAML".tar.gz
613         fi
614         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
615           echo "********        download Ocaml $REQUIRED_OCAML not successful, try do download it manually       *********" 1>&2;
616           echo "********        from http://caml.inria.fr/pub/distrib/                                   *********" 1>&2;
617           echo "********        and copy the tar.gz into $PATCH_DIR              *********" 1>&2;
618           exit 1
619         fi
621         echo Uncompressing ...
622         mkdir -p $BUILD_DIR
623         cd $BUILD_DIR
624         rm -rf ocaml-"$REQUIRED_OCAML"
625         gzip -cd $PATCH_DIR/ocaml-"$REQUIRED_OCAML".tar.gz | tar vxf -
626         cd ocaml-"$REQUIRED_OCAML"
627         if test -f $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch; then
628           echo Patching ...
629           patch -p1 < $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch
630         fi
631       fi
632       echo Configuring ...
633       ./configure -prefix $LOCAL_DIR -host $host -cc $CC
634       cd config
635       cp -f Makefile Makefile.old
636       sed "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" Makefile.old > Makefile
637       cd ..
638       cp -f $PATCH_DIR/Makefile.ocamldoc ocamldoc/Makefile
639       echo Compiling ...
640       $GNU_MAKE world opt opt.opt
641       echo Installing ...
642       $GNU_MAKE install
643       if ! test -f $LOCAL_DIR/lib/ocaml/threads; then
644         if ! test -f $LOCAL_DIR/lib/ocaml/vmthreads; then
645           ln -s vmthreads  $LOCAL_DIR/lib/ocaml/threads
646         fi
647       fi
648       cd $BUILD_DIR
649       if [ test "$REQUIRED_OCAML" = "CVS" ]; then
650         rm -rf ocaml
651       else
652         rm -rf ocaml-"$REQUIRED_OCAML"
653       fi
654       cd $CONFIG_DIR
655       echo Ocaml locally installed for mldonkey
657       if test -f "$LOCAL_OCAML"/ocamlc.opt; then
658          OCAMLC=$LOCAL_OCAML/ocamlc.opt
659          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc.opt
660       else
661       if test -f "$LOCAL_OCAML"/ocamlc; then
662          OCAMLC=$LOCAL_OCAML/ocamlc
663          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc
664       else
665         echo "Ocaml installation failed"; exit 1
666       fi
667       fi
668       ;;
669    *)  exit 1;;
670   esac
671   fi
674 if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc.opt ; then
675   OCAML_PATH="$LOCAL_OCAML"/
676   OCAMLOPT=$LOCAL_OCAML/ocamlopt.opt
677   OCAMLDOC=$LOCAL_OCAML/ocamldoc
678   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
679   OCAMLDEP=$LOCAL_OCAML/ocamldep
680   OCAMLLEX=$LOCAL_OCAML/ocamllex.opt
681   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
682   CAMLP4=$LOCAL_OCAML/camlp4
683   CAMLP4OF=$LOCAL_OCAML/camlp4of
684 else
685   if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc ; then
686   OCAML_PATH="$LOCAL_OCAML"/
687   if test -f "$LOCAL_OCAML/ocamlopt"; then
688     OCAMLOPT=$LOCAL_OCAML/ocamlopt
689   else
690     OCAMLOPT=no
691   fi
692   OCAMLDOC=$LOCAL_OCAML/ocamldoc
693   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
694   OCAMLDEP=$LOCAL_OCAML/ocamldep
695   OCAMLLEX=$LOCAL_OCAML/ocamllex
696   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
697   CAMLP4=$LOCAL_OCAML/camlp4
698   CAMLP4OF=$LOCAL_OCAML/camlp4of
699   else
700   AC_CHECK_PROG(OCAMLOPT, ocamlopt.opt, ocamlopt.opt)
701   AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt, no)
702   AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
703   AC_CHECK_PROG(OCAMLLEX, ocamllex.opt, ocamllex.opt)
704   AC_CHECK_PROG(OCAMLLEX, ocamllex, ocamllex)
705   AC_CHECK_PROG(OCAMLYACC, ocamlyacc, ocamlyacc)
706   AC_CHECK_PROG(OCAMLDOC, ocamldoc, ocamldoc)
707   AC_CHECK_PROG(OCAMLMKTOP, ocamlmktop, ocamlmktop)
708   AC_CHECK_PROG(CAMLP4, camlp4, camlp4)
709   AC_CHECK_PROG(CAMLP4OF, camlp4of, camlp4of, $CAMLP4 pa_o.cmo pr_o.cmo Camlp4QuotationExpander.cmo Camlp4GrammarParser.cmo)
713 OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
714 OCAMLLIB=`$OCAMLC -where`
716 # check if native dynlink is supported and therefore needed for linking
717 CAMLP4LIB_OPT="camlp4lib.cmxa"
718 CAMLP4LIB_BYTE="camlp4lib.cma"
719 if test -f $OCAMLLIB/dynlink.cma; then
720   CAMLP4LIB_BYTE="dynlink.cma $CAMLP4LIB_BYTE"
722 if test -f $OCAMLLIB/dynlink.cmxa; then
723   CAMLP4LIB_OPT="dynlink.cmxa $CAMLP4LIB_OPT"
726 # force usage of supported Ocaml versions
727 case "$OCAMLVERSION" in
728     3.10.1*|3.10.2*|3.1*) ;;
729     *)
730       if [ test "$REQUIRED_OCAML" != "CVS" ]; then
731         echo "********  Version $REQUIRED_OCAML of Objective-Caml is required  *********" 1>&2;
732         echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
733         exit 1
734       fi
735       ;;
736 esac
738 if test "$OCAMLOPT" = "no"; then
739   TARGET_TYPE=byte
740   OCAMLLIB_EXT=cma
741 else
742   TARGET_TYPE=opt
743   OCAMLLIB_EXT=cmxa
745   OCAMLOPTVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
747   test "$OCAMLOPTVERSION" = "$OCAMLVERSION" || {
748     echo "********  Version $REQUIRED_OCAML of ocamlopt is required  *********" 1>&2;
749     echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
750     exit 1; }
754 echo "-------------------------------------------"
755 echo "     Checking Ocaml $OCAMLVERSION finished."
756 echo "-------------------------------------------"
759 if test "$PROFILE" = "yes"; then
760    OCAMLOPT="$OCAMLOPT -p"
761    CFLAGS="$CFLAGS -pg"
763 if test "$FORCE_MINGW" = "yes"; then
764     OCAMLC="$OCAMLC -ccopt -mno-cygwin"
765     OCAMLOPT="$OCAMLOPT -ccopt -mno-cygwin"
766     OCAMLMKTOP="$OCAMLMKTOP -ccopt -mno-cygwin"
768 if test "$DEBUG" = "yes"; then
769     OCAMLC="$OCAMLC -g"
770     OCAMLOPT="$OCAMLOPT -g"
773 echo -e "\n----------------------------------"
774 echo "     Checking system headers."
775 echo "----------------------------------"
777 ifelse(AC_ACVERSION, [2.13], [],
778 [dnl Large file enabled
779    AC_SYS_LARGEFILE
783 dnl Check for native endianness.
784 AC_C_BIGENDIAN(,,
785   [AC_MSG_ERROR([Machine endianness could not be determined])]
787 if test "x$WORDS_BIGENDIAN" = "x"; then
788   NATIVEENDIAN=LittleEndian
789 else
790   NATIVEENDIAN=BigEndian
792 AC_SUBST(NATIVEENDIAN)
794 # various header files
795 AC_CHECK_FUNCS(setrlimit getrlimit strerror_r strerror posix_fallocate)
796 AC_CHECK_HEADERS(byteswap.h,,)
797 AC_CHECK_HEADERS([sys/utsname.h])
798 AC_CHECK_HEADERS(arpa/inet.h,,)
799 AC_CHECK_HEADERS([sys/types.h sys/time.h sys/resource.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
800 [#ifdef HAVE_SYS_TYPES_H
801 #include <sys/types.h>
802 #endif
803 #ifdef HAVE_SYS_TIME_H
804 #include <sys/time.h>
805 #endif
806 #ifdef HAVE_NETINET_IN_SYSTM_H
807 #include <netinet/in_systm.h>
808 #endif
809 #ifdef HAVE_NETINET_IN_H
810 #include <netinet/in.h>
811 #endif
814 # poll if possible
815 AC_CHECK_HEADERS(sys/poll.h,,)
816 AC_CHECK_FUNCS(poll,,)
818 AC_CHECK_HEADERS(sys/vfs.h,,)
819 AC_CHECK_HEADERS(sys/statvfs.h,,)
820 AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
821 [#if HAVE_SYS_PARAM_H
822 #include <sys/param.h>
823 #endif
825 echo "-------------------------------------------"
826 echo "     Checking system headers finished."
827 echo -e "-------------------------------------------\n"
828 echo "-----------------------------------"
829 echo "     Checking system libraries."
830 echo "-----------------------------------"
831 echo "----- checking zlib (required)"
832 AC_CHECK_LIB(z,inflate,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
833 AC_CHECK_HEADERS(zlib.h,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
834 AC_CHECK_LIB(z,zlibVersion,[AC_DEFINE(HAVE_ZLIBVERSION, 1,)])
836 if test "$BZIP2" != "no"; then
837   echo "----- checking bzlib (optional)"
838   AC_CHECK_HEADERS(bzlib.h,[AC_CHECK_LIB(bz2,BZ2_bzReadOpen,[BZIP2=yes],[BZIP2=no])],[BZIP2=no])
841 if test "$BZIP2" = "yes"; then
842   AC_CHECK_LIB(bz2,BZ2_bzlibVersion,[AC_DEFINE(HAVE_BZLIBVERSION, 1,)])
843   AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
844 else
845   AC_MSG_NOTICE(bzlib not available)
848 if test "$UPNP_NATPMP_FORCE" = "yes"; then
849         UPNP_NATPMP=yes
850         cd $PATCH_DIR
851         $WGET http://miniupnp.tuxfamily.org/files/miniupnpc-1.4.20100609.tar.gz
852         $WGET http://miniupnp.tuxfamily.org/files/libnatpmp-20100202.tar.gz
853         mkdir -p $BUILD_DIR $LOCAL_DIR/usr/bin $LOCAL_DIR/usr/lib $LOCAL_DIR/usr/include/miniupnpc
854         cd $BUILD_DIR
855         rm -rf libnatpmp-20100202 miniupnpc-1.4.20100609
856         tar -xzf $PATCH_DIR/miniupnpc-1.4.20100609.tar.gz
857         tar -xzf $PATCH_DIR/libnatpmp-20100202.tar.gz
858         cd $BUILD_DIR/libnatpmp-20100202
859         make all install PREFIX=$LOCAL_DIR
860         cd $BUILD_DIR/miniupnpc-1.4.20100609
861         make all install PREFIX=$LOCAL_DIR
862         cd $CONFIG_DIR
863         rm -rf $BUILD_DIR/libnatpmp-20100202 $BUILD_DIR/miniupnpc-1.4.20100609
864         CPPFLAGS="${CPPFLAGS} -I$LOCAL_DIR/usr/include"
865         LDFLAGS="${LDFLAGS} -L$LOCAL_DIR/usr/lib"
868 if test "$UPNP_NATPMP" = "yes"; then
869   echo "----- checking libminiupnpc >= 1.4.20100609 (optional)"
870   AC_CHECK_HEADERS(miniupnpc/miniupnpc.h,[AC_CHECK_LIB(miniupnpc,upnpDiscover,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
873 if test "$UPNP_NATPMP" = "yes"; then
874   echo "----- checking libnatpmp >= 20100202 (optional)"
875   AC_CHECK_HEADERS(natpmp.h,[AC_CHECK_LIB(natpmp,initnatpmp,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
878 if test "$UPNP_NATPMP" = "yes"; then
879   AC_DEFINE(ENABLE_UPNP_NATPMP, 1, [Define to 1 if you have libminiupnpc & libnatpmp for port forwarding support.])
880   UPNP_NATPMP_LIBS="-lminiupnpc -lnatpmp $LIBS"
883 if test "$MAGIC" != "no"; then
884   echo "----- checking libmagic (GNU file) (optional)"
885   AC_CHECK_HEADERS(magic.h,
886     [AC_CHECK_LIB(magic,magic_file,
887       [AC_CHECK_DECL([MAGIC_ERROR], [MAGIC=yes], [MAGIC=no],[#include <magic.h>])],
888       [MAGIC=no])],
889     [MAGIC=no])
892 if test "$MAGIC" = "yes"; then
893   MAGICLIB=Magic_magic
894 else
895   MAGICLIB=Magic_nomagic
896   AC_MSG_NOTICE(libmagic not available)
899 GD_JPG=no
900 GD_PNG=no
901 if test "$GD" != "no"; then
902   echo "----- checking gd (optional)"
903   GD=no
904   LIBGD=no
905   SAVE_LIBS=$LIBS
906   SAVE_CFLAGS=$CFLAGS
907   SAVE_LDFLAGS=$LDFLAGS
908   AC_CHECK_PROG(GDLIBCONFIG, gdlib-config, gdlib-config)
909   if test "$ac_cv_prog_GDLIBCONFIG" = "gdlib-config"; then
910     GD_LIBS=`$GDLIBCONFIG --libs`
911     $GDLIBCONFIG --static-libs > /dev/null 2>&1
912     if test "$?" = "0"; then
913       GD_STATIC_LIBS=`$GDLIBCONFIG --static-libs`
914     fi
915     GD_LIBS2="$LIBS -lgd $GD_LIBS"
916     LIBS=$GD_LIBS2
917     GD_CFLAGS=`$GDLIBCONFIG --cflags`
918     CFLAGS="$CFLAGS $GD_CFLAGS"
919     GD_LDFLAGS=`$GDLIBCONFIG --ldflags`
920     LDFLAGS="$LDFLAGS $GD_LDFLAGS"
921     AC_MSG_CHECKING(for libgd > 2.0.14)
922     GDVERSION=`$GDLIBCONFIG --version`
923     GDMAJORVERSION=`$GDLIBCONFIG --majorversion`
924     GDMINORVERSION=`$GDLIBCONFIG --minorversion`
925     GDREVISION=`$GDLIBCONFIG --revision`
926     if [ [ $GDMAJORVERSION = 2 ] && [ $GDMINORVERSION = 0 ] && [ $GDREVISION -gt 14 ]]; then
927         AC_MSG_RESULT($GDVERSION)
928         LIBGD=yes
929     else
930         AC_MSG_RESULT(no (found $GDVERSION))
931         LIBGD=no
932     fi
933   else
934     LIBGD=yes
935   fi
937   if test "$LIBGD" = "yes"; then
938     AC_CHECK_HEADERS(gd.h,[LIBGD=yes],[LIBGD=no])
939   fi
941   if test "$LIBGD" = "yes"; then
942     AC_MSG_CHECKING(for gdImageCreate in -lgd)
943     AC_TRY_LINK([#include <gd.h>],
944     [gdImageCreate (0,0);],
945     [LIBGD=yes], [LIBGD=no])
946     AC_MSG_RESULT($LIBGD)
947     LIBS=$SAVE_LIBS
949     if test "$LIBGD" = "no"; then
950       AC_MSG_NOTICE([not found, trying another method])
951       AC_CHECK_LIB(gd, gdImageCreate, [LIBGD=yes], [LIBGD=no])
952     fi
953   fi
955   if test "$LIBGD" = "yes"; then
956     LIBPNG=no
957 # saving current variables
958     SAVE_LIBS_PNG=$LIBS
959     SAVE_CFLAGS_PNG=$CFLAGS
960     SAVE_LDFLAGS_PNG=$LDFLAGS
961     AC_CHECK_PROG(PNGLIBCONFIG, libpng-config, libpng-config)
962     if test "$ac_cv_prog_PNGLIBCONFIG" = "libpng-config"; then
963 # check libpng-config contents and update system variables
964       PNG_LIBS=`$PNGLIBCONFIG --libs`
965       LIBS="$LIBS $PNG_LIBS"
966       PNG_CFLAGS=`$PNGLIBCONFIG --cflags`
967       CFLAGS="$CFLAGS $PNG_CFLAGS"
968       PNG_LDFLAGS=`$PNGLIBCONFIG --ldflags`
969       LDFLAGS="$LDFLAGS $PNG_LDFLAGS"
970     fi
971     AC_CHECK_LIB(png, png_create_read_struct , [LIBPNG=yes])
972 # restore variables
973     LIBS=$SAVE_LIBS_PNG
974     CFLAGS=$SAVE_CFLAGS_PNG
975     LDFLAGS=$SAVE_LDFLAGS_PNG
977     if test "$LIBPNG" = "no"; then
978       AC_MSG_NOTICE(png support not available)
979     else
980       LIBGD_PNG=no
981       LIBS=$GD_LIBS2
982       AC_MSG_CHECKING(for gdImagePng in -lgd)
983       AC_TRY_LINK([#include <gd.h>],
984       [gdImagePng (0,0);],
985       [LIBGD_PNG=yes], [LIBGD_PNG=no])
986       AC_MSG_RESULT($LIBGD_PNG)
987       LIBS=$SAVE_LIBS
989       if test "$LIBGD_PNG" = "no"; then
990         AC_MSG_NOTICE([not found, trying another method])
991         AC_CHECK_LIB(gd, gdImagePng, [LIBGD_PNG=yes], [LIBGD_PNG=no])
992       fi
994       AC_MSG_CHECKING(for png support in libgd)
995       if test "$LIBGD_PNG" = "yes"; then
996         GD=yes
997         GD_PNG=yes
998         AC_MSG_RESULT(yes)
999         AC_CHECK_LIB(png, png_access_version_number,[AC_DEFINE(HAVE_PNGVERSION, 1,)])
1000         AC_DEFINE(HAVE_GD_PNG, 1, [Define to 1 if you have png support in libgd.])
1001       else
1002         AC_MSG_RESULT(no)
1003       fi
1004     fi
1006     LIBJPEG=no
1007     AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [LIBJPEG=yes])
1009     if test "$LIBJPEG" = "no"; then
1010       AC_MSG_NOTICE(jpeg support not available)
1011     else
1012       LIBGD_JPG=no
1013       LIBS=$GD_LIBS2
1014       AC_MSG_CHECKING(for gdImageJpeg in -lgd)
1015       AC_TRY_LINK([#include <gd.h>],
1016       [gdImageJpeg (0,0,0);],
1017       [LIBGD_JPG=yes], [LIBGD_JPG=no])
1018       AC_MSG_RESULT($LIBGD_JPG)
1019       LIBS=$SAVE_LIBS
1021       if test "$LIBGD_JPG" = "no"; then
1022         AC_MSG_NOTICE([not found, trying another method])
1023         AC_CHECK_LIB(gd, gdImageJpeg, [LIBGD_JPG=yes], [LIBGD_JPG=no])
1024       fi
1026       AC_MSG_CHECKING(for jpeg support in libgd)
1027       if test "$LIBGD_JPG" = "yes"; then
1028         GD=yes
1029         GD_JPG=yes
1030         AC_DEFINE(HAVE_GD_JPG, 1, [Define to 1 if you have jpg support in libgd.])
1031         AC_MSG_RESULT(yes)
1032       else
1033         AC_MSG_RESULT(no)
1034       fi
1035     fi
1036   else
1037     AC_MSG_NOTICE(libgd not available)
1038   fi
1039   LIBS=$SAVE_LIBS
1040   CFLAGS=$SAVE_CFLAGS
1041   LDFLAGS=$SAVE_LDFLAGS
1044 if test "$GD" != "no"; then
1045   GDGRAPHICS=DriverGraphics_gd
1046 else
1047   GDGRAPHICS=DriverGraphics_nogd
1050 if test "$ICONV" = "yes"; then
1051   echo "----- checking iconv (optional)"
1052   AM_ICONV
1053   if test "$am_cv_func_iconv" != "yes"; then
1054     AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1055     ICONV=no
1056   else
1057   LIBS="$LIBS $LIBICONV"
1058   AC_CHECK_FUNCS([locale_charset],,
1059   AC_TRY_LINK([#include <langinfo.h>],
1060   [char* cs = nl_langinfo(CODESET);],
1061   AC_MSG_NOTICE(found nl_langinfo(CODESET)),
1062   [echo "Your iconv implementation is incomplete"; exit 1]))
1063   AC_CHECK_LIB(charset,locale_charset)
1064   AC_CHECK_HEADERS([libcharset.h])
1065   AC_CHECK_HEADERS([langinfo.h])
1066   AC_CHECK_HEADERS([locale.h])
1067   fi
1068 else
1069   AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1070   ICONV=no
1073 if test "$USE_PTHREAD" = "no"; then
1074  PTHREAD_LIBS=""
1075  echo "You disabled thread support, this will hurt MLDonkey performance!"
1076 else
1077   echo "----- checking thread support (optional, strongly advised)"
1078   ACX_PTHREAD
1081 # On linux plaforms, we will have to check that includes from kernel are
1082 # available. glibc version test was shamelessly taken from
1083 # http://public.activestate.com/gsar/APC/perl-5.8.x/Configure
1084 GLIBC_VERSION=""
1085 case $host in
1086         *linux*)
1087            echo "----- GNU C Library version"
1088            AC_CHECK_HEADERS(linux/limits.h,, [
1089              OLD_CPPFLAGS=$CPPFLAGS
1090              CPPFLAGS="-I /usr/src/linux/include"
1091              AC_CHECK_HEADER(linux/types.h,[CONFIG_INCLUDES="-I /usr/src/linux/include"])
1092              CPPFLAGS=$OLD_CPPFLAGS]
1093            )
1094            AC_CHECK_HEADERS(gnu/libc-version.h,[AC_MSG_CHECKING(for GNU C Library version)
1096 cat >try.c <<'EOCP'
1097 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
1098    alone are insufficient to distinguish different versions, such as
1099    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
1100    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
1102 #include <stdio.h>
1103 int main(void)
1105 #ifdef __GLIBC__
1106 #   ifdef __GLIBC_MINOR__
1107 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1108 #           include <gnu/libc-version.h>
1109     printf("%s\n",  gnu_get_libc_version());
1110 #       else
1111     printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
1112 #       endif
1113 #   else
1114 printf("%d\n",  __GLIBC__);
1115 #   endif
1116     return 0;
1117 #else
1118     return 1;
1119 #endif
1121 EOCP
1123            $CC -o try ./try.c
1124            GLIBC_VERSION="`./try`"
1125            AC_MSG_RESULT($GLIBC_VERSION)
1126            rm -f try try.*],)
1127         ;;
1128         *)         ;;
1129 esac
1131 echo "---------------------------------------------"
1132 echo "     Checking system libraries finished."
1133 echo -e "---------------------------------------------\n"
1135 CXX_VERSION=
1136 CRYPTOPPFLAGS=
1137 echo "--------------------------------------"
1138 echo "     Checking activated networks."
1139 echo "--------------------------------------"
1141   if test "$DONKEY" = "yes"; then
1142     AC_MSG_CHECKING(eDonkey)
1143     if test -d ../src/networks/donkey; then
1144       AC_MSG_RESULT(yes)
1145       if test "$DONKEY_SUI" = "yes"; then
1146         AC_PROG_CXX
1148         AC_CHECK_TOOL(NEWCXX, [$CXX], [no])
1149         AC_MSG_CHECKING(eMule SUI)
1150         if test x"$NEWCXX" = x"no"
1151         then
1152           AC_MSG_RESULT(no)
1153           CXX=
1154           DONKEY_SUI=no
1155         else
1156           AC_MSG_RESULT(yes)
1157           ACX_CHECK_CXX_FLAGS(-fno-omit-frame-pointer,cv_no_omit_frame_pointer, CRYPTOPPFLAGS="-fno-omit-frame-pointer")
1158           ACX_CHECK_CXX_FLAGS(-mno-omit-leaf-frame-pointer,cv_no_omit_leaf_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -mno-omit-leaf-frame-pointer")
1159           CXX=$NEWCXX
1160           CXX_VERSION=`$CXX -dumpversion`
1161           DONKEY_SUI_FILE=DonkeySui1
1162           AC_DEFINE(HAVE_CRYPTOPP, 1,)
1163         fi
1164       fi
1165 #      AC_MSG_CHECKING(eDonkey server)
1166 #      if test -d ../src/networks/server; then
1167 #        AC_MSG_RESULT(no)
1168 #        DONKEY_SERVER=no
1169 #      else
1170 #        AC_MSG_RESULT(no)
1171 #        DONKEY_SERVER=no
1172 #      fi
1173     else
1174       DONKEY=no
1175       DONKEY_SUI=no
1176       AC_MSG_RESULT(no)
1177     fi
1178   else
1179     DONKEY_SUI=no
1180   fi
1182   if test "$BITTORRENT" = "yes"; then
1183     AC_MSG_CHECKING(BitTorrent)
1184     if test -d ../src/networks/bittorrent; then
1185       AC_MSG_RESULT(yes)
1186     else
1187       BITTORRENT=no
1188       AC_MSG_RESULT(no)
1189     fi
1190   fi
1192   if test "$FILETP" = "yes"; then
1193     AC_MSG_CHECKING(FileTP)
1194     if test -d ../src/networks/fileTP; then
1195       AC_MSG_RESULT(yes)
1196     else
1197       FILETP=no
1198       AC_MSG_RESULT(no)
1199     fi
1200   fi
1202   if test "$GNUTELLA" = "yes"; then
1203     AC_MSG_CHECKING(Gnutella)
1204     if test -d ../src/networks/gnutella; then
1205       AC_MSG_RESULT(yes)
1206     else
1207       GNUTELLA=no
1208       AC_MSG_RESULT(no)
1209     fi
1210   fi
1212   if test "$GNUTELLA2" = "yes"; then
1213     AC_MSG_CHECKING(G2)
1214     if test -d ../src/networks/gnutella2; then
1215       AC_MSG_RESULT(yes)
1216     else
1217       GNUTELLA2=no
1218       AC_MSG_RESULT(no)
1219     fi
1220   fi
1222   if test "$FASTTRACK" = "yes"; then
1223     AC_MSG_CHECKING(Fasttrack)
1224     if test -d ../src/networks/fasttrack; then
1225       AC_MSG_RESULT(yes)
1226     else
1227       FASTTRACK=no
1228       AC_MSG_RESULT(no)
1229     fi
1230   fi
1232   if test "$DIRECT_CONNECT" = "yes"; then
1233     AC_MSG_CHECKING(DirectConnect)
1234     if test "$BZIP2" = "yes"; then
1235       if test -d ../src/networks/direct_connect; then
1236         AC_MSG_RESULT(yes)
1237       else
1238         DIRECT_CONNECT=no
1239         AC_MSG_RESULT(no)
1240       fi
1241     else
1242       DIRECT_CONNECT=no
1243       AC_MSG_RESULT(no - bzip2 support missing)
1244     fi
1245   fi
1247   if test "$SOULSEEK" = "yes"; then
1248     AC_MSG_CHECKING(Soulseek)
1249     if test -d ../src/networks/soulseek; then
1250       AC_MSG_RESULT(yes)
1251     else
1252       SOULSEEK=no
1253       AC_MSG_RESULT(no)
1254     fi
1255   fi
1257   if test "$OPEN_NAPSTER" = "yes"; then
1258     AC_MSG_CHECKING(OpenNapster)
1259     if test -d ../src/networks/opennap; then
1260       AC_MSG_RESULT(yes)
1261     else
1262       OPEN_NAPSTER=no
1263       AC_MSG_RESULT(no)
1264     fi
1265   fi
1267   if test "$OPENFT" = "yes"; then
1268     AC_MSG_CHECKING(OpenFT)
1269     if test -d ../src/networks/openFT; then
1270       AC_MSG_RESULT(yes)
1271     else
1272       OPENFT=no
1273       AC_MSG_RESULT(no)
1274     fi
1275   fi
1276 echo "-----------------------------------------------"
1277 echo "     Checking activated networks finished."
1278 echo "-----------------------------------------------"
1280 if test -f $OCAMLLIB/lablgl.cma; then
1281   LABLGL_CMA=lablgl.cma
1284 if test -f $OCAMLLIB/lablgl.$OCAMLLIB_EXT; then
1285   LABLGL_CMXA=lablgl.$OCAMLLIB_EXT
1288 # Check for GTK only if we want to build the GUI
1289 if test ! "$GUI" = "no"; then
1290   echo "---------------------------------------------------------"
1291   echo "Checking the libraries required to build the GTK GUI."
1292   echo "---------------------------------------------------------"
1293   if test "$GUI" = "newgui2"; then
1294       REQUIRED_GTK=2.4.0
1295       PKG_GTK=gtk+-2.0
1296       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1297       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1298         AC_MSG_RESULT(yes)
1299         REQUIRED_RSVG=2.4.0
1300         PKG_RSVG=librsvg-2.0
1301         AC_MSG_CHECKING(for librsvg - version >= $REQUIRED_RSVG)
1302         if pkg-config --atleast-version $REQUIRED_RSVG $PKG_RSVG; then
1303           GTK_CONFIG="pkg-config $PKG_GTK $PKG_RSVG"
1304           REQUIRED_LABLGTK=2.14.2
1305           LABLGTK_NAME=lablgtk2
1306           AC_MSG_RESULT(yes)
1307         else
1308           GTK_CONFIG=no
1309           AC_MSG_RESULT(no)
1310         fi
1311       else
1312         GTK_CONFIG=no
1313         AC_MSG_RESULT(no)
1314       fi
1315   else
1316     if test "$OS_FILES2" = "mingw"; then
1317       REQUIRED_GTK=1.3.0
1318       PKG_GTK=gtk+-1.3-win32-production
1319       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1320       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1321         GTK_CONFIG="pkg-config $PKG_GTK"
1322         AC_MSG_RESULT(yes)
1323       else
1324         GTK_CONFIG=no
1325         AC_MSG_RESULT(no)
1326       fi
1327     else
1328       AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no)
1329       if test "$GTK_CONFIG" = "no"; then
1330         AC_MSG_RESULT(no)
1331       else
1332         AC_MSG_RESULT(yes)
1333       fi
1334     fi
1335   fi
1336 else
1337   GTK_CONFIG=no
1339 if test "$GTK_CONFIG" = "no"; then
1340      LABLGTK_CONFIG=no
1341 else
1342   AC_MSG_CHECKING(for native code $LABLGTK_NAME)
1343   if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1344      if test "$GUI" = "newgui2"; then
1345        if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.$OCAMLLIB_EXT; then
1346          AC_MSG_RESULT(yes)
1347          LABLGTK_CONFIG=yes
1348        else
1349          AC_MSG_RESULT(no)
1350          LABLGTK_CONFIG=no
1351          if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.cma; then
1352            echo "---------------------------------------------------------"
1353            echo "lablrsvg is not installed properly. See the INSTALL.txt"
1354            echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1355            echo "probably forgot to call 'make opt' before 'make install'."
1356            echo "---------------------------------------------------------"
1357          else
1358            echo "---------------------------------------------------------"
1359            echo "lablrsvg is not installed. See the INSTALL.txt file of"
1360            echo "mldonkey to see how to compile $LABLGTK_NAME. Librsvg"
1361            echo "may not be installed when you compiled $LABLGTK_NAME."
1362            echo "---------------------------------------------------------"
1363          fi
1364        fi
1365      else
1366        AC_MSG_RESULT(yes)
1367        LABLGTK_CONFIG=yes
1368      fi
1369   else
1370      AC_MSG_RESULT(no)
1371      LABLGTK_CONFIG=no
1372      if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.cma; then
1373        echo "-------------------------------------------------------------"
1374        echo "$LABLGTK_NAME is not installed properly. See the INSTALL.txt"
1375        echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1376        echo "probably forgot to call 'make opt' before 'make install'."
1377        echo "-------------------------------------------------------------"
1378      else
1379        echo "Do you want this script to try to download and install $LABLGTK_NAME"
1380        echo "LOCALLY in mldonkey directory ?"
1381        if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
1382        case "$i" in
1383         y* | Y*)
1385          cd $PATCH_DIR
1386          rm -rf lablgtk-"$REQUIRED_LABLGTK"
1387          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then
1388            echo Downloading ...
1389            $WGET http://www.math.nagoya-u.ac.jp/~garrigue/soft/olabl/dist/lablgtk-"$REQUIRED_LABLGTK".tar.gz
1390          fi
1391          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then exit 1; fi
1393          mkdir -p $BUILD_DIR
1394          cd $BUILD_DIR
1395          echo Uncompressing ...
1396          gzip -cd $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".tar.gz | tar xf -
1397          (cd lablgtk-"$REQUIRED_LABLGTK"
1398           if test -f $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch; then
1399             echo Patching ...
1400             patch -p0 < $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch
1401           fi
1402           PATH=$OCAML_PATH:$PATH
1403           export PATH
1404           echo $PATH
1406           if test "$GUI" = "newgui2"; then
1407             ./configure --prefix=$LOCAL_DIR
1408             $GNU_MAKE world
1409             $GNU_MAKE install
1410           else
1411             $GNU_MAKE configure
1412             $GNU_MAKE
1413             $GNU_MAKE opt
1414             $GNU_MAKE install
1415           fi
1417           cd ..
1418           rm -rf lablgtk-"$REQUIRED_LABLGTK"
1419          )
1420          cd $CONFIG_DIR
1421          if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1422             LABLGTK_CONFIG=yes
1423          else
1424             echo "Installation of $LABLGTK_NAME failed"
1425             LABLGTK_CONFIG=no
1426          fi
1427          ;;
1428         *);;
1429       esac
1430      fi
1431   fi
1434 if test "$GUI" = "newgui2" ; then
1435   GUIS="mldonkey_gui\$(EXE)"
1436   GTKCFLAGS="`pkg-config --cflags-only-I gtk+-2.0`"
1437   GTKLLIBS="`pkg-config --libs-only-L gtk+-2.0`"
1438   GTKLFLAGS="`pkg-config --libs-only-l gtk+-2.0` -lX11"
1439 else
1440   GUIS="mldonkey_gui\$(EXE) mldonkey_gui2\$(EXE)"
1443 if test "$LABLGTK_CONFIG" = "no"; then
1444   GUI="no"
1445 else
1446   MORE_TARGETS="$MORE_TARGETS $GUIS"
1447   AC_MSG_CHECKING(GToolbox.popup_menu args)
1448   GTOOLBOX="$OCAMLLIB/$LABLGTK_NAME/gToolbox.mli"
1449   grep popup $GTOOLBOX | grep -i button 2> /dev/null && GTOOLBOX_ARGS=new
1450   if test "$GTOOLBOX_ARGS" = "new"; then
1451     GTOOLBOX_POPUPMENU=' ~button: button ~time: time '
1452     AC_MSG_RESULT(new)
1453   else
1454     GTOOLBOX_POPUPMENU=' ~x: button ~y: time '
1455     AC_MSG_RESULT(old)
1456   fi
1457   echo "---------------------------------------------------------"
1458   echo "End of GTK GUI configuration."
1459   echo "---------------------------------------------------------"
1462 if test "$OS_FILES" = "mingw"; then
1463    OCAMLDEP_OPTIONS="-slash"
1466 AC_SUBST(LIBS)
1467 AC_SUBST(CFLAGS)
1468 AC_SUBST(CPPFLAGS)
1469 AC_SUBST(CXXFLAGS)
1470 AC_SUBST(LDFLAGS)
1471 AC_SUBST(CC)
1472 AC_SUBST(CPP)
1473 AC_SUBST(CXX)
1474 AC_SUBST(FIX_BROKEN_CPP)
1475 AC_SUBST(CONFIG_INCLUDES)
1476 AC_SUBST(OCAMLC)
1477 AC_SUBST(OCAMLLIB)
1478 AC_SUBST(OCAMLOPT)
1479 AC_SUBST(OCAMLLEX)
1480 AC_SUBST(OCAMLYACC)
1481 AC_SUBST(OCAMLDEP)
1482 AC_SUBST(OCAMLDEP_OPTIONS)
1483 AC_SUBST(CAMLP4)
1484 AC_SUBST(CAMLP4OF)
1485 AC_SUBST(CAMLP4LIB_OPT)
1486 AC_SUBST(CAMLP4LIB_BYTE)
1487 AC_SUBST(PERL)
1488 AC_SUBST(OCAMLDOC)
1489 AC_SUBST(OCAMLMKTOP)
1490 AC_SUBST(SYSTEM)
1491 AC_SUBST(MORE_TARGETS)
1492 AC_SUBST(MORE_SUBDIRS)
1493 AC_SUBST(LABLGL_CMA)
1494 AC_SUBST(LABLGL_CMXA)
1495 AC_SUBST(MD4ARCH)
1496 AC_SUBST(MD4COMP)
1497 AC_SUBST(ICONV)
1498 AC_SUBST(OPEN_NAPSTER)
1499 AC_SUBST(DIRECT_CONNECT)
1500 AC_SUBST(GNUTELLA)
1501 AC_SUBST(GNUTELLA2)
1502 AC_SUBST(BITTORRENT)
1503 AC_SUBST(FILETP)
1504 AC_SUBST(SOULSEEK)
1505 AC_SUBST(OPENFT)
1506 AC_SUBST(FASTTRACK)
1507 AC_SUBST(DONKEY)
1508 AC_SUBST(DONKEY_SUI)
1509 AC_SUBST(CRYPTOPPFLAGS)
1510 AC_SUBST(DONKEY_SUI_FILE)
1511 AC_SUBST(DONKEY_SERVER)
1512 AC_SUBST(GUI)
1513 AC_SUBST(REQUIRED_OCAML)
1514 AC_SUBST(REQUIRED_LABLGTK)
1515 AC_SUBST(ARCH)
1516 AC_SUBST(COMPRESS)
1517 AC_SUBST(COMPRESS_EXT)
1518 AC_SUBST(CHECKBOUNDS)
1519 AC_SUBST(MLDONKEY_VERSION)
1520 AC_SUBST(SCM_VERSION)
1521 AC_SUBST(MAJOR_VERSION)
1522 AC_SUBST(MINOR_VERSION)
1523 AC_SUBST(SUB_VERSION)
1524 AC_SUBST(GTOOLBOX_POPUPMENU)
1525 AC_SUBST(OS_FILES)
1526 AC_SUBST(OS_FILES2)
1527 AC_SUBST(TARGET_TYPE)
1528 AC_SUBST(RPMBUILD)
1529 AC_SUBST(GTKCFLAGS)
1530 AC_SUBST(GTKLLIBS)
1531 AC_SUBST(GTKLFLAGS)
1532 AC_SUBST(GD)
1533 AC_SUBST(GD_JPG)
1534 AC_SUBST(GD_PNG)
1535 AC_SUBST(GDGRAPHICS)
1536 AC_SUBST(GD_LIBS)
1537 AC_SUBST(GD_STATIC_LIBS)
1538 AC_SUBST(GD_CFLAGS)
1539 AC_SUBST(GD_LDFLAGS)
1540 AC_SUBST(BZIP2)
1541 AC_SUBST(MAGIC)
1542 AC_SUBST(MAGICLIB)
1543 AC_SUBST(UPNP_NATPMP)
1544 AC_SUBST(UPNP_NATPMP_LIBS)
1545 BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
1546 AC_SUBST(BUILD_SYSTEM)
1547 AC_SUBST(GLIBC_VERSION)
1548 AC_SUBST(CC_VERSION)
1549 AC_SUBST(CXX_VERSION)
1550 AC_SUBST(CONFIGURE_ARGUMENTS)
1551 AC_SUBST(CONFIGURE_RUN)
1553 AUTOCONF=../src/utils/lib/autoconf.ml
1554 GTK_AUTOCONF=../src/utils/lib/gAutoconf.ml
1555 AC_OUTPUT(\
1556   Makefile.config \
1557   mldonkey.rc \
1558   $AUTOCONF.new $GTK_AUTOCONF.new \
1559    ../src/utils/bitstring/bitstring.ml \
1560    ../src/utils/lib/magic.ml \
1561    ../src/networks/donkey/donkeySui.ml \
1562    ../src/daemon/driver/driverGraphics.ml \
1563    ../packages/rpm/mldonkey.spec \
1564    ../packages/rpm/Makefile \
1565    ../packages/slackware/mldonkey.options)
1566 diff $AUTOCONF.new $AUTOCONF 2> /dev/null > /dev/null || cp -f $AUTOCONF.new $AUTOCONF
1567 diff $GTK_AUTOCONF.new $GTK_AUTOCONF 2> /dev/null > /dev/null || cp -f $GTK_AUTOCONF.new $GTK_AUTOCONF
1569 cd ..
1571 echo -e "\nBuilding dependencies (if it blocks, try '$GNU_MAKE depend' to see the problem)"
1572 $GNU_MAKE depend 2> /dev/null > /dev/null || echo "Building dependencies fails: try: '$GNU_MAKE depend'"
1574 echo -e -n "\nConfiguring MLDonkey" $MLDONKEY_VERSION
1575 if test ! -z "$SCM_VERSION"; then
1576   echo -n " - SCM: $SCM_VERSION"
1578 echo " completed."
1580 echo -e "\nNetwork modules:"
1581 echo -n " - eDonkey           "
1582 if test "$DONKEY" = "yes"; then
1583   if test "$DONKEY_SUI" = "yes"; then
1584     echo "enabled (eMule SUI enabled)"
1585   else
1586     echo "enabled (eMule SUI disabled)"
1587   fi
1588 else
1589   echo "        disabled"
1592 echo -n " - BitTorrent        "
1593 if test "$BITTORRENT" = "yes"; then
1594   echo "enabled"
1595 else
1596   echo "        disabled"
1599 echo -n " - FileTP (aka wget) "
1600 if test "$FILETP" = "yes"; then
1601   echo "enabled"
1602 else
1603   echo "        disabled"
1606 echo -n " - Fasttrack         "
1607 if test "$FASTTRACK" = "yes"; then
1608   echo "enabled"
1609 else
1610   echo "        disabled"
1613 echo -n " - Gnutella          "
1614 if test "$GNUTELLA" = "yes"; then
1615   echo "enabled (warning: this network module is unmaintained)"
1616 else
1617   echo "        disabled - unmaintained"
1620 echo -n " - Gnutella2         "
1621 if test "$GNUTELLA2" = "yes"; then
1622   echo "enabled (warning: this network module is unmaintained)"
1623 else
1624   echo "        disabled - unmaintained"
1627 echo -n " - Direct Connect    "
1628 if test "$DIRECT_CONNECT" = "yes"; then
1629   echo "enabled"
1630 else
1631   echo "        disabled"
1634 echo -n " - Open Napster      "
1635 if test "$OPEN_NAPSTER" = "yes"; then
1636   echo "enabled          - currently not usable"
1637 else
1638   echo "        disabled - currently not usable"
1641 echo -n " - Soulseek          "
1642 if test "$SOULSEEK" = "yes"; then
1643   echo "enabled          - currently not usable"
1644 else
1645   echo "        disabled - currently not usable"
1648 echo -n " - OpenFT            "
1649 if test "$OPENFT" = "yes"; then
1650   echo "enabled          - currently not usable"
1651 else
1652   echo "        disabled - currently not usable"
1655 echo -e "\nCore features:"
1657 echo " - zlib (required)   enabled"
1659 echo -n " - threads           "
1660 if test "$USE_PTHREAD" = "yes"; then
1661   echo "enabled"
1662 else
1663   echo "        disabled"
1666 echo -n " - bzip2             "
1667 if test "$BZIP2" = "yes"; then
1668   echo "enabled"
1669 else
1670   echo "        disabled"
1673 echo -n " - iconv             "
1674 if test "$ICONV" = "yes"; then
1675   echo "enabled"
1676 else
1677   echo "        disabled"
1680 echo -n " - libmagic          "
1681 if test "$MAGIC" = "yes"; then
1682   echo "enabled"
1683 else
1684   echo "        disabled"
1687 echo -n " - upnp & natpmp     "
1688 if test "$UPNP_NATPMP" = "yes"; then
1689   echo "enabled"
1690 else
1691   echo "        disabled"
1694 echo -n " - graphical stats   "
1695 if test "$GD" = "yes"; then
1696   echo "enabled"
1697   echo -n "   - png support     "
1698   if test "$GD_PNG" = "yes"; then
1699     echo "enabled"
1700   else
1701     echo "        disabled"
1702   fi
1704   echo -n "   - jpg support     "
1705   if test "$GD_JPG" = "yes"; then
1706     echo "enabled"
1707   else
1708     echo "        disabled"
1709   fi
1710 else
1711   echo "        disabled"
1714 echo -n -e "\n - GUI build        "
1715 if test "$LABLGTK_CONFIG" = "yes"; then
1716   if test "$GUI" = "newgui1"; then
1717     echo "GTK1 newgui"
1718   else
1719     if test "$GUI" = "newgui2"; then
1720       echo "GTK2 GUI"
1721     else
1722       echo "GTK1 oldgui"
1723     fi
1724   fi
1725 else
1726   echo "         disabled"
1729 if test "$TARGET_TYPE" = "byte"; then
1730   OCAML_TYPE="- byte code"
1731   COMPILE_TARGET=".byte"
1733 echo -e "\nCompilers:"
1734 echo -e " - Ocaml version     $OCAMLVERSION $OCAML_TYPE"
1735 echo -e " - $CC version       $CC_VERSION"
1736 if test "x$CXX" != "x"; then
1737   echo -e " - $CXX version       $CXX_VERSION"
1739 echo -e "\nNow execute '$GNU_MAKE' to start compiling. Good luck!"
1741 echo -e "\nTo compile a static core execute:     $GNU_MAKE mlnet$COMPILE_TARGET.static"
1742 echo      "To produce a release tarball execute: $GNU_MAKE release.mlnet.static"
1743 echo      "To clean the build directory execute: $GNU_MAKE maintainerclean"
1744 if test "$DONKEY_SUI" = "yes"; then
1745   echo -e "\nCompiling CryptoPP.cc can take several minutes, on slow machines up to half an hour."