summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 200a8056df9365f029ec67142d1e32bf39912664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================

dnl    This file is part of the KDE libraries/packages
dnl    Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
 
dnl    This file is free software; you can redistribute it and/or
dnl    modify it under the terms of the GNU Library General Public
dnl    License as published by the Free Software Foundation; either
dnl    version 2 of the License, or (at your option) any later version.
 
dnl    This library is distributed in the hope that it will be useful,
dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl    Library General Public License for more details.
 
dnl    You should have received a copy of the GNU Library General Public License
dnl    along with this library; see the file COPYING.LIB.  If not, write to
dnl    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl    Boston, MA 02110-1301, USA.

# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.

AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH

dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM 
dnl Perform program name transformation
AC_ARG_PROGRAM

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(tork, 0.1) dnl searches for some needed programs

KDE_SET_PREFIX

dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS

KDE_USE_QT(3.3.5)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================

#MIN_CONFIG(3.3.5)

dnl PACKAGE set before
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

# ---- Taken from KOffice ----------------------
# --- Check for KDE 3.2 or 3.3 or 3.4 or 3.5 ---

AC_MSG_CHECKING([for KDE version])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
tdeversion_save_CXXFLAGS="$CXXFLAGS"
tdeversion_safe_LIBS="$LIBS"
LIBS="$LIBS $X_EXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $all_includes"

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 2, 90 ) )
#error KDE 3.2
#endif
],
        need_kde32_compat="no"
,
        need_kde32_compat="yes"
)

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 3, 90 ) )
#error KDE 3.3
#endif
],
        need_kde33_compat="no"
,
        need_kde33_compat="yes"
)

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 4, 90 ) )
#error KDE 3.4
#endif
],
        need_kde34_compat="no"
,
        need_kde34_compat="yes"
)

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 5, 2 ) )
#error KDE 3.5.x (x < 2)
#endif
],
        need_kde351_compat="no"
,
        need_kde351_compat="yes"
)
CXXFLAGS="$tdeversion_save_CXXFLAGS"
LIBS="$tdeversion_safe_LIBS"
AC_LANG_RESTORE

if test "$need_kde32_compat" = "yes"; then
        AC_MSG_ERROR([You have KDE 3.2.x. TorK needs KDE 3.5.1 or greater.])
else
        if test "$need_kde33_compat" = "yes"; then
                AC_MSG_ERROR([You have KDE 3.3.x TorK needs KDE 3.5.1 or greater.])
        else 
                if test "$need_kde34_compat" = "yes"; then
                        AC_MSG_ERROR([You have KDE 3.4.x TorK needs KDE 3.5.1 or greater.])
                else
                        if test "$need_kde351_compat" = "yes"; then
                                 AC_MSG_RESULT([KDE 3.5.x (x >=1) or SVN trunk])
                        else
                                AC_MSG_RESULT([KDE 3.5.x (x >=2) or SVN trunk])
                        fi
                fi
        fi
fi


# --- End KDE 3.2 check ---

# --- Begin libgnutls macro ---

dnl Autoconf macros for libgnutls
dnl $id$

# Modified for LIBGNUTLS -- nmav
# Configure paths for LIBGCRYPT
# Shamelessly stolen from the one of XDELTA by Owen Taylor
# Werner Koch   99-12-09

dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
dnl
AC_DEFUN([AM_PATH_LIBGNUTLS],
[dnl
dnl Get the cflags and libraries from the libgnutls-config script
dnl
AC_ARG_WITH(libgnutls-prefix,
          [  --with-libgnutls-prefix=PFX   Prefix where libgnutls is installed (optional)],
          libgnutls_config_prefix="$withval", libgnutls_config_prefix="")

  if test x$libgnutls_config_prefix != x ; then
     if test x${LIBGNUTLS_CONFIG+set} != xset ; then
        LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
     fi
  fi

  AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
  no_libgnutls=""
  if test "$LIBGNUTLS_CONFIG" = "no" ; then
    no_libgnutls=yes
  else
    LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
    libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`


      ac_save_CFLAGS="$CFLAGS"
      ac_save_LIBS="$LIBS"
      CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
      LIBS="$LIBS $LIBGNUTLS_LIBS"
dnl
dnl Now check if the installed libgnutls is sufficiently new. Also sanity
dnl checks the results of libgnutls-config to some extent
dnl
      rm -f conf.libgnutlstest
      AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>

int
main ()
{
    system ("touch conf.libgnutlstest");

    if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
    {
      printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
             "$libgnutls_config_version", gnutls_check_version(NULL) );
      printf("*** was found! If libgnutls-config was correct, then it is best\n");
      printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
      printf("*** required on your system.\n");
      printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
      printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
      printf("*** before re-running configure\n");
    }
    else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
    {
      printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
      printf("*** library (version %s)\n", gnutls_check_version(NULL) );
    }
    else
    {
      if ( gnutls_check_version( "$min_libgnutls_version" ) )
      {
        return 0;
      }
     else
      {
        printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
                gnutls_check_version(NULL) );
        printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
               "$min_libgnutls_version" );
        printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
        printf("*** \n");
        printf("*** If you have already installed a sufficiently new version, this error\n");
        printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
        printf("*** being found. The easiest way to fix this is to remove the old version\n");
        printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
        printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
        printf("*** so that the correct libraries are found at run-time))\n");
      }
    }
  return 1;
}
],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
  fi

  if test "x$no_libgnutls" = x ; then
     AC_MSG_RESULT(yes)
     ifelse([$2], , :, [$2])
  else
     if test -f conf.libgnutlstest ; then
        :
     else
        AC_MSG_RESULT(no)
     fi
     if test "$LIBGNUTLS_CONFIG" = "no" ; then
       echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
       echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
       echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
       echo "*** full path to libgnutls-config."
     else
       if test -f conf.libgnutlstest ; then
        :
       else
          echo "*** Could not run libgnutls test program, checking why..."
          CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
          LIBS="$LIBS $LIBGNUTLS_LIBS"
          AC_TRY_LINK([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
],      [ return !!gnutls_check_version(NULL); ],
        [ echo "*** The test program compiled, but did not run. This usually means"
          echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
          echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
          echo "*** is required on your system"
          echo "***"
          echo "*** If you have an old version installed, it is best to remove it, although"
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
          echo "***" ],
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
          echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
          echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
          echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
          CFLAGS="$ac_save_CFLAGS"
          LIBS="$ac_save_LIBS"
       fi
     fi
     LIBGNUTLS_CFLAGS=""
     LIBGNUTLS_LIBS=""
     ifelse([$3], , :, [$3])
  fi
  rm -f conf.libgnutlstest
  AC_SUBST(LIBGNUTLS_CFLAGS)
  AC_SUBST(LIBGNUTLS_LIBS)
])

# --- End libgnutls macro ---


dnl Compile with GNUTLS
AC_ARG_ENABLE(gnutls,
     AS_HELP_STRING(--enable-gnutls, Compile with GnuTLS))

if test x$enable_gnutls = xyes; then

# gnu tls
#AM_PATH_LIBGNUTLS(1.0.0, , [
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.0.0], , [
       AC_DEFINE(USE_OPENSSL, 1, [use openssl for ssl session decryption instead of gnutls])
        AC_SUBST(USE_OPENSSL)
])

fi

# --- If no gnutls check for openssl ---

if test "x$LIBGNUTLS_LIBS" = "x"; then

AC_DEFINE(USE_OPENSSL, 1, [use openssl for ssl session decryption instead of gnutls])
AC_SUBST(USE_OPENSSL)

fi

# --- End of If no gnutls check for openssl ---

# Even if gnutls is required, we still need openssl for shallot.

dnl ------------------------------------------------------
dnl Where do you live, openssl?  And how do we call you?

AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssl_dir, [
  saved_LIBS="$LIBS"
  saved_LDFLAGS="$LDFLAGS"
  saved_CPPFLAGS="$CPPFLAGS"
  ssl_found=no
  for ssldir in $tryssldir "" $prefix /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /usr/pkg /opt /opt/openssl ; do
    LDFLAGS="$saved_LDFLAGS"
    SSL_LIBS="-lssl -lcrypto"
    LIBS="$saved_LIBS $SSL_LIBS"

    # Skip the directory if it isn't there.
    if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
       continue;
    fi
    if test ! -z "$ssldir" ; then
      if test -d "$ssldir/lib" ; then
        LDFLAGS="-L$ssldir/lib $LDFLAGS"
      else
        LDFLAGS="-L$ssldir $LDFLAGS"
      fi
      if test -d "$ssldir/include" ; then
        CPPFLAGS="-I$ssldir/include $CPPFLAGS"
      else
        CPPFLAGS="-I$ssldir $CPPFLAGS"
      fi
    fi
    # Can I link it?
    AC_TRY_LINK([#include <openssl/rand.h>],
       [ RAND_add((void*)0,0,0); ],
       [ openssl_linked=yes ], [ openssl_linked=no ])
    if test $openssl_linked = yes; then
       if test ! -z "$ssldir" ; then
         ac_cv_openssl_dir=$ssldir
       else
         ac_cv_openssl_dir="(system)"
       fi
       ssl_found=yes
       break
    fi
  done
  LIBS="$saved_LIBS"
  LDFLAGS="$saved_LDFLAGS"
  CPPFLAGS="$saved_CPPFLAGS"
  if test $ssl_found = no ; then
    AC_MSG_ERROR([Could not find a linkable OpenSSL. You can specify an explicit path using --with-ssl-dir])
  fi
])

saved_LIBS="$LIBS"
SSL_LIBS="-lssl -lcrypto"
LIBS="$saved_LIBS $SSL_LIBS"

if test "$ac_cv_openssl_dir" != "(system)"; then
  if test -d "$ac_cv_openssl_dir/lib" ; then
    LDFLAGS="-L$ac_cv_openssl_dir/lib $LDFLAGS"
    ssl_libdir="$ac_cv_openssl_dir/lib"
  else
    LDFLAGS="-L$ac_cv_openssl_dir $LDFLAGS"
    ssl_libdir="$ac_cv_openssl_dir"
  fi
  if test -d "$ac_cv_openssl_dir/include" ; then
    CPPFLAGS="-I$ac_cv_openssl_dir/include $CPPFLAGS"
  else
    CPPFLAGS="-I$ac_cv_openssl_dir $CPPFLAGS"
  fi
fi

AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
               ac_cv_openssl_linker_option, [
    saved_LDFLAGS="$LDFLAGS"
    ssl_runs=no
    linked_with=nothing
    for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do
      LDFLAGS="$ssl_extra $saved_LDFLAGS"
      AC_TRY_RUN([
#include <string.h>
#include <openssl/rand.h>
int main(void)
{
        char a[2048];
        memset(a, 0, sizeof(a));
        RAND_add(a, sizeof(a), sizeof(a));
        return(RAND_status() <= 0);
}
                        ],
                openssl_runs=yes, openssl_runs=no)
      if test $openssl_runs = yes ; then
        if test "$linked_with" = nothing; then
           linked_with="$ssl_extra"
        fi
        AC_TRY_RUN([
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
int main(void) {
return (OPENSSL_VERSION_NUMBER == SSLeay()) == 0;
}],
        right_version=yes, right_version=no)
        if test "$right_version" = yes; then
          if test -z "$ssl_extra" ; then
            ac_cv_openssl_linker_option='(none)'
          else
            ac_cv_openssl_linker_option=$ssl_extra
          fi
          ssl_runs=yes
          break
        fi
     fi
    done
    if test $ssl_runs = no ; then
      if test "$linked_with" = 'nothing' ; then
        AC_MSG_ERROR([Found linkable OpenSSL in $ac_cv_openssl_dir, but it doesn't run, even with -R.  Maybe specify another using --with-ssl-dir?])
      else
        if test -z "$linked_with" ; then
            ac_cv_openssl_linker_option='(none)'
        else
            ac_cv_openssl_linker_option=$linked_with
        fi
        AC_MSG_WARN([I managed to make OpenSSL link and run, but I couldn't make it link against the same version I found header files for.])
      fi
    fi
    LDFLAGS="$saved_LDFLAGS"
])

if test "$ac_cv_openssl_linker_option" != '(none)' ; then
   LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS"
fi

LIBS="$saved_LIBS"

# --- Decide which library to use for linking Tork ---
# --- SSL will be used for shallot ---

if test "x$LIBGNUTLS_LIBS" = "x"; then
    CRYPTO_LIBS=$SSL_LIBS
else
    CRYPTO_LIBS=$LIBGNUTLS_LIBS
fi
AC_SUBST(CRYPTO_LIBS)
AC_SUBST(SSL_LIBS)



dnl - GeoIP

AC_ARG_WITH(external-geoip,
	AC_HELP_STRING([--with-external-geoip], [Build against an external copy of GeoIP]))

if test "x$with_external_geoip" != "xyes"; then
   GEOVERSION=1.4.2
   dnl PACKAGE=GeoIP
   GEOIP_VERSION_INFO=`echo $GEOVERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
   AC_SUBST(GEOIP_VERSION_INFO)

   AC_ARG_WITH(city,
   [  --with-city=\"no\"   Enable/disable support for GeoIP City Edition. (yes)])
   if test "$with_city" = "no" ; then
     echo Disabling GeoIP City Edition support
     WITH_CITY=1
   else
     echo Enabling GeoIP City Edition support
     WITH_CITY=0
   fi
   AC_SUBST(WITH_CITY)
else
   with_city=no

   AC_CHECK_HEADERS([GeoIP.h],,
     [AC_MSG_ERROR([External GeoIP requested but GeoIP not found.])])
   AC_CHECK_LIB([GeoIP], [GeoIP_new], [GEOIPLIB=-lGeoIP],
     [AC_MSG_ERROR([External GeoIP requested but GeoIP not found.])])
fi

AM_CONDITIONAL(WITH_CITY, test "$with_city" != "no")
AM_CONDITIONAL([EXTERNAL_GEOIP], [test "x$with_external_geoip" = "xyes"])

if test x$with_external_geoip = xyes; then
  AC_DEFINE(EXTERNAL_GEOIP, 1, "Using External GeoIP")
fi



dnl - libwhich

which_cv_iberty=no
AC_ARG_ENABLE(iberty,
  [  --disable-iberty        do not try to find and use the iberty library],
  which_cv_iberty=$enableval)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_LANG_C


AC_DEFUN([BASH_CHECK_GETPW_FUNCS],
[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
AC_CACHE_VAL(bash_cv_can_redecl_getpw,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <pwd.h>
extern struct passwd *getpwent();
extern struct passwd *getpwuid();
extern struct passwd *getpwnam();],
[struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");],
  bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)])
AC_MSG_RESULT($bash_cv_can_redecl_getpw)
if test $bash_cv_can_redecl_getpw = no; then
AC_DEFINE([HAVE_GETPW_DECLS], 1, [Define this when you are able to redeclare getpw functions.])
fi
])


dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_FUNCS(strchr memcpy getopt_long)
AC_CHECK_HEADERS(unistd.h string.h libiberty.h)
AC_HEADER_STAT

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_CHECK_FUNCS(getcwd getwd)

AC_DEFINE([NEED_XMALLOC], 1, [Define if you need xmalloc().])

dnl Additional stuff needed for the tilde directory
AC_CHECK_PROG(AR, ar, ar, ar)
AC_PROG_RANLIB
AC_CHECK_HEADERS(stdlib.h)
BASH_CHECK_GETPW_FUNCS

if test "x$CONFDIR" = "x"; then
  CONFDIR=`eval echo $sysconfdir`
fi
AC_SUBST(CONFDIR)
AH_TEMPLATE([CONFDIR],[tork's configuration directory])
AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")


dnl Disable stuff that's not suitable for a Live CD
AC_ARG_ENABLE(live-cd,
     AS_HELP_STRING(--enable-live-cd, Disable Features Unsuitable for LiveCD))

if test x$enable_live_cd = xyes; then
  AC_DEFINE(LIVECD, 1, "Define to compile for a LiveCD")
fi

dnl Detect OS for Shallot compilation

case "$host" in 
  *-*-linux*) AC_DEFINE(LINUX_PORT, 1, "Shallot will compile for Linux") ;;
  *-*-freebsd*) AC_DEFINE(BSD, 1, "Shallot will compile for BSD") ;;
  *-*-netbsd*) AC_DEFINE(BSD, 1, "Shallot will compile for BSD") ;;
  *-*-openbsd*) AC_DEFINE(BSD, 1, "Shallot will compile for BSD") ;;
  *) AC_DEFINE(GENERIC, 1, "Shallot will compile for GENERIC") ;;
