sync zlibstubs.c with upstream
[mldonkey.git] / config / configure.in
blob584e10745eb4d551e7965c2143e6789eea632597
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=7   # range 0-7 due to eMule limitations
27 # **********                                                                                  **********
28 # **********                                  check for C compiler                            **********
29 # **********                                                                                  **********
31 AC_PROG_CC
32 CC_VERSION=`$CC -dumpversion`
33 AC_EXEEXT
34 AC_PROG_CPP
36 # **********                                                                                  **********
37 # **********                                    System checks                                 **********
38 # **********                                                                                  **********
40 AC_CANONICAL_HOST
42 OS_FILES=unix
43 OS_FILES2=unix
44 SYSTEM=unknown
45 FIX_BROKEN_CPP=
46 case $host in
47   *mingw*)
48     SYSTEM=mingw
49     OS_FILES=mingw
50     OS_FILES2=mingw
51     PTHREAD_LIBS="-lpthreadGC2 -lwsock32"
52     PTHREAD_MINGW_CFLAGS="-DPTW32_STATIC_LIB"
53     AC_MSG_CHECKING(for mingw-runtime version)
54       
55 cat >mingw_rt_ver.c <<'END'
56 #include <stdio.h>
57 #include <_mingw.h>
58 main(int argc, char *argv[[]])  {
60 int required_runtime_major=3;       /**********     change required mingw-runtime   **********/
61 int required_runtime_minor=10;      /**********              version here           **********/
63 #ifdef __MINGW32_MAJOR_VERSION
64 #  ifdef __MINGW32_MINOR_VERSION
65      switch(argv[[1]][[0]]) {
66        case 'x':
67          printf("%d.%d", __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION);
68          break;
69        case 'y':
70          if ((__MINGW32_MAJOR_VERSION == required_runtime_major && __MINGW32_MINOR_VERSION < required_runtime_minor) || 
71              (__MINGW32_MAJOR_VERSION < required_runtime_major)) {
72            printf("no");
73            break; }
74          else {
75            printf("yes");
76            break; }
77        case 'z':
78          printf("%d.%d", required_runtime_major, required_runtime_minor);
79          break;
80      }
81      return 0;
82 #  else
83    printf("__MINGW32_MINOR_VERSION not defined in _mingw.h");
84    return 0;
85 #  endif
86 #else
87  printf("__MINGW32_MAJOR_VERSION not defined in _mingw.h");
88  return 0;
89 #endif
91 END
93     $CC -o mingw_rt_ver ./mingw_rt_ver.c
94     MINGW_RT_VER="`./mingw_rt_ver x`"
95     MINGW_RT_VER_OK="`./mingw_rt_ver y`"
96     MINGW_RT_VER_REQ="`./mingw_rt_ver z`"
97     rm -f mingw_rt_ver mingw_rt_ver.*
98     AC_MSG_RESULT($MINGW_RT_VER)
99     if test "$MINGW_RT_VER_OK" = "no"; then
100       echo "********  mingw-runtime version $MINGW_RT_VER_REQ is required  *********" 1>&2;
101       exit 1
102     fi
103     ;;
104   *cygwin*)
105     SYSTEM=cygwin
106     OS_FILES2=cygwin
107     ;;
108   *kfreebsd*)
109     SYSTEM=kfreebsd
110     ;;
111   *freebsd*|*dragonfly*)
112     SYSTEM=freebsd
113     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
114     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
115     ;;
116   *openbsd*)
117     SYSTEM=openbsd
118     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
119     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
120     ;;
121   *netbsd*)
122     SYSTEM=netbsd
123     ;;
124   *linux*)
125     SYSTEM=linux
126     ;;
127   *solaris*)
128     SYSTEM=solaris
129     ;;
130   *morphos*|*amigaos*)
131     SYSTEM=morphos
132     ;;
133   *aix*)
134     SYSTEM=aix
135     ;;
136   *beos*)
137     SYSTEM=beos
138     ;;
139   *osf*)
140     SYSTEM=osf
141     ;;
142   *irix*)
143     SYSTEM=irix
144     ;;
145   *hppa*|*hpux*)
146     SYSTEM=hpux
147     ;;
148   *darwin*|*rhapsody*|*macosx*)
149     SYSTEM=macos
150     AC_CHECK_PROG(SED, sed, sed)
151     if test "$ac_cv_prog_SED" = "sed"; then
152       FIX_BROKEN_CPP="| sed -n '/^\#pragma/!p'"
153     else
154       AC_CHECK_PROG(GREP, grep, grep)
155       if test "$ac_cv_prog_GREP" = "grep"; then
156         FIX_BROKEN_CPP="| grep -v '^\#pragma'"
157       fi
158     fi
159     if test "xFIX_BROKEN_CPP" = "x"; then
160       echo "Apple cpp produces broken files, your system lacks sed or grep to fix it"
161       exit 1
162     fi
163     ;;
164   *-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 # Parse git version if available
221 if test -d ../.git; then
222   AC_MSG_NOTICE(checking git revision)
223   AC_CHECK_PROG(GIT,git,yes)
224   SUB_VERSION3="git"
225   if test "$ac_cv_prog_GIT" = "yes"; then
226     GIT_BRANCH=`git symbolic-ref -q --short HEAD`
227     GIT_COMMIT=`git describe --always --tags`
228     case "$GIT_BRANCH" in
229     ""|"master")
230       SCM_VERSION="${GIT_COMMIT}"
231       ;;
232     *)
233       SCM_VERSION="${GIT_COMMIT}-${GIT_BRANCH}"
234       ;;
235     esac
236   else
237     AC_MSG_NOTICE(cannot determine git revision)
238     SCM_VERSION=""
239   fi
242 # **********                                                                                  **********
243 # **********             build MLDonkey version, Required OCaml and LablGTK versions          **********
244 # **********                                                                                  **********
246 MLDONKEY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$SUB_VERSION
247 if test -f ./subrelease; then
248   MLDONKEY_VERSION=$MLDONKEY_VERSION`cat ./subrelease`
250 if test ! -z "$SUB_VERSION3"; then
251   MLDONKEY_VERSION=$MLDONKEY_VERSION.$SUB_VERSION3
254 MINIMUM_OCAML=4.00.0
255 DEFAULT_OCAML=4.01.0
256 REQUIRED_OCAML=$DEFAULT_OCAML
258 REQUIRED_LABLGTK=1.2.7
260 touch install-sh
262 LABLGTK_NAME=lablgtk
264 # **********                                                                                  **********
265 # **********                    Network and Feature configure switch variables                **********
266 # **********                                                                                  **********
268 # **********   currently not working Networks, can't be enabled
270 SOULSEEK=no
271 OPEN_NAPSTER=no
272 OPENFT=no
274 # **********   working Networks, enabled by default
276 DONKEY=yes
277 BITTORRENT=yes
278 GNUTELLA=no
279 GNUTELLA2=no
280 FASTTRACK=yes
281 FILETP=yes
282 DIRECT_CONNECT=yes
284 # **********   predefined configure variations
286 MULTINET=yes
287 MINIMUM=no
289 # **********   Features, enabled by default
291 DONKEY_SUI=yes
292 DONKEY_SUI_FILE=DonkeySui2
293 GD=yes
294 BZIP2=yes
295 MAGIC=yes
296 ICONV=yes
297 USE_PTHREAD=yes
298 UPNP_NATPMP=no
299 UPNP_NATPMP_FORCE=no
301 # **********
303 BATCH=no
304 FORCE_OCAML=no
305 FORCE_MINGW=no
306 PROFILE=no
307 DEBUG=no
308 DEV=no
309 GUI=no
310 CHECKBOUNDS=false
311 DEVFLAGS=
313 # **********                                                                                  **********
314 # **********                Network and Feature configure switches and dependency             **********
315 # **********                                                                                  **********
317 AC_ARG_ENABLE(multinet,
318   AS_HELP_STRING([--disable-multinet], [disable all networks except eDonkey (with Overnet and Kademlia)]),
319   [MULTINET="$enableval"])
320 AC_ARG_ENABLE(minimum,
321   AS_HELP_STRING([--enable-minimum], [enable minimum set of features and networks (eDonkey, iconv and threads enabled)]),
322   [MINIMUM="$enableval"])
323 AC_ARG_ENABLE(minimum,
324   AS_HELP_STRING([--enable-minimum=all], [enable only eDonkey network and disable all optional features (not recommended)]),
325   [MINIMUM="$enableval"])
327 if [ test ! "$MULTINET" = "yes" ] || [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
328   GNUTELLA=no
329   GNUTELLA2=no
330   FASTTRACK=no
331   DIRECT_CONNECT=no
332   FILETP=no
333   BITTORRENT=no
335 if [ test "$MINIMUM" = "yes" ] || [ test "$MINIMUM" = "all" ]; then
336   DONKEY_SUI=no
337   GD=no
338   BZIP2=no
339   MAGIC=no
341 if [ test "$MINIMUM" = "all" ]; then
342   USE_PTHREAD=no
343   ICONV=no
346 #AC_ARG_ENABLE(soulseek,      [  --disable-soulseek      disable support for SoulSeek], [SOULSEEK="$enableval"])
347 #AC_ARG_ENABLE(opennap,       [  --disable-opennap       disable support for Open Napster], [OPEN_NAPSTER="$enableval"])
348 AC_ARG_ENABLE(directconnect,
349   AS_HELP_STRING([--disable-directconnect], [disable support for Direct Connect]),
350   [DIRECT_CONNECT="$enableval"])
351 #AC_ARG_ENABLE(openft,        [  --disable-openft        disable support for OpenFT], [OPENFT="$enableval"])
353 AC_ARG_ENABLE(donkey,
354   AS_HELP_STRING([--disable-donkey], [disable support for eDonkey]),
355   [DONKEY="$enableval"])
356 AC_ARG_ENABLE(donkeysui,
357   AS_HELP_STRING([--disable-donkeysui], [disable support for eMule SecureUserIdent]),
358   [DONKEY_SUI="$enableval"])
359 AC_ARG_ENABLE(bittorrent,
360   AS_HELP_STRING([--disable-bittorrent], [disable support for Bittorent]),
361   [BITTORRENT="$enableval"])
362 AC_ARG_ENABLE(filetp,
363   AS_HELP_STRING([--disable-filetp], [disable support for fileTP]),
364   [FILETP="$enableval"])
365 AC_ARG_ENABLE(gnutella,
366   AS_HELP_STRING([--disable-gnutella], [disable support for Gnutella]),
367   [GNUTELLA="$enableval"])
368 AC_ARG_ENABLE(gnutella2,
369   AS_HELP_STRING([--disable-gnutella2], [disable support for Gnutella2]),
370   [GNUTELLA2="$enableval"])
371 AC_ARG_ENABLE(fasttrack,
372   AS_HELP_STRING([--disable-fasttrack], [disable support for FastTrack]),
373   [FASTTRACK="$enableval"])
375 AC_ARG_ENABLE(batch,
376   AS_HELP_STRING([--enable-batch], [reply YES to all queries in this script]),
377   [BATCH="$enableval"])
378 AC_ARG_ENABLE(force-ocaml,
379   AS_HELP_STRING([--enable-force-ocaml], [force usage of self-compiled OCaml]),
380   [FORCE_OCAML="$enableval"])
381 AC_ARG_ENABLE(ocamlver,
382   AS_HELP_STRING([--enable-ocamlver=VER], [force usage of specific OCaml version]),
383   [REQUIRED_OCAML="$enableval"])
384 AC_ARG_ENABLE(mingw,
385   AS_HELP_STRING([--enable-mingw], [force compilation with MINGW on Cygwin]),
386   [FORCE_MINGW="$enableval"])
387 AC_ARG_ENABLE(checks,
388   AS_HELP_STRING([--enable-checks], [enable bounds-checking for array/string accesses]),
389   [CHECKBOUNDS="$enableval"])
390 if test "$CHECKBOUNDS" = "yes"; then
391   CHECKBOUNDS=true
394 AC_ARG_ENABLE(profile,
395   AS_HELP_STRING([--enable-profile], [compile with gprof profiling support (enables debug)]),
396   [PROFILE="$enableval"])
397 AC_ARG_ENABLE(debug,
398   AS_HELP_STRING([--enable-debug], [compile with debugging information]),
399   [DEBUG="$enableval"])
400 AC_ARG_ENABLE(dev,
401   AS_HELP_STRING([--enable-dev], [development mode (enables debug and annot information)]),
402   [DEV="$enableval"])
403 if test "$PROFILE" = "yes"; then
404   DEBUG="yes"
406 if test "$DEV" = "yes"; then
407   DEBUG="yes"
409 AC_ARG_ENABLE(gui,
410   AS_HELP_STRING([--disable-gui], [disable GUI build (default)]),
411   [GUI="$enableval"])
412 AC_ARG_ENABLE(gui,
413   AS_HELP_STRING([--enable-gui=oldgui|newgui1|newgui2], 
414                  [enable GUI (newgui2 uses GTK2 (default), other GUIs use GTK1)]),
415   [GUI="$enableval"])
416 if test "$GUI" = "yes"; then
417   GUI=newgui2
419 if test ! "$GUI" = "newgui2"; then
420   if test ! "$GUI" = "newgui1"; then
421     if test ! "$GUI" = "oldgui"; then
422       GUI=no
423     fi
424   fi
427 AC_ARG_ENABLE(pthread,
428   AS_HELP_STRING([--disable-pthread], [disable the use of pthread, hurts performance!]),
429   [USE_PTHREAD="$enableval"])
430 AC_ARG_ENABLE(pthread-lib,
431   AS_HELP_STRING([--enable-pthread-lib], [legacy option]),
432   [USE_PTHREAD="$enableval"])
433 AC_ARG_ENABLE(iconv,
434   AS_HELP_STRING([--disable-iconv], [disable the use of iconv]),
435   [ICONV="$enableval"])
436 AC_ARG_ENABLE(gd,
437   AS_HELP_STRING([--disable-gd], [disable the use of gd]),
438   [GD="$enableval"])
439 AC_ARG_ENABLE(bzip2,
440   AS_HELP_STRING([--disable-bzip2], [disable the use of bzip2]),
441   [BZIP2="$enableval"])
442 AC_ARG_ENABLE(magic,
443   AS_HELP_STRING([--disable-magic], [disable the use of libmagic (GNU file)]),
444   [MAGIC="$enableval"])
445 AC_ARG_ENABLE(upnp-natpmp,
446   AS_HELP_STRING([--enable-upnp-natpmp], [enable the use of libminiupnpc and libnatpmp]),
447   [UPNP_NATPMP="$enableval"])
448 AC_ARG_ENABLE(force-upnp-natpmp,
449   AS_HELP_STRING([--enable-force-upnp-natpmp], [force local compilation of libminiupnpc and libnatpmp]),
450   [UPNP_NATPMP_FORCE="$enableval"])
452 if test "$FORCE_MINGW" = "yes"; then
453     CC="$CC -mno-cygwin"
454     CPP="$CPP -mno-cygwin"
455     OS_FILES=mingw
456     OS_FILES2=mingw
457     SYSTEM=mingw
460 OCAML_PATH=
462 echo ""
463 echo "--------------------------------"
464 echo "     Checking system tools."
465 echo "--------------------------------"
467 AC_PROG_RANLIB
468 AC_CHECK_PROG(GNU_MAKE, gmake, gmake)
469 AC_CHECK_PROG(GNU_MAKE, make, make)
471 if test "x$GNU_MAKE" != "x"; then
472   AC_MSG_CHECKING( [if $GNU_MAKE is GNU make] )
473   $GNU_MAKE --version > /dev/null 2>&1
474   if test "$?" != "0"; then
475     AC_MSG_RESULT([no])
476         AC_MSG_ERROR(GNU make not found)
477   else
478     AC_MSG_RESULT([yes])
479   fi
480 else
481   AC_MSG_ERROR(GNU make not found)
484 AC_CHECK_PROG(COMPRESS, bzip2, bzip2)
485 AC_CHECK_PROG(COMPRESS, gzip, gzip)
487 if test "$ac_cv_prog_COMPRESS" = "bzip2"; then
488    COMPRESS_EXT=bz2
489 else
490    COMPRESS_EXT=gz
493 AC_PATH_PROG(PERL, perl, perl)
494 AC_CHECK_PROG(RPMBUILD,rpmbuild,rpmbuild)
495 AC_CHECK_PROG(RPMBUILD,rpm,rpm)
497 AC_CHECK_PROG(WGET, wget, wget)
498 if test -z "$ac_cv_prog_WGET"; then
499   $CC -o wget wget.c || echo "Cannot compile wget.c"
500   AC_PATH_PROG(WGET, wget,,$SOURCE_DIR/config)
501   ac_cv_prog_WGET="$ac_cv_path_WGET"
503 WGET="$ac_cv_prog_WGET"
505 echo "----------------------------------------"
506 echo "     Checking system tools finished."
507 echo "----------------------------------------"
508 echo ""
509 echo "--------------------------------"
510 echo "     Checking OCaml compiler."
511 echo "--------------------------------"
513 CONFIG_DIR=$SOURCE_DIR/config
514 PATCH_DIR=$SOURCE_DIR/patches
515 LOCAL_DIR=$PATCH_DIR/local
516 BUILD_DIR=$PATCH_DIR/build
518 AC_ARG_ENABLE(local-prefix,
519   AS_HELP_STRING([--enable-local-prefix=DIR], [specify path for temporary tools installation (DIR must be absolute)]),
520   [LOCAL_DIR="$enableval"])
522 LOCAL=$LOCAL_DIR
523 LOCAL_OCAML=$LOCAL_DIR/bin
525 AC_PATH_PROG(OCAMLC,ocamlc.opt,"",[$LOCAL_DIR/bin:$PATH])
526 AC_CHECK_TOOL(OCAMLC,ocamlc,ocamlrun ocamlc)
527 AC_PATH_PROG(CAMLP4, camlp4,"",[$LOCAL_DIR/bin:$PATH])
529 BUILD_OCAML=no
530 if [ test -z "$OCAMLC" ] || [ test -z "$CAMLP4" ]; then
531    BUILD_OCAML=yes
532 else
533   OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
534   if test "$OCAMLVERSION" \< "$MINIMUM_OCAML"; then
535     echo "Detected OCaml $OCAMLVERSION, required at least $MINIMUM_OCAML, need build"
536     BUILD_OCAML=yes
537   fi
539 if test "$REQUIRED_OCAML" \< "$MINIMUM_OCAML"; then
540   echo "OCaml $REQUIRED_OCAML is too old, need build"
541   REQUIRED_OCAML=$DEFAULT_OCAML
542   BUILD_OCAML=yes
544 if [ test "$BUILD_OCAML" = "yes" ] || [ test "$FORCE_OCAML" = "yes" ]; then
546   if [ test "$SYSTEM" = "mingw" ]; then
547     echo "********     No valid OCaml compiler found on your system.       *********" 1>&2;
548     echo "********    OCaml version >= $MINIMUM_OCAML is required.        *********" 1>&2;
549     echo "********   On MinGW there is no possibility to let configure     *********" 1>&2;
550     echo "********   build the OCaml compiler with the included script     *********" 1>&2;
551     echo "********    check http://mldonkey.sourceforge.net/Windows        *********" 1>&2;
552     echo "********   for instuctions how to compile OCaml under MinGW      *********" 1>&2;
553     exit 1
554   else
556   echo "********  OCaml (and camlp4) version >= $MINIMUM_OCAML required  *********" 1>&2;
557   if [ test "$WGET" = "" ]; then
558     echo "********          wget is missing          *********" 1>&2;
559     echo "********       cannot download OCaml       *********" 1>&2;
560     exit 1
561   fi
562   echo "*******  Check http://ocaml.org/  ********" 1>&2;
563   echo "Do you want this script to try to download and install ocaml $REQUIRED_OCAML"
564   echo "LOCALLY in mldonkey directory ?"
565   if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
566   case "$i" in
567    y* | Y*)
568       cd $PATCH_DIR
569       DOWNLOAD_OCAML_MAJOR=`echo $REQUIRED_OCAML | sed -n -e 's/^\([[0-9]]*\.[[0-9]]*\).*/\1/p'`
570       if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
571         echo Downloading ...
572         $WGET http://caml.inria.fr/pub/distrib/ocaml-"$DOWNLOAD_OCAML_MAJOR"/ocaml-"$REQUIRED_OCAML".tar.gz
573       fi
574       if test ! -f ocaml-"$REQUIRED_OCAML".tar.gz; then
575         echo "********        download OCaml $REQUIRED_OCAML not successful, try do download it manually       *********" 1>&2;
576         echo "********        from http://caml.inria.fr/pub/distrib/                                   *********" 1>&2;
577         echo "********        and copy the tar.gz into $PATCH_DIR              *********" 1>&2;
578         exit 1
579       fi
581       echo Uncompressing ...
582       mkdir -p $BUILD_DIR
583       cd $BUILD_DIR
584       rm -rf ocaml-"$REQUIRED_OCAML"
585       gzip -cd $PATCH_DIR/ocaml-"$REQUIRED_OCAML".tar.gz | tar vxf -
586       cd ocaml-"$REQUIRED_OCAML"
587       if test -f $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch; then
588         echo Patching ...
589         patch -p1 < $PATCH_DIR/ocaml-"$REQUIRED_OCAML".patch
590       fi
591       echo Configuring ...
592       if test "$REQUIRED_OCAML" \< "4.08.0"; then
593         ./configure -prefix "$LOCAL_DIR" -host "$host" -cc "$CC"
594       else
595         ./configure CC="$CC" -prefix "$LOCAL_DIR" -host "$host"
596       fi
597       cd config
598       cp -f Makefile Makefile.old
599       sed "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" Makefile.old > Makefile
600       cd ..
601       cp -f $PATCH_DIR/Makefile.ocamldoc ocamldoc/Makefile
602       echo Compiling ...
603       $GNU_MAKE world opt opt.opt
604       echo Installing ...
605       $GNU_MAKE install
606       if ! test -f $LOCAL_DIR/lib/ocaml/threads; then
607         if ! test -f $LOCAL_DIR/lib/ocaml/vmthreads; then
608           ln -s vmthreads  $LOCAL_DIR/lib/ocaml/threads
609         fi
610       fi
611       cd $BUILD_DIR
612       rm -rf ocaml-"$REQUIRED_OCAML"
613       cd $CONFIG_DIR
614       echo OCaml locally installed for mldonkey
616       if test -f "$LOCAL_OCAML"/ocamlc.opt; then
617          OCAMLC=$LOCAL_OCAML/ocamlc.opt
618          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc.opt
619       else
620       if test -f "$LOCAL_OCAML"/ocamlc; then
621          OCAMLC=$LOCAL_OCAML/ocamlc
622          ac_cv_prog_OCAMLC=$LOCAL_OCAML/ocamlc
623       else
624         echo "OCaml installation failed"; exit 1
625       fi
626       fi
627       ;;
628    *)  exit 1;;
629   esac
630   fi
633 if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc.opt ; then
634   OCAML_PATH="$LOCAL_OCAML"/
635   OCAMLOPT=$LOCAL_OCAML/ocamlopt.opt
636   OCAMLDOC=$LOCAL_OCAML/ocamldoc
637   OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
638   OCAMLDEP=$LOCAL_OCAML/ocamldep
639   OCAMLLEX=$LOCAL_OCAML/ocamllex.opt
640   OCAMLYACC=$LOCAL_OCAML/ocamlyacc
641   CAMLP4=$LOCAL_OCAML/camlp4
642   CAMLP4OF=$LOCAL_OCAML/camlp4of
643 else
644   if test "$OCAMLC" = "$LOCAL_OCAML"/ocamlc ; then
645     OCAML_PATH="$LOCAL_OCAML"/
646     if test -f "$LOCAL_OCAML/ocamlopt"; then
647       OCAMLOPT=$LOCAL_OCAML/ocamlopt
648     else
649       OCAMLOPT=no
650     fi
651     OCAMLDOC=$LOCAL_OCAML/ocamldoc
652     OCAMLMKTOP=$LOCAL_OCAML/ocamlmktop
653     OCAMLDEP=$LOCAL_OCAML/ocamldep
654     OCAMLLEX=$LOCAL_OCAML/ocamllex
655     OCAMLYACC=$LOCAL_OCAML/ocamlyacc
656     CAMLP4=$LOCAL_OCAML/camlp4
657     CAMLP4OF=$LOCAL_OCAML/camlp4of
658   else
659     AC_PATH_PROG(OCAMLOPT, ocamlopt.opt, ,[$PATH])
660     AC_PATH_PROG(OCAMLOPT, ocamlopt, no, [$PATH])
661     AC_PATH_PROG(OCAMLDEP, ocamldep, ocamldep, [$PATH])
662     AC_PATH_PROG(OCAMLLEX, ocamllex.opt, , [$PATH])
663     AC_PATH_PROG(OCAMLLEX, ocamllex, ocamllex, [$PATH])
664     AC_PATH_PROG(OCAMLYACC, ocamlyacc, ocamlyacc, [$PATH])
665     AC_PATH_PROG(OCAMLDOC, ocamldoc, ocamldoc, [$PATH])
666     AC_PATH_PROG(OCAMLMKTOP, ocamlmktop, ocamlmktop, [$PATH])
667     AC_PATH_PROG(CAMLP4, camlp4, camlp4, [$PATH])
668     AC_PATH_PROG(CAMLP4OF, camlp4of, $CAMLP4 pa_o.cmo pr_o.cmo Camlp4QuotationExpander.cmo Camlp4GrammarParser.cmo, [$PATH])
669   fi
672 OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
673 OCAMLVERSION_MAJOR=`echo $OCAMLVERSION | sed -n -e 's/^\([[0-9]]*\.[[0-9]]*\).*/\1/' -e 's/\.//gp'`
674 OCAMLLIB=`$OCAMLC -where`
676 # check if native dynlink is supported and therefore needed for linking
677 CAMLP4LIB_OPT="camlp4lib.cmxa"
678 CAMLP4LIB_BYTE="camlp4lib.cma"
679 if test -f $OCAMLLIB/dynlink.cma; then
680   CAMLP4LIB_BYTE="dynlink.cma $CAMLP4LIB_BYTE"
682 if test -f $OCAMLLIB/dynlink.cmxa; then
683   CAMLP4LIB_OPT="dynlink.cmxa $CAMLP4LIB_OPT"
686 # force usage of supported OCaml versions
687 if test "$OCAMLVERSION" \< "$MINIMUM_OCAML"; then
688   echo "******** OCaml version >= $MINIMUM_OCAML required  *********" 1>&2;
689   echo "*******  Check http://ocaml.org/  ********" 1>&2;
690   exit 1
693 if test ! "$OCAMLVERSION" \< "4.03.0"; then
694   OCAMLC="$OCAMLC -unsafe-string"
697 if test "$OCAMLOPT" = "no"; then
698   TARGET_TYPE=byte
699   OCAMLLIB_EXT=cma
700 else
701   TARGET_TYPE=opt
702   OCAMLLIB_EXT=cmxa
704   OCAMLOPTVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
706   test "$OCAMLOPTVERSION" = "$OCAMLVERSION" || {
707     echo "******** Expected ocamlopt version $OCAMLVERSION , but got $OCAMLOPTVERSION *********" 1>&2;
708     echo "*******  Check http://ocaml.org/  ********" 1>&2;
709     exit 1; }
711   if test ! "$OCAMLVERSION" \< "4.03.0"; then
712     OCAMLOPT="$OCAMLOPT -unsafe-string"
713   fi
717 echo "-------------------------------------------"
718 echo "     Checking OCaml $OCAMLVERSION finished."
719 echo "-------------------------------------------"
722 if test "$PROFILE" = "yes"; then
723    OCAMLOPT="$OCAMLOPT -p"
724    CFLAGS="$CFLAGS -pg"
726 if test "$FORCE_MINGW" = "yes"; then
727     OCAMLC="$OCAMLC -ccopt -mno-cygwin"
728     OCAMLOPT="$OCAMLOPT -ccopt -mno-cygwin"
729     OCAMLMKTOP="$OCAMLMKTOP -ccopt -mno-cygwin"
731 if test "$DEBUG" = "yes"; then
732     OCAMLC="$OCAMLC -g"
733     OCAMLOPT="$OCAMLOPT -g"
736 if test "$DEV" = "yes"; then
737   DEVFLAGS="-annot -bin-annot -w @a\$(MINUS_WARNING)"
740 NUMS_INCLUDE=
741 NUMS=yes
742 AC_MSG_CHECKING([ocaml num library])
743 if ! test -f $OCAMLLIB/nums.$OCAMLLIB_EXT; then
744   if test -f $OCAMLLIB/num/nums.$OCAMLLIB_EXT; then
745     NUMS_INCLUDE="-I +num"
746   else
747     NUMS_PATH="`ocamlfind query num 2> /dev/null`"
748     if test "$NUMS_PATH" != ""; then
749       NUMS_INCLUDE="-I $NUMS_PATH"
750     else
751       NUMS=no
752     fi
753   fi
756 if test "$NUMS" = "no"; then
757   AC_MSG_RESULT([no])
758 else
759   AC_MSG_RESULT([found $NUMS_INCLUDE])
762 echo ""
763 echo "----------------------------------"
764 echo "     Checking system headers."
765 echo "----------------------------------"
767 ifelse(AC_ACVERSION, [2.13], [],
768 [dnl Large file enabled
769    AC_SYS_LARGEFILE
773 dnl Check for native endianness.
774 AC_C_BIGENDIAN(,,
775   [AC_MSG_ERROR([Machine endianness could not be determined])]
777 if test "x$WORDS_BIGENDIAN" = "x"; then
778   NATIVEENDIAN=LittleEndian
779 else
780   NATIVEENDIAN=BigEndian
782 AC_SUBST(NATIVEENDIAN)
784 # various header files
785 AC_CHECK_FUNCS(setrlimit getrlimit strerror_r strerror posix_fallocate)
786 AC_CHECK_HEADERS(byteswap.h,,)
787 AC_CHECK_HEADERS([sys/utsname.h])
788 AC_CHECK_HEADERS(arpa/inet.h,,)
789 AC_CHECK_HEADERS([sys/types.h sys/time.h sys/resource.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
790 [#ifdef HAVE_SYS_TYPES_H
791 #include <sys/types.h>
792 #endif
793 #ifdef HAVE_SYS_TIME_H
794 #include <sys/time.h>
795 #endif
796 #ifdef HAVE_NETINET_IN_SYSTM_H
797 #include <netinet/in_systm.h>
798 #endif
799 #ifdef HAVE_NETINET_IN_H
800 #include <netinet/in.h>
801 #endif
804 # poll if possible
805 AC_CHECK_HEADERS(sys/poll.h,,)
806 AC_CHECK_FUNCS(poll,,)
808 AC_CHECK_HEADERS(sys/vfs.h,,)
809 AC_CHECK_HEADERS(sys/statvfs.h,,)
810 AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
811 [#if HAVE_SYS_PARAM_H
812 #include <sys/param.h>
813 #endif
815 echo "-------------------------------------------"
816 echo "     Checking system headers finished."
817 echo "-------------------------------------------"
818 echo ""
819 echo "-----------------------------------"
820 echo "     Checking system libraries."
821 echo "-----------------------------------"
822 echo "----- checking zlib (required)"
823 AC_CHECK_LIB(z,inflate,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
824 AC_CHECK_HEADERS(zlib.h,,[echo "Zlib missing, did you install zlib and zlib-developer packages?"; exit 1])
825 AC_CHECK_LIB(z,zlibVersion,[AC_DEFINE(HAVE_ZLIBVERSION, 1,)])
827 if test "$BZIP2" != "no"; then
828   echo "----- checking bzlib (optional)"
829   AC_CHECK_HEADERS(bzlib.h,[AC_CHECK_LIB(bz2,BZ2_bzReadOpen,[BZIP2=yes],[BZIP2=no])],[BZIP2=no])
832 if test "$BZIP2" = "yes"; then
833   AC_CHECK_LIB(bz2,BZ2_bzlibVersion,[AC_DEFINE(HAVE_BZLIBVERSION, 1,)])
834   AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
835 else
836   AC_MSG_NOTICE(bzlib not available)
839 if test "$UPNP_NATPMP_FORCE" = "yes"; then
840         UPNP_NATPMP=yes
841         cd $PATCH_DIR
842         MINIUPNPC=miniupnpc-2.1
843         LIBNATPMP=libnatpmp-20150609
844         $WGET http://miniupnp.tuxfamily.org/files/$MINIUPNPC.tar.gz
845         $WGET http://miniupnp.tuxfamily.org/files/$LIBNATPMP.tar.gz
846         mkdir -p $BUILD_DIR $LOCAL_DIR/usr/bin $LOCAL_DIR/usr/lib $LOCAL_DIR/usr/include/miniupnpc
847         cd $BUILD_DIR
848         rm -rf $LIBNATPMP $MINIUPNPC
849         tar -xzf $PATCH_DIR/$MINIUPNPC.tar.gz
850         tar -xzf $PATCH_DIR/$LIBNATPMP.tar.gz
851         cd $BUILD_DIR/$LIBNATPMP
852         $GNU_MAKE all install PREFIX=$LOCAL_DIR
853         cd $BUILD_DIR/$MINIUPNPC
854         $GNU_MAKE all install PREFIX=$LOCAL_DIR/usr
855         cd $CONFIG_DIR
856         rm -rf $BUILD_DIR/$LIBNATPMP $BUILD_DIR/$MINIUPNPC
857         CPPFLAGS="${CPPFLAGS} -I$LOCAL_DIR/usr/include"
858         LDFLAGS="${LDFLAGS} -L$LOCAL_DIR/usr/lib"
861 if test "$UPNP_NATPMP" = "yes"; then
862   echo "----- checking libminiupnpc >= 1.6 (optional)"
863   AC_CHECK_HEADERS(miniupnpc/miniupnpc.h,[AC_CHECK_LIB(miniupnpc,upnpDiscover,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
866 if test "$UPNP_NATPMP" = "yes"; then
867   echo "----- checking libnatpmp >= 20110808 (optional)"
868   AC_CHECK_HEADERS(natpmp.h,[AC_CHECK_LIB(natpmp,initnatpmp,[UPNP_NATPMP=yes],[UPNP_NATPMP=no])],[UPNP_NATPMP=no])
871 if test "$UPNP_NATPMP" = "yes"; then
872   AC_DEFINE(ENABLE_UPNP_NATPMP, 1, [Define to 1 if you have libminiupnpc & libnatpmp for port forwarding support.])
873   UPNP_NATPMP_LIBS="-lminiupnpc -lnatpmp $LIBS"
874   UPNP_NATPMP_STATIC_LIBS="-lminiupnpc -lnatpmp $LIBS"
877 if test "$MAGIC" != "no"; then
878   echo "----- checking libmagic (GNU file) (optional)"
879   AC_CHECK_HEADERS(magic.h,
880     [AC_CHECK_LIB(magic,magic_file,
881       [AC_CHECK_DECL([MAGIC_ERROR], [MAGIC=yes], [MAGIC=no],[#include <magic.h>])],
882       [MAGIC=no])],
883     [MAGIC=no])
886 if test "$MAGIC" = "yes"; then
887   MAGICLIB=Magic_magic
888 else
889   MAGICLIB=Magic_nomagic
890   AC_MSG_NOTICE(libmagic not available)
893 GD_JPG=no
894 GD_PNG=no
895 if test "$GD" != "no"; then
896   echo "----- checking gd (optional)"
897   GD=no
898   LIBGD=no
899   SAVE_LIBS=$LIBS
900   SAVE_CFLAGS=$CFLAGS
901   SAVE_LDFLAGS=$LDFLAGS
902   AC_CHECK_PROG(GDLIBCONFIG, gdlib-config, gdlib-config)
903   if test "$ac_cv_prog_GDLIBCONFIG" = "gdlib-config"; then
904     GD_LIBS=`$GDLIBCONFIG --libs`
905     $GDLIBCONFIG --static-libs > /dev/null 2>&1
906     if test "$?" = "0"; then
907       GD_STATIC_LIBS=`$GDLIBCONFIG --static-libs`
908     fi
909     GD_LIBS2="$LIBS -lgd $GD_LIBS"
910     LIBS=$GD_LIBS2
911     GD_CFLAGS=`$GDLIBCONFIG --cflags`
912     CFLAGS="$CFLAGS $GD_CFLAGS"
913     GD_LDFLAGS=`$GDLIBCONFIG --ldflags`
914     LDFLAGS="$LDFLAGS $GD_LDFLAGS"
915     AC_MSG_CHECKING(for libgd > 2.0.14)
916     GDVERSION=`$GDLIBCONFIG --version`
917     GDMAJORVERSION=`$GDLIBCONFIG --majorversion`
918     GDMINORVERSION=`$GDLIBCONFIG --minorversion`
919     GDREVISION=`$GDLIBCONFIG --revision`
920     case $GDMAJORVERSION in
921         1)
922             AC_MSG_RESULT(no (found $GDVERSION))
923             LIBGD=no
924             ;;
925         2)
926             if test $GDMINORVERSION -ge 1; then
927                 AC_MSG_RESULT($GDVERSION)
928                 LIBGD=yes
929             else
930                 if test $GDREVISION -gt 14; then
931                     AC_MSG_RESULT($GDVERSION)
932                     LIBGD=yes
933                 else
934                     AC_MSG_RESULT(no (found $GDVERSION))
935                     LIBGD=no
936                 fi
937             fi
938             ;;
939         *)
940             AC_MSG_RESULT($GDVERSION)
941             LIBGD=yes
942             ;;
943     esac
944   else
945     LIBGD=yes
946   fi
948   if test "$LIBGD" = "yes"; then
949     AC_CHECK_HEADERS(gd.h,[LIBGD=yes],[LIBGD=no])
950   fi
952   if test "$LIBGD" = "yes"; then
953     AC_MSG_CHECKING(for gdImageCreate in -lgd)
954     AC_TRY_LINK([#include <gd.h>],
955     [gdImageCreate (0,0);],
956     [LIBGD=yes], [LIBGD=no])
957     AC_MSG_RESULT($LIBGD)
958     LIBS=$SAVE_LIBS
960     if test "$LIBGD" = "no"; then
961       AC_MSG_NOTICE([not found, trying another method])
962       AC_CHECK_LIB(gd, gdImageCreate, [LIBGD=yes], [LIBGD=no])
963     fi
964   fi
966   if test "$LIBGD" = "yes"; then
967     LIBPNG=no
968 # saving current variables
969     SAVE_LIBS_PNG=$LIBS
970     SAVE_CFLAGS_PNG=$CFLAGS
971     SAVE_LDFLAGS_PNG=$LDFLAGS
972     AC_CHECK_PROG(PNGLIBCONFIG, libpng-config, libpng-config)
973     if test "$ac_cv_prog_PNGLIBCONFIG" = "libpng-config"; then
974 # check libpng-config contents and update system variables
975       PNG_LIBS=`$PNGLIBCONFIG --libs`
976       LIBS="$LIBS $PNG_LIBS"
977       PNG_CFLAGS=`$PNGLIBCONFIG --cflags`
978       CFLAGS="$CFLAGS $PNG_CFLAGS"
979       PNG_LDFLAGS=`$PNGLIBCONFIG --ldflags`
980       LDFLAGS="$LDFLAGS $PNG_LDFLAGS"
981     fi
982     AC_CHECK_LIB(png, png_create_read_struct , [LIBPNG=yes])
983 # restore variables
984     LIBS=$SAVE_LIBS_PNG
985     CFLAGS=$SAVE_CFLAGS_PNG
986     LDFLAGS=$SAVE_LDFLAGS_PNG
988     if test "$LIBPNG" = "no"; then
989       AC_MSG_NOTICE(png support not available)
990     else
991       LIBGD_PNG=no
992       LIBS=$GD_LIBS2
993       AC_MSG_CHECKING(for gdImagePng in -lgd)
994       AC_TRY_LINK([#include <gd.h>],
995       [gdImagePng (0,0);],
996       [LIBGD_PNG=yes], [LIBGD_PNG=no])
997       AC_MSG_RESULT($LIBGD_PNG)
998       LIBS=$SAVE_LIBS
1000       if test "$LIBGD_PNG" = "no"; then
1001         AC_MSG_NOTICE([not found, trying another method])
1002         AC_CHECK_LIB(gd, gdImagePng, [LIBGD_PNG=yes], [LIBGD_PNG=no])
1003       fi
1005       AC_MSG_CHECKING(for png support in libgd)
1006       if test "$LIBGD_PNG" = "yes"; then
1007         GD=yes
1008         GD_PNG=yes
1009         GD_LIBS="$GD_LIBS $PNG_LIBS"
1010         AC_MSG_RESULT(yes)
1011         AC_CHECK_LIB(png, png_access_version_number,[AC_DEFINE(HAVE_PNGVERSION, 1,)])
1012         AC_DEFINE(HAVE_GD_PNG, 1, [Define to 1 if you have png support in libgd.])
1013       else
1014         AC_MSG_RESULT(no)
1015       fi
1016     fi
1018     LIBJPEG=no
1019     AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [LIBJPEG=yes])
1021     if test "$LIBJPEG" = "no"; then
1022       AC_MSG_NOTICE(jpeg support not available)
1023     else
1024       LIBGD_JPG=no
1025       LIBS=$GD_LIBS2
1026       AC_MSG_CHECKING(for gdImageJpeg in -lgd)
1027       AC_TRY_LINK([#include <gd.h>],
1028       [gdImageJpeg (0,0,0);],
1029       [LIBGD_JPG=yes], [LIBGD_JPG=no])
1030       AC_MSG_RESULT($LIBGD_JPG)
1031       LIBS=$SAVE_LIBS
1033       if test "$LIBGD_JPG" = "no"; then
1034         AC_MSG_NOTICE([not found, trying another method])
1035         AC_CHECK_LIB(gd, gdImageJpeg, [LIBGD_JPG=yes], [LIBGD_JPG=no])
1036       fi
1038       AC_MSG_CHECKING(for jpeg support in libgd)
1039       if test "$LIBGD_JPG" = "yes"; then
1040         GD=yes
1041         GD_JPG=yes
1042         GD_LIBS="$GD_LIBS -ljpeg"
1043         AC_DEFINE(HAVE_GD_JPG, 1, [Define to 1 if you have jpg support in libgd.])
1044         AC_MSG_RESULT(yes)
1045       else
1046         AC_MSG_RESULT(no)
1047       fi
1048     fi
1049   else
1050     AC_MSG_NOTICE(libgd not available)
1051   fi
1052   LIBS=$SAVE_LIBS
1053   CFLAGS=$SAVE_CFLAGS
1054   LDFLAGS=$SAVE_LDFLAGS
1057 if test "$GD" != "no"; then
1058   GDGRAPHICS=DriverGraphics_gd
1059 else
1060   GDGRAPHICS=DriverGraphics_nogd
1063 if test "$ICONV" = "yes"; then
1064   echo "----- checking iconv (optional)"
1065   AM_ICONV
1066   if test "$am_cv_func_iconv" != "yes"; then
1067     AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1068     ICONV=no
1069   else
1070   LIBS="$LIBS $LIBICONV"
1071   AC_CHECK_FUNCS([locale_charset],,
1072   AC_TRY_LINK([#include <langinfo.h>],
1073   [char* cs = nl_langinfo(CODESET);],
1074   AC_MSG_NOTICE(found nl_langinfo(CODESET)),
1075   [echo "Your iconv implementation is incomplete"; exit 1]))
1076   AC_CHECK_LIB(charset,locale_charset)
1077   AC_CHECK_HEADERS([libcharset.h])
1078   AC_CHECK_HEADERS([langinfo.h])
1079   AC_CHECK_HEADERS([locale.h])
1080   fi
1081 else
1082   AC_DEFINE(DISABLE_ICONV, 1, [Define to 1 if you want to replace iconv and related with stubs.])
1083   ICONV=no
1086 if test "$USE_PTHREAD" = "no"; then
1087  PTHREAD_LIBS=""
1088  echo "You disabled thread support, this will hurt MLDonkey performance!"
1089 else
1090   echo "----- checking thread support (optional, strongly advised)"
1091   ACX_PTHREAD
1094 # On linux plaforms, we will have to check that includes from kernel are
1095 # available. glibc version test was shamelessly taken from
1096 # http://public.activestate.com/gsar/APC/perl-5.8.x/Configure
1097 GLIBC_VERSION=""
1098 case $host in
1099         *linux*)
1100            echo "----- GNU C Library version"
1101            AC_CHECK_HEADERS(linux/limits.h,, [
1102              OLD_CPPFLAGS=$CPPFLAGS
1103              CPPFLAGS="-I /usr/src/linux/include"
1104              AC_CHECK_HEADER(linux/types.h,[CONFIG_INCLUDES="-I /usr/src/linux/include"])
1105              CPPFLAGS=$OLD_CPPFLAGS]
1106            )
1107            AC_CHECK_HEADERS(gnu/libc-version.h,[AC_MSG_CHECKING(for GNU C Library version)
1109 cat >try.c <<'EOCP'
1110 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
1111    alone are insufficient to distinguish different versions, such as
1112    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
1113    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
1115 #include <stdio.h>
1116 int main(void)
1118 #ifdef __GLIBC__
1119 #   ifdef __GLIBC_MINOR__
1120 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1121 #           include <gnu/libc-version.h>
1122     printf("%s\n",  gnu_get_libc_version());
1123 #       else
1124     printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
1125 #       endif
1126 #   else
1127 printf("%d\n",  __GLIBC__);
1128 #   endif
1129     return 0;
1130 #else
1131     return 1;
1132 #endif
1134 EOCP
1136            $CC -o try ./try.c
1137            GLIBC_VERSION="`./try`"
1138            AC_MSG_RESULT($GLIBC_VERSION)
1139            rm -f try try.*],)
1140         ;;
1141         *)         ;;
1142 esac
1144 echo "---------------------------------------------"
1145 echo "     Checking system libraries finished."
1146 echo "---------------------------------------------"
1147 echo ""
1149 CXX_VERSION=
1150 CRYPTOPPFLAGS=
1151 echo "--------------------------------------"
1152 echo "     Checking activated networks."
1153 echo "--------------------------------------"
1155   if test "$DONKEY" = "yes"; then
1156     AC_MSG_CHECKING(eDonkey)
1157     if test -d ../src/networks/donkey; then
1158       AC_MSG_RESULT(yes)
1159       if test "$DONKEY_SUI" = "yes"; then
1160         AC_PROG_CXX
1162 # GCC miscompiles cryptopp.cc with -O2 on armhf
1163 # http://mldonkey.sourceforge.net/phpBB2/viewtopic.php?p=32309#32309
1164 # https://bugs.launchpad.net/ubuntu/+source/mldonkey/+bug/1060007
1165         case "$host" in
1166                 armv7l-*-linux-gnueabihf)
1167                         CXXFLAGS="-g -Os"
1168                         ;;
1169         esac
1171         AC_CHECK_TOOL(NEWCXX, [$CXX], [no])
1172         AC_MSG_CHECKING(eMule SUI)
1173         if test x"$NEWCXX" = x"no"
1174         then
1175           AC_MSG_RESULT(no)
1176           CXX=
1177           DONKEY_SUI=no
1178         else
1179           AC_MSG_RESULT(yes)
1180           ACX_CHECK_CXX_FLAGS(-std=c++14,cv_stdcxx14, CRYPTOPPFLAGS="-std=c++14")
1181           ACX_CHECK_CXX_FLAGS(-fno-omit-frame-pointer,cv_no_omit_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -fno-omit-frame-pointer")
1182           ACX_CHECK_CXX_FLAGS(-mno-omit-leaf-frame-pointer,cv_no_omit_leaf_frame_pointer, CRYPTOPPFLAGS="$CRYPTOPPFLAGS -mno-omit-leaf-frame-pointer")
1183           CXX=$NEWCXX
1184           CXX_VERSION=`$CXX -dumpversion`
1185           DONKEY_SUI_FILE=DonkeySui1
1186           AC_DEFINE(HAVE_CRYPTOPP, 1,)
1187         fi
1188       fi
1189 #      AC_MSG_CHECKING(eDonkey server)
1190 #      if test -d ../src/networks/server; then
1191 #        AC_MSG_RESULT(no)
1192 #        DONKEY_SERVER=no
1193 #      else
1194 #        AC_MSG_RESULT(no)
1195 #        DONKEY_SERVER=no
1196 #      fi
1197     else
1198       DONKEY=no
1199       DONKEY_SUI=no
1200       AC_MSG_RESULT(no)
1201     fi
1202   else
1203     DONKEY_SUI=no
1204   fi
1206   if test "$BITTORRENT" = "yes"; then
1207     AC_MSG_CHECKING(BitTorrent)
1208     if test -d ../src/networks/bittorrent; then
1209       if test "$NUMS" != "no"; then
1210         AC_MSG_RESULT(yes)
1211       else
1212         BITTORRENT=no
1213         AC_MSG_RESULT([no (ocaml num library missing)])
1214       fi
1215     else
1216       BITTORRENT=no
1217       AC_MSG_RESULT(no)
1218     fi
1219   fi
1221   if test "$FILETP" = "yes"; then
1222     AC_MSG_CHECKING(FileTP)
1223     if test -d ../src/networks/fileTP; then
1224       AC_MSG_RESULT(yes)
1225     else
1226       FILETP=no
1227       AC_MSG_RESULT(no)
1228     fi
1229   fi
1231   if test "$GNUTELLA" = "yes"; then
1232     AC_MSG_CHECKING(Gnutella)
1233     if test -d ../src/networks/gnutella; then
1234       AC_MSG_RESULT(yes)
1235     else
1236       GNUTELLA=no
1237       AC_MSG_RESULT(no)
1238     fi
1239   fi
1241   if test "$GNUTELLA2" = "yes"; then
1242     AC_MSG_CHECKING(G2)
1243     if test -d ../src/networks/gnutella2; then
1244       AC_MSG_RESULT(yes)
1245     else
1246       GNUTELLA2=no
1247       AC_MSG_RESULT(no)
1248     fi
1249   fi
1251   if test "$FASTTRACK" = "yes"; then
1252     AC_MSG_CHECKING(Fasttrack)
1253     if test -d ../src/networks/fasttrack; then
1254       AC_MSG_RESULT(yes)
1255     else
1256       FASTTRACK=no
1257       AC_MSG_RESULT(no)
1258     fi
1259   fi
1261   if test "$DIRECT_CONNECT" = "yes"; then
1262     AC_MSG_CHECKING(DirectConnect)
1263     if test "$BZIP2" = "yes"; then
1264       if test -d ../src/networks/direct_connect; then
1265         AC_MSG_RESULT(yes)
1266       else
1267         DIRECT_CONNECT=no
1268         AC_MSG_RESULT(no)
1269       fi
1270     else
1271       DIRECT_CONNECT=no
1272       AC_MSG_RESULT(no - bzip2 support missing)
1273     fi
1274   fi
1276   if test "$SOULSEEK" = "yes"; then
1277     AC_MSG_CHECKING(Soulseek)
1278     if test -d ../src/networks/soulseek; then
1279       AC_MSG_RESULT(yes)
1280     else
1281       SOULSEEK=no
1282       AC_MSG_RESULT(no)
1283     fi
1284   fi
1286   if test "$OPEN_NAPSTER" = "yes"; then
1287     AC_MSG_CHECKING(OpenNapster)
1288     if test -d ../src/networks/opennap; then
1289       AC_MSG_RESULT(yes)
1290     else
1291       OPEN_NAPSTER=no
1292       AC_MSG_RESULT(no)
1293     fi
1294   fi
1296   if test "$OPENFT" = "yes"; then
1297     AC_MSG_CHECKING(OpenFT)
1298     if test -d ../src/networks/openFT; then
1299       AC_MSG_RESULT(yes)
1300     else
1301       OPENFT=no
1302       AC_MSG_RESULT(no)
1303     fi
1304   fi
1305 echo "-----------------------------------------------"
1306 echo "     Checking activated networks finished."
1307 echo "-----------------------------------------------"
1309 if test -f $OCAMLLIB/lablgl.cma; then
1310   LABLGL_CMA=lablgl.cma
1313 if test -f $OCAMLLIB/lablgl.$OCAMLLIB_EXT; then
1314   LABLGL_CMXA=lablgl.$OCAMLLIB_EXT
1317 # Check for GTK only if we want to build the GUI
1318 if test ! "$GUI" = "no"; then
1319   echo "---------------------------------------------------------"
1320   echo "Checking the libraries required to build the GTK GUI."
1321   echo "---------------------------------------------------------"
1322   if test "$GUI" = "newgui2"; then
1323       REQUIRED_GTK=2.4.0
1324       PKG_GTK=gtk+-2.0
1325       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1326       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1327         AC_MSG_RESULT(yes)
1328         REQUIRED_RSVG=2.4.0
1329         PKG_RSVG=librsvg-2.0
1330         AC_MSG_CHECKING(for librsvg - version >= $REQUIRED_RSVG)
1331         if pkg-config --atleast-version $REQUIRED_RSVG $PKG_RSVG; then
1332           GTK_CONFIG="pkg-config $PKG_GTK $PKG_RSVG"
1333           REQUIRED_LABLGTK=2.14.2
1334           LABLGTK_NAME=lablgtk2
1335           AC_MSG_RESULT(yes)
1336         else
1337           GTK_CONFIG=no
1338           AC_MSG_RESULT(no)
1339         fi
1340       else
1341         GTK_CONFIG=no
1342         AC_MSG_RESULT(no)
1343       fi
1344   else
1345     if test "$OS_FILES2" = "mingw"; then
1346       REQUIRED_GTK=1.3.0
1347       PKG_GTK=gtk+-1.3-win32-production
1348       AC_MSG_CHECKING(for GTK+ - version >= $REQUIRED_GTK)
1349       if pkg-config --atleast-version $REQUIRED_GTK $PKG_GTK; then
1350         GTK_CONFIG="pkg-config $PKG_GTK"
1351         AC_MSG_RESULT(yes)
1352       else
1353         GTK_CONFIG=no
1354         AC_MSG_RESULT(no)
1355       fi
1356     else
1357       AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no)
1358       if test "$GTK_CONFIG" = "no"; then
1359         AC_MSG_RESULT(no)
1360       else
1361         AC_MSG_RESULT(yes)
1362       fi
1363     fi
1364   fi
1365 else
1366   GTK_CONFIG=no
1368 if test "$GTK_CONFIG" = "no"; then
1369      LABLGTK_CONFIG=no
1370 else
1371   AC_MSG_CHECKING(for native code $LABLGTK_NAME)
1372   if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1373      if test "$GUI" = "newgui2"; then
1374        if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.$OCAMLLIB_EXT; then
1375          AC_MSG_RESULT(yes)
1376          LABLGTK_CONFIG=yes
1377        else
1378          AC_MSG_RESULT(no)
1379          LABLGTK_CONFIG=no
1380          if test -f $OCAMLLIB/$LABLGTK_NAME/lablrsvg.cma; then
1381            echo "---------------------------------------------------------"
1382            echo "lablrsvg is not installed properly. See the INSTALL.txt"
1383            echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1384            echo "probably forgot to call 'make opt' before 'make install'."
1385            echo "---------------------------------------------------------"
1386          else
1387            echo "---------------------------------------------------------"
1388            echo "lablrsvg is not installed. See the INSTALL.txt file of"
1389            echo "mldonkey to see how to compile $LABLGTK_NAME. Librsvg"
1390            echo "may not be installed when you compiled $LABLGTK_NAME."
1391            echo "---------------------------------------------------------"
1392          fi
1393        fi
1394      else
1395        AC_MSG_RESULT(yes)
1396        LABLGTK_CONFIG=yes
1397      fi
1398   else
1399      AC_MSG_RESULT(no)
1400      LABLGTK_CONFIG=no
1401      if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.cma; then
1402        echo "-------------------------------------------------------------"
1403        echo "$LABLGTK_NAME is not installed properly. See the INSTALL.txt"
1404        echo "file of mldonkey to see how to compile $LABLGTK_NAME. You"
1405        echo "probably forgot to call 'make opt' before 'make install'."
1406        echo "-------------------------------------------------------------"
1407      else
1408        echo "Do you want this script to try to download and install $LABLGTK_NAME"
1409        echo "LOCALLY in mldonkey directory ?"
1410        if test "$BATCH" = "no"; then read i <&1; else i=yes; fi
1411        case "$i" in
1412         y* | Y*)
1414          cd $PATCH_DIR
1415          rm -rf lablgtk-"$REQUIRED_LABLGTK"
1416          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then
1417            echo Downloading ...
1418            $WGET http://www.math.nagoya-u.ac.jp/~garrigue/soft/olabl/dist/lablgtk-"$REQUIRED_LABLGTK".tar.gz
1419          fi
1420          if test ! -f lablgtk-"$REQUIRED_LABLGTK".tar.gz; then exit 1; fi
1422          mkdir -p $BUILD_DIR
1423          cd $BUILD_DIR
1424          echo Uncompressing ...
1425          gzip -cd $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".tar.gz | tar xf -
1426          (cd lablgtk-"$REQUIRED_LABLGTK"
1427           if test -f $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch; then
1428             echo Patching ...
1429             patch -p0 < $PATCH_DIR/lablgtk-"$REQUIRED_LABLGTK".patch
1430           fi
1431           PATH=$OCAML_PATH:$PATH
1432           export PATH
1433           echo $PATH
1435           if test "$GUI" = "newgui2"; then
1436             ./configure --prefix=$LOCAL_DIR
1437             $GNU_MAKE world
1438             $GNU_MAKE install
1439           else
1440             $GNU_MAKE configure
1441             $GNU_MAKE
1442             $GNU_MAKE opt
1443             $GNU_MAKE install
1444           fi
1446           cd ..
1447           rm -rf lablgtk-"$REQUIRED_LABLGTK"
1448          )
1449          cd $CONFIG_DIR
1450          if test -f $OCAMLLIB/$LABLGTK_NAME/lablgtk.$OCAMLLIB_EXT; then
1451             LABLGTK_CONFIG=yes
1452          else
1453             echo "Installation of $LABLGTK_NAME failed"
1454             LABLGTK_CONFIG=no
1455          fi
1456          ;;
1457         *);;
1458       esac
1459      fi
1460   fi
1463 if test "$GUI" = "newgui2" ; then
1464   GUIS="mldonkey_gui\$(EXE)"
1465   GTKCFLAGS="`pkg-config --cflags-only-I gtk+-2.0`"
1466   GTKLLIBS="`pkg-config --libs-only-L gtk+-2.0`"
1467   GTKLFLAGS="`pkg-config --libs-only-l gtk+-2.0` -lX11"
1468 else
1469   GUIS="mldonkey_gui\$(EXE) mldonkey_gui2\$(EXE)"
1472 if test "$LABLGTK_CONFIG" = "no"; then
1473   GUI="no"
1474 else
1475   MORE_TARGETS="$MORE_TARGETS $GUIS"
1476   AC_MSG_CHECKING(GToolbox.popup_menu args)
1477   GTOOLBOX="$OCAMLLIB/$LABLGTK_NAME/gToolbox.mli"
1478   grep popup $GTOOLBOX | grep -i button 2> /dev/null && GTOOLBOX_ARGS=new
1479   if test "$GTOOLBOX_ARGS" = "new"; then
1480     GTOOLBOX_POPUPMENU=' ~button: button ~time: time '
1481     AC_MSG_RESULT(new)
1482   else
1483     GTOOLBOX_POPUPMENU=' ~x: button ~y: time '
1484     AC_MSG_RESULT(old)
1485   fi
1486   echo "---------------------------------------------------------"
1487   echo "End of GTK GUI configuration."
1488   echo "---------------------------------------------------------"
1491 if test "$OS_FILES" = "mingw"; then
1492    OCAMLDEP_OPTIONS="-slash"
1495 AC_SUBST(LIBS)
1496 AC_SUBST(CFLAGS)
1497 AC_SUBST(CPPFLAGS)
1498 AC_SUBST(CXXFLAGS)
1499 AC_SUBST(LDFLAGS)
1500 AC_SUBST(CC)
1501 AC_SUBST(CPP)
1502 AC_SUBST(CXX)
1503 AC_SUBST(FIX_BROKEN_CPP)
1504 AC_SUBST(CONFIG_INCLUDES)
1505 AC_SUBST(OCAMLC)
1506 AC_SUBST(OCAMLLIB)
1507 AC_SUBST(OCAMLOPT)
1508 AC_SUBST(OCAMLLEX)
1509 AC_SUBST(OCAMLYACC)
1510 AC_SUBST(OCAMLDEP)
1511 AC_SUBST(OCAMLDEP_OPTIONS)
1512 AC_SUBST(CAMLP4)
1513 AC_SUBST(CAMLP4OF)
1514 AC_SUBST(CAMLP4LIB_OPT)
1515 AC_SUBST(CAMLP4LIB_BYTE)
1516 AC_SUBST(PERL)
1517 AC_SUBST(OCAMLDOC)
1518 AC_SUBST(OCAMLMKTOP)
1519 AC_SUBST(SYSTEM)
1520 AC_SUBST(MORE_TARGETS)
1521 AC_SUBST(MORE_SUBDIRS)
1522 AC_SUBST(LABLGL_CMA)
1523 AC_SUBST(LABLGL_CMXA)
1524 AC_SUBST(MD4ARCH)
1525 AC_SUBST(MD4COMP)
1526 AC_SUBST(ICONV)
1527 AC_SUBST(OPEN_NAPSTER)
1528 AC_SUBST(DIRECT_CONNECT)
1529 AC_SUBST(GNUTELLA)
1530 AC_SUBST(GNUTELLA2)
1531 AC_SUBST(BITTORRENT)
1532 AC_SUBST(FILETP)
1533 AC_SUBST(SOULSEEK)
1534 AC_SUBST(OPENFT)
1535 AC_SUBST(FASTTRACK)
1536 AC_SUBST(DONKEY)
1537 AC_SUBST(DONKEY_SUI)
1538 AC_SUBST(CRYPTOPPFLAGS)
1539 AC_SUBST(DONKEY_SUI_FILE)
1540 AC_SUBST(DONKEY_SERVER)
1541 AC_SUBST(GUI)
1542 AC_SUBST(REQUIRED_OCAML)
1543 AC_SUBST(REQUIRED_LABLGTK)
1544 AC_SUBST(ARCH)
1545 AC_SUBST(COMPRESS)
1546 AC_SUBST(COMPRESS_EXT)
1547 AC_SUBST(CHECKBOUNDS)
1548 AC_SUBST(MLDONKEY_VERSION)
1549 AC_SUBST(SCM_VERSION)
1550 AC_SUBST(MAJOR_VERSION)
1551 AC_SUBST(MINOR_VERSION)
1552 AC_SUBST(SUB_VERSION)
1553 AC_SUBST(GTOOLBOX_POPUPMENU)
1554 AC_SUBST(OS_FILES)
1555 AC_SUBST(OS_FILES2)
1556 AC_SUBST(TARGET_TYPE)
1557 AC_SUBST(RPMBUILD)
1558 AC_SUBST(GTKCFLAGS)
1559 AC_SUBST(GTKLLIBS)
1560 AC_SUBST(GTKLFLAGS)
1561 AC_SUBST(GD)
1562 AC_SUBST(GD_JPG)
1563 AC_SUBST(GD_PNG)
1564 AC_SUBST(GDGRAPHICS)
1565 AC_SUBST(GD_LIBS)
1566 AC_SUBST(GD_STATIC_LIBS)
1567 AC_SUBST(GD_CFLAGS)
1568 AC_SUBST(GD_LDFLAGS)
1569 AC_SUBST(BZIP2)
1570 AC_SUBST(MAGIC)
1571 AC_SUBST(MAGICLIB)
1572 AC_SUBST(UPNP_NATPMP)
1573 AC_SUBST(UPNP_NATPMP_LIBS)
1574 AC_SUBST(UPNP_NATPMP_STATIC_LIBS)
1575 BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
1576 AC_SUBST(BUILD_SYSTEM)
1577 AC_SUBST(GLIBC_VERSION)
1578 AC_SUBST(CC_VERSION)
1579 AC_SUBST(CXX_VERSION)
1580 AC_SUBST(CONFIGURE_ARGUMENTS)
1581 AC_SUBST(CONFIGURE_RUN)
1582 AC_SUBST(DEVFLAGS)
1583 AC_SUBST(OCAMLVERSION_MAJOR)
1584 AC_SUBST(NUMS_INCLUDE)
1586 AUTOCONF=../src/utils/lib/autoconf.ml
1587 GTK_AUTOCONF=../src/utils/lib/gAutoconf.ml
1588 AC_OUTPUT(\
1589   Makefile.config \
1590   mldonkey.rc \
1591   $AUTOCONF.new $GTK_AUTOCONF.new \
1592    ../src/utils/bitstring/bitstring.ml \
1593    ../src/utils/lib/magic.ml \
1594    ../src/networks/donkey/donkeySui.ml \
1595    ../src/daemon/driver/driverGraphics.ml \
1596    ../packages/rpm/mldonkey.spec \
1597    ../packages/rpm/Makefile \
1598    ../packages/slackware/mldonkey.options)
1599 diff $AUTOCONF.new $AUTOCONF 2> /dev/null > /dev/null || cp -f $AUTOCONF.new $AUTOCONF
1600 diff $GTK_AUTOCONF.new $GTK_AUTOCONF 2> /dev/null > /dev/null || cp -f $GTK_AUTOCONF.new $GTK_AUTOCONF
1602 cd ..
1604 echo ""
1605 echo "Building dependencies (if it blocks, try '$GNU_MAKE depend' to see the problem)"
1606 $GNU_MAKE depend 2> /dev/null > /dev/null || echo "Building dependencies fails: try: '$GNU_MAKE depend'"
1608 echo ""
1609 printf "Configuring MLDonkey %s" "$MLDONKEY_VERSION"
1610 if test ! -z "$SCM_VERSION"; then
1611   printf " - SCM: %s" "$SCM_VERSION"
1613 echo " completed."
1615 echo ""
1616 echo "Network modules:"
1617 printf " - eDonkey           "
1618 if test "$DONKEY" = "yes"; then
1619   if test "$DONKEY_SUI" = "yes"; then
1620     echo "enabled (eMule SUI enabled)"
1621   else
1622     echo "enabled (eMule SUI disabled)"
1623   fi
1624 else
1625   echo "        disabled"
1628 printf " - BitTorrent        "
1629 if test "$BITTORRENT" = "yes"; then
1630   echo "enabled"
1631 else
1632   if test "$NUMS" != "no"; then
1633     echo "        disabled"
1634   else
1635     echo "        disabled - ocaml num library missing (must be installed manually when building with OCaml >= 4.06)"
1636   fi
1639 printf " - FileTP (aka wget) "
1640 if test "$FILETP" = "yes"; then
1641   echo "enabled"
1642 else
1643   echo "        disabled"
1646 printf " - Fasttrack         "
1647 if test "$FASTTRACK" = "yes"; then
1648   echo "enabled"
1649 else
1650   echo "        disabled"
1653 printf " - Gnutella          "
1654 if test "$GNUTELLA" = "yes"; then
1655   echo "enabled (warning: this network module is unmaintained)"
1656 else
1657   echo "        disabled - unmaintained"
1660 printf " - Gnutella2         "
1661 if test "$GNUTELLA2" = "yes"; then
1662   echo "enabled (warning: this network module is unmaintained)"
1663 else
1664   echo "        disabled - unmaintained"
1667 printf " - Direct Connect    "
1668 if test "$DIRECT_CONNECT" = "yes"; then
1669   echo "enabled"
1670 else
1671   echo "        disabled"
1674 printf " - Open Napster      "
1675 if test "$OPEN_NAPSTER" = "yes"; then
1676   echo "enabled          - currently not usable"
1677 else
1678   echo "        disabled - currently not usable"
1681 printf " - Soulseek          "
1682 if test "$SOULSEEK" = "yes"; then
1683   echo "enabled          - currently not usable"
1684 else
1685   echo "        disabled - currently not usable"
1688 printf " - OpenFT            "
1689 if test "$OPENFT" = "yes"; then
1690   echo "enabled          - currently not usable"
1691 else
1692   echo "        disabled - currently not usable"
1695 echo ""
1696 echo "Core features:"
1698 echo " - zlib (required)   enabled"
1700 printf " - threads           "
1701 if test "$USE_PTHREAD" = "yes"; then
1702   echo "enabled"
1703 else
1704   echo "        disabled"
1707 printf " - bzip2             "
1708 if test "$BZIP2" = "yes"; then
1709   echo "enabled"
1710 else
1711   echo "        disabled"
1714 printf " - iconv             "
1715 if test "$ICONV" = "yes"; then
1716   echo "enabled"
1717 else
1718   echo "        disabled"
1721 printf " - libmagic          "
1722 if test "$MAGIC" = "yes"; then
1723   echo "enabled"
1724 else
1725   echo "        disabled"
1728 printf " - upnp & natpmp     "
1729 if test "$UPNP_NATPMP" = "yes"; then
1730   echo "enabled"
1731 else
1732   echo "        disabled"
1735 printf " - graphical stats   "
1736 if test "$GD" = "yes"; then
1737   echo "enabled"
1738   printf "   - png support     "
1739   if test "$GD_PNG" = "yes"; then
1740     echo "enabled"
1741   else
1742     echo "        disabled"
1743   fi
1745   printf "   - jpg support     "
1746   if test "$GD_JPG" = "yes"; then
1747     echo "enabled"
1748   else
1749     echo "        disabled"
1750   fi
1751 else
1752   echo "        disabled"
1755 if test "$LABLGTK_CONFIG" = "yes"; then
1756   echo ""
1757   printf "\n - GUI support       "
1758   if test "$GUI" = "newgui1"; then
1759     echo "GTK1 newgui"
1760   else
1761     if test "$GUI" = "newgui2"; then
1762       echo "GTK2 GUI"
1763     else
1764       echo "GTK1 oldgui"
1765     fi
1766   fi
1769 if test "$OLDGUI_NO_31" = "yes"; then
1770   echo " - GUI support       GTK1 oldgui does not work with Ocaml 3.1*, disabled"
1773 if test "$TARGET_TYPE" = "byte"; then
1774   OCAML_TYPE="- byte code"
1775   COMPILE_TARGET=".byte"
1777 echo ""
1778 echo "Compilers:"
1779 echo " - OCaml version     $OCAMLVERSION $OCAML_TYPE"
1780 echo " - $CC version       $CC_VERSION"
1781 if test "x$CXX" != "x"; then
1782   echo " - $CXX version       $CXX_VERSION"
1784 echo ""
1785 echo "\nNow execute '$GNU_MAKE' to start compiling. Good luck!"
1787 echo ""
1788 echo "To compile a static code execute:     $GNU_MAKE mlnet$COMPILE_TARGET.static"
1789 echo "To produce a release tarball execute: $GNU_MAKE release.mlnet.static"
1790 echo "To clean the build directory execute: $GNU_MAKE maintainerclean"
1791 if test "$DONKEY_SUI" = "yes"; then
1792   echo ""
1793   echo "Compiling CryptoPP.cc can take several minutes, on slow machines up to half an hour."