update default blocklist url (Closes #4)
[mldonkey.git] / config / configure.in
blobd7c6b5ed4c88e97d9935de99eef4c6837548436d
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=5   # 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 ../.git; then
224   AC_MSG_NOTICE(checking git revision)
225   AC_CHECK_PROG(GIT,git,yes)
226   SUB_VERSION3="git"
227   if test "$ac_cv_prog_GIT" = "yes"; then
228     GIT_BRANCH=`git symbolic-ref -q --short HEAD`
229     GIT_COMMIT=`git describe --always --tags`
230     case "$GIT_BRANCH" in
231     ""|"master")
232       SCM_VERSION="${GIT_COMMIT}"
233       ;;
234     *)
235       SCM_VERSION="${GIT_COMMIT}-${GIT_BRANCH}"
236       ;;
237     esac
238   else
239     AC_MSG_NOTICE(cannot determine git revision)
240     SCM_VERSION=""
241   fi
244 if test -d .svn; then
245   AC_MSG_NOTICE(checking SVN revision)
246   AC_CHECK_PROG(SVNVERSION,svnversion,svnversion)
247   if test "$ac_cv_prog_SVNVERSION" = "svnversion"; then
248     SUB_VERSION3="SVN"
249     SCM_VERSION=`svnversion -n .`
250   else
251     AC_MSG_NOTICE(cannot checking SVN revision... no SVNVERSION)
252     SCM_VERSION="cannot find out SVN revision (no SVNVERSION)"
253   fi
256 if test -f ./CVS/Entries ; then
257   AC_MSG_NOTICE(checking CVS checkout date)
258   AC_CHECK_PROGS(STAT, stat gstat, stat)
259   if [ test "$ac_cv_prog_STAT" = "stat" ] || [ test "$ac_cv_prog_STAT" = "gstat" ]; then
260     AC_CHECK_PROG(SED, sed, sed)
261     if test "$ac_cv_prog_SED" = "sed"; then
262       AC_CHECK_PROG(CUT, cut, cut)
263       if test "$ac_cv_prog_CUT" = "cut"; then
264         SUB_VERSION3="CVS"
265         if [ test "$SYSTEM" = "freebsd"] || [ test "$SYSTEM" = "netbsd"] || ( [ test "$SYSTEM" = "macos" ] && [ test "$ac_cv_prog_STAT" != "gstat" ] ); then
266           SCM_VERSION=`$STAT -f "%Sm" ./CVS/Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\4-\1-\2 \3/'`
267         else
268         if [ test "$SYSTEM" = "openbsd"]; then
269           AC_CHECK_PROG(GREP, grep, grep)
270           if test "$ac_cv_prog_GREP" = "grep"; then
271             SCM_VERSION=`$STAT -f %a ./CVS/Entries | $GREP -v Entries | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\)/\1-\2-\4 \3/'`
272           fi
273         else
274         if [ test "$SYSTEM" = "mingw"] || [ test "$SYSTEM" = "cygwin"]; then
275           AC_CHECK_PROG(GREP, grep, grep)
276           if test "$ac_cv_prog_GREP" = "grep"; then
277             SCM_VERSION=`$STAT ./CVS/Entries  | $GREP Modify | $SED -e 's/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/\5-\2-\3 \4/'`
278           fi
279         else
280           SCM_VERSION=`$STAT -Lc %y ./CVS/Entries | $SED -e 's#\.[0-9]*##' | $CUT -c 1-19`
281         fi  #if [ test "$SYSTEM" = "mingw"] || ...
282         fi  #if [ test "$SYSTEM" = "openbsd"]
283         fi  #if [ test "$SYSTEM" = "freebsd"] || ...
284       else
285         AC_MSG_NOTICE(cannot checking CVS checkout date... no CUT)
286         SCM_VERSION="cannot find out SCM Version (no CUT)"
287       fi
288     else
289       AC_MSG_NOTICE(cannot checking CVS checkout date... no SED)
290       SCM_VERSION="cannot find out SCM Version (no SED)"
291     fi
292   else
293     AC_MSG_NOTICE(cannot checking CVS checkout date... no STAT)
294     SCM_VERSION="cannot find out SCM Version (no STAT)"
295   fi
298 # **********                                                                                  **********
299 # **********             build MLDonkey version, Required OCaml and LablGTK versions          **********
300 # **********                                                                                  **********
302 MLDONKEY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$SUB_VERSION
303 if test -f ./subrelease; then
304   MLDONKEY_VERSION=$MLDONKEY_VERSION`cat ./subrelease`
306 if test ! -z "$SUB_VERSION3"; then
307   MLDONKEY_VERSION=$MLDONKEY_VERSION.$SUB_VERSION3
310 REQUIRED_OCAML=3.12.0
311 DOWNLOAD_OCAML_MAJOR=3.12
312 DOWNLOAD_OCAML=3.12.0
314 REQUIRED_LABLGTK=1.2.7
316 touch install-sh
318 LABLGTK_NAME=lablgtk
320 # **********                                                                                  **********
321 # **********                    Network and Feature configure switch variables                **********
322 # **********                                                                                  **********
324 # **********   currently not working Networks, can't be enabled
326 SOULSEEK=no
327 OPEN_NAPSTER=no
328 OPENFT=no
330 # **********   working Networks, enabled by default
332 DONKEY=yes
333 BITTORRENT=yes
334 GNUTELLA=no
335 GNUTELLA2=no
336 FASTTRACK=yes
337 FILETP=yes
338 DIRECT_CONNECT=yes
340 # **********   predefined configure variations
342 MULTINET=yes
343 MINIMUM=no
345 # **********   Features, enabled by default
347 DONKEY_SUI=yes
348 DONKEY_SUI_FILE=DonkeySui2
349 GD=yes
350 BZIP2=yes
351 MAGIC=yes
352 ICONV=yes
353 USE_PTHREAD=yes
354 UPNP_NATPMP=no
355 UPNP_NATPMP_FORCE=no
357 # **********
359 BATCH=no
360 FORCE_OCAML=no
361 FORCE_MINGW=no
362 PROFILE=no
363 DEBUG=no
364 DEV=no
365 GUI=no
366 CHECKBOUNDS=false
367 DEVFLAGS=
369 # **********                                                                                  **********
370 # **********                Network and Feature configure switches and dependency             **********
371 # **********                                                                                  **********
373 AC_ARG_ENABLE(multinet,
374   AS_HELP_STRING([--disable-multinet], [disable all networks except eDonkey (with Overnet and Kademlia)]),
375   [MULTINET="$enableval"])
376 AC_ARG_ENABLE(minimum,
377   AS_HELP_STRING([--enable-minimum], [enable minimum set of features and networks (eDonkey, iconv and threads enabled)]),
378   [MINIMUM="$enableval"])
379 AC_ARG_ENABLE(minimum,
380   AS_HELP_STRING([--enable-minimum=all], [enable only eDonkey network and disable all optional features (not recommended)]),
381   [MINIMUM="$enableval"])
383 if [ test ! "$MULTINET" = "yes" ] || [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
384   GNUTELLA=no
385   GNUTELLA2=no
386   FASTTRACK=no
387   DIRECT_CONNECT=no
388   FILETP=no
389   BITTORRENT=no
391 if [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
392   DONKEY_SUI=no
393   GD=no
394   BZIP2=no
395   MAGIC=no
397 if [ test "$MINIMUM" = "all" ]; then
398   USE_PTHREAD=no
399   ICONV=no
402 #AC_ARG_ENABLE(soulseek,      [  --disable-soulseek      disable support for SoulSeek], [SOULSEEK="$enableval"])
403 #AC_ARG_ENABLE(opennap,       [  --disable-opennap       disable support for Open Napster], [OPEN_NAPSTER="$enableval"])
404 AC_ARG_ENABLE(directconnect,
405   AS_HELP_STRING([--disable-directconnect], [disable support for Direct Connect]),
406   [DIRECT_CONNECT="$enableval"])
407 #AC_ARG_ENABLE(openft,        [  --disable-openft        disable support for OpenFT], [OPENFT="$enableval"])
409 AC_ARG_ENABLE(donkey,
410   AS_HELP_STRING([--disable-donkey], [disable support for eDonkey]),
411   [DONKEY="$enableval"])
412 AC_ARG_ENABLE(donkeysui,
413   AS_HELP_STRING([--disable-donkeysui], [disable support for eMule SecureUserIdent]),
414   [DONKEY_SUI="$enableval"])
415 AC_ARG_ENABLE(bittorrent,
416   AS_HELP_STRING([--disable-bittorrent], [disable support for Bittorent]),
417   [BITTORRENT="$enableval"])
418 AC_ARG_ENABLE(filetp,
419   AS_HELP_STRING([--disable-filetp], [disable support for fileTP]),
420   [FILETP="$enableval"])
421 AC_ARG_ENABLE(gnutella,
422   AS_HELP_STRING([--disable-gnutella], [disable support for Gnutella]),
423   [GNUTELLA="$enableval"])
424 AC_ARG_ENABLE(gnutella2,
425   AS_HELP_STRING([--disable-gnutella2], [disable support for Gnutella2]),
426   [GNUTELLA2="$enableval"])
427 AC_ARG_ENABLE(fasttrack,
428   AS_HELP_STRING([--disable-fasttrack], [disable support for FastTrack]),
429   [FASTTRACK="$enableval"])
431 AC_ARG_ENABLE(batch,
432   AS_HELP_STRING([--enable-batch], [reply YES to all queries in this script]),
433   [BATCH="$enableval"])
434 AC_ARG_ENABLE(force-ocaml,
435   AS_HELP_STRING([--enable-force-ocaml], [force usage of self-compiled OCaml]),
436   [FORCE_OCAML="$enableval"])
437 AC_ARG_ENABLE(ocamlver,
438   AS_HELP_STRING([--enable-ocamlver=VER], [force usage of specific OCaml version (3.10.1|SVN), ]),
439   [REQUIRED_OCAML="$enableval"])
440 AC_ARG_ENABLE(mingw,
441   AS_HELP_STRING([--enable-mingw], [force compilation with MINGW on Cygwin]),
442   [FORCE_MINGW="$enableval"])
443 AC_ARG_ENABLE(checks,
444   AS_HELP_STRING([--enable-checks], [enable bounds-checking for array/string accesses]),
445   [CHECKBOUNDS="$enableval"])
446 if test "$CHECKBOUNDS" = "yes"; then
447   CHECKBOUNDS=true
450 AC_ARG_ENABLE(profile,
451   AS_HELP_STRING([--enable-profile], [compile with gprof profiling support (enables debug)]),
452   [PROFILE="$enableval"])
453 AC_ARG_ENABLE(debug,
454   AS_HELP_STRING([--enable-debug], [compile with debugging information]),
455   [DEBUG="$enableval"])
456 AC_ARG_ENABLE(dev,
457   AS_HELP_STRING([--enable-dev], [development mode (enables debug and annot information)]),
458   [DEV="$enableval"])
459 if test "$PROFILE" = "yes"; then
460   DEBUG="yes"
462 if test "$DEV" = "yes"; then
463   DEBUG="yes"
465 AC_ARG_ENABLE(gui,
466   AS_HELP_STRING([--disable-gui], [disable GUI build (default)]),
467   [GUI="$enableval"])
468 AC_ARG_ENABLE(gui,
469   AS_HELP_STRING([--enable-gui=oldgui|newgui1|newgui2], 
470                  [enable GUI (newgui2 uses GTK2 (default), other GUIs use GTK1)]),
471   [GUI="$enableval"])
472 if test "$GUI" = "yes"; then
473   GUI=newgui2
475 if test ! "$GUI" = "newgui2"; then
476   if test ! "$GUI" = "newgui1"; then
477     if test ! "$GUI" = "oldgui"; then
478       GUI=no
479     fi
480   fi
483 AC_ARG_ENABLE(pthread,
484   AS_HELP_STRING([--disable-pthread], [disable the use of pthread, hurts performance!]),
485   [USE_PTHREAD="$enableval"])
486 AC_ARG_ENABLE(pthread-lib,
487   AS_HELP_STRING([--enable-pthread-lib], [legacy option]),
488   [USE_PTHREAD="$enableval"])
489 AC_ARG_ENABLE(iconv,
490   AS_HELP_STRING([--disable-iconv], [disable the use of iconv]),
491   [ICONV="$enableval"])
492 AC_ARG_ENABLE(gd,
493   AS_HELP_STRING([--disable-gd], [disable the use of gd]),
494   [GD="$enableval"])
495 AC_ARG_ENABLE(bzip2,
496   AS_HELP_STRING([--disable-bzip2], [disable the use of bzip2]),
497   [BZIP2="$enableval"])
498 AC_ARG_ENABLE(magic,
499   AS_HELP_STRING([--disable-magic], [disable the use of libmagic (GNU file)]),
500   [MAGIC="$enableval"])
501 AC_ARG_ENABLE(upnp-natpmp,
502   AS_HELP_STRING([--enable-upnp-natpmp], [enable the use of libminiupnpc and libnatpmp]),
503   [UPNP_NATPMP="$enableval"])
504 AC_ARG_ENABLE(force-upnp-natpmp,
505   AS_HELP_STRING([--enable-force-upnp-natpmp], [force local compilation of libminiupnpc and libnatpmp]),
506   [UPNP_NATPMP_FORCE="$enableval"])
508 if test "$FORCE_MINGW" = "yes"; then
509     CC="$CC -mno-cygwin"
510     CPP="$CPP -mno-cygwin"
511     OS_FILES=mingw
512     OS_FILES2=mingw
513     SYSTEM=mingw
516 OCAML_PATH=
518 echo ""
519 echo "--------------------------------"
520 echo "     Checking system tools."
521 echo "--------------------------------"
523 AC_PROG_RANLIB
524 AC_CHECK_PROG(GNU_MAKE, gmake, gmake)
525 AC_CHECK_PROG(GNU_MAKE, make, make)
527 if test "x$GNU_MAKE" != "x"; then
528   AC_MSG_CHECKING( [if $GNU_MAKE is GNU make] )
529   $GNU_MAKE --version > /dev/null 2>&1
530   if test "$?" != "0"; then
531     AC_MSG_RESULT([no])
532         AC_MSG_ERROR(GNU make not found)
533   else
534     AC_MSG_RESULT([yes])
535   fi
536 else
537   AC_MSG_ERROR(GNU make not found)
540 AC_CHECK_PROG(COMPRESS, bzip2, bzip2)
541 AC_CHECK_PROG(COMPRESS, gzip, gzip)
543 if test "$ac_cv_prog_COMPRESS" = "bzip2"; then
544    COMPRESS_EXT=bz2
545 else
546    COMPRESS_EXT=gz
549 AC_PATH_PROG(PERL, perl, perl)
550 AC_CHECK_PROG(RPMBUILD,rpmbuild,rpmbuild)
551 AC_CHECK_PROG(RPMBUILD,rpm,rpm)
553 AC_CHECK_PROG(WGET, wget, wget)
554 if test -z "$ac_cv_prog_WGET"; then
555   $CC -o wget wget.c || echo "Cannot compile wget.c"
556   AC_PATH_PROG(WGET, wget,,$SOURCE_DIR/config)
557   ac_cv_prog_WGET="$ac_cv_path_WGET"
559 WGET="$ac_cv_prog_WGET"
561 echo "----------------------------------------"
562 echo "     Checking system tools finished."
563 echo "----------------------------------------"
564 echo ""
565 echo "--------------------------------"
566 echo "     Checking OCaml compiler."
567 echo "--------------------------------"
569 CONFIG_DIR=$SOURCE_DIR/config
570 PATCH_DIR=$SOURCE_DIR/patches
571 LOCAL_DIR=$PATCH_DIR/local
572 BUILD_DIR=$PATCH_DIR/build
574 AC_ARG_ENABLE(local-prefix,
575   AS_HELP_STRING([--enable-local-prefix=DIR], [specify path for temporary tools installation (DIR must be absolute)]),
576   [LOCAL_DIR="$enableval"])
578 LOCAL=$LOCAL_DIR
579 LOCAL_OCAML=$LOCAL_DIR/bin
581 AC_PATH_PROG(OCAMLC,ocamlc.opt,"",[$LOCAL_DIR/bin:$PATH])
582 AC_CHECK_TOOL(OCAMLC,ocamlc,ocamlrun ocamlc)
583 AC_PATH_PROG(CAMLP4, camlp4,"",[$LOCAL_DIR/bin:$PATH])
585 BUILD_OCAML=no
586 if [ test -z "$OCAMLC" ] || [ test -z "$CAMLP4" ] || [ test "$REQUIRED_OCAML" = "SVN" ]; then
587    BUILD_OCAML=yes
588 else
589   OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
590   case "$OCAMLVERSION" in
591     "$REQUIRED_OCAML"*|4.*|3.12.*|3.11.*|3.10.1*|3.10.2*) ;;
592     *)
593         echo "Need build"
594         BUILD_OCAML=yes
595         ;;
596   esac
598 case "$REQUIRED_OCAML" in
599   3.10.0|3.0*)
600     echo "Need build"
601     REQUIRED_OCAML=3.12.0
602     BUILD_OCAML=yes
603     ;;
604 esac
605 if [ test "$BUILD_OCAML" = "yes" ] || [ test "$FORCE_OCAML" = "yes" ]; then
607   if [ test "$SYSTEM" = "mingw" ]; then
608     echo "********         Objective-Caml $REQUIRED_OCAML is required               *********" 1>&2;
609     echo "********     no valid OCaml compiler found on your system        *********" 1>&2;
610     echo "********   on MinGW there is no possibility to let configure     *********" 1>&2;
611     echo "********   build the OCaml compiler with the included script     *********" 1>&2;
612     echo "********    check http://mldonkey.sourceforge.net/Windows        *********" 1>&2;
613     echo "********   for instuctions how to compile OCaml under MinGW      *********" 1>&2;
614     exit 1
615   else  
616     
617   echo "********  Objective-Caml $REQUIRED_OCAML is required  *********" 1>&2;
618   if [ test "$WGET" = "" ] && [ test "$REQUIRED_OCAML" != "SVN" ]; then
619     echo "********          wget is missing          *********" 1>&2;
620     echo "********       cannot download OCaml       *********" 1>&2;
621     exit 1
622   fi
623   echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
624   echo "Do you want this script to try to download and install ocaml"
625   echo "LOCALLY in mldonkey directory ?"
626   if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
627   case "$i" in
628    y* | Y*)
629       cd $PATCH_DIR
630       if [ test "$REQUIRED_OCAML" = "SVN" ]; then
631         rm -rf $BUILD_DIR
632         mkdir -p $BUILD_DIR
633         cd $BUILD_DIR
634         svn checkout http://caml.inria.fr/svn/ocaml/trunk
635         cd trunk
636       else
637         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
638           echo Downloading ...
639           $WGET http://caml.inria.fr/pub/distrib/ocaml-"$DOWNLOAD_OCAML_MAJOR"/ocaml-"$REQUIRED_OCAML".tar.gz
640         fi
641         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
642           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-"$REQUIRED_OCAML".tar.gz
643         fi
644         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
645           $WGET http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-"$REQUIRED_OCAML".tar.gz
646         fi
647         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
648           $WGET http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-"$REQUIRED_OCAML".tar.gz
649         fi
650         if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
651           echo "********        download OCaml $REQUIRED_OCAML not successful, try do download it manually       *********" 1>&2;
652           echo "********        from http://caml.inria.fr/pub/distrib/                                   *********" 1>&2;
653           echo "********        and copy the tar.gz into $PATCH_DIR              *********" 1>&2;
654           exit 1
655         fi
657         echo Uncompressing ...
658         mkdir -p $BUILD_DIR
659         cd $BUILD_DIR
660         rm -rf ocaml-"$REQUIRED_OCAML"
661         gzip -cd $PATCH_DIR/ocaml-"$REQUIRED_OCAML".tar.gz | tar vxf -
662         cd ocaml-"$REQUIRED_OCAML"
663         if test -f $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch; then
664           echo Patching ...
665           patch -p1 < $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch
666         fi
667       fi
668       echo Configuring ...
669       ./configure -prefix $LOCAL_DIR -host $host -cc $CC
670       cd config
671       cp -f Makefile Makefile.old
672       sed "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" Makefile.old > Makefile
673       cd ..
674       cp -f $PATCH_DIR/Makefile.ocamldoc ocamldoc/Makefile
675       echo Compiling ...
676       $GNU_MAKE world opt opt.opt
677       echo Installing ...
678       $GNU_MAKE install
679       if ! test -f $LOCAL_DIR/lib/ocaml/threads; then
680         if ! test -f $LOCAL_DIR/lib/ocaml/vmthreads; then
681           ln -s vmthreads  $LOCAL_DIR/lib/ocaml/threads
682         fi
683       fi
684       cd $BUILD_DIR
685       if [ test "$REQUIRED_OCAML" = "SVN" ]; then
686         rm -rf trunk
687       else
688         rm -rf ocaml-"$REQUIRED_OCAML"
689       fi
690       cd $CONFIG_DIR
691       echo OCaml locally installed for mldonkey
693       if test -f "$LOCAL_OCAML"/ocamlc.opt; then
694          OCAMLC=$LOCAL_OCAML/ocamlc.opt
695          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc.opt
696       else
697       if test -f "$LOCAL_OCAML"/ocamlc; then
698          OCAMLC=$LOCAL_OCAML/ocamlc
699          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc
700       else
701         echo "OCaml installation failed"; exit 1
702       fi
703       fi
704       ;;
705    *)  exit 1;;
706   esac
707   fi
710 if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc.opt ; then
711   OCAML_PATH="$LOCAL_OCAML"/
712   OCAMLOPT=$LOCAL_OCAML/ocamlopt.opt
713   OCAMLDOC=$LOCAL_OCAML/ocamldoc
714   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
715   OCAMLDEP=$LOCAL_OCAML/ocamldep
716   OCAMLLEX=$LOCAL_OCAML/ocamllex.opt
717   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
718   CAMLP4=$LOCAL_OCAML/camlp4
719   CAMLP4OF=$LOCAL_OCAML/camlp4of
720 else
721   if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc ; then
722   OCAML_PATH="$LOCAL_OCAML"/
723   if test -f "$LOCAL_OCAML/ocamlopt"; then
724     OCAMLOPT=$LOCAL_OCAML/ocamlopt
725   else
726     OCAMLOPT=no
727   fi
728   OCAMLDOC=$LOCAL_OCAML/ocamldoc
729   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
730   OCAMLDEP=$LOCAL_OCAML/ocamldep
731   OCAMLLEX=$LOCAL_OCAML/ocamllex
732   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
733   CAMLP4=$LOCAL_OCAML/camlp4
734   CAMLP4OF=$LOCAL_OCAML/camlp4of
735   else
736   AC_CHECK_PROG(OCAMLOPT, ocamlopt.opt, ocamlopt.opt)
737   AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt, no)
738   AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
739   AC_CHECK_PROG(OCAMLLEX, ocamllex.opt, ocamllex.opt)
740   AC_CHECK_PROG(OCAMLLEX, ocamllex, ocamllex)
741   AC_CHECK_PROG(OCAMLYACC, ocamlyacc, ocamlyacc)
742   AC_CHECK_PROG(OCAMLDOC, ocamldoc, ocamldoc)
743   AC_CHECK_PROG(OCAMLMKTOP, ocamlmktop, ocamlmktop)
744   AC_CHECK_PROG(CAMLP4, camlp4, camlp4)
745   AC_CHECK_PROG(CAMLP4OF, camlp4of, camlp4of, $CAMLP4 pa_o.cmo pr_o.cmo Camlp4QuotationExpander.cmo Camlp4GrammarParser.cmo)
749 OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
750 OCAMLLIB=`$OCAMLC -where`
752 # check if native dynlink is supported and therefore needed for linking
753 CAMLP4LIB_OPT="camlp4lib.cmxa"
754 CAMLP4LIB_BYTE="camlp4lib.cma"
755 if test -f $OCAMLLIB/dynlink.cma; then
756   CAMLP4LIB_BYTE="dynlink.cma $CAMLP4LIB_BYTE"
758 if test -f $OCAMLLIB/dynlink.cmxa; then
759   CAMLP4LIB_OPT="dynlink.cmxa $CAMLP4LIB_OPT"
762 # force usage of supported OCaml versions
763 case "$OCAMLVERSION" in
764     3.10.1*|3.10.2*|3.1*|4.*) ;;
765     *)
766       if [ test "$REQUIRED_OCAML" != "SVN" ]; then
767         echo "********  Version $REQUIRED_OCAML of Objective-Caml is required  *********" 1>&2;
768         echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
769         exit 1
770       fi
771       ;;
772 esac
774 if test "$OCAMLOPT" = "no"; then
775   TARGET_TYPE=byte
776   OCAMLLIB_EXT=cma
777 else
778   TARGET_TYPE=opt
779   OCAMLLIB_EXT=cmxa
781   OCAMLOPTVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
783   test "$OCAMLOPTVERSION" = "$OCAMLVERSION" || {
784     echo "********  Version $REQUIRED_OCAML of ocamlopt is required  *********" 1>&2;
785     echo "*******  Check http://caml.inria.fr/  ********" 1>&2;
786     exit 1; }
790 echo "-------------------------------------------"
791 echo "     Checking OCaml $OCAMLVERSION finished."
792 echo "-------------------------------------------"
795 if test "$PROFILE" = "yes"; then
796    OCAMLOPT="$OCAMLOPT -p"
797    CFLAGS="$CFLAGS -pg"
799 if test "$FORCE_MINGW" = "yes"; then
800     OCAMLC="$OCAMLC -ccopt -mno-cygwin"
801     OCAMLOPT="$OCAMLOPT -ccopt -mno-cygwin"
802     OCAMLMKTOP="$OCAMLMKTOP -ccopt -mno-cygwin"
804 if test "$DEBUG" = "yes"; then
805     OCAMLC="$OCAMLC -g"
806     OCAMLOPT="$OCAMLOPT -g"
809 if test "$DEV" = "yes"; then
810   case "$OCAMLVERSION" in
811     3.*) DEVFLAGS="-annot" ;;
812     *) DEVFLAGS="-annot -bin-annot" ;;
813   esac
816 echo ""
817 echo "----------------------------------"
818 echo "     Checking system headers."
819 echo "----------------------------------"
821 ifelse(AC_ACVERSION, [2.13], [],
822 [dnl Large file enabled
823    AC_SYS_LARGEFILE
827 dnl Check for native endianness.
828 AC_C_BIGENDIAN(,,
829   [AC_MSG_ERROR([Machine endianness could not be determined])]
831 if test "x$WORDS_BIGENDIAN" = "x"; then
832   NATIVEENDIAN=LittleEndian
833 else
834   NATIVEENDIAN=BigEndian
836 AC_SUBST(NATIVEENDIAN)
838 # various header files
839 AC_CHECK_FUNCS(setrlimit getrlimit strerror_r strerror posix_fallocate)
840 AC_CHECK_HEADERS(byteswap.h,,)
841 AC_CHECK_HEADERS([sys/utsname.h])
842 AC_CHECK_HEADERS(arpa/inet.h,,)
843 AC_CHECK_HEADERS([sys/types.h sys/time.h sys/resource.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
844 [#ifdef HAVE_SYS_TYPES_H
845 #include <sys/types.h>
846 #endif
847 #ifdef HAVE_SYS_TIME_H
848 #include <sys/time.h>
849 #endif
850 #ifdef HAVE_NETINET_IN_SYSTM_H
851 #include <netinet/in_systm.h>
852 #endif
853 #ifdef HAVE_NETINET_IN_H
854 #include <netinet/in.h>
855 #endif
858 # poll if possible
859 AC_CHECK_HEADERS(sys/poll.h,,)
860 AC_CHECK_FUNCS(poll,,)
862 AC_CHECK_HEADERS(sys/vfs.h,,)
863 AC_CHECK_HEADERS(sys/statvfs.h,,)
864 AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
865 [#if HAVE_SYS_PARAM_H
866 #include <sys/param.h>
867 #endif
869 echo "-------------------------------------------"
870 echo "     Checking system headers finished."
871 echo "-------------------------------------------"
872 echo ""
873 echo "-----------------------------------"
874 echo "     Checking system libraries."
875 echo "-----------------------------------"
876 echo "----- checking zlib (required)"
877 AC_CHECK_LIB(z,inflate,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
878 AC_CHECK_HEADERS(zlib.h,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
879 AC_CHECK_LIB(z,zlibVersion,[AC_DEFINE(HAVE_ZLIBVERSION, 1,)])
881 if test "$BZIP2" != "no"; then
882   echo "----- checking bzlib (optional)"
883   AC_CHECK_HEADERS(bzlib.h,[AC_CHECK_LIB(bz2,BZ2_bzReadOpen,[BZIP2=yes],[BZIP2=no])],[BZIP2=no])
886 if test "$BZIP2" = "yes"; then
887   AC_CHECK_LIB(bz2,BZ2_bzlibVersion,[AC_DEFINE(HAVE_BZLIBVERSION, 1,)])
888   AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
889 else
890   AC_MSG_NOTICE(bzlib not available)
893 if test "$UPNP_NATPMP_FORCE" = "yes"; then
894         UPNP_NATPMP=yes
895         cd $PATCH_DIR
896         MINIUPNPC=miniupnpc-1.9
897         LIBNATPMP=libnatpmp-20131126
898         $WGET http://miniupnp.tuxfamily.org/files/$MINIUPNPC.tar.gz
899         $WGET http://miniupnp.tuxfamily.org/files/$LIBNATPMP.tar.gz
900         mkdir -p $BUILD_DIR $LOCAL_DIR/usr/bin $LOCAL_DIR/usr/lib $LOCAL_DIR/usr/include/miniupnpc
901         cd $BUILD_DIR
902         rm -rf $LIBNATPMP $MINIUPNPC
903         tar -xzf $PATCH_DIR/$MINIUPNPC.tar.gz
904         tar -xzf $PATCH_DIR/$LIBNATPMP.tar.gz
905         cd $BUILD_DIR/$LIBNATPMP
906         $GNU_MAKE all install PREFIX=$LOCAL_DIR
907         cd $BUILD_DIR/$MINIUPNPC
908         $GNU_MAKE all install PREFIX=$LOCAL_DIR
909         cd $CONFIG_DIR
910         rm -rf $BUILD_DIR/$LIBNATPMP $BUILD_DIR/$MINIUPNPC
911         CPPFLAGS="${CPPFLAGS} -I$LOCAL_DIR/usr/include"
912         LDFLAGS="${LDFLAGS} -L$LOCAL_DIR/usr/lib"
915 if test "$UPNP_NATPMP" = "yes"; then
916   echo "----- checking libminiupnpc >= 1.6 (optional)"
917   AC_CHECK_HEADERS(miniupnpc/miniupnpc.h,[AC_CHECK_LIB(miniupnpc,upnpDiscover,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
920 if test "$UPNP_NATPMP" = "yes"; then
921   echo "----- checking libnatpmp >= 20110808 (optional)"
922   AC_CHECK_HEADERS(natpmp.h,[AC_CHECK_LIB(natpmp,initnatpmp,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
925 if test "$UPNP_NATPMP" = "yes"; then
926   AC_DEFINE(ENABLE_UPNP_NATPMP, 1, [Define to 1 if you have libminiupnpc & libnatpmp for port forwarding support.])
927   UPNP_NATPMP_LIBS="-lminiupnpc -lnatpmp $LIBS"
928   UPNP_NATPMP_STATIC_LIBS="-lminiupnpc -lnatpmp $LIBS"
931 if test "$MAGIC" != "no"; then
932   echo "----- checking libmagic (GNU file) (optional)"
933   AC_CHECK_HEADERS(magic.h,
934     [AC_CHECK_LIB(magic,magic_file,
935       [AC_CHECK_DECL([MAGIC_ERROR], [MAGIC=yes], [MAGIC=no],[#include <magic.h>])],
936       [MAGIC=no])],
937     [MAGIC=no])
940 if test "$MAGIC" = "yes"; then
941   MAGICLIB=Magic_magic
942 else
943   MAGICLIB=Magic_nomagic
944   AC_MSG_NOTICE(libmagic not available)
947 GD_JPG=no
948 GD_PNG=no
949 if test "$GD" != "no"; then
950   echo "----- checking gd (optional)"
951   GD=no
952   LIBGD=no
953   SAVE_LIBS=$LIBS
954   SAVE_CFLAGS=$CFLAGS
955   SAVE_LDFLAGS=$LDFLAGS
956   AC_CHECK_PROG(GDLIBCONFIG, gdlib-config, gdlib-config)
957   if test "$ac_cv_prog_GDLIBCONFIG" = "gdlib-config"; then
958     GD_LIBS=`$GDLIBCONFIG --libs`
959     $GDLIBCONFIG --static-libs > /dev/null 2>&1
960     if test "$?" = "0"; then
961       GD_STATIC_LIBS=`$GDLIBCONFIG --static-libs`
962     fi
963     GD_LIBS2="$LIBS -lgd $GD_LIBS"
964     LIBS=$GD_LIBS2
965     GD_CFLAGS=`$GDLIBCONFIG --cflags`
966     CFLAGS="$CFLAGS $GD_CFLAGS"
967     GD_LDFLAGS=`$GDLIBCONFIG --ldflags`
968     LDFLAGS="$LDFLAGS $GD_LDFLAGS"
969     AC_MSG_CHECKING(for libgd > 2.0.14)
970     GDVERSION=`$GDLIBCONFIG --version`
971     GDMAJORVERSION=`$GDLIBCONFIG --majorversion`
972     GDMINORVERSION=`$GDLIBCONFIG --minorversion`
973     GDREVISION=`$GDLIBCONFIG --revision`
974     case $GDMAJORVERSION in
975         1)
976             AC_MSG_RESULT(no (found $GDVERSION))
977             LIBGD=no
978             ;;
979         2)
980             if test $GDMINORVERSION -ge 1; then
981                 AC_MSG_RESULT($GDVERSION)
982                 LIBGD=yes
983             else
984                 if test $GDREVISION -gt 14; then
985                     AC_MSG_RESULT($GDVERSION)
986                     LIBGD=yes
987                 else
988                     AC_MSG_RESULT(no (found $GDVERSION))
989                     LIBGD=no
990                 fi
991             fi
992             ;;
993         *)
994             AC_MSG_RESULT($GDVERSION)
995             LIBGD=yes
996             ;;
997     esac
998   else
999     LIBGD=yes
1000   fi
1002   if test "$LIBGD" = "yes"; then
1003     AC_CHECK_HEADERS(gd.h,[LIBGD=yes],[LIBGD=no])
1004   fi
1006   if test "$LIBGD" = "yes"; then
1007     AC_MSG_CHECKING(for gdImageCreate in -lgd)
1008     AC_TRY_LINK([#include <gd.h>],
1009     [gdImageCreate (0,0);],
1010     [LIBGD=yes], [LIBGD=no])
1011     AC_MSG_RESULT($LIBGD)
1012     LIBS=$SAVE_LIBS
1014     if test "$LIBGD" = "no"; then
1015       AC_MSG_NOTICE([not found, trying another method])
1016       AC_CHECK_LIB(gd, gdImageCreate, [LIBGD=yes], [LIBGD=no])
1017     fi
1018   fi
1020   if test "$LIBGD" = "yes"; then
1021     LIBPNG=no
1022 # saving current variables
1023     SAVE_LIBS_PNG=$LIBS
1024     SAVE_CFLAGS_PNG=$CFLAGS
1025     SAVE_LDFLAGS_PNG=$LDFLAGS
1026     AC_CHECK_PROG(PNGLIBCONFIG, libpng-config, libpng-config)
1027     if test "$ac_cv_prog_PNGLIBCONFIG" = "libpng-config"; then
1028 # check libpng-config contents and update system variables
1029       PNG_LIBS=`$PNGLIBCONFIG --libs`
1030       LIBS="$LIBS $PNG_LIBS"
1031       PNG_CFLAGS=`$PNGLIBCONFIG --cflags`
1032       CFLAGS="$CFLAGS $PNG_CFLAGS"
1033       PNG_LDFLAGS=`$PNGLIBCONFIG --ldflags`
1034       LDFLAGS="$LDFLAGS $PNG_LDFLAGS"
1035     fi
1036     AC_CHECK_LIB(png, png_create_read_struct , [LIBPNG=yes])
1037 # restore variables
1038     LIBS=$SAVE_LIBS_PNG
1039     CFLAGS=$SAVE_CFLAGS_PNG
1040     LDFLAGS=$SAVE_LDFLAGS_PNG
1042     if test "$LIBPNG" = "no"; then
1043       AC_MSG_NOTICE(png support not available)
1044     else
1045       LIBGD_PNG=no
1046       LIBS=$GD_LIBS2
1047       AC_MSG_CHECKING(for gdImagePng in -lgd)
1048       AC_TRY_LINK([#include <gd.h>],
1049       [gdImagePng (0,0);],
1050       [LIBGD_PNG=yes], [LIBGD_PNG=no])
1051       AC_MSG_RESULT($LIBGD_PNG)
1052       LIBS=$SAVE_LIBS
1054       if test "$LIBGD_PNG" = "no"; then
1055         AC_MSG_NOTICE([not found, trying another method])
1056         AC_CHECK_LIB(gd, gdImagePng, [LIBGD_PNG=yes], [LIBGD_PNG=no])
1057       fi
1059       AC_MSG_CHECKING(for png support in libgd)
1060       if test "$LIBGD_PNG" = "yes"; then
1061         GD=yes
1062         GD_PNG=yes
1063         GD_LIBS="$GD_LIBS $PNG_LIBS"
1064         AC_MSG_RESULT(yes)
1065         AC_CHECK_LIB(png, png_access_version_number,[AC_DEFINE(HAVE_PNGVERSION, 1,)])
1066         AC_DEFINE(HAVE_GD_PNG, 1, [Define to 1 if you have png support in libgd.])
1067       else
1068         AC_MSG_RESULT(no)
1069       fi
1070     fi
1072     LIBJPEG=no
1073     AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [LIBJPEG=yes])
1075     if test "$LIBJPEG" = "no"; then
1076       AC_MSG_NOTICE(jpeg support not available)
1077     else
1078       LIBGD_JPG=no
1079       LIBS=$GD_LIBS2
1080       AC_MSG_CHECKING(for gdImageJpeg in -lgd)
1081       AC_TRY_LINK([#include <gd.h>],
1082       [gdImageJpeg (0,0,0);],
1083       [LIBGD_JPG=yes], [LIBGD_JPG=no])
1084       AC_MSG_RESULT($LIBGD_JPG)
1085       LIBS=$SAVE_LIBS
1087       if test "$LIBGD_JPG" = "no"; then
1088         AC_MSG_NOTICE([not found, trying another method])
1089         AC_CHECK_LIB(gd, gdImageJpeg, [LIBGD_JPG=yes], [LIBGD_JPG=no])
1090       fi
1092       AC_MSG_CHECKING(for jpeg support in libgd)
1093       if test "$LIBGD_JPG" = "yes"; then
1094         GD=yes
1095         GD_JPG=yes
1096         GD_LIBS="$GD_LIBS -ljpeg"
1097         AC_DEFINE(HAVE_GD_JPG, 1, [Define to 1 if you have jpg support in libgd.])
1098         AC_MSG_RESULT(yes)
1099       else
1100         AC_MSG_RESULT(no)
1101       fi
1102     fi
1103   else
1104     AC_MSG_NOTICE(libgd not available)
1105   fi
1106   LIBS=$SAVE_LIBS
1107   CFLAGS=$SAVE_CFLAGS
1108   LDFLAGS=$SAVE_LDFLAGS
1111 if test "$GD" != "no"; then
1112   GDGRAPHICS=DriverGraphics_gd
1113 else
1114   GDGRAPHICS=DriverGraphics_nogd
1117 if test "$ICONV" = "yes"; then
1118   echo "----- checking iconv (optional)"
1119   AM_ICONV
1120   if test "$am_cv_func_iconv" != "yes"; then
1121     AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1122     ICONV=no
1123   else
1124   LIBS="$LIBS $LIBICONV"
1125   AC_CHECK_FUNCS([locale_charset],,
1126   AC_TRY_LINK([#include <langinfo.h>],
1127   [char* cs = nl_langinfo(CODESET);],
1128   AC_MSG_NOTICE(found nl_langinfo(CODESET)),
1129   [echo "Your iconv implementation is incomplete"; exit 1]))
1130   AC_CHECK_LIB(charset,locale_charset)
1131   AC_CHECK_HEADERS([libcharset.h])
1132   AC_CHECK_HEADERS([langinfo.h])
1133   AC_CHECK_HEADERS([locale.h])
1134   fi
1135 else
1136   AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1137   ICONV=no
1140 if test "$USE_PTHREAD" = "no"; then
1141  PTHREAD_LIBS=""
1142  echo "You disabled thread support, this will hurt MLDonkey performance!"
1143 else
1144   echo "----- checking thread support (optional, strongly advised)"
1145   ACX_PTHREAD
1148 # On linux plaforms, we will have to check that includes from kernel are
1149 # available. glibc version test was shamelessly taken from
1150 # http://public.activestate.com/gsar/APC/perl-5.8.x/Configure
1151 GLIBC_VERSION=""
1152 case $host in
1153         *linux*)
1154            echo "----- GNU C Library version"
1155            AC_CHECK_HEADERS(linux/limits.h,, [
1156              OLD_CPPFLAGS=$CPPFLAGS
1157              CPPFLAGS="-I /usr/src/linux/include"
1158              AC_CHECK_HEADER(linux/types.h,[CONFIG_INCLUDES="-I /usr/src/linux/include"])
1159              CPPFLAGS=$OLD_CPPFLAGS]
1160            )
1161            AC_CHECK_HEADERS(gnu/libc-version.h,[AC_MSG_CHECKING(for GNU C Library version)
1163 cat >try.c <<'EOCP'
1164 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
1165    alone are insufficient to distinguish different versions, such as
1166    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
1167    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
1169 #include <stdio.h>
1170 int main(void)
1172 #ifdef __GLIBC__
1173 #   ifdef __GLIBC_MINOR__
1174 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1175 #           include <gnu/libc-version.h>
1176     printf("%s\n",  gnu_get_libc_version());
1177 #       else
1178     printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
1179 #       endif
1180 #   else
1181 printf("%d\n",  __GLIBC__);
1182 #   endif
1183     return 0;
1184 #else
1185     return 1;
1186 #endif
1188 EOCP
1190            $CC -o try ./try.c
1191            GLIBC_VERSION="`./try`"
1192            AC_MSG_RESULT($GLIBC_VERSION)
1193            rm -f try try.*],)
1194         ;;
1195         *)         ;;
1196 esac
1198 echo "---------------------------------------------"
1199 echo "     Checking system libraries finished."
1200 echo "---------------------------------------------"
1201 echo ""
1203 CXX_VERSION=
1204 CRYPTOPPFLAGS=
1205 echo "--------------------------------------"
1206 echo "     Checking activated networks."
1207 echo "--------------------------------------"
1209   if test "$DONKEY" = "yes"; then
1210     AC_MSG_CHECKING(eDonkey)
1211     if test -d ../src/networks/donkey; then
1212       AC_MSG_RESULT(yes)
1213       if test "$DONKEY_SUI" = "yes"; then
1214         AC_PROG_CXX
1216 # GCC miscompiles cryptopp.cc with -O2 on armhf
1217 # http://mldonkey.sourceforge.net/phpBB2/viewtopic.php?p=32309#32309
1218 # https://bugs.launchpad.net/ubuntu/+source/mldonkey/+bug/1060007
1219         case "$host" in
1220                 armv7l-*-linux-gnueabihf)
1221                         CXXFLAGS="-g -Os"
1222                         ;;
1223         esac
1225         AC_CHECK_TOOL(NEWCXX, [$CXX], [no])
1226         AC_MSG_CHECKING(eMule SUI)
1227         if test x"$NEWCXX" = x"no"
1228         then
1229           AC_MSG_RESULT(no)
1230           CXX=
1231           DONKEY_SUI=no
1232         else
1233           AC_MSG_RESULT(yes)
1234           ACX_CHECK_CXX_FLAGS(-fno-omit-frame-pointer,cv_no_omit_frame_pointer, CRYPTOPPFLAGS="-fno-omit-frame-pointer")
1235           ACX_CHECK_CXX_FLAGS(-mno-omit-leaf-frame-pointer,cv_no_omit_leaf_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -mno-omit-leaf-frame-pointer")
1236           CXX=$NEWCXX
1237           CXX_VERSION=`$CXX -dumpversion`
1238           DONKEY_SUI_FILE=DonkeySui1
1239           AC_DEFINE(HAVE_CRYPTOPP, 1,)
1240         fi
1241       fi
1242 #      AC_MSG_CHECKING(eDonkey server)
1243 #      if test -d ../src/networks/server; then
1244 #        AC_MSG_RESULT(no)
1245 #        DONKEY_SERVER=no
1246 #      else
1247 #        AC_MSG_RESULT(no)
1248 #        DONKEY_SERVER=no
1249 #      fi
1250     else
1251       DONKEY=no
1252       DONKEY_SUI=no
1253       AC_MSG_RESULT(no)
1254     fi
1255   else
1256     DONKEY_SUI=no
1257   fi
1259   if test "$BITTORRENT" = "yes"; then
1260     AC_MSG_CHECKING(BitTorrent)
1261     if test -d ../src/networks/bittorrent; then
1262       AC_MSG_RESULT(yes)
1263     else
1264       BITTORRENT=no
1265       AC_MSG_RESULT(no)
1266     fi
1267   fi
1269   if test "$FILETP" = "yes"; then
1270     AC_MSG_CHECKING(FileTP)
1271     if test -d ../src/networks/fileTP; then
1272       AC_MSG_RESULT(yes)
1273     else
1274       FILETP=no
1275       AC_MSG_RESULT(no)
1276     fi
1277   fi
1279   if test "$GNUTELLA" = "yes"; then
1280     AC_MSG_CHECKING(Gnutella)
1281     if test -d ../src/networks/gnutella; then
1282       AC_MSG_RESULT(yes)
1283     else
1284       GNUTELLA=no
1285       AC_MSG_RESULT(no)
1286     fi
1287   fi
1289   if test "$GNUTELLA2" = "yes"; then
1290     AC_MSG_CHECKING(G2)
1291     if test -d ../src/networks/gnutella2; then
1292       AC_MSG_RESULT(yes)
1293     else
1294       GNUTELLA2=no
1295       AC_MSG_RESULT(no)
1296     fi
1297   fi
1299   if test "$FASTTRACK" = "yes"; then
1300     AC_MSG_CHECKING(Fasttrack)
1301     if test -d ../src/networks/fasttrack; then
1302       AC_MSG_RESULT(yes)
1303     else
1304       FASTTRACK=no
1305       AC_MSG_RESULT(no)
1306     fi
1307   fi
1309   if test "$DIRECT_CONNECT" = "yes"; then
1310     AC_MSG_CHECKING(DirectConnect)
1311     if test "$BZIP2" = "yes"; then
1312       if test -d ../src/networks/direct_connect; then
1313         AC_MSG_RESULT(yes)
1314       else
1315         DIRECT_CONNECT=no
1316         AC_MSG_RESULT(no)
1317       fi
1318     else
1319       DIRECT_CONNECT=no
1320       AC_MSG_RESULT(no - bzip2 support missing)
1321     fi
1322   fi
1324   if test "$SOULSEEK" = "yes"; then
1325     AC_MSG_CHECKING(Soulseek)
1326     if test -d ../src/networks/soulseek; then
1327       AC_MSG_RESULT(yes)
1328     else
1329       SOULSEEK=no
1330       AC_MSG_RESULT(no)
1331     fi
1332   fi
1334   if test "$OPEN_NAPSTER" = "yes"; then
1335     AC_MSG_CHECKING(OpenNapster)
1336     if test -d ../src/networks/opennap; then
1337       AC_MSG_RESULT(yes)
1338     else
1339       OPEN_NAPSTER=no
1340       AC_MSG_RESULT(no)
1341     fi
1342   fi
1344   if test "$OPENFT" = "yes"; then
1345     AC_MSG_CHECKING(OpenFT)
1346     if test -d ../src/networks/openFT; then
1347       AC_MSG_RESULT(yes)
1348     else
1349       OPENFT=no
1350       AC_MSG_RESULT(no)
1351     fi
1352   fi
1353 echo "-----------------------------------------------"
1354 echo "     Checking activated networks finished."
1355 echo "-----------------------------------------------"
1357 if test -f $OCAMLLIB/lablgl.cma; then
1358   LABLGL_CMA=lablgl.cma
1361 if test -f $OCAMLLIB/lablgl.$OCAMLLIB_EXT; then
1362   LABLGL_CMXA=lablgl.$OCAMLLIB_EXT
1365 # Check for GTK only if we want to build the GUI
1366 if test ! "$GUI" = "no"; then
1367   echo "---------------------------------------------------------"
1368   echo "Checking the libraries required to build the GTK GUI."
1369   echo "---------------------------------------------------------"
1370   if test "$GUI" = "newgui2"; then
1371       REQUIRED_GTK=2.4.0
1372       PKG_GTK=gtk+-2.0
1373       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1374       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1375         AC_MSG_RESULT(yes)
1376         REQUIRED_RSVG=2.4.0
1377         PKG_RSVG=librsvg-2.0
1378         AC_MSG_CHECKING(for librsvg - version >= $REQUIRED_RSVG)
1379         if pkg-config --atleast-version $REQUIRED_RSVG $PKG_RSVG; then
1380           GTK_CONFIG="pkg-config $PKG_GTK $PKG_RSVG"
1381           REQUIRED_LABLGTK=2.14.2
1382           LABLGTK_NAME=lablgtk2
1383           AC_MSG_RESULT(yes)
1384         else
1385           GTK_CONFIG=no
1386           AC_MSG_RESULT(no)
1387         fi
1388       else
1389         GTK_CONFIG=no
1390         AC_MSG_RESULT(no)
1391       fi
1392   else
1393     if test "$OS_FILES2" = "mingw"; then
1394       REQUIRED_GTK=1.3.0
1395       PKG_GTK=gtk+-1.3-win32-production
1396       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1397       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1398         GTK_CONFIG="pkg-config $PKG_GTK"
1399         AC_MSG_RESULT(yes)
1400       else
1401         GTK_CONFIG=no
1402         AC_MSG_RESULT(no)
1403       fi
1404     else
1405       AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no)
1406       if test "$GTK_CONFIG" = "no"; then
1407         AC_MSG_RESULT(no)
1408       else
1409         AC_MSG_RESULT(yes)
1410       fi
1411     fi
1412   fi
1413 else
1414   GTK_CONFIG=no
1416 if test "$GTK_CONFIG" = "no"; then
1417      LABLGTK_CONFIG=no
1418 else
1419   AC_MSG_CHECKING(for native code $LABLGTK_NAME)
1420   if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1421      if test "$GUI" = "newgui2"; then
1422        if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.$OCAMLLIB_EXT; then
1423          AC_MSG_RESULT(yes)
1424          LABLGTK_CONFIG=yes
1425        else
1426          AC_MSG_RESULT(no)
1427          LABLGTK_CONFIG=no
1428          if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.cma; then
1429            echo "---------------------------------------------------------"
1430            echo "lablrsvg is not installed properly. See the INSTALL.txt"
1431            echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1432            echo "probably forgot to call 'make opt' before 'make install'."
1433            echo "---------------------------------------------------------"
1434          else
1435            echo "---------------------------------------------------------"
1436            echo "lablrsvg is not installed. See the INSTALL.txt file of"
1437            echo "mldonkey to see how to compile $LABLGTK_NAME. Librsvg"
1438            echo "may not be installed when you compiled $LABLGTK_NAME."
1439            echo "---------------------------------------------------------"
1440          fi
1441        fi
1442      else
1443        AC_MSG_RESULT(yes)
1444        LABLGTK_CONFIG=yes
1445      fi
1446   else
1447      AC_MSG_RESULT(no)
1448      LABLGTK_CONFIG=no
1449      if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.cma; then
1450        echo "-------------------------------------------------------------"
1451        echo "$LABLGTK_NAME is not installed properly. See the INSTALL.txt"
1452        echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1453        echo "probably forgot to call 'make opt' before 'make install'."
1454        echo "-------------------------------------------------------------"
1455      else
1456        echo "Do you want this script to try to download and install $LABLGTK_NAME"
1457        echo "LOCALLY in mldonkey directory ?"
1458        if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
1459        case "$i" in
1460         y* | Y*)
1462          cd $PATCH_DIR
1463          rm -rf lablgtk-"$REQUIRED_LABLGTK"
1464          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then
1465            echo Downloading ...
1466            $WGET http://www.math.nagoya-u.ac.jp/~garrigue/soft/olabl/dist/lablgtk-"$REQUIRED_LABLGTK".tar.gz
1467          fi
1468          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then exit 1; fi
1470          mkdir -p $BUILD_DIR
1471          cd $BUILD_DIR
1472          echo Uncompressing ...
1473          gzip -cd $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".tar.gz | tar xf -
1474          (cd lablgtk-"$REQUIRED_LABLGTK"
1475           if test -f $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch; then
1476             echo Patching ...
1477             patch -p0 < $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch
1478           fi
1479           PATH=$OCAML_PATH:$PATH
1480           export PATH
1481           echo $PATH
1483           if test "$GUI" = "newgui2"; then
1484             ./configure --prefix=$LOCAL_DIR
1485             $GNU_MAKE world
1486             $GNU_MAKE install
1487           else
1488             $GNU_MAKE configure
1489             $GNU_MAKE
1490             $GNU_MAKE opt
1491             $GNU_MAKE install
1492           fi
1494           cd ..
1495           rm -rf lablgtk-"$REQUIRED_LABLGTK"
1496          )
1497          cd $CONFIG_DIR
1498          if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1499             LABLGTK_CONFIG=yes
1500          else
1501             echo "Installation of $LABLGTK_NAME failed"
1502             LABLGTK_CONFIG=no
1503          fi
1504          ;;
1505         *);;
1506       esac
1507      fi
1508   fi
1511 if test "$GUI" = "newgui2" ; then
1512   GUIS="mldonkey_gui\$(EXE)"
1513   GTKCFLAGS="`pkg-config --cflags-only-I gtk+-2.0`"
1514   GTKLLIBS="`pkg-config --libs-only-L gtk+-2.0`"
1515   GTKLFLAGS="`pkg-config --libs-only-l gtk+-2.0` -lX11"
1516 else
1517   GUIS="mldonkey_gui\$(EXE) mldonkey_gui2\$(EXE)"
1520 if test "$LABLGTK_CONFIG" = "no"; then
1521   GUI="no"
1522 else
1523   MORE_TARGETS="$MORE_TARGETS $GUIS"
1524   AC_MSG_CHECKING(GToolbox.popup_menu args)
1525   GTOOLBOX="$OCAMLLIB/$LABLGTK_NAME/gToolbox.mli"
1526   grep popup $GTOOLBOX | grep -i button 2> /dev/null && GTOOLBOX_ARGS=new
1527   if test "$GTOOLBOX_ARGS" = "new"; then
1528     GTOOLBOX_POPUPMENU=' ~button: button ~time: time '
1529     AC_MSG_RESULT(new)
1530   else
1531     GTOOLBOX_POPUPMENU=' ~x: button ~y: time '
1532     AC_MSG_RESULT(old)
1533   fi
1534   echo "---------------------------------------------------------"
1535   echo "End of GTK GUI configuration."
1536   echo "---------------------------------------------------------"
1539 if test "$OS_FILES" = "mingw"; then
1540    OCAMLDEP_OPTIONS="-slash"
1543 AC_SUBST(LIBS)
1544 AC_SUBST(CFLAGS)
1545 AC_SUBST(CPPFLAGS)
1546 AC_SUBST(CXXFLAGS)
1547 AC_SUBST(LDFLAGS)
1548 AC_SUBST(CC)
1549 AC_SUBST(CPP)
1550 AC_SUBST(CXX)
1551 AC_SUBST(FIX_BROKEN_CPP)
1552 AC_SUBST(CONFIG_INCLUDES)
1553 AC_SUBST(OCAMLC)
1554 AC_SUBST(OCAMLLIB)
1555 AC_SUBST(OCAMLOPT)
1556 AC_SUBST(OCAMLLEX)
1557 AC_SUBST(OCAMLYACC)
1558 AC_SUBST(OCAMLDEP)
1559 AC_SUBST(OCAMLDEP_OPTIONS)
1560 AC_SUBST(CAMLP4)
1561 AC_SUBST(CAMLP4OF)
1562 AC_SUBST(CAMLP4LIB_OPT)
1563 AC_SUBST(CAMLP4LIB_BYTE)
1564 AC_SUBST(PERL)
1565 AC_SUBST(OCAMLDOC)
1566 AC_SUBST(OCAMLMKTOP)
1567 AC_SUBST(SYSTEM)
1568 AC_SUBST(MORE_TARGETS)
1569 AC_SUBST(MORE_SUBDIRS)
1570 AC_SUBST(LABLGL_CMA)
1571 AC_SUBST(LABLGL_CMXA)
1572 AC_SUBST(MD4ARCH)
1573 AC_SUBST(MD4COMP)
1574 AC_SUBST(ICONV)
1575 AC_SUBST(OPEN_NAPSTER)
1576 AC_SUBST(DIRECT_CONNECT)
1577 AC_SUBST(GNUTELLA)
1578 AC_SUBST(GNUTELLA2)
1579 AC_SUBST(BITTORRENT)
1580 AC_SUBST(FILETP)
1581 AC_SUBST(SOULSEEK)
1582 AC_SUBST(OPENFT)
1583 AC_SUBST(FASTTRACK)
1584 AC_SUBST(DONKEY)
1585 AC_SUBST(DONKEY_SUI)
1586 AC_SUBST(CRYPTOPPFLAGS)
1587 AC_SUBST(DONKEY_SUI_FILE)
1588 AC_SUBST(DONKEY_SERVER)
1589 AC_SUBST(GUI)
1590 AC_SUBST(REQUIRED_OCAML)
1591 AC_SUBST(REQUIRED_LABLGTK)
1592 AC_SUBST(ARCH)
1593 AC_SUBST(COMPRESS)
1594 AC_SUBST(COMPRESS_EXT)
1595 AC_SUBST(CHECKBOUNDS)
1596 AC_SUBST(MLDONKEY_VERSION)
1597 AC_SUBST(SCM_VERSION)
1598 AC_SUBST(MAJOR_VERSION)
1599 AC_SUBST(MINOR_VERSION)
1600 AC_SUBST(SUB_VERSION)
1601 AC_SUBST(GTOOLBOX_POPUPMENU)
1602 AC_SUBST(OS_FILES)
1603 AC_SUBST(OS_FILES2)
1604 AC_SUBST(TARGET_TYPE)
1605 AC_SUBST(RPMBUILD)
1606 AC_SUBST(GTKCFLAGS)
1607 AC_SUBST(GTKLLIBS)
1608 AC_SUBST(GTKLFLAGS)
1609 AC_SUBST(GD)
1610 AC_SUBST(GD_JPG)
1611 AC_SUBST(GD_PNG)
1612 AC_SUBST(GDGRAPHICS)
1613 AC_SUBST(GD_LIBS)
1614 AC_SUBST(GD_STATIC_LIBS)
1615 AC_SUBST(GD_CFLAGS)
1616 AC_SUBST(GD_LDFLAGS)
1617 AC_SUBST(BZIP2)
1618 AC_SUBST(MAGIC)
1619 AC_SUBST(MAGICLIB)
1620 AC_SUBST(UPNP_NATPMP)
1621 AC_SUBST(UPNP_NATPMP_LIBS)
1622 AC_SUBST(UPNP_NATPMP_STATIC_LIBS)
1623 BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
1624 AC_SUBST(BUILD_SYSTEM)
1625 AC_SUBST(GLIBC_VERSION)
1626 AC_SUBST(CC_VERSION)
1627 AC_SUBST(CXX_VERSION)
1628 AC_SUBST(CONFIGURE_ARGUMENTS)
1629 AC_SUBST(CONFIGURE_RUN)
1630 AC_SUBST(DEVFLAGS)
1632 AUTOCONF=../src/utils/lib/autoconf.ml
1633 GTK_AUTOCONF=../src/utils/lib/gAutoconf.ml
1634 AC_OUTPUT(\
1635   Makefile.config \
1636   mldonkey.rc \
1637   $AUTOCONF.new $GTK_AUTOCONF.new \
1638    ../src/utils/bitstring/bitstring.ml \
1639    ../src/utils/lib/magic.ml \
1640    ../src/networks/donkey/donkeySui.ml \
1641    ../src/daemon/driver/driverGraphics.ml \
1642    ../packages/rpm/mldonkey.spec \
1643    ../packages/rpm/Makefile \
1644    ../packages/slackware/mldonkey.options)
1645 diff $AUTOCONF.new $AUTOCONF 2> /dev/null > /dev/null || cp -f $AUTOCONF.new $AUTOCONF
1646 diff $GTK_AUTOCONF.new $GTK_AUTOCONF 2> /dev/null > /dev/null || cp -f $GTK_AUTOCONF.new $GTK_AUTOCONF
1648 cd ..
1650 echo ""
1651 echo "Building dependencies (if it blocks, try '$GNU_MAKE depend' to see the problem)"
1652 $GNU_MAKE depend 2> /dev/null > /dev/null || echo "Building dependencies fails: try: '$GNU_MAKE depend'"
1654 echo ""
1655 printf "Configuring MLDonkey %s" "$MLDONKEY_VERSION"
1656 if test ! -z "$SCM_VERSION"; then
1657   printf " - SCM: %s" "$SCM_VERSION"
1659 echo " completed."
1661 echo ""
1662 echo "Network modules:"
1663 printf " - eDonkey           "
1664 if test "$DONKEY" = "yes"; then
1665   if test "$DONKEY_SUI" = "yes"; then
1666     echo "enabled (eMule SUI enabled)"
1667   else
1668     echo "enabled (eMule SUI disabled)"
1669   fi
1670 else
1671   echo "        disabled"
1674 printf " - BitTorrent        "
1675 if test "$BITTORRENT" = "yes"; then
1676   echo "enabled"
1677 else
1678   echo "        disabled"
1681 printf " - FileTP (aka wget) "
1682 if test "$FILETP" = "yes"; then
1683   echo "enabled"
1684 else
1685   echo "        disabled"
1688 printf " - Fasttrack         "
1689 if test "$FASTTRACK" = "yes"; then
1690   echo "enabled"
1691 else
1692   echo "        disabled"
1695 printf " - Gnutella          "
1696 if test "$GNUTELLA" = "yes"; then
1697   echo "enabled (warning: this network module is unmaintained)"
1698 else
1699   echo "        disabled - unmaintained"
1702 printf " - Gnutella2         "
1703 if test "$GNUTELLA2" = "yes"; then
1704   echo "enabled (warning: this network module is unmaintained)"
1705 else
1706   echo "        disabled - unmaintained"
1709 printf " - Direct Connect    "
1710 if test "$DIRECT_CONNECT" = "yes"; then
1711   echo "enabled"
1712 else
1713   echo "        disabled"
1716 printf " - Open Napster      "
1717 if test "$OPEN_NAPSTER" = "yes"; then
1718   echo "enabled          - currently not usable"
1719 else
1720   echo "        disabled - currently not usable"
1723 printf " - Soulseek          "
1724 if test "$SOULSEEK" = "yes"; then
1725   echo "enabled          - currently not usable"
1726 else
1727   echo "        disabled - currently not usable"
1730 printf " - OpenFT            "
1731 if test "$OPENFT" = "yes"; then
1732   echo "enabled          - currently not usable"
1733 else
1734   echo "        disabled - currently not usable"
1737 echo ""
1738 echo "Core features:"
1740 echo " - zlib (required)   enabled"
1742 printf " - threads           "
1743 if test "$USE_PTHREAD" = "yes"; then
1744   echo "enabled"
1745 else
1746   echo "        disabled"
1749 printf " - bzip2             "
1750 if test "$BZIP2" = "yes"; then
1751   echo "enabled"
1752 else
1753   echo "        disabled"
1756 printf " - iconv             "
1757 if test "$ICONV" = "yes"; then
1758   echo "enabled"
1759 else
1760   echo "        disabled"
1763 printf " - libmagic          "
1764 if test "$MAGIC" = "yes"; then
1765   echo "enabled"
1766 else
1767   echo "        disabled"
1770 printf " - upnp & natpmp     "
1771 if test "$UPNP_NATPMP" = "yes"; then
1772   echo "enabled"
1773 else
1774   echo "        disabled"
1777 printf " - graphical stats   "
1778 if test "$GD" = "yes"; then
1779   echo "enabled"
1780   printf "   - png support     "
1781   if test "$GD_PNG" = "yes"; then
1782     echo "enabled"
1783   else
1784     echo "        disabled"
1785   fi
1787   printf "   - jpg support     "
1788   if test "$GD_JPG" = "yes"; then
1789     echo "enabled"
1790   else
1791     echo "        disabled"
1792   fi
1793 else
1794   echo "        disabled"
1797 if test "$LABLGTK_CONFIG" = "yes"; then
1798   echo ""
1799   printf "\n - GUI support       "
1800   if test "$GUI" = "newgui1"; then
1801     echo "GTK1 newgui"
1802   else
1803     if test "$GUI" = "newgui2"; then
1804       echo "GTK2 GUI"
1805     else
1806       echo "GTK1 oldgui"
1807     fi
1808   fi
1811 if test "$OLDGUI_NO_31" = "yes"; then
1812   echo " - GUI support       GTK1 oldgui does not work with Ocaml 3.1*, disabled"
1815 if test "$TARGET_TYPE" = "byte"; then
1816   OCAML_TYPE="- byte code"
1817   COMPILE_TARGET=".byte"
1819 echo ""
1820 echo "Compilers:"
1821 echo " - OCaml version     $OCAMLVERSION $OCAML_TYPE"
1822 echo " - $CC version       $CC_VERSION"
1823 if test "x$CXX" != "x"; then
1824   echo " - $CXX version       $CXX_VERSION"
1826 echo ""
1827 echo "\nNow execute '$GNU_MAKE' to start compiling. Good luck!"
1829 echo ""
1830 echo "To compile a static code execute:     $GNU_MAKE mlnet$COMPILE_TARGET.static"
1831 echo "To produce a release tarball execute: $GNU_MAKE release.mlnet.static"
1832 echo "To clean the build directory execute: $GNU_MAKE maintainerclean"
1833 if test "$DONKEY_SUI" = "yes"; then
1834   echo ""
1835   echo "Compiling CryptoPP.cc can take several minutes, on slow machines up to half an hour."