esac
#AC_DEFINE(_GNU_SOURCE, 1, "Shallot will compile with _GNU_SOURCE")
# USE_GNU_SOURCE above is used instead and _GNU_SOURCE defined in shallot.

dnl Check for presence of torsocks
AC_CHECK_PROG(TORSOCKS, torsocks, torsocks)
if test "${TORSOCKS}" = ""; then
  AC_MSG_ERROR('TorK requires torsocks: http://code.google.com/p/torsocks')
fi

dnl detect netfilter
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
        linux_netfilter_ipv4=1, linux_netfilter_ipv4=0)


failsafe_ok=0
if test x$linux_netfilter_ipv4 = x1 ; then
  failsafe_ok=1
fi
if test x$failsafe_ok = x1 ; then
  AC_DEFINE(USE_FAILSAFE, 1, "Define to enable failsafe support")
fi

AC_CONFIG_FILES([src/menu/tork])
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/en/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ src/Makefile ])
AC_CONFIG_FILES([ src/GeoIP-1.4.0/Makefile ])
AC_CONFIG_FILES([ src/GeoIP-1.4.0/data/Makefile ])
AC_CONFIG_FILES([ src/GeoIP-1.4.0/libGeoIP/Makefile ])
AC_CONFIG_FILES([ src/arkollon/Makefile ])
AC_CONFIG_FILES([ src/icons/Makefile ])
AC_CONFIG_FILES([ src/konqplugin/Makefile ])
AC_CONFIG_FILES([ src/menu/Makefile ])
AC_CONFIG_FILES([ src/privoxytemplates/Makefile ])
AC_CONFIG_FILES([ src/tor_ioslave/Makefile ])
AC_CONFIG_FILES([ src/torkapplet/Makefile ])
AC_CONFIG_FILES([ src/upnp/Makefile ])
AC_OUTPUT
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
  # And if so, warn when they don't match
  if test "$kde_libs_prefix" != "$given_prefix"; then
    # And if kde doesn't know about the prefix yet
    echo ":"`tde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
    if test $? -ne 0; then
      echo ""
      echo "Warning: you chose to install this package in $given_prefix,"
      echo "but KDE was found in $kde_libs_prefix."
      echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
      echo "that TDEDIRS contains it, e.g. export TDEDIRS=$given_prefix:$kde_libs_prefix"
      echo "Then restart KDE."
      echo ""
    fi
  fi
fi

if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
  echo ""
  echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
  echo "was not included. Therefore, GCC symbol visibility support remains disabled."
  echo ""
  echo "For better performance, consider including the Qt visibility supporting patch"
  echo "located at:"
  echo ""
  echo "http://bugs.kde.org/show_bug.cgi?id=109386"
  echo ""
  echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
  echo "everything will continue to work just fine without it."
  echo ""
fi

if test "$all_tests" = "bad"; then
  if test ! "$cache_file" = "/dev/null"; then
    echo ""
    echo "Please remove the file $cache_file after changing your setup"
    echo "so that configure will find the changes next time."
    echo ""
  fi
else
  echo ""
  echo "Good - your configure finished. Start make now"
  echo ""
fi