release-3-1-3
[mldonkey.git] / config / configure.in
blob58018bc12ec9cad22135f5e300cbd61adec42ab5
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=1
25 SUB_VERSION=3   # 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   *-gnu*)
165     SYSTEM=hurd
166     ;;
167 esac
168 if test "x$SYSTEM" = "xunknown"; then
169   echo "Unknown build system, please report to the MLDonkey development team at http://mldonkey.sourceforge.net/forums/"
170   exit 1
173 case "$host" in
174   alpha*-*-osf*)                arch=alpha; system=digital;;
175   alpha*-*-linux*)              arch=alpha; system=linux;;
176   alpha*-*-freebsd*)            arch=alpha; system=freebsd;;
177   alpha*-*-netbsd*)             arch=alpha; system=netbsd;;
178   alpha*-*-openbsd*)            arch=alpha; system=openbsd;;
179   sparc-*-sunos4.*)             arch=sparc; system=sunos;;
180   sparc-*-solaris2.*)           arch=sparc; system=solaris;;
181   sparc-*-*bsd*)                arch=sparc; system=bsd;;
182   sparc-*-linux*)               arch=sparc; system=linux;;
183   i?86-*-linux*)           arch=i386; system=linux;;
184   i386-*-*bsd*)            arch=i386; system=bsd;;
185   i486-*-*bsd*)            arch=i486; system=bsd;;
186   i586-*-*bsd*)            arch=i586; system=bsd;;
187   i686-*-*bsd*)            arch=i686; system=bsd;;
188   i?86-*-nextstep*)        arch=i386; system=nextstep;;
189   i?86-*-solaris*)         arch=i386; system=solaris;;
190   i?86-*-beos*)            arch=i386; system=beos;;
191   i?86-*-cygwin*)          arch=i386; system=cygwin;;
192   mips-*-irix6*)                arch=mips; system=irix;;
193   hppa1.1-*-hpux*)              arch=hppa; system=hpux;;
194   hppa1.1-*-nextstep*)          arch=hppa; system=nextstep;;
195   rs6000-*-aix*)                arch=power; model=rs6000; system=aix;;
196   powerpc-*-aix*)               arch=power; model=ppc; system=aix;;
197   powerpc-*-linux*)             arch=power; model=ppc; system=elf;;
198   powerpc-*-rhapsody*)          arch=power; model=ppc; system=rhapsody;;
199   powerpc-*-darwin*)            arch=power; model=ppc; system=rhapsody;;
200   arm*-*-linux*)                arch=arm; system=linux;;
201   ia64-*-linux*)                arch=ia64; system=linux;;
202 esac
204 MD4ARCH=$arch
205 case $host in
206   i386-pc-linux*|i386-*-*bsd*) MD4COMP=as; MD4ARCH=i386;;
207   i486-pc-linux*|i486-*-*bsd*) MD4COMP=as; MD4ARCH=i486;;
208   i586-pc-linux*|i586-*-*bsd*) MD4COMP=as; MD4ARCH=i586;;
209   i686-pc-linux*|i686-*-*bsd*) MD4COMP=as; MD4ARCH=i686;;
210   i386-pc-mingw32*) MD4COMP=cc; MD4ARCH=i386;;
211   i486-pc-mingw32*) MD4COMP=cc; MD4ARCH=i486;;
212   i586-pc-mingw32*) MD4COMP=cc; MD4ARCH=i586;;
213   i686-pc-mingw32*) MD4COMP=cc; MD4ARCH=i686;;
214   *) MD4COMP=cc;;
215 esac
217 ARCH=$arch
219 # **********                                                                                  **********
220 # **********               Parse checkout date (CVS) or revision (SVN) if available           **********
221 # **********                                                                                  **********
223 if test -d .svn; then
224   AC_MSG_NOTICE(checking SVN revision)
225   AC_CHECK_PROG(SVNVERSION,svnversion,svnversion)
226   if test "$ac_cv_prog_SVNVERSION" = "svnversion"; then
227     SUB_VERSION3="SVN"
228     SCM_VERSION=`svnversion -n .`
229   else AC_MSG_NOTICE(cannot checking SVN revision... no SVNVERSION)
230     SCM_VERSION="cannot find out SVN revision (no SVNVERSION)"  
231   fi     
234 if test -f ./CVS/Entries ; then
235   AC_MSG_NOTICE(checking CVS checkout date)
236   AC_CHECK_PROGS(STAT, stat gstat, stat)
237   if [ test "$ac_cv_prog_STAT" = "stat" ] || [ test "$ac_cv_prog_STAT" = "gstat" ]; then
238     AC_CHECK_PROG(SED, sed, sed)
239     if test "$ac_cv_prog_SED" = "sed"; then
240       AC_CHECK_PROG(CUT, cut, cut)
241       if test "$ac_cv_prog_CUT" = "cut"; then
242         SUB_VERSION3="CVS"
243         if [ test "$SYSTEM" = "freebsd"] || [ test "$SYSTEM" = "netbsd"] || ( [ test "$SYSTEM" = "macos" ] && [ test "$ac_cv_prog_STAT" != "gstat" ] ); then
244           SCM_VERSION=`$STAT -f "%Sm" ./CVS/Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\4-\1-\2 \3/'`
245         else
246         if [ test "$SYSTEM" = "openbsd"]; then
247           AC_CHECK_PROG(GREP, grep, grep)
248           if test "$ac_cv_prog_GREP" = "grep"; then
249             SCM_VERSION=`$STAT -f %a ./CVS/Entries | $GREP -v Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\1-\2-\4 \3/'`
250           fi
251         else
252         if [ test "$SYSTEM" = "mingw"] || [ test "$SYSTEM" = "cygwin"]; then
253           AC_CHECK_PROG(GREP, grep, grep)
254           if test "$ac_cv_prog_GREP" = "grep"; then
255             SCM_VERSION=`$STAT ./CVS/Entries  | $GREP Modify | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/\5-\2-\3 \4/'`
256           fi
257         else
258           SCM_VERSION=`$STAT -Lc %y ./CVS/Entries | $SED -e 's#\.[0-9]*##' | $CUT -c 1-19`
259         fi  #if [ test "$SYSTEM" = "mingw"] || ...
260         fi  #if [ test "$SYSTEM" = "openbsd"]
261         fi  #if [ test "$SYSTEM" = "freebsd"] || ...
262       else
263         AC_MSG_NOTICE(cannot checking CVS checkout date... no CUT)
264         SCM_VERSION="cannot find out SCM Version (no CUT)"
265       fi
266     else
267       AC_MSG_NOTICE(cannot checking CVS checkout date... no SED)
268       SCM_VERSION="cannot find out SCM Version (no SED)"
269     fi
270   else
271     AC_MSG_NOTICE(cannot checking CVS checkout date... no STAT)
272     SCM_VERSION="cannot find out SCM Version (no STAT)"
273   fi
276 # **********                                                                                  **********
277 # **********             build MLDonkey version, Required OCaml and LablGTK versions          **********
278 # **********                                                                                  **********
280 MLDONKEY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$SUB_VERSION
281 if test -f ./subrelease; then
282   MLDONKEY_VERSION=$MLDONKEY_VERSION`cat ./subrelease`
284 if test ! -z "$SUB_VERSION3"; then
285   MLDONKEY_VERSION=$MLDONKEY_VERSION.$SUB_VERSION3
288 REQUIRED_OCAML=3.12.0
289 DOWNLOAD_OCAML_MAJOR=3.12
290 DOWNLOAD_OCAML=3.12.0
292 REQUIRED_LABLGTK=1.2.7
294 touch install-sh
296 LABLGTK_NAME=lablgtk
298 # **********                                                                                  **********
299 # **********                    Network and Feature configure switch variables                **********
300 # **********                                                                                  **********
302 # **********   currently not working Networks, can't be enabled
304 SOULSEEK=no
305 OPEN_NAPSTER=no
306 OPENFT=no
308 # **********   working Networks, enabled by default
310 DONKEY=yes
311 BITTORRENT=yes
312 GNUTELLA=no
313 GNUTELLA2=no
314 FASTTRACK=yes
315 FILETP=yes
316 DIRECT_CONNECT=yes
318 # **********   predefined configure variations
320 MULTINET=yes
321 MINIMUM=no
323 # **********   Features, enabled by default
325 DONKEY_SUI=yes
326 DONKEY_SUI_FILE=DonkeySui2
327 GD=yes
328 BZIP2=yes
329 MAGIC=yes
330 ICONV=yes
331 USE_PTHREAD=yes
332 UPNP_NATPMP=no
333 UPNP_NATPMP_FORCE=no
335 # **********
337 BATCH=no
338 FORCE_OCAML=no
339 FORCE_MINGW=no
340 PROFILE=no
341 DEBUG=no
342 GUI=no
343 CHECKBOUNDS=false
345 # **********                                                                                  **********
346 # **********                Network and Feature configure switches and dependency             **********
347 # **********                                                                                  **********
349 AC_ARG_ENABLE(multinet,
350   AS_HELP_STRING([--disable-multinet], [disable all networks except eDonkey (with Overnet and Kademlia)]),
351   [MULTINET="$enableval"])
352 AC_ARG_ENABLE(minimum,
353   AS_HELP_STRING([--enable-minimum], [enable minimum set of features and networks (eDonkey, iconv and threads enabled)]),
354   [MINIMUM="$enableval"])
355 AC_ARG_ENABLE(minimum,
356   AS_HELP_STRING([--enable-minimum=all], [enable only eDonkey network and disable all optional features (not recommended)]),
357   [MINIMUM="$enableval"])
359 if [ test ! "$MULTINET" = "yes" ] || [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
360   GNUTELLA=no
361   GNUTELLA2=no
362   FASTTRACK=no
363   DIRECT_CONNECT=no
364   FILETP=no
365   BITTORRENT=no
367 if [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
368   DONKEY_SUI=no
369   GD=no
370   BZIP2=no
371   MAGIC=no
373 if [ test "$MINIMUM" = "all" ]; then
374   USE_PTHREAD=no
375   ICONV=no
378 #AC_ARG_ENABLE(soulseek,      [  --disable-soulseek      disable support for SoulSeek], [SOULSEEK="$enableval"])
379 #AC_ARG_ENABLE(opennap,       [  --disable-opennap       disable support for Open Napster], [OPEN_NAPSTER="$enableval"])
380 AC_ARG_ENABLE(directconnect,
381   AS_HELP_STRING([--disable-directconnect], [disable support for Direct Connect]),
382   [DIRECT_CONNECT="$enableval"])
383 #AC_ARG_ENABLE(openft,        [  --disable-openft        disable support for OpenFT], [OPENFT="$enableval"])
385 AC_ARG_ENABLE(donkey,
386   AS_HELP_STRING([--disable-donkey], [disable support for eDonkey]),
387   [DONKEY="$enableval"])
388 AC_ARG_ENABLE(donkeysui,
389   AS_HELP_STRING([--disable-donkeysui], [disable support for eMule SecureUserIdent]),
390   [DONKEY_SUI="$enableval"])
391 AC_ARG_ENABLE(bittorrent,
392   AS_HELP_STRING([--disable-bittorrent], [disable support for Bittorent]),
393   [BITTORRENT="$enableval"])
394 AC_ARG_ENABLE(filetp,
395   AS_HELP_STRING([--disable-filetp], [disable support for fileTP]),
396   [FILETP="$enableval"])
397 AC_ARG_ENABLE(gnutella,
398   AS_HELP_STRING([--disable-gnutella], [disable support for Gnutella]),
399   [GNUTELLA="$enableval"])
400 AC_ARG_ENABLE(gnutella2,
401   AS_HELP_STRING([--disable-gnutella2], [disable support for Gnutella2]),
402   [GNUTELLA2="$enableval"])
403 AC_ARG_ENABLE(fasttrack,
404   AS_HELP_STRING([--disable-fasttrack], [disable support for FastTrack]),
405   [FASTTRACK="$enableval"])
407 AC_ARG_ENABLE(batch,
408   AS_HELP_STRING([--enable-batch], [reply YES to all queries in this script]),
409   [BATCH="$enableval"])
410 AC_ARG_ENABLE(force-ocaml,
411   AS_HELP_STRING([--enable-force-ocaml], [force usage of self-compiled OCaml]),
412   [FORCE_OCAML="$enableval"])
413 AC_ARG_ENABLE(ocamlver,
414   AS_HELP_STRING([--enable-ocamlver=VER], [force usage of specific OCaml version (3.10.1|SVN), ]),
415   [REQUIRED_OCAML="$enableval"])
416 AC_ARG_ENABLE(mingw,
417   AS_HELP_STRING([--enable-mingw], [force compilation with MINGW on Cygwin]),
418   [FORCE_MINGW="$enableval"])
419 AC_ARG_ENABLE(checks,
420   AS_HELP_STRING([--enable-checks], [enable bounds-checking for array/string accesses]),
421   [CHECKBOUNDS="$enableval"])
422 if test "$CHECKBOUNDS" = "yes"; then
423   CHECKBOUNDS=true
426 AC_ARG_ENABLE(profile,
427   AS_HELP_STRING([--enable-profile], [compile with gprof profiling support (enables debug)]),
428   [PROFILE="$enableval"])
429 AC_ARG_ENABLE(debug,
430   AS_HELP_STRING([--enable-debug], [compile with debugging information]),
431   [DEBUG="$enableval"])
432 if test "$PROFILE" = "yes"; then
433   DEBUG="yes"
435 AC_ARG_ENABLE(gui,
436   AS_HELP_STRING([--disable-gui], [disable GUI build (default)]),
437   [GUI="$enableval"])
438 AC_ARG_ENABLE(gui,
439   AS_HELP_STRING([--enable-gui=oldgui|newgui1|newgui2], 
440                  [enable GUI (newgui2 uses GTK2 (default), other GUIs use GTK1)]),
441   [GUI="$enableval"])
442 if test "$GUI" = "yes"; then
443   GUI=newgui2
445 if test ! "$GUI" = "newgui2"; then
446   if test ! "$GUI" = "newgui1"; then
447     if test ! "$GUI" = "oldgui"; then
448       GUI=no
449     fi
450   fi
453 AC_ARG_ENABLE(pthread,
454   AS_HELP_STRING([--disable-pthread], [disable the use of pthread, hurts performance!]),
455   [USE_PTHREAD="$enableval"])
456 AC_ARG_ENABLE(pthread-lib,
457   AS_HELP_STRING([--enable-pthread-lib], [legacy option]),
458   [USE_PTHREAD="$enableval"])
459 AC_ARG_ENABLE(iconv,
460   AS_HELP_STRING([--disable-iconv], [disable the use of iconv]),
461   [ICONV="$enableval"])
462 AC_ARG_ENABLE(gd,
463   AS_HELP_STRING([--disable-gd], [disable the use of gd]),
464   [GD="$enableval"])
465 AC_ARG_ENABLE(bzip2,
466   AS_HELP_STRING([--disable-bzip2], [disable the use of bzip2]),
467   [BZIP2="$enableval"])
468 AC_ARG_ENABLE(magic,
469   AS_HELP_STRING([--disable-magic], [disable the use of libmagic (GNU file)]),
470   [MAGIC="$enableval"])
471 AC_ARG_ENABLE(upnp-natpmp,
472   AS_HELP_STRING([--enable-upnp-natpmp], [enable the use of libminiupnpc and libnatpmp]),
473   [UPNP_NATPMP="$enableval"])
474 AC_ARG_ENABLE(force-upnp-natpmp,
475   AS_HELP_STRING([--enable-force-upnp-natpmp], [force local compilation of libminiupnpc and libnatpmp]),
476   [UPNP_NATPMP_FORCE="$enableval"])
478 if test "$FORCE_MINGW" = "yes"; then
479     CC="$CC -mno-cygwin"
480     CPP="$CPP -mno-cygwin"
481     OS_FILES=mingw
482     OS_FILES2=mingw
483     SYSTEM=mingw
486 OCAML_PATH=
488 echo ""
489 echo "--------------------------------"
490 echo "     Checking system tools."
491 echo "--------------------------------"
493 AC_PROG_RANLIB
494 AC_CHECK_PROG(GNU_MAKE, gmake, gmake)
495 AC_CHECK_PROG(GNU_MAKE, make, make)
497 if test "x$GNU_MAKE" != "x"; then
498   AC_MSG_CHECKING( [if $GNU_MAKE is GNU make] )
499   $GNU_MAKE --version > /dev/null 2>&1
500   if test "$?" != "0"; then
501     AC_MSG_RESULT([no])
502         AC_MSG_ERROR(GNU make not found)
503   else
504     AC_MSG_RESULT([yes])
505   fi
506 else
507   AC_MSG_ERROR(GNU make not found)
510 AC_CHECK_PROG(COMPRESS, bzip2, bzip2)
511 AC_CHECK_PROG(COMPRESS, gzip, gzip)
513 if test "$ac_cv_prog_COMPRESS" = "bzip2"; then
514    COMPRESS_EXT=bz2
515 else
516    COMPRESS_EXT=gz
519 AC_PATH_PROG(PERL, perl, perl)
520 AC_CHECK_PROG(RPMBUILD,rpmbuild,rpmbuild)
521 AC_CHECK_PROG(RPMBUILD,rpm,rpm)
523 AC_CHECK_PROG(WGET, wget, wget)
524 if test -z "$ac_cv_prog_WGET"; then
525   $CC -o wget wget.c || echo "Cannot compile wget.c"
526   AC_PATH_PROG(WGET, wget,,$SOURCE_DIR/config)
527   ac_cv_prog_WGET="$ac_cv_path_WGET"
529 WGET="$ac_cv_prog_WGET"
531 echo "----------------------------------------"
532 echo "     Checking system tools finished."
533 echo "----------------------------------------"
534 echo ""
535 echo "--------------------------------"
536 echo "     Checking OCaml compiler."
537 echo "--------------------------------"
539 CONFIG_DIR=$SOURCE_DIR/config
540 PATCH_DIR=$SOURCE_DIR/patches
541 LOCAL_DIR=$PATCH_DIR/local
542 BUILD_DIR=$PATCH_DIR/build
544 AC_ARG_ENABLE(local-prefix,
545   AS_HELP_STRING([--enable-local-prefix=DIR], [specify path for temporary tools installation (DIR must be absolute)]),
546   [LOCAL_DIR="$enableval"])
548 LOCAL=$LOCAL_DIR
549 LOCAL_OCAML=$LOCAL_DIR/bin
551 AC_PATH_PROG(OCAMLC,ocamlc.opt,"",[$LOCAL_DIR/bin:$PATH])
552 AC_CHECK_TOOL(OCAMLC,ocamlc,ocamlrun ocamlc)
553 AC_PATH_PROG(CAMLP4, camlp4,"",[$LOCAL_DIR/bin:$PATH])
555 BUILD_OCAML=no
556 if [ test -z "$OCAMLC" ] || [ test -z "$CAMLP4" ] || [ test "$REQUIRED_OCAML" = "SVN" ]; then
557    BUILD_OCAML=yes
558 else
559   OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
560   case "$OCAMLVERSION" in
561     "$REQUIRED_OCAML"*|4.*|3.12.*|3.11.*|3.10.1*|3.10.2*) ;;
562     *)
563         echo "Need build"
564         BUILD_OCAML=yes
565         ;;
566   esac
568 case "$REQUIRED_OCAML" in
569   3.10.0|3.0*)
570     echo "Need build"
571     REQUIRED_OCAML=3.12.0
572     BUILD_OCAML=yes
573     ;;
574 esac
575 if [ test "$BUILD_OCAML" = "yes" ] || [ test "$FORCE_OCAML" = "yes" ]; then
577   if [ test "$SYSTEM" = "mingw" ]; then
578     echo "********         Objective-Caml $REQUIRED_OCAML is required               *********" 1>&2;
579     echo "********     no valid OCaml compiler found on your system        *********" 1>&2;
580     echo "********   on MinGW there is no possibility to let configure     *********" 1>&2;
581     echo "********   build the OCaml compiler with the included script     *********" 1>&2;
582     echo "********    check http://mldonkey.sourceforge.net/Windows        *********" 1>&2;
583     echo "********   for instuctions how to compile OCaml under MinGW      *********" 1>&2;
584     exit 1
585   else  
586     
587   echo "********  Objective-Caml $REQUIRED_OCAML is required  *********" 1>&2;
588   if [ test "$WGET" = "" ] && [ test "$REQUIRED_OCAML" != "SVN" ]; then
589     echo "********          wget is missing          *********" 1>&2;
590     echo "********       cannot download OCaml       *********" 1>&2;
591     exit 1
592   fi
593   echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
594   echo "Do you want this script to try to download and install ocaml"
595   echo "LOCALLY in mldonkey directory ?"
596   if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
597   case "$i" in
598    y* | Y*)
599       cd $PATCH_DIR
600       if [ test "$REQUIRED_OCAML" = "SVN" ]; then
601         rm -rf $BUILD_DIR
602         mkdir -p $BUILD_DIR
603         cd $BUILD_DIR
604         svn checkout http://caml.inria.fr/svn/ocaml/trunk
605         cd trunk
606       else
607         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
608           echo Downloading ...
609           $WGET http://caml.inria.fr/pub/distrib/ocaml-"$DOWNLOAD_OCAML_MAJOR"/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.11/ocaml-"$REQUIRED_OCAML".tar.gz
613         fi
614         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
615           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-"$REQUIRED_OCAML".tar.gz
616         fi
617         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
618           echo "********        download OCaml $REQUIRED_OCAML not successful, try do download it manually       *********" 1>&2;
619           echo "********        from http://caml.inria.fr/pub/distrib/                                   *********" 1>&2;
620           echo "********        and copy the tar.gz into $PATCH_DIR              *********" 1>&2;
621           exit 1
622         fi
624         echo Uncompressing ...
625         mkdir -p $BUILD_DIR
626         cd $BUILD_DIR
627         rm -rf ocaml-"$REQUIRED_OCAML"
628         gzip -cd $PATCH_DIR/ocaml-"$REQUIRED_OCAML".tar.gz | tar vxf -
629         cd ocaml-"$REQUIRED_OCAML"
630         if test -f $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch; then
631           echo Patching ...
632           patch -p1 < $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch
633         fi
634       fi
635       echo Configuring ...
636       ./configure -prefix $LOCAL_DIR -host $host -cc $CC
637       cd config
638       cp -f Makefile Makefile.old
639       sed "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" Makefile.old > Makefile
640       cd ..
641       cp -f $PATCH_DIR/Makefile.ocamldoc ocamldoc/Makefile
642       echo Compiling ...
643       $GNU_MAKE world opt opt.opt
644       echo Installing ...
645       $GNU_MAKE install
646       if ! test -f $LOCAL_DIR/lib/ocaml/threads; then
647         if ! test -f $LOCAL_DIR/lib/ocaml/vmthreads; then
648           ln -s vmthreads  $LOCAL_DIR/lib/ocaml/threads
649         fi
650       fi
651       cd $BUILD_DIR
652       if [ test "$REQUIRED_OCAML" = "SVN" ]; then
653         rm -rf trunk
654       else
655         rm -rf ocaml-"$REQUIRED_OCAML"
656       fi
657       cd $CONFIG_DIR
658       echo OCaml locally installed for mldonkey
660       if test -f "$LOCAL_OCAML"/ocamlc.opt; then
661          OCAMLC=$LOCAL_OCAML/ocamlc.opt
662          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc.opt
663       else
664       if test -f "$LOCAL_OCAML"/ocamlc; then
665          OCAMLC=$LOCAL_OCAML/ocamlc
666          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc
667       else
668         echo "OCaml installation failed"; exit 1
669       fi
670       fi
671       ;;
672    *)  exit 1;;
673   esac
674   fi
677 if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc.opt ; then
678   OCAML_PATH="$LOCAL_OCAML"/
679   OCAMLOPT=$LOCAL_OCAML/ocamlopt.opt
680   OCAMLDOC=$LOCAL_OCAML/ocamldoc
681   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
682   OCAMLDEP=$LOCAL_OCAML/ocamldep
683   OCAMLLEX=$LOCAL_OCAML/ocamllex.opt
684   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
685   CAMLP4=$LOCAL_OCAML/camlp4
686   CAMLP4OF=$LOCAL_OCAML/camlp4of
687 else
688   if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc ; then
689   OCAML_PATH="$LOCAL_OCAML"/
690   if test -f "$LOCAL_OCAML/ocamlopt"; then
691     OCAMLOPT=$LOCAL_OCAML/ocamlopt
692   else
693     OCAMLOPT=no
694   fi
695   OCAMLDOC=$LOCAL_OCAML/ocamldoc
696   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
697   OCAMLDEP=$LOCAL_OCAML/ocamldep
698   OCAMLLEX=$LOCAL_OCAML/ocamllex
699   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
700   CAMLP4=$LOCAL_OCAML/camlp4
701   CAMLP4OF=$LOCAL_OCAML/camlp4of
702   else
703   AC_CHECK_PROG(OCAMLOPT, ocamlopt.opt, ocamlopt.opt)
704   AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt, no)
705   AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
706   AC_CHECK_PROG(OCAMLLEX, ocamllex.opt, ocamllex.opt)
707   AC_CHECK_PROG(OCAMLLEX, ocamllex, ocamllex)
708   AC_CHECK_PROG(OCAMLYACC, ocamlyacc, ocamlyacc)
709   AC_CHECK_PROG(OCAMLDOC, ocamldoc, ocamldoc)
710   AC_CHECK_PROG(OCAMLMKTOP, ocamlmktop, ocamlmktop)
711   AC_CHECK_PROG(CAMLP4, camlp4, camlp4)
712   AC_CHECK_PROG(CAMLP4OF, camlp4of, camlp4of, $CAMLP4 pa_o.cmo pr_o.cmo Camlp4QuotationExpander.cmo Camlp4GrammarParser.cmo)
716 OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
717 OCAMLLIB=`$OCAMLC -where`
719 # check if native dynlink is supported and therefore needed for linking
720 CAMLP4LIB_OPT="camlp4lib.cmxa"
721 CAMLP4LIB_BYTE="camlp4lib.cma"
722 if test -f $OCAMLLIB/dynlink.cma; then
723   CAMLP4LIB_BYTE="dynlink.cma $CAMLP4LIB_BYTE"
725 if test -f $OCAMLLIB/dynlink.cmxa; then
726   CAMLP4LIB_OPT="dynlink.cmxa $CAMLP4LIB_OPT"
729 # force usage of supported OCaml versions
730 case "$OCAMLVERSION" in
731     3.10.1*|3.10.2*|3.1*|4.*) ;;
732     *)
733       if [ test "$REQUIRED_OCAML" != "SVN" ]; then
734         echo "********  Version $REQUIRED_OCAML of Objective-Caml is required  *********" 1>&2;
735         echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
736         exit 1
737       fi
738       ;;
739 esac
741 if test "$OCAMLOPT" = "no"; then
742   TARGET_TYPE=byte
743   OCAMLLIB_EXT=cma
744 else
745   TARGET_TYPE=opt
746   OCAMLLIB_EXT=cmxa
748   OCAMLOPTVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
750   test "$OCAMLOPTVERSION" = "$OCAMLVERSION" || {
751     echo "********  Version $REQUIRED_OCAML of ocamlopt is required  *********" 1>&2;
752     echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
753     exit 1; }
757 echo "-------------------------------------------"
758 echo "     Checking OCaml $OCAMLVERSION finished."
759 echo "-------------------------------------------"
762 if test "$PROFILE" = "yes"; then
763    OCAMLOPT="$OCAMLOPT -p"
764    CFLAGS="$CFLAGS -pg"
766 if test "$FORCE_MINGW" = "yes"; then
767     OCAMLC="$OCAMLC -ccopt -mno-cygwin"
768     OCAMLOPT="$OCAMLOPT -ccopt -mno-cygwin"
769     OCAMLMKTOP="$OCAMLMKTOP -ccopt -mno-cygwin"
771 if test "$DEBUG" = "yes"; then
772     OCAMLC="$OCAMLC -g"
773     OCAMLOPT="$OCAMLOPT -g"
776 echo ""
777 echo "----------------------------------"
778 echo "     Checking system headers."
779 echo "----------------------------------"
781 ifelse(AC_ACVERSION, [2.13], [],
782 [dnl Large file enabled
783    AC_SYS_LARGEFILE
787 dnl Check for native endianness.
788 AC_C_BIGENDIAN(,,
789   [AC_MSG_ERROR([Machine endianness could not be determined])]
791 if test "x$WORDS_BIGENDIAN" = "x"; then
792   NATIVEENDIAN=LittleEndian
793 else
794   NATIVEENDIAN=BigEndian
796 AC_SUBST(NATIVEENDIAN)
798 # various header files
799 AC_CHECK_FUNCS(setrlimit getrlimit strerror_r strerror posix_fallocate)
800 AC_CHECK_HEADERS(byteswap.h,,)
801 AC_CHECK_HEADERS([sys/utsname.h])
802 AC_CHECK_HEADERS(arpa/inet.h,,)
803 AC_CHECK_HEADERS([sys/types.h sys/time.h sys/resource.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
804 [#ifdef HAVE_SYS_TYPES_H
805 #include <sys/types.h>
806 #endif
807 #ifdef HAVE_SYS_TIME_H
808 #include <sys/time.h>
809 #endif
810 #ifdef HAVE_NETINET_IN_SYSTM_H
811 #include <netinet/in_systm.h>
812 #endif
813 #ifdef HAVE_NETINET_IN_H
814 #include <netinet/in.h>
815 #endif
818 # poll if possible
819 AC_CHECK_HEADERS(sys/poll.h,,)
820 AC_CHECK_FUNCS(poll,,)
822 AC_CHECK_HEADERS(sys/vfs.h,,)
823 AC_CHECK_HEADERS(sys/statvfs.h,,)
824 AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
825 [#if HAVE_SYS_PARAM_H
826 #include <sys/param.h>
827 #endif
829 echo "-------------------------------------------"
830 echo "     Checking system headers finished."
831 echo "-------------------------------------------"
832 echo ""
833 echo "-----------------------------------"
834 echo "     Checking system libraries."
835 echo "-----------------------------------"
836 echo "----- checking zlib (required)"
837 AC_CHECK_LIB(z,inflate,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
838 AC_CHECK_HEADERS(zlib.h,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
839 AC_CHECK_LIB(z,zlibVersion,[AC_DEFINE(HAVE_ZLIBVERSION, 1,)])
841 if test "$BZIP2" != "no"; then
842   echo "----- checking bzlib (optional)"
843   AC_CHECK_HEADERS(bzlib.h,[AC_CHECK_LIB(bz2,BZ2_bzReadOpen,[BZIP2=yes],[BZIP2=no])],[BZIP2=no])
846 if test "$BZIP2" = "yes"; then
847   AC_CHECK_LIB(bz2,BZ2_bzlibVersion,[AC_DEFINE(HAVE_BZLIBVERSION, 1,)])
848   AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
849 else
850   AC_MSG_NOTICE(bzlib not available)
853 if test "$UPNP_NATPMP_FORCE" = "yes"; then
854         UPNP_NATPMP=yes
855         cd $PATCH_DIR
856         $WGET http://miniupnp.tuxfamily.org/files/miniupnpc-1.6.tar.gz
857         $WGET http://miniupnp.tuxfamily.org/files/libnatpmp-20110808.tar.gz
858         mkdir -p $BUILD_DIR $LOCAL_DIR/usr/bin $LOCAL_DIR/usr/lib $LOCAL_DIR/usr/include/miniupnpc
859         cd $BUILD_DIR
860         rm -rf libnatpmp-20110808 miniupnpc-1.6
861         tar -xzf $PATCH_DIR/miniupnpc-1.6.tar.gz
862         tar -xzf $PATCH_DIR/libnatpmp-20110808.tar.gz
863         cd $BUILD_DIR/libnatpmp-20110808
864         make all install PREFIX=$LOCAL_DIR
865         cd $BUILD_DIR/miniupnpc-1.6
866         make all install PREFIX=$LOCAL_DIR
867         cd $CONFIG_DIR
868         rm -rf $BUILD_DIR/libnatpmp-20110808 $BUILD_DIR/miniupnpc-1.6
869         CPPFLAGS="${CPPFLAGS} -I$LOCAL_DIR/usr/include"
870         LDFLAGS="${LDFLAGS} -L$LOCAL_DIR/usr/lib"
873 if test "$UPNP_NATPMP" = "yes"; then
874   echo "----- checking libminiupnpc >= 1.6 (optional)"
875   AC_CHECK_HEADERS(miniupnpc/miniupnpc.h,[AC_CHECK_LIB(miniupnpc,upnpDiscover,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
878 if test "$UPNP_NATPMP" = "yes"; then
879   echo "----- checking libnatpmp >= 20110808 (optional)"
880   AC_CHECK_HEADERS(natpmp.h,[AC_CHECK_LIB(natpmp,initnatpmp,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
883 if test "$UPNP_NATPMP" = "yes"; then
884   AC_DEFINE(ENABLE_UPNP_NATPMP, 1, [Define to 1 if you have libminiupnpc & libnatpmp for port forwarding support.])
885   UPNP_NATPMP_LIBS="-lminiupnpc -lnatpmp $LIBS"
886   UPNP_NATPMP_STATIC_LIBS="-lminiupnpc -lnatpmp $LIBS"
889 if test "$MAGIC" != "no"; then
890   echo "----- checking libmagic (GNU file) (optional)"
891   AC_CHECK_HEADERS(magic.h,
892     [AC_CHECK_LIB(magic,magic_file,
893       [AC_CHECK_DECL([MAGIC_ERROR], [MAGIC=yes], [MAGIC=no],[#include <magic.h>])],
894       [MAGIC=no])],
895     [MAGIC=no])
898 if test "$MAGIC" = "yes"; then
899   MAGICLIB=Magic_magic
900 else
901   MAGICLIB=Magic_nomagic
902   AC_MSG_NOTICE(libmagic not available)
905 GD_JPG=no
906 GD_PNG=no
907 if test "$GD" != "no"; then
908   echo "----- checking gd (optional)"
909   GD=no
910   LIBGD=no
911   SAVE_LIBS=$LIBS
912   SAVE_CFLAGS=$CFLAGS
913   SAVE_LDFLAGS=$LDFLAGS
914   AC_CHECK_PROG(GDLIBCONFIG, gdlib-config, gdlib-config)
915   if test "$ac_cv_prog_GDLIBCONFIG" = "gdlib-config"; then
916     GD_LIBS=`$GDLIBCONFIG --libs`
917     $GDLIBCONFIG --static-libs > /dev/null 2>&1
918     if test "$?" = "0"; then
919       GD_STATIC_LIBS=`$GDLIBCONFIG --static-libs`
920     fi
921     GD_LIBS2="$LIBS -lgd $GD_LIBS"
922     LIBS=$GD_LIBS2
923     GD_CFLAGS=`$GDLIBCONFIG --cflags`
924     CFLAGS="$CFLAGS $GD_CFLAGS"
925     GD_LDFLAGS=`$GDLIBCONFIG --ldflags`
926     LDFLAGS="$LDFLAGS $GD_LDFLAGS"
927     AC_MSG_CHECKING(for libgd > 2.0.14)
928     GDVERSION=`$GDLIBCONFIG --version`
929     GDMAJORVERSION=`$GDLIBCONFIG --majorversion`
930     GDMINORVERSION=`$GDLIBCONFIG --minorversion`
931     GDREVISION=`$GDLIBCONFIG --revision`
932     if [ [ $GDMAJORVERSION = 2 ] && [ $GDMINORVERSION = 0 ] && [ $GDREVISION -gt 14 ]]; then
933         AC_MSG_RESULT($GDVERSION)
934         LIBGD=yes
935     else
936         AC_MSG_RESULT(no (found $GDVERSION))
937         LIBGD=no
938     fi
939   else
940     LIBGD=yes
941   fi
943   if test "$LIBGD" = "yes"; then
944     AC_CHECK_HEADERS(gd.h,[LIBGD=yes],[LIBGD=no])
945   fi
947   if test "$LIBGD" = "yes"; then
948     AC_MSG_CHECKING(for gdImageCreate in -lgd)
949     AC_TRY_LINK([#include <gd.h>],
950     [gdImageCreate (0,0);],
951     [LIBGD=yes], [LIBGD=no])
952     AC_MSG_RESULT($LIBGD)
953     LIBS=$SAVE_LIBS
955     if test "$LIBGD" = "no"; then
956       AC_MSG_NOTICE([not found, trying another method])
957       AC_CHECK_LIB(gd, gdImageCreate, [LIBGD=yes], [LIBGD=no])
958     fi
959   fi
961   if test "$LIBGD" = "yes"; then
962     LIBPNG=no
963 # saving current variables
964     SAVE_LIBS_PNG=$LIBS
965     SAVE_CFLAGS_PNG=$CFLAGS
966     SAVE_LDFLAGS_PNG=$LDFLAGS
967     AC_CHECK_PROG(PNGLIBCONFIG, libpng-config, libpng-config)
968     if test "$ac_cv_prog_PNGLIBCONFIG" = "libpng-config"; then
969 # check libpng-config contents and update system variables
970       PNG_LIBS=`$PNGLIBCONFIG --libs`
971       LIBS="$LIBS $PNG_LIBS"
972       PNG_CFLAGS=`$PNGLIBCONFIG --cflags`
973       CFLAGS="$CFLAGS $PNG_CFLAGS"
974       PNG_LDFLAGS=`$PNGLIBCONFIG --ldflags`
975       LDFLAGS="$LDFLAGS $PNG_LDFLAGS"
976     fi
977     AC_CHECK_LIB(png, png_create_read_struct , [LIBPNG=yes])
978 # restore variables
979     LIBS=$SAVE_LIBS_PNG
980     CFLAGS=$SAVE_CFLAGS_PNG
981     LDFLAGS=$SAVE_LDFLAGS_PNG
983     if test "$LIBPNG" = "no"; then
984       AC_MSG_NOTICE(png support not available)
985     else
986       LIBGD_PNG=no
987       LIBS=$GD_LIBS2
988       AC_MSG_CHECKING(for gdImagePng in -lgd)
989       AC_TRY_LINK([#include <gd.h>],
990       [gdImagePng (0,0);],
991       [LIBGD_PNG=yes], [LIBGD_PNG=no])
992       AC_MSG_RESULT($LIBGD_PNG)
993       LIBS=$SAVE_LIBS
995       if test "$LIBGD_PNG" = "no"; then
996         AC_MSG_NOTICE([not found, trying another method])
997         AC_CHECK_LIB(gd, gdImagePng, [LIBGD_PNG=yes], [LIBGD_PNG=no])
998       fi
1000       AC_MSG_CHECKING(for png support in libgd)
1001       if test "$LIBGD_PNG" = "yes"; then
1002         GD=yes
1003         GD_PNG=yes
1004         AC_MSG_RESULT(yes)
1005         AC_CHECK_LIB(png, png_access_version_number,[AC_DEFINE(HAVE_PNGVERSION, 1,)])
1006         AC_DEFINE(HAVE_GD_PNG, 1, [Define to 1 if you have png support in libgd.])
1007       else
1008         AC_MSG_RESULT(no)
1009       fi
1010     fi
1012     LIBJPEG=no
1013     AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [LIBJPEG=yes])
1015     if test "$LIBJPEG" = "no"; then
1016       AC_MSG_NOTICE(jpeg support not available)
1017     else
1018       LIBGD_JPG=no
1019       LIBS=$GD_LIBS2
1020       AC_MSG_CHECKING(for gdImageJpeg in -lgd)
1021       AC_TRY_LINK([#include <gd.h>],
1022       [gdImageJpeg (0,0,0);],
1023       [LIBGD_JPG=yes], [LIBGD_JPG=no])
1024       AC_MSG_RESULT($LIBGD_JPG)
1025       LIBS=$SAVE_LIBS
1027       if test "$LIBGD_JPG" = "no"; then
1028         AC_MSG_NOTICE([not found, trying another method])
1029         AC_CHECK_LIB(gd, gdImageJpeg, [LIBGD_JPG=yes], [LIBGD_JPG=no])
1030       fi
1032       AC_MSG_CHECKING(for jpeg support in libgd)
1033       if test "$LIBGD_JPG" = "yes"; then
1034         GD=yes
1035         GD_JPG=yes
1036         AC_DEFINE(HAVE_GD_JPG, 1, [Define to 1 if you have jpg support in libgd.])
1037         AC_MSG_RESULT(yes)
1038       else
1039         AC_MSG_RESULT(no)
1040       fi
1041     fi
1042   else
1043     AC_MSG_NOTICE(libgd not available)
1044   fi
1045   LIBS=$SAVE_LIBS
1046   CFLAGS=$SAVE_CFLAGS
1047   LDFLAGS=$SAVE_LDFLAGS
1050 if test "$GD" != "no"; then
1051   GDGRAPHICS=DriverGraphics_gd
1052 else
1053   GDGRAPHICS=DriverGraphics_nogd
1056 if test "$ICONV" = "yes"; then
1057   echo "----- checking iconv (optional)"
1058   AM_ICONV
1059   if test "$am_cv_func_iconv" != "yes"; then
1060     AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1061     ICONV=no
1062   else
1063   LIBS="$LIBS $LIBICONV"
1064   AC_CHECK_FUNCS([locale_charset],,
1065   AC_TRY_LINK([#include <langinfo.h>],
1066   [char* cs = nl_langinfo(CODESET);],
1067   AC_MSG_NOTICE(found nl_langinfo(CODESET)),
1068   [echo "Your iconv implementation is incomplete"; exit 1]))
1069   AC_CHECK_LIB(charset,locale_charset)
1070   AC_CHECK_HEADERS([libcharset.h])
1071   AC_CHECK_HEADERS([langinfo.h])
1072   AC_CHECK_HEADERS([locale.h])
1073   fi
1074 else
1075   AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1076   ICONV=no
1079 if test "$USE_PTHREAD" = "no"; then
1080  PTHREAD_LIBS=""
1081  echo "You disabled thread support, this will hurt MLDonkey performance!"
1082 else
1083   echo "----- checking thread support (optional, strongly advised)"
1084   ACX_PTHREAD
1087 # On linux plaforms, we will have to check that includes from kernel are
1088 # available. glibc version test was shamelessly taken from
1089 # http://public.activestate.com/gsar/APC/perl-5.8.x/Configure
1090 GLIBC_VERSION=""
1091 case $host in
1092         *linux*)
1093            echo "----- GNU C Library version"
1094            AC_CHECK_HEADERS(linux/limits.h,, [
1095              OLD_CPPFLAGS=$CPPFLAGS
1096              CPPFLAGS="-I /usr/src/linux/include"
1097              AC_CHECK_HEADER(linux/types.h,[CONFIG_INCLUDES="-I /usr/src/linux/include"])
1098              CPPFLAGS=$OLD_CPPFLAGS]
1099            )
1100            AC_CHECK_HEADERS(gnu/libc-version.h,[AC_MSG_CHECKING(for GNU C Library version)
1102 cat >try.c <<'EOCP'
1103 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
1104    alone are insufficient to distinguish different versions, such as
1105    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
1106    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
1108 #include <stdio.h>
1109 int main(void)
1111 #ifdef __GLIBC__
1112 #   ifdef __GLIBC_MINOR__
1113 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1114 #           include <gnu/libc-version.h>
1115     printf("%s\n",  gnu_get_libc_version());
1116 #       else
1117     printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
1118 #       endif
1119 #   else
1120 printf("%d\n",  __GLIBC__);
1121 #   endif
1122     return 0;
1123 #else
1124     return 1;
1125 #endif
1127 EOCP
1129            $CC -o try ./try.c
1130            GLIBC_VERSION="`./try`"
1131            AC_MSG_RESULT($GLIBC_VERSION)
1132            rm -f try try.*],)
1133         ;;
1134         *)         ;;
1135 esac
1137 echo "---------------------------------------------"
1138 echo "     Checking system libraries finished."
1139 echo "---------------------------------------------"
1140 echo ""
1142 CXX_VERSION=
1143 CRYPTOPPFLAGS=
1144 echo "--------------------------------------"
1145 echo "     Checking activated networks."
1146 echo "--------------------------------------"
1148   if test "$DONKEY" = "yes"; then
1149     AC_MSG_CHECKING(eDonkey)
1150     if test -d ../src/networks/donkey; then
1151       AC_MSG_RESULT(yes)
1152       if test "$DONKEY_SUI" = "yes"; then
1153         AC_PROG_CXX
1155         AC_CHECK_TOOL(NEWCXX, [$CXX], [no])
1156         AC_MSG_CHECKING(eMule SUI)
1157         if test x"$NEWCXX" = x"no"
1158         then
1159           AC_MSG_RESULT(no)
1160           CXX=
1161           DONKEY_SUI=no
1162         else
1163           AC_MSG_RESULT(yes)
1164           ACX_CHECK_CXX_FLAGS(-fno-omit-frame-pointer,cv_no_omit_frame_pointer, CRYPTOPPFLAGS="-fno-omit-frame-pointer")
1165           ACX_CHECK_CXX_FLAGS(-mno-omit-leaf-frame-pointer,cv_no_omit_leaf_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -mno-omit-leaf-frame-pointer")
1166           CXX=$NEWCXX
1167           CXX_VERSION=`$CXX -dumpversion`
1168           DONKEY_SUI_FILE=DonkeySui1
1169           AC_DEFINE(HAVE_CRYPTOPP, 1,)
1170         fi
1171       fi
1172 #      AC_MSG_CHECKING(eDonkey server)
1173 #      if test -d ../src/networks/server; then
1174 #        AC_MSG_RESULT(no)
1175 #        DONKEY_SERVER=no
1176 #      else
1177 #        AC_MSG_RESULT(no)
1178 #        DONKEY_SERVER=no
1179 #      fi
1180     else
1181       DONKEY=no
1182       DONKEY_SUI=no
1183       AC_MSG_RESULT(no)
1184     fi
1185   else
1186     DONKEY_SUI=no
1187   fi
1189   if test "$BITTORRENT" = "yes"; then
1190     AC_MSG_CHECKING(BitTorrent)
1191     if test -d ../src/networks/bittorrent; then
1192       AC_MSG_RESULT(yes)
1193     else
1194       BITTORRENT=no
1195       AC_MSG_RESULT(no)
1196     fi
1197   fi
1199   if test "$FILETP" = "yes"; then
1200     AC_MSG_CHECKING(FileTP)
1201     if test -d ../src/networks/fileTP; then
1202       AC_MSG_RESULT(yes)
1203     else
1204       FILETP=no
1205       AC_MSG_RESULT(no)
1206     fi
1207   fi
1209   if test "$GNUTELLA" = "yes"; then
1210     AC_MSG_CHECKING(Gnutella)
1211     if test -d ../src/networks/gnutella; then
1212       AC_MSG_RESULT(yes)
1213     else
1214       GNUTELLA=no
1215       AC_MSG_RESULT(no)
1216     fi
1217   fi
1219   if test "$GNUTELLA2" = "yes"; then
1220     AC_MSG_CHECKING(G2)
1221     if test -d ../src/networks/gnutella2; then
1222       AC_MSG_RESULT(yes)
1223     else
1224       GNUTELLA2=no
1225       AC_MSG_RESULT(no)
1226     fi
1227   fi
1229   if test "$FASTTRACK" = "yes"; then
1230     AC_MSG_CHECKING(Fasttrack)
1231     if test -d ../src/networks/fasttrack; then
1232       AC_MSG_RESULT(yes)
1233     else
1234       FASTTRACK=no
1235       AC_MSG_RESULT(no)
1236     fi
1237   fi
1239   if test "$DIRECT_CONNECT" = "yes"; then
1240     AC_MSG_CHECKING(DirectConnect)
1241     if test "$BZIP2" = "yes"; then
1242       if test -d ../src/networks/direct_connect; then
1243         AC_MSG_RESULT(yes)
1244       else
1245         DIRECT_CONNECT=no
1246         AC_MSG_RESULT(no)
1247       fi
1248     else
1249       DIRECT_CONNECT=no
1250       AC_MSG_RESULT(no - bzip2 support missing)
1251     fi
1252   fi
1254   if test "$SOULSEEK" = "yes"; then
1255     AC_MSG_CHECKING(Soulseek)
1256     if test -d ../src/networks/soulseek; then
1257       AC_MSG_RESULT(yes)
1258     else
1259       SOULSEEK=no
1260       AC_MSG_RESULT(no)
1261     fi
1262   fi
1264   if test "$OPEN_NAPSTER" = "yes"; then
1265     AC_MSG_CHECKING(OpenNapster)
1266     if test -d ../src/networks/opennap; then
1267       AC_MSG_RESULT(yes)
1268     else
1269       OPEN_NAPSTER=no
1270       AC_MSG_RESULT(no)
1271     fi
1272   fi
1274   if test "$OPENFT" = "yes"; then
1275     AC_MSG_CHECKING(OpenFT)
1276     if test -d ../src/networks/openFT; then
1277       AC_MSG_RESULT(yes)
1278     else
1279       OPENFT=no
1280       AC_MSG_RESULT(no)
1281     fi
1282   fi
1283 echo "-----------------------------------------------"
1284 echo "     Checking activated networks finished."
1285 echo "-----------------------------------------------"
1287 if test -f $OCAMLLIB/lablgl.cma; then
1288   LABLGL_CMA=lablgl.cma
1291 if test -f $OCAMLLIB/lablgl.$OCAMLLIB_EXT; then
1292   LABLGL_CMXA=lablgl.$OCAMLLIB_EXT
1295 # Check for GTK only if we want to build the GUI
1296 if test ! "$GUI" = "no"; then
1297   echo "---------------------------------------------------------"
1298   echo "Checking the libraries required to build the GTK GUI."
1299   echo "---------------------------------------------------------"
1300   if test "$GUI" = "newgui2"; then
1301       REQUIRED_GTK=2.4.0
1302       PKG_GTK=gtk+-2.0
1303       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1304       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1305         AC_MSG_RESULT(yes)
1306         REQUIRED_RSVG=2.4.0
1307         PKG_RSVG=librsvg-2.0
1308         AC_MSG_CHECKING(for librsvg - version >= $REQUIRED_RSVG)
1309         if pkg-config --atleast-version $REQUIRED_RSVG $PKG_RSVG; then
1310           GTK_CONFIG="pkg-config $PKG_GTK $PKG_RSVG"
1311           REQUIRED_LABLGTK=2.14.2
1312           LABLGTK_NAME=lablgtk2
1313           AC_MSG_RESULT(yes)
1314         else
1315           GTK_CONFIG=no
1316           AC_MSG_RESULT(no)
1317         fi
1318       else
1319         GTK_CONFIG=no
1320         AC_MSG_RESULT(no)
1321       fi
1322   else
1323     if test "$OS_FILES2" = "mingw"; then
1324       REQUIRED_GTK=1.3.0
1325       PKG_GTK=gtk+-1.3-win32-production
1326       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1327       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1328         GTK_CONFIG="pkg-config $PKG_GTK"
1329         AC_MSG_RESULT(yes)
1330       else
1331         GTK_CONFIG=no
1332         AC_MSG_RESULT(no)
1333       fi
1334     else
1335       AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no)
1336       if test "$GTK_CONFIG" = "no"; then
1337         AC_MSG_RESULT(no)
1338       else
1339         AC_MSG_RESULT(yes)
1340       fi
1341     fi
1342   fi
1343 else
1344   GTK_CONFIG=no
1346 if test "$GTK_CONFIG" = "no"; then
1347      LABLGTK_CONFIG=no
1348 else
1349   AC_MSG_CHECKING(for native code $LABLGTK_NAME)
1350   if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1351      if test "$GUI" = "newgui2"; then
1352        if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.$OCAMLLIB_EXT; then
1353          AC_MSG_RESULT(yes)
1354          LABLGTK_CONFIG=yes
1355        else
1356          AC_MSG_RESULT(no)
1357          LABLGTK_CONFIG=no
1358          if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.cma; then
1359            echo "---------------------------------------------------------"
1360            echo "lablrsvg is not installed properly. See the INSTALL.txt"
1361            echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1362            echo "probably forgot to call 'make opt' before 'make install'."
1363            echo "---------------------------------------------------------"
1364          else
1365            echo "---------------------------------------------------------"
1366            echo "lablrsvg is not installed. See the INSTALL.txt file of"
1367            echo "mldonkey to see how to compile $LABLGTK_NAME. Librsvg"
1368            echo "may not be installed when you compiled $LABLGTK_NAME."
1369            echo "---------------------------------------------------------"
1370          fi
1371        fi
1372      else
1373        AC_MSG_RESULT(yes)
1374        LABLGTK_CONFIG=yes
1375      fi
1376   else
1377      AC_MSG_RESULT(no)
1378      LABLGTK_CONFIG=no
1379      if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.cma; then
1380        echo "-------------------------------------------------------------"
1381        echo "$LABLGTK_NAME is not installed properly. See the INSTALL.txt"
1382        echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1383        echo "probably forgot to call 'make opt' before 'make install'."
1384        echo "-------------------------------------------------------------"
1385      else
1386        echo "Do you want this script to try to download and install $LABLGTK_NAME"
1387        echo "LOCALLY in mldonkey directory ?"
1388        if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
1389        case "$i" in
1390         y* | Y*)
1392          cd $PATCH_DIR
1393          rm -rf lablgtk-"$REQUIRED_LABLGTK"
1394          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then
1395            echo Downloading ...
1396            $WGET http://www.math.nagoya-u.ac.jp/~garrigue/soft/olabl/dist/lablgtk-"$REQUIRED_LABLGTK".tar.gz
1397          fi
1398          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then exit 1; fi
1400          mkdir -p $BUILD_DIR
1401          cd $BUILD_DIR
1402          echo Uncompressing ...
1403          gzip -cd $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".tar.gz | tar xf -
1404          (cd lablgtk-"$REQUIRED_LABLGTK"
1405           if test -f $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch; then
1406             echo Patching ...
1407             patch -p0 < $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch
1408           fi
1409           PATH=$OCAML_PATH:$PATH
1410           export PATH
1411           echo $PATH
1413           if test "$GUI" = "newgui2"; then
1414             ./configure --prefix=$LOCAL_DIR
1415             $GNU_MAKE world
1416             $GNU_MAKE install
1417           else
1418             $GNU_MAKE configure
1419             $GNU_MAKE
1420             $GNU_MAKE opt
1421             $GNU_MAKE install
1422           fi
1424           cd ..
1425           rm -rf lablgtk-"$REQUIRED_LABLGTK"
1426          )
1427          cd $CONFIG_DIR
1428          if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1429             LABLGTK_CONFIG=yes
1430          else
1431             echo "Installation of $LABLGTK_NAME failed"
1432             LABLGTK_CONFIG=no
1433          fi
1434          ;;
1435         *);;
1436       esac
1437      fi
1438   fi
1441 if test "$GUI" = "newgui2" ; then
1442   GUIS="mldonkey_gui\$(EXE)"
1443   GTKCFLAGS="`pkg-config --cflags-only-I gtk+-2.0`"
1444   GTKLLIBS="`pkg-config --libs-only-L gtk+-2.0`"
1445   GTKLFLAGS="`pkg-config --libs-only-l gtk+-2.0` -lX11"
1446 else
1447   GUIS="mldonkey_gui\$(EXE) mldonkey_gui2\$(EXE)"
1450 if test "$LABLGTK_CONFIG" = "no"; then
1451   GUI="no"
1452 else
1453   MORE_TARGETS="$MORE_TARGETS $GUIS"
1454   AC_MSG_CHECKING(GToolbox.popup_menu args)
1455   GTOOLBOX="$OCAMLLIB/$LABLGTK_NAME/gToolbox.mli"
1456   grep popup $GTOOLBOX | grep -i button 2> /dev/null && GTOOLBOX_ARGS=new
1457   if test "$GTOOLBOX_ARGS" = "new"; then
1458     GTOOLBOX_POPUPMENU=' ~button: button ~time: time '
1459     AC_MSG_RESULT(new)
1460   else
1461     GTOOLBOX_POPUPMENU=' ~x: button ~y: time '
1462     AC_MSG_RESULT(old)
1463   fi
1464   echo "---------------------------------------------------------"
1465   echo "End of GTK GUI configuration."
1466   echo "---------------------------------------------------------"
1469 if test "$OS_FILES" = "mingw"; then
1470    OCAMLDEP_OPTIONS="-slash"
1473 AC_SUBST(LIBS)
1474 AC_SUBST(CFLAGS)
1475 AC_SUBST(CPPFLAGS)
1476 AC_SUBST(CXXFLAGS)
1477 AC_SUBST(LDFLAGS)
1478 AC_SUBST(CC)
1479 AC_SUBST(CPP)
1480 AC_SUBST(CXX)
1481 AC_SUBST(FIX_BROKEN_CPP)
1482 AC_SUBST(CONFIG_INCLUDES)
1483 AC_SUBST(OCAMLC)
1484 AC_SUBST(OCAMLLIB)
1485 AC_SUBST(OCAMLOPT)
1486 AC_SUBST(OCAMLLEX)
1487 AC_SUBST(OCAMLYACC)
1488 AC_SUBST(OCAMLDEP)
1489 AC_SUBST(OCAMLDEP_OPTIONS)
1490 AC_SUBST(CAMLP4)
1491 AC_SUBST(CAMLP4OF)
1492 AC_SUBST(CAMLP4LIB_OPT)
1493 AC_SUBST(CAMLP4LIB_BYTE)
1494 AC_SUBST(PERL)
1495 AC_SUBST(OCAMLDOC)
1496 AC_SUBST(OCAMLMKTOP)
1497 AC_SUBST(SYSTEM)
1498 AC_SUBST(MORE_TARGETS)
1499 AC_SUBST(MORE_SUBDIRS)
1500 AC_SUBST(LABLGL_CMA)
1501 AC_SUBST(LABLGL_CMXA)
1502 AC_SUBST(MD4ARCH)
1503 AC_SUBST(MD4COMP)
1504 AC_SUBST(ICONV)
1505 AC_SUBST(OPEN_NAPSTER)
1506 AC_SUBST(DIRECT_CONNECT)
1507 AC_SUBST(GNUTELLA)
1508 AC_SUBST(GNUTELLA2)
1509 AC_SUBST(BITTORRENT)
1510 AC_SUBST(FILETP)
1511 AC_SUBST(SOULSEEK)
1512 AC_SUBST(OPENFT)
1513 AC_SUBST(FASTTRACK)
1514 AC_SUBST(DONKEY)
1515 AC_SUBST(DONKEY_SUI)
1516 AC_SUBST(CRYPTOPPFLAGS)
1517 AC_SUBST(DONKEY_SUI_FILE)
1518 AC_SUBST(DONKEY_SERVER)
1519 AC_SUBST(GUI)
1520 AC_SUBST(REQUIRED_OCAML)
1521 AC_SUBST(REQUIRED_LABLGTK)
1522 AC_SUBST(ARCH)
1523 AC_SUBST(COMPRESS)
1524 AC_SUBST(COMPRESS_EXT)
1525 AC_SUBST(CHECKBOUNDS)
1526 AC_SUBST(MLDONKEY_VERSION)
1527 AC_SUBST(SCM_VERSION)
1528 AC_SUBST(MAJOR_VERSION)
1529 AC_SUBST(MINOR_VERSION)
1530 AC_SUBST(SUB_VERSION)
1531 AC_SUBST(GTOOLBOX_POPUPMENU)
1532 AC_SUBST(OS_FILES)
1533 AC_SUBST(OS_FILES2)
1534 AC_SUBST(TARGET_TYPE)
1535 AC_SUBST(RPMBUILD)
1536 AC_SUBST(GTKCFLAGS)
1537 AC_SUBST(GTKLLIBS)
1538 AC_SUBST(GTKLFLAGS)
1539 AC_SUBST(GD)
1540 AC_SUBST(GD_JPG)
1541 AC_SUBST(GD_PNG)
1542 AC_SUBST(GDGRAPHICS)
1543 AC_SUBST(GD_LIBS)
1544 AC_SUBST(GD_STATIC_LIBS)
1545 AC_SUBST(GD_CFLAGS)
1546 AC_SUBST(GD_LDFLAGS)
1547 AC_SUBST(BZIP2)
1548 AC_SUBST(MAGIC)
1549 AC_SUBST(MAGICLIB)
1550 AC_SUBST(UPNP_NATPMP)
1551 AC_SUBST(UPNP_NATPMP_LIBS)
1552 AC_SUBST(UPNP_NATPMP_STATIC_LIBS)
1553 BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
1554 AC_SUBST(BUILD_SYSTEM)
1555 AC_SUBST(GLIBC_VERSION)
1556 AC_SUBST(CC_VERSION)
1557 AC_SUBST(CXX_VERSION)
1558 AC_SUBST(CONFIGURE_ARGUMENTS)
1559 AC_SUBST(CONFIGURE_RUN)
1561 AUTOCONF=../src/utils/lib/autoconf.ml
1562 GTK_AUTOCONF=../src/utils/lib/gAutoconf.ml
1563 AC_OUTPUT(\
1564   Makefile.config \
1565   mldonkey.rc \
1566   $AUTOCONF.new $GTK_AUTOCONF.new \
1567    ../src/utils/bitstring/bitstring.ml \
1568    ../src/utils/lib/magic.ml \
1569    ../src/networks/donkey/donkeySui.ml \
1570    ../src/daemon/driver/driverGraphics.ml \
1571    ../packages/rpm/mldonkey.spec \
1572    ../packages/rpm/Makefile \
1573    ../packages/slackware/mldonkey.options)
1574 diff $AUTOCONF.new $AUTOCONF 2> /dev/null > /dev/null || cp -f $AUTOCONF.new $AUTOCONF
1575 diff $GTK_AUTOCONF.new $GTK_AUTOCONF 2> /dev/null > /dev/null || cp -f $GTK_AUTOCONF.new $GTK_AUTOCONF
1577 cd ..
1579 echo ""
1580 echo "Building dependencies (if it blocks, try '$GNU_MAKE depend' to see the problem)"
1581 $GNU_MAKE depend 2> /dev/null > /dev/null || echo "Building dependencies fails: try: '$GNU_MAKE depend'"
1583 echo ""
1584 printf "Configuring MLDonkey %s" "$MLDONKEY_VERSION"
1585 if test ! -z "$SCM_VERSION"; then
1586   printf " - SCM: %s" "$SCM_VERSION"
1588 ec " completed.\n"
1590 echo ""
1591 echo "Network modules:"
1592 printf " - eDonkey           "
1593 if test "$DONKEY" = "yes"; then
1594   if test "$DONKEY_SUI" = "yes"; then
1595     echo "enabled (eMule SUI enabled)"
1596   else
1597     echo "enabled (eMule SUI disabled)"
1598   fi
1599 else
1600   echo "        disabled"
1603 printf " - BitTorrent        "
1604 if test "$BITTORRENT" = "yes"; then
1605   echo "enabled"
1606 else
1607   echo "        disabled"
1610 printf " - FileTP (aka wget) "
1611 if test "$FILETP" = "yes"; then
1612   echo "enabled"
1613 else
1614   echo "        disabled"
1617 printf " - Fasttrack         "
1618 if test "$FASTTRACK" = "yes"; then
1619   echo "enabled"
1620 else
1621   echo "        disabled"
1624 printf " - Gnutella          "
1625 if test "$GNUTELLA" = "yes"; then
1626   echo "enabled (warning: this network module is unmaintained)"
1627 else
1628   echo "        disabled - unmaintained"
1631 printf " - Gnutella2         "
1632 if test "$GNUTELLA2" = "yes"; then
1633   echo "enabled (warning: this network module is unmaintained)"
1634 else
1635   echo "        disabled - unmaintained"
1638 printf " - Direct Connect    "
1639 if test "$DIRECT_CONNECT" = "yes"; then
1640   echo "enabled"
1641 else
1642   echo "        disabled"
1645 printf " - Open Napster      "
1646 if test "$OPEN_NAPSTER" = "yes"; then
1647   echo "enabled          - currently not usable"
1648 else
1649   echo "        disabled - currently not usable"
1652 printf " - Soulseek          "
1653 if test "$SOULSEEK" = "yes"; then
1654   echo "enabled          - currently not usable"
1655 else
1656   echo "        disabled - currently not usable"
1659 printf " - OpenFT            "
1660 if test "$OPENFT" = "yes"; then
1661   echo "enabled          - currently not usable"
1662 else
1663   echo "        disabled - currently not usable"
1666 echo ""
1667 echo "Core features:"
1669 echo " - zlib (required)   enabled"
1671 printf " - threads           "
1672 if test "$USE_PTHREAD" = "yes"; then
1673   echo "enabled"
1674 else
1675   echo "        disabled"
1678 printf " - bzip2             "
1679 if test "$BZIP2" = "yes"; then
1680   echo "enabled"
1681 else
1682   echo "        disabled"
1685 printf " - iconv             "
1686 if test "$ICONV" = "yes"; then
1687   echo "enabled"
1688 else
1689   echo "        disabled"
1692 printf " - libmagic          "
1693 if test "$MAGIC" = "yes"; then
1694   echo "enabled"
1695 else
1696   echo "        disabled"
1699 printf " - upnp & natpmp     "
1700 if test "$UPNP_NATPMP" = "yes"; then
1701   echo "enabled"
1702 else
1703   echo "        disabled"
1706 printf " - graphical stats   "
1707 if test "$GD" = "yes"; then
1708   echo "enabled"
1709   printf "   - png support     "
1710   if test "$GD_PNG" = "yes"; then
1711     echo "enabled"
1712   else
1713     echo "        disabled"
1714   fi
1716   printf "   - jpg support     "
1717   if test "$GD_JPG" = "yes"; then
1718     echo "enabled"
1719   else
1720     echo "        disabled"
1721   fi
1722 else
1723   echo "        disabled"
1726 if test "$LABLGTK_CONFIG" = "yes"; then
1727   echo ""
1728   printf "\n - GUI support       "
1729   if test "$GUI" = "newgui1"; then
1730     echo "GTK1 newgui"
1731   else
1732     if test "$GUI" = "newgui2"; then
1733       echo "GTK2 GUI"
1734     else
1735       echo "GTK1 oldgui"
1736     fi
1737   fi
1740 if test "$OLDGUI_NO_31" = "yes"; then
1741   echo " - GUI support       GTK1 oldgui does not work with Ocaml 3.1*, disabled"
1744 if test "$TARGET_TYPE" = "byte"; then
1745   OCAML_TYPE="- byte code"
1746   COMPILE_TARGET=".byte"
1748 echo ""
1749 printf "Compilers:"
1750 echo " - OCaml version     $OCAMLVERSION $OCAML_TYPE"
1751 echo " - $CC version       $CC_VERSION"
1752 if test "x$CXX" != "x"; then
1753   echo " - $CXX version       $CXX_VERSION"
1755 echo ""
1756 echo "\nNow execute '$GNU_MAKE' to start compiling. Good luck!"
1758 echo ""
1759 echo "To compile a static code execute:     $GNU_MAKE mlnet$COMPILE_TARGET.static"
1760 echo "To produce a release tarball execute: $GNU_MAKE release.mlnet.static"
1761 echo "To clean the build directory execute: $GNU_MAKE maintainerclean"
1762 if test "$DONKEY_SUI" = "yes"; then
1763   echo ""
1764   echo "Compiling CryptoPP.cc can take several minutes, on slow machines up to half an hour."