patch #8335
[mldonkey.git] / config / configure.in
blob52c63e69bdc650d805c42000e83bb48abcbd5e8b
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 DEV=no
343 GUI=no
344 CHECKBOUNDS=false
345 DEVFLAGS=
347 # **********                                                                                  **********
348 # **********                Network and Feature configure switches and dependency             **********
349 # **********                                                                                  **********
351 AC_ARG_ENABLE(multinet,
352   AS_HELP_STRING([--disable-multinet], [disable all networks except eDonkey (with Overnet and Kademlia)]),
353   [MULTINET="$enableval"])
354 AC_ARG_ENABLE(minimum,
355   AS_HELP_STRING([--enable-minimum], [enable minimum set of features and networks (eDonkey, iconv and threads enabled)]),
356   [MINIMUM="$enableval"])
357 AC_ARG_ENABLE(minimum,
358   AS_HELP_STRING([--enable-minimum=all], [enable only eDonkey network and disable all optional features (not recommended)]),
359   [MINIMUM="$enableval"])
361 if [ test ! "$MULTINET" = "yes" ] || [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
362   GNUTELLA=no
363   GNUTELLA2=no
364   FASTTRACK=no
365   DIRECT_CONNECT=no
366   FILETP=no
367   BITTORRENT=no
369 if [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
370   DONKEY_SUI=no
371   GD=no
372   BZIP2=no
373   MAGIC=no
375 if [ test "$MINIMUM" = "all" ]; then
376   USE_PTHREAD=no
377   ICONV=no
380 #AC_ARG_ENABLE(soulseek,      [  --disable-soulseek      disable support for SoulSeek], [SOULSEEK="$enableval"])
381 #AC_ARG_ENABLE(opennap,       [  --disable-opennap       disable support for Open Napster], [OPEN_NAPSTER="$enableval"])
382 AC_ARG_ENABLE(directconnect,
383   AS_HELP_STRING([--disable-directconnect], [disable support for Direct Connect]),
384   [DIRECT_CONNECT="$enableval"])
385 #AC_ARG_ENABLE(openft,        [  --disable-openft        disable support for OpenFT], [OPENFT="$enableval"])
387 AC_ARG_ENABLE(donkey,
388   AS_HELP_STRING([--disable-donkey], [disable support for eDonkey]),
389   [DONKEY="$enableval"])
390 AC_ARG_ENABLE(donkeysui,
391   AS_HELP_STRING([--disable-donkeysui], [disable support for eMule SecureUserIdent]),
392   [DONKEY_SUI="$enableval"])
393 AC_ARG_ENABLE(bittorrent,
394   AS_HELP_STRING([--disable-bittorrent], [disable support for Bittorent]),
395   [BITTORRENT="$enableval"])
396 AC_ARG_ENABLE(filetp,
397   AS_HELP_STRING([--disable-filetp], [disable support for fileTP]),
398   [FILETP="$enableval"])
399 AC_ARG_ENABLE(gnutella,
400   AS_HELP_STRING([--disable-gnutella], [disable support for Gnutella]),
401   [GNUTELLA="$enableval"])
402 AC_ARG_ENABLE(gnutella2,
403   AS_HELP_STRING([--disable-gnutella2], [disable support for Gnutella2]),
404   [GNUTELLA2="$enableval"])
405 AC_ARG_ENABLE(fasttrack,
406   AS_HELP_STRING([--disable-fasttrack], [disable support for FastTrack]),
407   [FASTTRACK="$enableval"])
409 AC_ARG_ENABLE(batch,
410   AS_HELP_STRING([--enable-batch], [reply YES to all queries in this script]),
411   [BATCH="$enableval"])
412 AC_ARG_ENABLE(force-ocaml,
413   AS_HELP_STRING([--enable-force-ocaml], [force usage of self-compiled OCaml]),
414   [FORCE_OCAML="$enableval"])
415 AC_ARG_ENABLE(ocamlver,
416   AS_HELP_STRING([--enable-ocamlver=VER], [force usage of specific OCaml version (3.10.1|SVN), ]),
417   [REQUIRED_OCAML="$enableval"])
418 AC_ARG_ENABLE(mingw,
419   AS_HELP_STRING([--enable-mingw], [force compilation with MINGW on Cygwin]),
420   [FORCE_MINGW="$enableval"])
421 AC_ARG_ENABLE(checks,
422   AS_HELP_STRING([--enable-checks], [enable bounds-checking for array/string accesses]),
423   [CHECKBOUNDS="$enableval"])
424 if test "$CHECKBOUNDS" = "yes"; then
425   CHECKBOUNDS=true
428 AC_ARG_ENABLE(profile,
429   AS_HELP_STRING([--enable-profile], [compile with gprof profiling support (enables debug)]),
430   [PROFILE="$enableval"])
431 AC_ARG_ENABLE(debug,
432   AS_HELP_STRING([--enable-debug], [compile with debugging information]),
433   [DEBUG="$enableval"])
434 AC_ARG_ENABLE(dev,
435   AS_HELP_STRING([--enable-dev], [development mode (enables debug and annot information)]),
436   [DEV="$enableval"])
437 if test "$PROFILE" = "yes"; then
438   DEBUG="yes"
440 if test "$DEV" = "yes"; then
441   DEBUG="yes"
443 AC_ARG_ENABLE(gui,
444   AS_HELP_STRING([--disable-gui], [disable GUI build (default)]),
445   [GUI="$enableval"])
446 AC_ARG_ENABLE(gui,
447   AS_HELP_STRING([--enable-gui=oldgui|newgui1|newgui2], 
448                  [enable GUI (newgui2 uses GTK2 (default), other GUIs use GTK1)]),
449   [GUI="$enableval"])
450 if test "$GUI" = "yes"; then
451   GUI=newgui2
453 if test ! "$GUI" = "newgui2"; then
454   if test ! "$GUI" = "newgui1"; then
455     if test ! "$GUI" = "oldgui"; then
456       GUI=no
457     fi
458   fi
461 AC_ARG_ENABLE(pthread,
462   AS_HELP_STRING([--disable-pthread], [disable the use of pthread, hurts performance!]),
463   [USE_PTHREAD="$enableval"])
464 AC_ARG_ENABLE(pthread-lib,
465   AS_HELP_STRING([--enable-pthread-lib], [legacy option]),
466   [USE_PTHREAD="$enableval"])
467 AC_ARG_ENABLE(iconv,
468   AS_HELP_STRING([--disable-iconv], [disable the use of iconv]),
469   [ICONV="$enableval"])
470 AC_ARG_ENABLE(gd,
471   AS_HELP_STRING([--disable-gd], [disable the use of gd]),
472   [GD="$enableval"])
473 AC_ARG_ENABLE(bzip2,
474   AS_HELP_STRING([--disable-bzip2], [disable the use of bzip2]),
475   [BZIP2="$enableval"])
476 AC_ARG_ENABLE(magic,
477   AS_HELP_STRING([--disable-magic], [disable the use of libmagic (GNU file)]),
478   [MAGIC="$enableval"])
479 AC_ARG_ENABLE(upnp-natpmp,
480   AS_HELP_STRING([--enable-upnp-natpmp], [enable the use of libminiupnpc and libnatpmp]),
481   [UPNP_NATPMP="$enableval"])
482 AC_ARG_ENABLE(force-upnp-natpmp,
483   AS_HELP_STRING([--enable-force-upnp-natpmp], [force local compilation of libminiupnpc and libnatpmp]),
484   [UPNP_NATPMP_FORCE="$enableval"])
486 if test "$FORCE_MINGW" = "yes"; then
487     CC="$CC -mno-cygwin"
488     CPP="$CPP -mno-cygwin"
489     OS_FILES=mingw
490     OS_FILES2=mingw
491     SYSTEM=mingw
494 OCAML_PATH=
496 echo ""
497 echo "--------------------------------"
498 echo "     Checking system tools."
499 echo "--------------------------------"
501 AC_PROG_RANLIB
502 AC_CHECK_PROG(GNU_MAKE, gmake, gmake)
503 AC_CHECK_PROG(GNU_MAKE, make, make)
505 if test "x$GNU_MAKE" != "x"; then
506   AC_MSG_CHECKING( [if $GNU_MAKE is GNU make] )
507   $GNU_MAKE --version > /dev/null 2>&1
508   if test "$?" != "0"; then
509     AC_MSG_RESULT([no])
510         AC_MSG_ERROR(GNU make not found)
511   else
512     AC_MSG_RESULT([yes])
513   fi
514 else
515   AC_MSG_ERROR(GNU make not found)
518 AC_CHECK_PROG(COMPRESS, bzip2, bzip2)
519 AC_CHECK_PROG(COMPRESS, gzip, gzip)
521 if test "$ac_cv_prog_COMPRESS" = "bzip2"; then
522    COMPRESS_EXT=bz2
523 else
524    COMPRESS_EXT=gz
527 AC_PATH_PROG(PERL, perl, perl)
528 AC_CHECK_PROG(RPMBUILD,rpmbuild,rpmbuild)
529 AC_CHECK_PROG(RPMBUILD,rpm,rpm)
531 AC_CHECK_PROG(WGET, wget, wget)
532 if test -z "$ac_cv_prog_WGET"; then
533   $CC -o wget wget.c || echo "Cannot compile wget.c"
534   AC_PATH_PROG(WGET, wget,,$SOURCE_DIR/config)
535   ac_cv_prog_WGET="$ac_cv_path_WGET"
537 WGET="$ac_cv_prog_WGET"
539 echo "----------------------------------------"
540 echo "     Checking system tools finished."
541 echo "----------------------------------------"
542 echo ""
543 echo "--------------------------------"
544 echo "     Checking OCaml compiler."
545 echo "--------------------------------"
547 CONFIG_DIR=$SOURCE_DIR/config
548 PATCH_DIR=$SOURCE_DIR/patches
549 LOCAL_DIR=$PATCH_DIR/local
550 BUILD_DIR=$PATCH_DIR/build
552 AC_ARG_ENABLE(local-prefix,
553   AS_HELP_STRING([--enable-local-prefix=DIR], [specify path for temporary tools installation (DIR must be absolute)]),
554   [LOCAL_DIR="$enableval"])
556 LOCAL=$LOCAL_DIR
557 LOCAL_OCAML=$LOCAL_DIR/bin
559 AC_PATH_PROG(OCAMLC,ocamlc.opt,"",[$LOCAL_DIR/bin:$PATH])
560 AC_CHECK_TOOL(OCAMLC,ocamlc,ocamlrun ocamlc)
561 AC_PATH_PROG(CAMLP4, camlp4,"",[$LOCAL_DIR/bin:$PATH])
563 BUILD_OCAML=no
564 if [ test -z "$OCAMLC" ] || [ test -z "$CAMLP4" ] || [ test "$REQUIRED_OCAML" = "SVN" ]; then
565    BUILD_OCAML=yes
566 else
567   OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
568   case "$OCAMLVERSION" in
569     "$REQUIRED_OCAML"*|4.*|3.12.*|3.11.*|3.10.1*|3.10.2*) ;;
570     *)
571         echo "Need build"
572         BUILD_OCAML=yes
573         ;;
574   esac
576 case "$REQUIRED_OCAML" in
577   3.10.0|3.0*)
578     echo "Need build"
579     REQUIRED_OCAML=3.12.0
580     BUILD_OCAML=yes
581     ;;
582 esac
583 if [ test "$BUILD_OCAML" = "yes" ] || [ test "$FORCE_OCAML" = "yes" ]; then
585   if [ test "$SYSTEM" = "mingw" ]; then
586     echo "********         Objective-Caml $REQUIRED_OCAML is required               *********" 1>&2;
587     echo "********     no valid OCaml compiler found on your system        *********" 1>&2;
588     echo "********   on MinGW there is no possibility to let configure     *********" 1>&2;
589     echo "********   build the OCaml compiler with the included script     *********" 1>&2;
590     echo "********    check http://mldonkey.sourceforge.net/Windows        *********" 1>&2;
591     echo "********   for instuctions how to compile OCaml under MinGW      *********" 1>&2;
592     exit 1
593   else  
594     
595   echo "********  Objective-Caml $REQUIRED_OCAML is required  *********" 1>&2;
596   if [ test "$WGET" = "" ] && [ test "$REQUIRED_OCAML" != "SVN" ]; then
597     echo "********          wget is missing          *********" 1>&2;
598     echo "********       cannot download OCaml       *********" 1>&2;
599     exit 1
600   fi
601   echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
602   echo "Do you want this script to try to download and install ocaml"
603   echo "LOCALLY in mldonkey directory ?"
604   if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
605   case "$i" in
606    y* | Y*)
607       cd $PATCH_DIR
608       if [ test "$REQUIRED_OCAML" = "SVN" ]; then
609         rm -rf $BUILD_DIR
610         mkdir -p $BUILD_DIR
611         cd $BUILD_DIR
612         svn checkout http://caml.inria.fr/svn/ocaml/trunk
613         cd trunk
614       else
615         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
616           echo Downloading ...
617           $WGET http://caml.inria.fr/pub/distrib/ocaml-"$DOWNLOAD_OCAML_MAJOR"/ocaml-"$REQUIRED_OCAML".tar.gz
618         fi
619         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
620           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-"$REQUIRED_OCAML".tar.gz
621         fi
622         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
623           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-"$REQUIRED_OCAML".tar.gz
624         fi
625         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
626           $WGET http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-"$REQUIRED_OCAML".tar.gz
627         fi
628         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
629           echo "********        download OCaml $REQUIRED_OCAML not successful, try do download it manually       *********" 1>&2;
630           echo "********        from http://caml.inria.fr/pub/distrib/                                   *********" 1>&2;
631           echo "********        and copy the tar.gz into $PATCH_DIR              *********" 1>&2;
632           exit 1
633         fi
635         echo Uncompressing ...
636         mkdir -p $BUILD_DIR
637         cd $BUILD_DIR
638         rm -rf ocaml-"$REQUIRED_OCAML"
639         gzip -cd $PATCH_DIR/ocaml-"$REQUIRED_OCAML".tar.gz | tar vxf -
640         cd ocaml-"$REQUIRED_OCAML"
641         if test -f $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch; then
642           echo Patching ...
643           patch -p1 < $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch
644         fi
645       fi
646       echo Configuring ...
647       ./configure -prefix $LOCAL_DIR -host $host -cc $CC
648       cd config
649       cp -f Makefile Makefile.old
650       sed "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" Makefile.old > Makefile
651       cd ..
652       cp -f $PATCH_DIR/Makefile.ocamldoc ocamldoc/Makefile
653       echo Compiling ...
654       $GNU_MAKE world opt opt.opt
655       echo Installing ...
656       $GNU_MAKE install
657       if ! test -f $LOCAL_DIR/lib/ocaml/threads; then
658         if ! test -f $LOCAL_DIR/lib/ocaml/vmthreads; then
659           ln -s vmthreads  $LOCAL_DIR/lib/ocaml/threads
660         fi
661       fi
662       cd $BUILD_DIR
663       if [ test "$REQUIRED_OCAML" = "SVN" ]; then
664         rm -rf trunk
665       else
666         rm -rf ocaml-"$REQUIRED_OCAML"
667       fi
668       cd $CONFIG_DIR
669       echo OCaml locally installed for mldonkey
671       if test -f "$LOCAL_OCAML"/ocamlc.opt; then
672          OCAMLC=$LOCAL_OCAML/ocamlc.opt
673          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc.opt
674       else
675       if test -f "$LOCAL_OCAML"/ocamlc; then
676          OCAMLC=$LOCAL_OCAML/ocamlc
677          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc
678       else
679         echo "OCaml installation failed"; exit 1
680       fi
681       fi
682       ;;
683    *)  exit 1;;
684   esac
685   fi
688 if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc.opt ; then
689   OCAML_PATH="$LOCAL_OCAML"/
690   OCAMLOPT=$LOCAL_OCAML/ocamlopt.opt
691   OCAMLDOC=$LOCAL_OCAML/ocamldoc
692   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
693   OCAMLDEP=$LOCAL_OCAML/ocamldep
694   OCAMLLEX=$LOCAL_OCAML/ocamllex.opt
695   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
696   CAMLP4=$LOCAL_OCAML/camlp4
697   CAMLP4OF=$LOCAL_OCAML/camlp4of
698 else
699   if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc ; then
700   OCAML_PATH="$LOCAL_OCAML"/
701   if test -f "$LOCAL_OCAML/ocamlopt"; then
702     OCAMLOPT=$LOCAL_OCAML/ocamlopt
703   else
704     OCAMLOPT=no
705   fi
706   OCAMLDOC=$LOCAL_OCAML/ocamldoc
707   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
708   OCAMLDEP=$LOCAL_OCAML/ocamldep
709   OCAMLLEX=$LOCAL_OCAML/ocamllex
710   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
711   CAMLP4=$LOCAL_OCAML/camlp4
712   CAMLP4OF=$LOCAL_OCAML/camlp4of
713   else
714   AC_CHECK_PROG(OCAMLOPT, ocamlopt.opt, ocamlopt.opt)
715   AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt, no)
716   AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
717   AC_CHECK_PROG(OCAMLLEX, ocamllex.opt, ocamllex.opt)
718   AC_CHECK_PROG(OCAMLLEX, ocamllex, ocamllex)
719   AC_CHECK_PROG(OCAMLYACC, ocamlyacc, ocamlyacc)
720   AC_CHECK_PROG(OCAMLDOC, ocamldoc, ocamldoc)
721   AC_CHECK_PROG(OCAMLMKTOP, ocamlmktop, ocamlmktop)
722   AC_CHECK_PROG(CAMLP4, camlp4, camlp4)
723   AC_CHECK_PROG(CAMLP4OF, camlp4of, camlp4of, $CAMLP4 pa_o.cmo pr_o.cmo Camlp4QuotationExpander.cmo Camlp4GrammarParser.cmo)
727 OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
728 OCAMLLIB=`$OCAMLC -where`
730 # check if native dynlink is supported and therefore needed for linking
731 CAMLP4LIB_OPT="camlp4lib.cmxa"
732 CAMLP4LIB_BYTE="camlp4lib.cma"
733 if test -f $OCAMLLIB/dynlink.cma; then
734   CAMLP4LIB_BYTE="dynlink.cma $CAMLP4LIB_BYTE"
736 if test -f $OCAMLLIB/dynlink.cmxa; then
737   CAMLP4LIB_OPT="dynlink.cmxa $CAMLP4LIB_OPT"
740 # force usage of supported OCaml versions
741 case "$OCAMLVERSION" in
742     3.10.1*|3.10.2*|3.1*|4.*) ;;
743     *)
744       if [ test "$REQUIRED_OCAML" != "SVN" ]; then
745         echo "********  Version $REQUIRED_OCAML of Objective-Caml is required  *********" 1>&2;
746         echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
747         exit 1
748       fi
749       ;;
750 esac
752 if test "$OCAMLOPT" = "no"; then
753   TARGET_TYPE=byte
754   OCAMLLIB_EXT=cma
755 else
756   TARGET_TYPE=opt
757   OCAMLLIB_EXT=cmxa
759   OCAMLOPTVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
761   test "$OCAMLOPTVERSION" = "$OCAMLVERSION" || {
762     echo "********  Version $REQUIRED_OCAML of ocamlopt is required  *********" 1>&2;
763     echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
764     exit 1; }
768 echo "-------------------------------------------"
769 echo "     Checking OCaml $OCAMLVERSION finished."
770 echo "-------------------------------------------"
773 if test "$PROFILE" = "yes"; then
774    OCAMLOPT="$OCAMLOPT -p"
775    CFLAGS="$CFLAGS -pg"
777 if test "$FORCE_MINGW" = "yes"; then
778     OCAMLC="$OCAMLC -ccopt -mno-cygwin"
779     OCAMLOPT="$OCAMLOPT -ccopt -mno-cygwin"
780     OCAMLMKTOP="$OCAMLMKTOP -ccopt -mno-cygwin"
782 if test "$DEBUG" = "yes"; then
783     OCAMLC="$OCAMLC -g"
784     OCAMLOPT="$OCAMLOPT -g"
787 if test "$DEV" = "yes"; then
788   case "$OCAMLVERSION" in
789     3.*) DEVFLAGS="-annot" ;;
790     *) DEVFLAGS="-annot -bin-annot" ;;
791   esac
794 echo ""
795 echo "----------------------------------"
796 echo "     Checking system headers."
797 echo "----------------------------------"
799 ifelse(AC_ACVERSION, [2.13], [],
800 [dnl Large file enabled
801    AC_SYS_LARGEFILE
805 dnl Check for native endianness.
806 AC_C_BIGENDIAN(,,
807   [AC_MSG_ERROR([Machine endianness could not be determined])]
809 if test "x$WORDS_BIGENDIAN" = "x"; then
810   NATIVEENDIAN=LittleEndian
811 else
812   NATIVEENDIAN=BigEndian
814 AC_SUBST(NATIVEENDIAN)
816 # various header files
817 AC_CHECK_FUNCS(setrlimit getrlimit strerror_r strerror posix_fallocate)
818 AC_CHECK_HEADERS(byteswap.h,,)
819 AC_CHECK_HEADERS([sys/utsname.h])
820 AC_CHECK_HEADERS(arpa/inet.h,,)
821 AC_CHECK_HEADERS([sys/types.h sys/time.h sys/resource.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
822 [#ifdef HAVE_SYS_TYPES_H
823 #include <sys/types.h>
824 #endif
825 #ifdef HAVE_SYS_TIME_H
826 #include <sys/time.h>
827 #endif
828 #ifdef HAVE_NETINET_IN_SYSTM_H
829 #include <netinet/in_systm.h>
830 #endif
831 #ifdef HAVE_NETINET_IN_H
832 #include <netinet/in.h>
833 #endif
836 # poll if possible
837 AC_CHECK_HEADERS(sys/poll.h,,)
838 AC_CHECK_FUNCS(poll,,)
840 AC_CHECK_HEADERS(sys/vfs.h,,)
841 AC_CHECK_HEADERS(sys/statvfs.h,,)
842 AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
843 [#if HAVE_SYS_PARAM_H
844 #include <sys/param.h>
845 #endif
847 echo "-------------------------------------------"
848 echo "     Checking system headers finished."
849 echo "-------------------------------------------"
850 echo ""
851 echo "-----------------------------------"
852 echo "     Checking system libraries."
853 echo "-----------------------------------"
854 echo "----- checking zlib (required)"
855 AC_CHECK_LIB(z,inflate,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
856 AC_CHECK_HEADERS(zlib.h,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
857 AC_CHECK_LIB(z,zlibVersion,[AC_DEFINE(HAVE_ZLIBVERSION, 1,)])
859 if test "$BZIP2" != "no"; then
860   echo "----- checking bzlib (optional)"
861   AC_CHECK_HEADERS(bzlib.h,[AC_CHECK_LIB(bz2,BZ2_bzReadOpen,[BZIP2=yes],[BZIP2=no])],[BZIP2=no])
864 if test "$BZIP2" = "yes"; then
865   AC_CHECK_LIB(bz2,BZ2_bzlibVersion,[AC_DEFINE(HAVE_BZLIBVERSION, 1,)])
866   AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
867 else
868   AC_MSG_NOTICE(bzlib not available)
871 if test "$UPNP_NATPMP_FORCE" = "yes"; then
872         UPNP_NATPMP=yes
873         cd $PATCH_DIR
874         MINIUPNPC=miniupnpc-1.9
875         LIBNATPMP=libnatpmp-20131126
876         $WGET http://miniupnp.tuxfamily.org/files/$MINIUPNPC.tar.gz
877         $WGET http://miniupnp.tuxfamily.org/files/$LIBNATPMP.tar.gz
878         mkdir -p $BUILD_DIR $LOCAL_DIR/usr/bin $LOCAL_DIR/usr/lib $LOCAL_DIR/usr/include/miniupnpc
879         cd $BUILD_DIR
880         rm -rf $LIBNATPMP $MINIUPNPC
881         tar -xzf $PATCH_DIR/$MINIUPNPC.tar.gz
882         tar -xzf $PATCH_DIR/$LIBNATPMP.tar.gz
883         cd $BUILD_DIR/$LIBNATPMP
884         $GNU_MAKE all install PREFIX=$LOCAL_DIR
885         cd $BUILD_DIR/$MINIUPNPC
886         $GNU_MAKE all install PREFIX=$LOCAL_DIR
887         cd $CONFIG_DIR
888         rm -rf $BUILD_DIR/$LIBNATPMP $BUILD_DIR/$MINIUPNPC
889         CPPFLAGS="${CPPFLAGS} -I$LOCAL_DIR/usr/include"
890         LDFLAGS="${LDFLAGS} -L$LOCAL_DIR/usr/lib"
893 if test "$UPNP_NATPMP" = "yes"; then
894   echo "----- checking libminiupnpc >= 1.6 (optional)"
895   AC_CHECK_HEADERS(miniupnpc/miniupnpc.h,[AC_CHECK_LIB(miniupnpc,upnpDiscover,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
898 if test "$UPNP_NATPMP" = "yes"; then
899   echo "----- checking libnatpmp >= 20110808 (optional)"
900   AC_CHECK_HEADERS(natpmp.h,[AC_CHECK_LIB(natpmp,initnatpmp,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
903 if test "$UPNP_NATPMP" = "yes"; then
904   AC_DEFINE(ENABLE_UPNP_NATPMP, 1, [Define to 1 if you have libminiupnpc & libnatpmp for port forwarding support.])
905   UPNP_NATPMP_LIBS="-lminiupnpc -lnatpmp $LIBS"
906   UPNP_NATPMP_STATIC_LIBS="-lminiupnpc -lnatpmp $LIBS"
909 if test "$MAGIC" != "no"; then
910   echo "----- checking libmagic (GNU file) (optional)"
911   AC_CHECK_HEADERS(magic.h,
912     [AC_CHECK_LIB(magic,magic_file,
913       [AC_CHECK_DECL([MAGIC_ERROR], [MAGIC=yes], [MAGIC=no],[#include <magic.h>])],
914       [MAGIC=no])],
915     [MAGIC=no])
918 if test "$MAGIC" = "yes"; then
919   MAGICLIB=Magic_magic
920 else
921   MAGICLIB=Magic_nomagic
922   AC_MSG_NOTICE(libmagic not available)
925 GD_JPG=no
926 GD_PNG=no
927 if test "$GD" != "no"; then
928   echo "----- checking gd (optional)"
929   GD=no
930   LIBGD=no
931   SAVE_LIBS=$LIBS
932   SAVE_CFLAGS=$CFLAGS
933   SAVE_LDFLAGS=$LDFLAGS
934   AC_CHECK_PROG(GDLIBCONFIG, gdlib-config, gdlib-config)
935   if test "$ac_cv_prog_GDLIBCONFIG" = "gdlib-config"; then
936     GD_LIBS=`$GDLIBCONFIG --libs`
937     $GDLIBCONFIG --static-libs > /dev/null 2>&1
938     if test "$?" = "0"; then
939       GD_STATIC_LIBS=`$GDLIBCONFIG --static-libs`
940     fi
941     GD_LIBS2="$LIBS -lgd $GD_LIBS"
942     LIBS=$GD_LIBS2
943     GD_CFLAGS=`$GDLIBCONFIG --cflags`
944     CFLAGS="$CFLAGS $GD_CFLAGS"
945     GD_LDFLAGS=`$GDLIBCONFIG --ldflags`
946     LDFLAGS="$LDFLAGS $GD_LDFLAGS"
947     AC_MSG_CHECKING(for libgd > 2.0.14)
948     GDVERSION=`$GDLIBCONFIG --version`
949     GDMAJORVERSION=`$GDLIBCONFIG --majorversion`
950     GDMINORVERSION=`$GDLIBCONFIG --minorversion`
951     GDREVISION=`$GDLIBCONFIG --revision`
952     case $GDMAJORVERSION in
953         1)
954             AC_MSG_RESULT(no (found $GDVERSION))
955             LIBGD=no
956             ;;
957         2)
958             if test $GDMINORVERSION -ge 1; then
959                 AC_MSG_RESULT($GDVERSION)
960                 LIBGD=yes
961             else
962                 if test $GDREVISION -gt 14; then
963                     AC_MSG_RESULT($GDVERSION)
964                     LIBGD=yes
965                 else
966                     AC_MSG_RESULT(no (found $GDVERSION))
967                     LIBGD=no
968                 fi
969             fi
970             ;;
971         *)
972             AC_MSG_RESULT($GDVERSION)
973             LIBGD=yes
974             ;;
975     esac
976   else
977     LIBGD=yes
978   fi
980   if test "$LIBGD" = "yes"; then
981     AC_CHECK_HEADERS(gd.h,[LIBGD=yes],[LIBGD=no])
982   fi
984   if test "$LIBGD" = "yes"; then
985     AC_MSG_CHECKING(for gdImageCreate in -lgd)
986     AC_TRY_LINK([#include <gd.h>],
987     [gdImageCreate (0,0);],
988     [LIBGD=yes], [LIBGD=no])
989     AC_MSG_RESULT($LIBGD)
990     LIBS=$SAVE_LIBS
992     if test "$LIBGD" = "no"; then
993       AC_MSG_NOTICE([not found, trying another method])
994       AC_CHECK_LIB(gd, gdImageCreate, [LIBGD=yes], [LIBGD=no])
995     fi
996   fi
998   if test "$LIBGD" = "yes"; then
999     LIBPNG=no
1000 # saving current variables
1001     SAVE_LIBS_PNG=$LIBS
1002     SAVE_CFLAGS_PNG=$CFLAGS
1003     SAVE_LDFLAGS_PNG=$LDFLAGS
1004     AC_CHECK_PROG(PNGLIBCONFIG, libpng-config, libpng-config)
1005     if test "$ac_cv_prog_PNGLIBCONFIG" = "libpng-config"; then
1006 # check libpng-config contents and update system variables
1007       PNG_LIBS=`$PNGLIBCONFIG --libs`
1008       LIBS="$LIBS $PNG_LIBS"
1009       PNG_CFLAGS=`$PNGLIBCONFIG --cflags`
1010       CFLAGS="$CFLAGS $PNG_CFLAGS"
1011       PNG_LDFLAGS=`$PNGLIBCONFIG --ldflags`
1012       LDFLAGS="$LDFLAGS $PNG_LDFLAGS"
1013     fi
1014     AC_CHECK_LIB(png, png_create_read_struct , [LIBPNG=yes])
1015 # restore variables
1016     LIBS=$SAVE_LIBS_PNG
1017     CFLAGS=$SAVE_CFLAGS_PNG
1018     LDFLAGS=$SAVE_LDFLAGS_PNG
1020     if test "$LIBPNG" = "no"; then
1021       AC_MSG_NOTICE(png support not available)
1022     else
1023       LIBGD_PNG=no
1024       LIBS=$GD_LIBS2
1025       AC_MSG_CHECKING(for gdImagePng in -lgd)
1026       AC_TRY_LINK([#include <gd.h>],
1027       [gdImagePng (0,0);],
1028       [LIBGD_PNG=yes], [LIBGD_PNG=no])
1029       AC_MSG_RESULT($LIBGD_PNG)
1030       LIBS=$SAVE_LIBS
1032       if test "$LIBGD_PNG" = "no"; then
1033         AC_MSG_NOTICE([not found, trying another method])
1034         AC_CHECK_LIB(gd, gdImagePng, [LIBGD_PNG=yes], [LIBGD_PNG=no])
1035       fi
1037       AC_MSG_CHECKING(for png support in libgd)
1038       if test "$LIBGD_PNG" = "yes"; then
1039         GD=yes
1040         GD_PNG=yes
1041         AC_MSG_RESULT(yes)
1042         AC_CHECK_LIB(png, png_access_version_number,[AC_DEFINE(HAVE_PNGVERSION, 1,)])
1043         AC_DEFINE(HAVE_GD_PNG, 1, [Define to 1 if you have png support in libgd.])
1044       else
1045         AC_MSG_RESULT(no)
1046       fi
1047     fi
1049     LIBJPEG=no
1050     AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [LIBJPEG=yes])
1052     if test "$LIBJPEG" = "no"; then
1053       AC_MSG_NOTICE(jpeg support not available)
1054     else
1055       LIBGD_JPG=no
1056       LIBS=$GD_LIBS2
1057       AC_MSG_CHECKING(for gdImageJpeg in -lgd)
1058       AC_TRY_LINK([#include <gd.h>],
1059       [gdImageJpeg (0,0,0);],
1060       [LIBGD_JPG=yes], [LIBGD_JPG=no])
1061       AC_MSG_RESULT($LIBGD_JPG)
1062       LIBS=$SAVE_LIBS
1064       if test "$LIBGD_JPG" = "no"; then
1065         AC_MSG_NOTICE([not found, trying another method])
1066         AC_CHECK_LIB(gd, gdImageJpeg, [LIBGD_JPG=yes], [LIBGD_JPG=no])
1067       fi
1069       AC_MSG_CHECKING(for jpeg support in libgd)
1070       if test "$LIBGD_JPG" = "yes"; then
1071         GD=yes
1072         GD_JPG=yes
1073         AC_DEFINE(HAVE_GD_JPG, 1, [Define to 1 if you have jpg support in libgd.])
1074         AC_MSG_RESULT(yes)
1075       else
1076         AC_MSG_RESULT(no)
1077       fi
1078     fi
1079   else
1080     AC_MSG_NOTICE(libgd not available)
1081   fi
1082   LIBS=$SAVE_LIBS
1083   CFLAGS=$SAVE_CFLAGS
1084   LDFLAGS=$SAVE_LDFLAGS
1087 if test "$GD" != "no"; then
1088   GDGRAPHICS=DriverGraphics_gd
1089 else
1090   GDGRAPHICS=DriverGraphics_nogd
1093 if test "$ICONV" = "yes"; then
1094   echo "----- checking iconv (optional)"
1095   AM_ICONV
1096   if test "$am_cv_func_iconv" != "yes"; then
1097     AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1098     ICONV=no
1099   else
1100   LIBS="$LIBS $LIBICONV"
1101   AC_CHECK_FUNCS([locale_charset],,
1102   AC_TRY_LINK([#include <langinfo.h>],
1103   [char* cs = nl_langinfo(CODESET);],
1104   AC_MSG_NOTICE(found nl_langinfo(CODESET)),
1105   [echo "Your iconv implementation is incomplete"; exit 1]))
1106   AC_CHECK_LIB(charset,locale_charset)
1107   AC_CHECK_HEADERS([libcharset.h])
1108   AC_CHECK_HEADERS([langinfo.h])
1109   AC_CHECK_HEADERS([locale.h])
1110   fi
1111 else
1112   AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1113   ICONV=no
1116 if test "$USE_PTHREAD" = "no"; then
1117  PTHREAD_LIBS=""
1118  echo "You disabled thread support, this will hurt MLDonkey performance!"
1119 else
1120   echo "----- checking thread support (optional, strongly advised)"
1121   ACX_PTHREAD
1124 # On linux plaforms, we will have to check that includes from kernel are
1125 # available. glibc version test was shamelessly taken from
1126 # http://public.activestate.com/gsar/APC/perl-5.8.x/Configure
1127 GLIBC_VERSION=""
1128 case $host in
1129         *linux*)
1130            echo "----- GNU C Library version"
1131            AC_CHECK_HEADERS(linux/limits.h,, [
1132              OLD_CPPFLAGS=$CPPFLAGS
1133              CPPFLAGS="-I /usr/src/linux/include"
1134              AC_CHECK_HEADER(linux/types.h,[CONFIG_INCLUDES="-I /usr/src/linux/include"])
1135              CPPFLAGS=$OLD_CPPFLAGS]
1136            )
1137            AC_CHECK_HEADERS(gnu/libc-version.h,[AC_MSG_CHECKING(for GNU C Library version)
1139 cat >try.c <<'EOCP'
1140 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
1141    alone are insufficient to distinguish different versions, such as
1142    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
1143    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
1145 #include <stdio.h>
1146 int main(void)
1148 #ifdef __GLIBC__
1149 #   ifdef __GLIBC_MINOR__
1150 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1151 #           include <gnu/libc-version.h>
1152     printf("%s\n",  gnu_get_libc_version());
1153 #       else
1154     printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
1155 #       endif
1156 #   else
1157 printf("%d\n",  __GLIBC__);
1158 #   endif
1159     return 0;
1160 #else
1161     return 1;
1162 #endif
1164 EOCP
1166            $CC -o try ./try.c
1167            GLIBC_VERSION="`./try`"
1168            AC_MSG_RESULT($GLIBC_VERSION)
1169            rm -f try try.*],)
1170         ;;
1171         *)         ;;
1172 esac
1174 echo "---------------------------------------------"
1175 echo "     Checking system libraries finished."
1176 echo "---------------------------------------------"
1177 echo ""
1179 CXX_VERSION=
1180 CRYPTOPPFLAGS=
1181 echo "--------------------------------------"
1182 echo "     Checking activated networks."
1183 echo "--------------------------------------"
1185   if test "$DONKEY" = "yes"; then
1186     AC_MSG_CHECKING(eDonkey)
1187     if test -d ../src/networks/donkey; then
1188       AC_MSG_RESULT(yes)
1189       if test "$DONKEY_SUI" = "yes"; then
1190         AC_PROG_CXX
1192         AC_CHECK_TOOL(NEWCXX, [$CXX], [no])
1193         AC_MSG_CHECKING(eMule SUI)
1194         if test x"$NEWCXX" = x"no"
1195         then
1196           AC_MSG_RESULT(no)
1197           CXX=
1198           DONKEY_SUI=no
1199         else
1200           AC_MSG_RESULT(yes)
1201           ACX_CHECK_CXX_FLAGS(-fno-omit-frame-pointer,cv_no_omit_frame_pointer, CRYPTOPPFLAGS="-fno-omit-frame-pointer")
1202           ACX_CHECK_CXX_FLAGS(-mno-omit-leaf-frame-pointer,cv_no_omit_leaf_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -mno-omit-leaf-frame-pointer")
1203           CXX=$NEWCXX
1204           CXX_VERSION=`$CXX -dumpversion`
1205           DONKEY_SUI_FILE=DonkeySui1
1206           AC_DEFINE(HAVE_CRYPTOPP, 1,)
1207         fi
1208       fi
1209 #      AC_MSG_CHECKING(eDonkey server)
1210 #      if test -d ../src/networks/server; then
1211 #        AC_MSG_RESULT(no)
1212 #        DONKEY_SERVER=no
1213 #      else
1214 #        AC_MSG_RESULT(no)
1215 #        DONKEY_SERVER=no
1216 #      fi
1217     else
1218       DONKEY=no
1219       DONKEY_SUI=no
1220       AC_MSG_RESULT(no)
1221     fi
1222   else
1223     DONKEY_SUI=no
1224   fi
1226   if test "$BITTORRENT" = "yes"; then
1227     AC_MSG_CHECKING(BitTorrent)
1228     if test -d ../src/networks/bittorrent; then
1229       AC_MSG_RESULT(yes)
1230     else
1231       BITTORRENT=no
1232       AC_MSG_RESULT(no)
1233     fi
1234   fi
1236   if test "$FILETP" = "yes"; then
1237     AC_MSG_CHECKING(FileTP)
1238     if test -d ../src/networks/fileTP; then
1239       AC_MSG_RESULT(yes)
1240     else
1241       FILETP=no
1242       AC_MSG_RESULT(no)
1243     fi
1244   fi
1246   if test "$GNUTELLA" = "yes"; then
1247     AC_MSG_CHECKING(Gnutella)
1248     if test -d ../src/networks/gnutella; then
1249       AC_MSG_RESULT(yes)
1250     else
1251       GNUTELLA=no
1252       AC_MSG_RESULT(no)
1253     fi
1254   fi
1256   if test "$GNUTELLA2" = "yes"; then
1257     AC_MSG_CHECKING(G2)
1258     if test -d ../src/networks/gnutella2; then
1259       AC_MSG_RESULT(yes)
1260     else
1261       GNUTELLA2=no
1262       AC_MSG_RESULT(no)
1263     fi
1264   fi
1266   if test "$FASTTRACK" = "yes"; then
1267     AC_MSG_CHECKING(Fasttrack)
1268     if test -d ../src/networks/fasttrack; then
1269       AC_MSG_RESULT(yes)
1270     else
1271       FASTTRACK=no
1272       AC_MSG_RESULT(no)
1273     fi
1274   fi
1276   if test "$DIRECT_CONNECT" = "yes"; then
1277     AC_MSG_CHECKING(DirectConnect)
1278     if test "$BZIP2" = "yes"; then
1279       if test -d ../src/networks/direct_connect; then
1280         AC_MSG_RESULT(yes)
1281       else
1282         DIRECT_CONNECT=no
1283         AC_MSG_RESULT(no)
1284       fi
1285     else
1286       DIRECT_CONNECT=no
1287       AC_MSG_RESULT(no - bzip2 support missing)
1288     fi
1289   fi
1291   if test "$SOULSEEK" = "yes"; then
1292     AC_MSG_CHECKING(Soulseek)
1293     if test -d ../src/networks/soulseek; then
1294       AC_MSG_RESULT(yes)
1295     else
1296       SOULSEEK=no
1297       AC_MSG_RESULT(no)
1298     fi
1299   fi
1301   if test "$OPEN_NAPSTER" = "yes"; then
1302     AC_MSG_CHECKING(OpenNapster)
1303     if test -d ../src/networks/opennap; then
1304       AC_MSG_RESULT(yes)
1305     else
1306       OPEN_NAPSTER=no
1307       AC_MSG_RESULT(no)
1308     fi
1309   fi
1311   if test "$OPENFT" = "yes"; then
1312     AC_MSG_CHECKING(OpenFT)
1313     if test -d ../src/networks/openFT; then
1314       AC_MSG_RESULT(yes)
1315     else
1316       OPENFT=no
1317       AC_MSG_RESULT(no)
1318     fi
1319   fi
1320 echo "-----------------------------------------------"
1321 echo "     Checking activated networks finished."
1322 echo "-----------------------------------------------"
1324 if test -f $OCAMLLIB/lablgl.cma; then
1325   LABLGL_CMA=lablgl.cma
1328 if test -f $OCAMLLIB/lablgl.$OCAMLLIB_EXT; then
1329   LABLGL_CMXA=lablgl.$OCAMLLIB_EXT
1332 # Check for GTK only if we want to build the GUI
1333 if test ! "$GUI" = "no"; then
1334   echo "---------------------------------------------------------"
1335   echo "Checking the libraries required to build the GTK GUI."
1336   echo "---------------------------------------------------------"
1337   if test "$GUI" = "newgui2"; then
1338       REQUIRED_GTK=2.4.0
1339       PKG_GTK=gtk+-2.0
1340       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1341       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1342         AC_MSG_RESULT(yes)
1343         REQUIRED_RSVG=2.4.0
1344         PKG_RSVG=librsvg-2.0
1345         AC_MSG_CHECKING(for librsvg - version >= $REQUIRED_RSVG)
1346         if pkg-config --atleast-version $REQUIRED_RSVG $PKG_RSVG; then
1347           GTK_CONFIG="pkg-config $PKG_GTK $PKG_RSVG"
1348           REQUIRED_LABLGTK=2.14.2
1349           LABLGTK_NAME=lablgtk2
1350           AC_MSG_RESULT(yes)
1351         else
1352           GTK_CONFIG=no
1353           AC_MSG_RESULT(no)
1354         fi
1355       else
1356         GTK_CONFIG=no
1357         AC_MSG_RESULT(no)
1358       fi
1359   else
1360     if test "$OS_FILES2" = "mingw"; then
1361       REQUIRED_GTK=1.3.0
1362       PKG_GTK=gtk+-1.3-win32-production
1363       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1364       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1365         GTK_CONFIG="pkg-config $PKG_GTK"
1366         AC_MSG_RESULT(yes)
1367       else
1368         GTK_CONFIG=no
1369         AC_MSG_RESULT(no)
1370       fi
1371     else
1372       AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no)
1373       if test "$GTK_CONFIG" = "no"; then
1374         AC_MSG_RESULT(no)
1375       else
1376         AC_MSG_RESULT(yes)
1377       fi
1378     fi
1379   fi
1380 else
1381   GTK_CONFIG=no
1383 if test "$GTK_CONFIG" = "no"; then
1384      LABLGTK_CONFIG=no
1385 else
1386   AC_MSG_CHECKING(for native code $LABLGTK_NAME)
1387   if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1388      if test "$GUI" = "newgui2"; then
1389        if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.$OCAMLLIB_EXT; then
1390          AC_MSG_RESULT(yes)
1391          LABLGTK_CONFIG=yes
1392        else
1393          AC_MSG_RESULT(no)
1394          LABLGTK_CONFIG=no
1395          if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.cma; then
1396            echo "---------------------------------------------------------"
1397            echo "lablrsvg is not installed properly. See the INSTALL.txt"
1398            echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1399            echo "probably forgot to call 'make opt' before 'make install'."
1400            echo "---------------------------------------------------------"
1401          else
1402            echo "---------------------------------------------------------"
1403            echo "lablrsvg is not installed. See the INSTALL.txt file of"
1404            echo "mldonkey to see how to compile $LABLGTK_NAME. Librsvg"
1405            echo "may not be installed when you compiled $LABLGTK_NAME."
1406            echo "---------------------------------------------------------"
1407          fi
1408        fi
1409      else
1410        AC_MSG_RESULT(yes)
1411        LABLGTK_CONFIG=yes
1412      fi
1413   else
1414      AC_MSG_RESULT(no)
1415      LABLGTK_CONFIG=no
1416      if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.cma; then
1417        echo "-------------------------------------------------------------"
1418        echo "$LABLGTK_NAME is not installed properly. See the INSTALL.txt"
1419        echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1420        echo "probably forgot to call 'make opt' before 'make install'."
1421        echo "-------------------------------------------------------------"
1422      else
1423        echo "Do you want this script to try to download and install $LABLGTK_NAME"
1424        echo "LOCALLY in mldonkey directory ?"
1425        if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
1426        case "$i" in
1427         y* | Y*)
1429          cd $PATCH_DIR
1430          rm -rf lablgtk-"$REQUIRED_LABLGTK"
1431          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then
1432            echo Downloading ...
1433            $WGET http://www.math.nagoya-u.ac.jp/~garrigue/soft/olabl/dist/lablgtk-"$REQUIRED_LABLGTK".tar.gz
1434          fi
1435          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then exit 1; fi
1437          mkdir -p $BUILD_DIR
1438          cd $BUILD_DIR
1439          echo Uncompressing ...
1440          gzip -cd $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".tar.gz | tar xf -
1441          (cd lablgtk-"$REQUIRED_LABLGTK"
1442           if test -f $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch; then
1443             echo Patching ...
1444             patch -p0 < $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch
1445           fi
1446           PATH=$OCAML_PATH:$PATH
1447           export PATH
1448           echo $PATH
1450           if test "$GUI" = "newgui2"; then
1451             ./configure --prefix=$LOCAL_DIR
1452             $GNU_MAKE world
1453             $GNU_MAKE install
1454           else
1455             $GNU_MAKE configure
1456             $GNU_MAKE
1457             $GNU_MAKE opt
1458             $GNU_MAKE install
1459           fi
1461           cd ..
1462           rm -rf lablgtk-"$REQUIRED_LABLGTK"
1463          )
1464          cd $CONFIG_DIR
1465          if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1466             LABLGTK_CONFIG=yes
1467          else
1468             echo "Installation of $LABLGTK_NAME failed"
1469             LABLGTK_CONFIG=no
1470          fi
1471          ;;
1472         *);;
1473       esac
1474      fi
1475   fi
1478 if test "$GUI" = "newgui2" ; then
1479   GUIS="mldonkey_gui\$(EXE)"
1480   GTKCFLAGS="`pkg-config --cflags-only-I gtk+-2.0`"
1481   GTKLLIBS="`pkg-config --libs-only-L gtk+-2.0`"
1482   GTKLFLAGS="`pkg-config --libs-only-l gtk+-2.0` -lX11"
1483 else
1484   GUIS="mldonkey_gui\$(EXE) mldonkey_gui2\$(EXE)"
1487 if test "$LABLGTK_CONFIG" = "no"; then
1488   GUI="no"
1489 else
1490   MORE_TARGETS="$MORE_TARGETS $GUIS"
1491   AC_MSG_CHECKING(GToolbox.popup_menu args)
1492   GTOOLBOX="$OCAMLLIB/$LABLGTK_NAME/gToolbox.mli"
1493   grep popup $GTOOLBOX | grep -i button 2> /dev/null && GTOOLBOX_ARGS=new
1494   if test "$GTOOLBOX_ARGS" = "new"; then
1495     GTOOLBOX_POPUPMENU=' ~button: button ~time: time '
1496     AC_MSG_RESULT(new)
1497   else
1498     GTOOLBOX_POPUPMENU=' ~x: button ~y: time '
1499     AC_MSG_RESULT(old)
1500   fi
1501   echo "---------------------------------------------------------"
1502   echo "End of GTK GUI configuration."
1503   echo "---------------------------------------------------------"
1506 if test "$OS_FILES" = "mingw"; then
1507    OCAMLDEP_OPTIONS="-slash"
1510 AC_SUBST(LIBS)
1511 AC_SUBST(CFLAGS)
1512 AC_SUBST(CPPFLAGS)
1513 AC_SUBST(CXXFLAGS)
1514 AC_SUBST(LDFLAGS)
1515 AC_SUBST(CC)
1516 AC_SUBST(CPP)
1517 AC_SUBST(CXX)
1518 AC_SUBST(FIX_BROKEN_CPP)
1519 AC_SUBST(CONFIG_INCLUDES)
1520 AC_SUBST(OCAMLC)
1521 AC_SUBST(OCAMLLIB)
1522 AC_SUBST(OCAMLOPT)
1523 AC_SUBST(OCAMLLEX)
1524 AC_SUBST(OCAMLYACC)
1525 AC_SUBST(OCAMLDEP)
1526 AC_SUBST(OCAMLDEP_OPTIONS)
1527 AC_SUBST(CAMLP4)
1528 AC_SUBST(CAMLP4OF)
1529 AC_SUBST(CAMLP4LIB_OPT)
1530 AC_SUBST(CAMLP4LIB_BYTE)
1531 AC_SUBST(PERL)
1532 AC_SUBST(OCAMLDOC)
1533 AC_SUBST(OCAMLMKTOP)
1534 AC_SUBST(SYSTEM)
1535 AC_SUBST(MORE_TARGETS)
1536 AC_SUBST(MORE_SUBDIRS)
1537 AC_SUBST(LABLGL_CMA)
1538 AC_SUBST(LABLGL_CMXA)
1539 AC_SUBST(MD4ARCH)
1540 AC_SUBST(MD4COMP)
1541 AC_SUBST(ICONV)
1542 AC_SUBST(OPEN_NAPSTER)
1543 AC_SUBST(DIRECT_CONNECT)
1544 AC_SUBST(GNUTELLA)
1545 AC_SUBST(GNUTELLA2)
1546 AC_SUBST(BITTORRENT)
1547 AC_SUBST(FILETP)
1548 AC_SUBST(SOULSEEK)
1549 AC_SUBST(OPENFT)
1550 AC_SUBST(FASTTRACK)
1551 AC_SUBST(DONKEY)
1552 AC_SUBST(DONKEY_SUI)
1553 AC_SUBST(CRYPTOPPFLAGS)
1554 AC_SUBST(DONKEY_SUI_FILE)
1555 AC_SUBST(DONKEY_SERVER)
1556 AC_SUBST(GUI)
1557 AC_SUBST(REQUIRED_OCAML)
1558 AC_SUBST(REQUIRED_LABLGTK)
1559 AC_SUBST(ARCH)
1560 AC_SUBST(COMPRESS)
1561 AC_SUBST(COMPRESS_EXT)
1562 AC_SUBST(CHECKBOUNDS)
1563 AC_SUBST(MLDONKEY_VERSION)
1564 AC_SUBST(SCM_VERSION)
1565 AC_SUBST(MAJOR_VERSION)
1566 AC_SUBST(MINOR_VERSION)
1567 AC_SUBST(SUB_VERSION)
1568 AC_SUBST(GTOOLBOX_POPUPMENU)
1569 AC_SUBST(OS_FILES)
1570 AC_SUBST(OS_FILES2)
1571 AC_SUBST(TARGET_TYPE)
1572 AC_SUBST(RPMBUILD)
1573 AC_SUBST(GTKCFLAGS)
1574 AC_SUBST(GTKLLIBS)
1575 AC_SUBST(GTKLFLAGS)
1576 AC_SUBST(GD)
1577 AC_SUBST(GD_JPG)
1578 AC_SUBST(GD_PNG)
1579 AC_SUBST(GDGRAPHICS)
1580 AC_SUBST(GD_LIBS)
1581 AC_SUBST(GD_STATIC_LIBS)
1582 AC_SUBST(GD_CFLAGS)
1583 AC_SUBST(GD_LDFLAGS)
1584 AC_SUBST(BZIP2)
1585 AC_SUBST(MAGIC)
1586 AC_SUBST(MAGICLIB)
1587 AC_SUBST(UPNP_NATPMP)
1588 AC_SUBST(UPNP_NATPMP_LIBS)
1589 AC_SUBST(UPNP_NATPMP_STATIC_LIBS)
1590 BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
1591 AC_SUBST(BUILD_SYSTEM)
1592 AC_SUBST(GLIBC_VERSION)
1593 AC_SUBST(CC_VERSION)
1594 AC_SUBST(CXX_VERSION)
1595 AC_SUBST(CONFIGURE_ARGUMENTS)
1596 AC_SUBST(CONFIGURE_RUN)
1597 AC_SUBST(DEVFLAGS)
1599 AUTOCONF=../src/utils/lib/autoconf.ml
1600 GTK_AUTOCONF=../src/utils/lib/gAutoconf.ml
1601 AC_OUTPUT(\
1602   Makefile.config \
1603   mldonkey.rc \
1604   $AUTOCONF.new $GTK_AUTOCONF.new \
1605    ../src/utils/bitstring/bitstring.ml \
1606    ../src/utils/lib/magic.ml \
1607    ../src/networks/donkey/donkeySui.ml \
1608    ../src/daemon/driver/driverGraphics.ml \
1609    ../packages/rpm/mldonkey.spec \
1610    ../packages/rpm/Makefile \
1611    ../packages/slackware/mldonkey.options)
1612 diff $AUTOCONF.new $AUTOCONF 2> /dev/null > /dev/null || cp -f $AUTOCONF.new $AUTOCONF
1613 diff $GTK_AUTOCONF.new $GTK_AUTOCONF 2> /dev/null > /dev/null || cp -f $GTK_AUTOCONF.new $GTK_AUTOCONF
1615 cd ..
1617 echo ""
1618 echo "Building dependencies (if it blocks, try '$GNU_MAKE depend' to see the problem)"
1619 $GNU_MAKE depend 2> /dev/null > /dev/null || echo "Building dependencies fails: try: '$GNU_MAKE depend'"
1621 echo ""
1622 printf "Configuring MLDonkey %s" "$MLDONKEY_VERSION"
1623 if test ! -z "$SCM_VERSION"; then
1624   printf " - SCM: %s" "$SCM_VERSION"
1626 echo " completed."
1628 echo ""
1629 echo "Network modules:"
1630 printf " - eDonkey           "
1631 if test "$DONKEY" = "yes"; then
1632   if test "$DONKEY_SUI" = "yes"; then
1633     echo "enabled (eMule SUI enabled)"
1634   else
1635     echo "enabled (eMule SUI disabled)"
1636   fi
1637 else
1638   echo "        disabled"
1641 printf " - BitTorrent        "
1642 if test "$BITTORRENT" = "yes"; then
1643   echo "enabled"
1644 else
1645   echo "        disabled"
1648 printf " - FileTP (aka wget) "
1649 if test "$FILETP" = "yes"; then
1650   echo "enabled"
1651 else
1652   echo "        disabled"
1655 printf " - Fasttrack         "
1656 if test "$FASTTRACK" = "yes"; then
1657   echo "enabled"
1658 else
1659   echo "        disabled"
1662 printf " - Gnutella          "
1663 if test "$GNUTELLA" = "yes"; then
1664   echo "enabled (warning: this network module is unmaintained)"
1665 else
1666   echo "        disabled - unmaintained"
1669 printf " - Gnutella2         "
1670 if test "$GNUTELLA2" = "yes"; then
1671   echo "enabled (warning: this network module is unmaintained)"
1672 else
1673   echo "        disabled - unmaintained"
1676 printf " - Direct Connect    "
1677 if test "$DIRECT_CONNECT" = "yes"; then
1678   echo "enabled"
1679 else
1680   echo "        disabled"
1683 printf " - Open Napster      "
1684 if test "$OPEN_NAPSTER" = "yes"; then
1685   echo "enabled          - currently not usable"
1686 else
1687   echo "        disabled - currently not usable"
1690 printf " - Soulseek          "
1691 if test "$SOULSEEK" = "yes"; then
1692   echo "enabled          - currently not usable"
1693 else
1694   echo "        disabled - currently not usable"
1697 printf " - OpenFT            "
1698 if test "$OPENFT" = "yes"; then
1699   echo "enabled          - currently not usable"
1700 else
1701   echo "        disabled - currently not usable"
1704 echo ""
1705 echo "Core features:"
1707 echo " - zlib (required)   enabled"
1709 printf " - threads           "
1710 if test "$USE_PTHREAD" = "yes"; then
1711   echo "enabled"
1712 else
1713   echo "        disabled"
1716 printf " - bzip2             "
1717 if test "$BZIP2" = "yes"; then
1718   echo "enabled"
1719 else
1720   echo "        disabled"
1723 printf " - iconv             "
1724 if test "$ICONV" = "yes"; then
1725   echo "enabled"
1726 else
1727   echo "        disabled"
1730 printf " - libmagic          "
1731 if test "$MAGIC" = "yes"; then
1732   echo "enabled"
1733 else
1734   echo "        disabled"
1737 printf " - upnp & natpmp     "
1738 if test "$UPNP_NATPMP" = "yes"; then
1739   echo "enabled"
1740 else
1741   echo "        disabled"
1744 printf " - graphical stats   "
1745 if test "$GD" = "yes"; then
1746   echo "enabled"
1747   printf "   - png support     "
1748   if test "$GD_PNG" = "yes"; then
1749     echo "enabled"
1750   else
1751     echo "        disabled"
1752   fi
1754   printf "   - jpg support     "
1755   if test "$GD_JPG" = "yes"; then
1756     echo "enabled"
1757   else
1758     echo "        disabled"
1759   fi
1760 else
1761   echo "        disabled"
1764 if test "$LABLGTK_CONFIG" = "yes"; then
1765   echo ""
1766   printf "\n - GUI support       "
1767   if test "$GUI" = "newgui1"; then
1768     echo "GTK1 newgui"
1769   else
1770     if test "$GUI" = "newgui2"; then
1771       echo "GTK2 GUI"
1772     else
1773       echo "GTK1 oldgui"
1774     fi
1775   fi
1778 if test "$OLDGUI_NO_31" = "yes"; then
1779   echo " - GUI support       GTK1 oldgui does not work with Ocaml 3.1*, disabled"
1782 if test "$TARGET_TYPE" = "byte"; then
1783   OCAML_TYPE="- byte code"
1784   COMPILE_TARGET=".byte"
1786 echo ""
1787 echo "Compilers:"
1788 echo " - OCaml version     $OCAMLVERSION $OCAML_TYPE"
1789 echo " - $CC version       $CC_VERSION"
1790 if test "x$CXX" != "x"; then
1791   echo " - $CXX version       $CXX_VERSION"
1793 echo ""
1794 echo "\nNow execute '$GNU_MAKE' to start compiling. Good luck!"
1796 echo ""
1797 echo "To compile a static code execute:     $GNU_MAKE mlnet$COMPILE_TARGET.static"
1798 echo "To produce a release tarball execute: $GNU_MAKE release.mlnet.static"
1799 echo "To clean the build directory execute: $GNU_MAKE maintainerclean"
1800 if test "$DONKEY_SUI" = "yes"; then
1801   echo ""
1802   echo "Compiling CryptoPP.cc can take several minutes, on slow machines up to half an hour."