File: configure.in

package info (click to toggle)
gnome-vfs 1:2.24.4-6.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 17,144 kB
  • ctags: 10,422
  • sloc: ansic: 78,500; sh: 10,341; makefile: 902; perl: 99
file content (1371 lines) | stat: -rw-r--r-- 41,528 bytes parent folder | download | duplicates (2)
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
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
AC_INIT(libgnomevfs/gnome-vfs.h)

# Making releases:
#   LIBGNOMEVFS_MICRO_VERSION += 1;
#   LIBGNOMEVFS_INTERFACE_AGE += 1;
# if any functions have been added, set LIBGNOMEVFS_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set LIBGNOMEVFS_BINARY_AGE and LIBGNOMEVFS_INTERFACE_AGE to 0.
#
LIBGNOMEVFS_MAJOR_VERSION=2
LIBGNOMEVFS_MINOR_VERSION=24
LIBGNOMEVFS_MICRO_VERSION=4
LIBGNOMEVFS_INTERFACE_AGE=4
# If you need a modifier for the version number. 
# Normally empty, but can be used to make "fixup" releases.
LIBGNOMEVFS_EXTRAVERSION=

dnl libtool versioning from libgnome

LIBGNOMEVFS_CURRENT=`expr 100 '*' $LIBGNOMEVFS_MINOR_VERSION + $LIBGNOMEVFS_MICRO_VERSION - $LIBGNOMEVFS_INTERFACE_AGE`
LIBGNOMEVFS_BINARY_AGE=`expr 100 '*' $LIBGNOMEVFS_MINOR_VERSION + $LIBGNOMEVFS_MICRO_VERSION`
LIBGNOMEVFS_REVISION=$LIBGNOMEVFS_INTERFACE_AGE
LIBGNOMEVFS_AGE=`expr $LIBGNOMEVFS_BINARY_AGE - $LIBGNOMEVFS_INTERFACE_AGE`
LIBGNOMEVFS_VERSION=$LIBGNOMEVFS_MAJOR_VERSION.$LIBGNOMEVFS_MINOR_VERSION.$LIBGNOMEVFS_MICRO_VERSION$LIBGNOMEVFS_EXTRAVERSION

AC_SUBST(LIBGNOMEVFS_MAJOR_VERSION)
AC_SUBST(LIBGNOMEVFS_MINOR_VERSION)
AC_SUBST(LIBGNOMEVFS_MICRO_VERSION)
AC_SUBST(LIBGNOMEVFS_INTERFACE_AGE)
AC_SUBST(LIBGNOMEVFS_BINARY_AGE)
AC_SUBST(LIBGNOMEVFS_CURRENT)
AC_SUBST(LIBGNOMEVFS_REVISION)
AC_SUBST(LIBGNOMEVFS_AGE)
AC_SUBST(LIBGNOMEVFS_VERSION)
	
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gnome-vfs, $LIBGNOMEVFS_VERSION)

dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")

AM_MAINTAINER_MODE

GNOME_COMMON_INIT

dnl touch NOINST_GOB
dnl AC_CONFIG_SUBDIRS(gob)

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_AWK
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
IT_PROG_INTLTOOL([0.35.0])

dnl Check for Win32
case $host in
  *-*-mingw*)
    os_win32=yes
    # We do have getaddrinfo
    # But only on XP, so don't use it as Win2000 is still widespread
    # AC_CACHE_VAL(ac_cv_func_getaddrinfo, [ac_cv_func_getaddrinfo=yes])

    # No dbus on Win32 (yet, at least)
    dbus_requirement=""

    # Thus also no gnome-vfs-daemon on Win32
    enable_daemon_default=no
    ;;
  *)
    os_win32=no
    dbus_requirement="dbus-glib-1 >= 0.60"
    enable_daemon_default=yes
    ;;
esac
AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])

dnl Globally define_GNU_SOURCE and therefore enable the GNU extensions
AC_DEFINE(_GNU_SOURCE, 1, [Enable GNU Extensions])

dnl Versions shared with the .spec file.
GCONF_REQUIRED=1.1.1
GLIB_REQUIRED=2.9.3
XML_REQUIRED=2.6.0

AC_SUBST(GCONF_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
AC_SUBST(XML_REQUIRED)

LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
AC_SUBST(LIBTOOL_EXPORT_OPTIONS)

PKG_CHECK_MODULES(MODULES_XML, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED libxml-2.0 >= $XML_REQUIRED)
AC_SUBST(MODULES_XML_CFLAGS)
AC_SUBST(MODULES_XML_LIBS)
	
PKG_CHECK_MODULES(MODULES, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
AC_SUBST(MODULES_LIBS)
AC_SUBST(MODULES_CFLAGS)

PKG_CHECK_MODULES(MODULES_FILE, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
AC_SUBST(MODULES_FILE_LIBS)
AC_SUBST(MODULES_FILE_CFLAGS)

PKG_CHECK_MODULES(MODULES_GCONF, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
AC_SUBST(MODULES_GCONF_CFLAGS)
AC_SUBST(MODULES_GCONF_LIBS)

PKG_CHECK_MODULES(MODULES_XML_GCONF, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED libxml-2.0 >= $XML_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
AC_SUBST(MODULES_XML_GCONF_CFLAGS)
AC_SUBST(MODULES_XML_GCONF_LIBS)

PKG_CHECK_MODULES(TEST, gconf-2.0 >= $GCONF_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED)
AC_SUBST(TEST_LIBS)
AC_SUBST(TEST_CFLAGS)

PKG_CHECK_MODULES(PROGRAMS, gobject-2.0 >= $GLIB_REQUIRED)
AC_SUBST(PROGRAMS_LIBS)
AC_SUBST(PROGRAMS_CFLAGS)

cflags_set=yes
GNOME_COMPILE_WARNINGS
VFS_CFLAGS="$warnCFLAGS $complCFLAGS"

dnl semaphore functions are in librt.so on solaris
AC_SEARCH_LIBS(sem_wait, rt)
dnl and in libsem.so on systems that use libsem
AC_SEARCH_LIBS(sem_wait, sem)

dnl Don't blindly #define them if they're typedef'ed in <sys/types.h>
AM_GNOME_SIZE_T
AM_GNOME_OFF_T

AC_CACHE_CHECK([for off64_t],
	ac_cv_have_off64_t,
	AC_TRY_COMPILE([
#		define _LARGEFILE64_SOURCE
#		include <sys/types.h>],
		[off64_t testoffset],
	ac_cv_have_off64_t=yes,
	ac_cv_have_off64_t=no))
if test x"$ac_cv_have_off64_t" = "xyes" ; then
	AC_DEFINE(HAVE_OFF64_T, 1, [Whether off64_t type is available])
fi

GETTEXT_PACKAGE=gnome-vfs-2.0
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Name of the gettext package])

AM_GLIB_GNU_GETTEXT


AC_CHECK_FUNCS(ngettext, have_ngettext=yes, [AC_CHECK_LIB(intl,ngettext,have_ngettext=yes)])

if test x"$have_ngettext" != "xyes"; then
	AC_MSG_ERROR([Your Gettext installation doesn't seem to support ngettext to handle translation of plural forms. Please install GNU Gettext])
fi;

AC_SEARCH_LIBS(gethostent, nsl)
AC_SEARCH_LIBS(setsockopt, socket)
AC_SEARCH_LIBS(login_tty, util, [AC_DEFINE([HAVE_LOGIN_TTY],[],[Whether login_tty is available])])

AC_FUNC_ALLOCA
AC_CHECK_FUNCS(getdtablesize open64 lseek64 statfs statvfs seteuid setegid setresuid setresgid readdir_r mbrtowc inet_pton getdelim sysctlbyname poll posix_fadvise fchmod atoll mmap)
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
AC_STRUCT_ST_BLOCKS

dnl Volume monitor stuff			     
AC_CHECK_FUNCS(setmntent endmntent hasmntopt getmntinfo)
AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/vfstab.h sys/cdio.h sys/mount.h sys/mntctl.h sys/vfs.h sys/vmount.h sys/sysctl.h fstab.h fnmatch.h util.h sys/sysmacros.h)


AC_PATH_PROG(GCONFTOOL, gconftool-2, no)

if test x"$GCONFTOOL" = xno; then
  AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
fi

AM_GCONF_SOURCE_2

VFS_SIZE="guint64"
VFS_OFFSET="gint64"
VFS_SIZE_IS="UNSIGNED_LONG_LONG"
VFS_OFFSET_IS="LONG_LONG"

AC_SUBST(VFS_SIZE)
AC_SUBST(VFS_OFFSET)
AC_SUBST(VFS_SIZE_IS)
AC_SUBST(VFS_OFFSET_IS)

AC_CHECK_HEADERS(sys/param.h sys/resource.h sys/vfs.h sys/mount.h sys/statfs.h sys/statvfs.h sys/param.h wctype.h sys/poll.h poll.h)

dnl
dnl file system type member in statfs struct
dnl
AC_CHECK_MEMBERS([struct statfs.f_type], ,[
  AC_CHECK_MEMBERS([struct statfs.f_fstyp], , , [#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif])], [#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif])
 
dnl
dnl if statfs() takes 2 arguments or 4 (Solaris)
dnl
if test "$ac_cv_func_statfs" = yes ; then
  AC_MSG_CHECKING([number of arguments to statfs()])
  AC_TRY_COMPILE([#include <unistd.h>
  #ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
  #endif
  #ifdef HAVE_SYS_VFS_H
  #include <sys/vfs.h>
  #endif
  #ifdef HAVE_SYS_MOUNT_H
  #include <sys/mount.h>
  #endif
  #ifdef HAVE_SYS_STATFS_H
  #include <sys/statfs.h>
  #endif], [struct statfs st;
  statfs(NULL, &st);],[
    AC_MSG_RESULT([2])
    AC_DEFINE(STATFS_ARGS, 2, [Number of arguments to statfs()])],[
    AC_TRY_COMPILE([#include <unistd.h>
  #ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
  #endif
  #ifdef HAVE_SYS_VFS_H
  #include <sys/vfs.h>
  #endif
  #ifdef HAVE_SYS_MOUNT_H
  #include <sys/mount.h>
  #endif
  #ifdef HAVE_SYS_STATFS_H
  #include <sys/statfs.h>
  #endif], [struct statfs st;
  statfs(NULL, &st, sizeof (st), 0);],[
      AC_MSG_RESULT([4])
      AC_DEFINE(STATFS_ARGS, 4, [Number of arguments to statfs()])],[
      AC_MSG_RESULT(unknown)
      AC_MSG_ERROR([unable to determine number of arguments to statfs()])])])
fi dnl test "$ac_cv_func_statfs" = yes

AC_TYPE_MBSTATE_T

AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
  AC_SEARCH_LIBS(dirname, [gen])])


dnl ====================================
dnl =
dnl = Profiling support
dnl =
dnl ====================================
ENABLE_PROFILER=
AC_ARG_ENABLE(profiler,
[  --enable-profiler		Enable profiler],
[ENABLE_PROFILER=1
AC_DEFINE(ENABLE_PROFILER, 1, [Whether to enable profiler support])
])
if test "$ENABLE_PROFILER" = 1; then
	CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES"
	LDFLAGS="/gnome/PROFILE/lib/libprofiler.so -lpthread"
fi

AC_SUBST(ENABLE_PROFILER)
AM_CONDITIONAL(ENABLE_PROFILER, test "$ENABLE_PROFILER" = 1)
dnl ====================================

dnl turn warnings into errors to enforce clean code for cvs users (not in tarball)

AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
if test -f $srcdir/CVSVERSION; then
	set_more_warnings=yes
else
	set_more_warnings=no
fi
])

if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	echo "enable compile warnings = $set_more_warnings"
	VFS_CFLAGS="-Wall  \
	-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith"

	for option in -fno-strict-aliasing -Wno-strict-aliasing -Wno-sign-compare; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$VFS_CFLAGS $option $CFLAGS"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		CFLAGS="$SAVE_CFLAGS"
		if test $has_option = yes; then
		  VFS_CFLAGS="$VFS_CFLAGS $option"
		fi
		AC_MSG_RESULT($has_option)
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
fi
AC_SUBST(VFS_CFLAGS)

dnl
dnl gnome vfs Documentation
dnl 
GNOME_VFS_DIR=`(cd $srcdir; pwd)`
AC_SUBST(GNOME_VFS_DIR)

VFS_LIBS="-lgnomevfs $VFS_GLIB_LIBS"
VFS_LIBDIR='-L${libdir}'
VFS_INCLUDEDIR='-I${includedir} -I${libdir}/vfs/include'" $VFS_GLIB_CFLAGS"
AC_SUBST(VFS_LIBDIR)
AC_SUBST(VFS_INCLUDEDIR)
AC_SUBST(VFS_LIBS)

dnl
dnl efs-method.c
dnl

dnl if test "x$libefs_disabled" = xyes; then 
dnl     LIBEFS_CONFIG=no
dnl else
dnl     AC_PATH_PROG(LIBEFS_CONFIG, libefs-config, no)
dnl fi
dnl 
dnl if test "x$LIBEFS_CONFIG" != xno; then
dnl 	LIBEFS_LIBS=`$LIBEFS_CONFIG --libs`
dnl 	LIBEFS_CFLAGS=`$LIBEFS_CONFIG --cflags`
dnl fi
dnl 

AM_CONDITIONAL(HAVE_LIBEFS, false) 
LIBEFS_LIBS=""
LIBEFS_CFLAGS=""
AC_SUBST(LIBEFS_LIBS)
AC_SUBST(LIBEFS_CFLAGS)

dnl
dnl ftp-method.c
dnl
AC_DEFUN([AC_STRUCT_LINGER], [
av_struct_linger=no
AC_MSG_CHECKING(struct linger is available)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>

struct linger li;

main ()
{
    li.l_onoff = 1;
    li.l_linger = 120;
    exit (0);
}
],[
AC_DEFINE(HAVE_STRUCT_LINGER, 1, [Define to 1 if struct linger is available])
av_struct_linger=yes
],[
av_struct_linger=no
],[
av_struct_linger=no
])
AC_MSG_RESULT($av_struct_linger)
])

have_socket=no
AC_CHECK_FUNCS(socket, have_socket=yes)
if test $have_socket = no; then
  # socket is not in the default libraries.  See if it's in some other.
  for lib in bsd socket inet; do
    AC_CHECK_LIB($lib, socket, [
	  LIBS="$LIBS -l$lib"
	  have_socket=yes
	  AC_DEFINE(HAVE_SOCKET, 1, [Whether we have socket])
	  break])
  done
fi

AC_CHECK_FUNCS(inet_ntop)	   

AC_CHECK_LIB(bz2, bzCompressInit, AC_DEFINE(HAVE_OLDER_BZIP2, 1, [Define to 1 if older bzip2 version is used]))
AC_CHECK_HEADERS(bzlib.h,
	BZ2_LIBS="$BZ2_LIBS -lbz2",
	AC_MSG_ERROR([Gnome-vfs requires libbz2 to compile.])
	)
AC_SUBST(BZ2_LIBS)

if test $have_socket = yes; then
    AC_STRUCT_LINGER
fi

dnl modules/cdda
have_cdda=no
AC_ARG_ENABLE(cdda,
[  --enable-cdda		Enable cdda module (not recommended)],
[
  if test "x$enable_cdda" != "xno"; then
    AC_CHECK_HEADERS(cdda_interface.h cdda_paranoia.h, [
	CDDA_LIBS="$CDDA_LIBS -lcdda_paranoia -lcdda_interface"
	have_cdda=yes
    ])

    if test "$have_cdda" = yes; then
      dnl FreeBSD applies some patches to cdparanoia to support their libcam
      dnl library.  We need to detect if those ara available because the
      dnl cdrom_drive structure changes internally.
      AC_MSG_CHECKING([whether cdparanoia uses FreeBSD's libcam])
      AC_COMPILE_IFELSE([#include <cdda_interface.h>
int
main(void)
{
    struct cdrom_drive cd;
    void *v = (void *) cd.dev;
    return 0;
}],
        [AC_DEFINE(HAVE_CDDA_WITH_LIBCAM, 1,
          [Define to 1 if cdparanoia contains FreeBSD-specific libcam support])
         cdda_with_libcam=yes],
        [cdda_with_libcam=no
      ])
      AC_MSG_RESULT($cdda_with_libcam)
    fi
  fi
])
AM_CONDITIONAL(HAVE_CDDA, test $have_cdda = yes)
AC_SUBST(CDDA_LIBS)

dnl GSSAPI
dnl Check for Kerberos installation
have_gssapi=no
AC_PATH_PROG([KRB5_CONFIG], krb5-config, none, $PATH:/usr/kerberos/bin)
					   
if test "x$KRB5_CONFIG" != "xnone"; then
   GSSAPI_LIBS="`${KRB5_CONFIG} --libs gssapi`"
   GSSAPI_CFLAGS="`${KRB5_CONFIG} --cflags gssapi`"
   
   saved_CPPFLAGS="$CPPFLAGS"
   saved_LIBS="$LIBS"
   LIBS="$LIBS $GSSAPI_LIBS"
   CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
   # MIT and Heimdal put gssapi.h in different places
   AC_CHECK_HEADERS(gssapi/gssapi.h gssapi.h, [
       AC_CHECK_FUNCS(gss_init_sec_context, [
           AC_MSG_NOTICE([GSSAPI authentication support enabled])
           AC_DEFINE(HAVE_GSSAPI, 1, [Define if GSSAPI support is enabled])
           AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
		 have_gssapi=yes
	 
       # MIT Kerberos lacks GSS_C_NT_HOSTBASED_SERVICE
       AC_CHECK_DECL([GSS_C_NT_HOSTBASED_SERVICE],,
          [AC_DEFINE([GSS_C_NT_HOSTBASED_SERVICE], gss_nt_service_name, 
             [Define if GSS_C_NT_HOSTBASED_SERVICE is not defined otherwise])
		], [
		    #ifdef HAVE_GSSAPI_GSSAPI_H
		    #include <gssapi/gssapi.h>
		    #else	   
		    #include <gssapi.h>
		    #endif
		])
	  ])
     break
   ])
   LIBS="$saved_LIBS" 
   CPPFLAGS="$saved_CPPFLAGS" 
fi   
AC_SUBST(GSSAPI_LIBS)
AC_SUBST(GSSAPI_CFLAGS)
	   
dnl ******************************
dnl http-method (neon checks)
dnl ******************************
VFS_NEON_BUNDLED(imported/neon)

AC_ARG_ENABLE(http-debug,
	[AS_HELP_STRING([--enable-http-debug],[Enable HTTP method debugging])],
	[],[enable_http_debug=no])

if test "$enable_http_debug" = "yes"; then
 AC_DEFINE([DEBUG_HTTP_ENABLE], 1, [Indicates http debugging status])
 AC_MSG_NOTICE([HTTP module debugging ENABLED])
fi

dnl modules/cdemenu-desktop

AC_MSG_CHECKING(for Solaris platform)
case $host in
        *solaris*) build_cdemenu_module=yes ;;
        *) build_cdemenu_module=no ;;
esac
AC_MSG_RESULT([$build_cdemenu_module])
AM_CONDITIONAL(BUILD_CDEMENU_MODULE, test "$build_cdemenu_module" = "yes")

dnl ******************************
dnl Samba 3.0
dnl ******************************

AC_ARG_ENABLE(samba, [  --disable-samba       build without samba support])
msg_samba="no"
if test "x$enable_samba" != "xno"; then
  AC_ARG_WITH(samba-includes, [  --with-samba-includes=PREFIX     Location of samba includes.],
	      with_samba_includes="$withval", with_samba_includes="/usr/include")
  have_samba_includes="no"
  if test "x${with_samba_includes}" != "xno"; then
	CPPFLAGS_save="$CPPFLAGS"

	echo "before test, samba_includes: ${samba_includes}"

	CPPFLAGS="$CPPFLAGS -I$with_samba_includes"
	AC_CHECK_HEADER(libsmbclient.h, [ samba_includes="yes" ])
	CPPFLAGS="$CPPFLAGS_save"
	
	if test "x{samba_includes}" != "xno" -a "x${samba_includes}" != "x"; then
		have_samba_includes="yes"
		if test "${with_samba_includes}" != "/usr/include" ; then
			SAMBA_CFLAGS="-I$with_samba_includes"
		else
			SAMBA_CFLAGS=""
		fi
		
		CPPFLAGS="$CPPFLAGS -I$with_samba_includes"
		AC_CHECK_MEMBER(SMBCCTX.flags,
				[AC_DEFINE(HAVE_SAMBA_FLAGS,, [Defined if flags availible in SMBCCTXT])],,
				[#include <libsmbclient.h>])
		AC_CHECK_MEMBER(SMBCCTX.close,
				[AC_DEFINE(HAVE_SAMBA_OLD_CLOSE, , [Defined if old close is available in SMBCCTXT])],,
				[#include <libsmbclient.h>])
		CPPFLAGS="$CPPFLAGS_save"
	else
		SAMBA_CFLAGS=""
	fi
  fi
  echo "have_samba_includes: ${have_samba_includes}"
  AC_ARG_WITH(samba-libs, [  --with-samba-libs=PREFIX     	Location of Samba libs.],
	      with_samba_libs="$withval", with_samba_libs="/usr/lib")
  if test "x${with_samba_libs}" != "xno" -a "x${have_samba_includes}" != "xno"; then
	LDFLAGS_save="$LDFLAGS"
	
	LDFLAGS="$LDFLAGS -L$with_samba_libs"
	AC_CHECK_LIB(smbclient, smbc_new_context,samba_libs="yes", samba_libs="no")
	LDFLAGS="$LDFLAGS_save"
	if test "x${samba_libs}" != "xno"; then
		AC_DEFINE(HAVE_SAMBA,, [Define to 1 if you have the samba 3.0 libraries])
		msg_samba="yes"
                if test x$with_samba_libs != x/usr/lib; then
                        SAMBA_LIBS="-L$with_samba_libs -lsmbclient"
                else
                	SAMBA_LIBS="-lsmbclient"
                fi
	else
		SAMBA_CFLAGS=""
		SAMBA_LIBS=""
	fi
  fi
  AC_MSG_CHECKING(for Samba 3.0 libraries)
  AC_MSG_RESULT($msg_samba)
fi
AM_CONDITIONAL(HAVE_SAMBA, test $msg_samba = yes)
AC_SUBST(SAMBA_CFLAGS)
AC_SUBST(SAMBA_LIBS)

dnl ***************************************************************************
dnl SSL support
dnl ***************************************************************************
have_ssl=false

dnl ******************************
dnl OpenSSL
dnl ******************************

AC_ARG_ENABLE(openssl, [  --disable-openssl       build without openssl support])
if test "x$enable_openssl" != "xno"; then
  PKG_CHECK_MODULES(OPENSSL, openssl, [have_ssl=true
				       AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if OpenSSL is available])
	                               ],[
  AC_ARG_WITH(openssl-includes, [  --with-openssl-includes=PREFIX     Location of OpenSSL includes.],
	      with_openssl_includes="$withval", with_openssl_includes="/usr/include")
  have_openssl_includes="no"
  if test "x${with_openssl_includes}" != "xno"; then
	CPPFLAGS_save="$CPPFLAGS"
	
	AC_MSG_CHECKING(for OpenSSL includes)
	AC_MSG_RESULT("")
	
	CPPFLAGS="$CPPFLAGS -I$with_openssl_includes"
	AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h, [ openssl_includes="yes" ])
	CPPFLAGS="$CPPFLAGS_save"
	
	if test "x${openssl_includes}" != "xno" -a "x${openssl_includes}" != "x"; then
		have_openssl_includes="yes"
		if test "${with_openssl_includes}" != "/usr/include" ; then
			OPENSSL_CFLAGS="-I$with_openssl_includes"
		else
			OPENSSL_CFLAGS=""
		fi
	else
		OPENSSL_CFLAGS=""
	fi
  else
	AC_MSG_CHECKING(for OpenSSL includes)
	AC_MSG_RESULT(no)
	have_ssl=false
  fi

  AC_ARG_WITH(openssl-libs, [  --with-openssl-libs=PREFIX     	Location of OpenSSL libs.],
	      with_openssl_libs="$withval", with_openssl_libs="/usr/lib")
  msg_openssl="no"
  if test "x${with_openssl_libs}" != "xno" -a "x${have_openssl_includes}" != "xno"; then
	LDFLAGS_save="$LDFLAGS"
	
	AC_CACHE_CHECK([for OpenSSL libraries], openssl_libs,
	[
dnl How can we test to see if we need to link to libld for sure?? 
dnl RedHat 6.2 seems to need to but Debian Woody doesn't
		LDFLAGS="$LDFLAGS -L$with_openssl_libs -lssl -lcrypto -ldl"
		AC_TRY_LINK_FUNC(SSL_read, openssl_libs="yes", openssl_libs="no")
		LDFLAGS="$LDFLAGS_save"
	])
	if test "x${openssl_libs}" != "xno"; then
		AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if OpenSSL is available])
		msg_openssl="yes"
                if test x$with_openssl_libs != x/usr/lib; then
                        OPENSSL_LIBS="-L$with_openssl_libs -lssl -lcrypto"
                else
                	OPENSSL_LIBS="-lssl -lcrypto"
                fi
		have_ssl=true
		AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if OpenSSL is available])
	else
		OPENSSL_CFLAGS=""
		OPENSSL_LIBS=""
		have_ssl=false
	fi
  else
	AC_MSG_CHECKING(for OpenSSL libraries)
	AC_MSG_RESULT(no)
  fi
  ])
  dnl end of PKG_CHECK_MODULES(openssl)
fi

dnl ****************************
dnl GNUTLS
dnl ****************************

AC_ARG_ENABLE(gnutls, [  --enable-gnutls         build with gnutls support])
if test "x$enable_gnutls" = "xyes"; then
  if test "x${OPENSSL_LIBS}" != "x"; then
    AC_MSG_ERROR([*** Can't use both openssl and gnutls at the same time. Please pick one only. ***])
  else
    PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 1.0.0, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
    				 	   	  have_ssl=true])
    if test "x${LIBGNUTLS_LIBS}" = "x"; then
      AC_MSG_ERROR([Unable to find GNUTLS])
    fi
  fi
fi

if test x$have_ssl = xtrue; then
	msg_ssl="yes"
else
	msg_ssl="no"
fi

AM_CONDITIONAL(HAVE_SSL, test x$have_ssl = xtrue)

dnl ****************************
dnl DNS-SD implementations
dnl ****************************
AM_CONDITIONAL(HAVE_AVAHI, false)
AM_CONDITIONAL(HAVE_HOWL, false)
			  
AC_ARG_ENABLE(avahi, [  --disable-avahi     build without avahi support])
msg_avahi=no
if test "x$enable_avahi" != "xno"; then
	PKG_CHECK_MODULES(AVAHI, avahi-glib >= 0.6 avahi-client >= 0.6,
		  	[AM_CONDITIONAL(HAVE_AVAHI, true)
		   	AC_DEFINE(HAVE_AVAHI, [], [Set if we can use avahi])]
                        msg_avahi=yes,
	          	[AM_CONDITIONAL(HAVE_AVAHI, false)])
	AC_SUBST(AVAHI_CFLAGS)
	AC_SUBST(AVAHI_LIBS)
fi
			  
AC_ARG_ENABLE(howl, [  --disable-howl     build without howl support])
msg_howl=no
if test "x$msg_avahi" = "xno" -a "x$enable_howl" != "xno"; then
	PKG_CHECK_MODULES(HOWL, howl >= 0.9.6,
		  	[AM_CONDITIONAL(HAVE_HOWL, true)
		   	AC_DEFINE(HAVE_HOWL, [], [Set if we can use howl])]
                        msg_howl=yes,
	          	[AM_CONDITIONAL(HAVE_HOWL, false)])
	AC_SUBST(HOWL_CFLAGS)
	AC_SUBST(HOWL_LIBS)
fi

dnl ****************************
dnl Enable the daemon?
dnl ****************************

msg_daemon=no
AC_ARG_ENABLE(daemon,
AC_HELP_STRING([--enable-daemon],[enable gnome-vfs-daemon]),
[case $enableval in
yes) if test "$os_win32" = "yes"; then
	AC_MSG_ERROR([can't enable gnome-vfs-daemon on Win32])
     fi
     ENABLE_DAEMON=yes ;;
no)  ENABLE_DAEMON=no ;;
*) AC_MSG_ERROR(bad value $enableval for --enable-daemon) ;;
esac],
[ENABLE_DAEMON=$enable_daemon_default]) dnl Default value

if test "$ENABLE_DAEMON" = "yes"; then
	AC_DEFINE(USE_DAEMON, 1, [defined if we have gnome-vfs-daemon])
	msg_daemon=yes
fi

AM_CONDITIONAL(USE_DAEMON, test "$ENABLE_DAEMON" = "yes")

dnl ****************************
dnl HAL stuff
dnl ****************************
msg_hal=no
AC_ARG_ENABLE(hal,
AC_HELP_STRING([--enable-hal],[use hal, if available]),
[case $enableval in
yes) ENABLE_HAL=yes ;;
no)  ENABLE_HAL=no ;;
*) AC_MSG_ERROR(bad value $enableval for --enable-hal) ;;
esac],
[ENABLE_HAL=yes]) dnl Default value

if test "$ENABLE_HAL" = "yes"; then
	PKG_CHECK_MODULES(HAL, hal >= 0.5.7,
		[ USE_HAL="hal >= 0.5.7, hal-storage >= 0.5.7, dbus-1 >= 0.32, dbus-glib-1 >= 0.32"
		  AC_DEFINE(USE_HAL, 1, [defined if using libhal])
		  msg_hal=yes],
		[ USE_HAL=""])
else
	USE_HAL=""
fi

if test "$USE_HAL" != ""; then
  AC_ARG_WITH(hal-mount,  [  --with-hal-mount=PROGRAM     Program for mounting filesystems known to HAL (not used if gnome-mount is installed)],
	      with_hal_mount="$withval", with_hal_mount="none")
  if test "x$with_hal_mount" != "xnone"; then
    AC_DEFINE_UNQUOTED(HAL_MOUNT, "$with_hal_mount", [Path to program for mounting filesystems known to HAL (not used if gnome-mount is installed)])
  fi
  AC_ARG_WITH(hal-umount, [  --with-hal-umount=PROGRAM    Program for unmounting filesystems known to HAL (not used if gnome-mount is installed)],
	      with_hal_umount="$withval", with_hal_umount="none")
  if test "x$with_hal_umount" != "xnone"; then
    AC_DEFINE_UNQUOTED(HAL_UMOUNT, "$with_hal_umount", [Path to program for unmounting filesystems known to HAL (not used if gnome-mount is installed)])
  fi
  AC_ARG_WITH(hal-eject,  [  --with-hal-eject=PROGRAM     Program for ejecting filesystems known to HAL (not used if gnome-mount is installed)],
	      with_hal_eject="$withval", with_hal_eject="none")
  if test "x$with_hal_eject" != "xnone"; then
    AC_DEFINE_UNQUOTED(HAL_EJECT, "$with_hal_eject", [Path to program for ejecting filesystems known to HAL (not used if gnome-mount is installed)])
  fi
fi


dnl ==============================================================================
dnl Check for a supported resolver functions
dnl ==============================================================================
dnl This is just a mix of the old code and new one taken from the gnet library and
dnl evolution. 

need_lib_resolve=no
dnl need libresolv for dns-sd stuff			 
AC_MSG_CHECKING(for res_search)
AC_TRY_LINK_FUNC(res_search, AC_MSG_RESULT(yes),
	[ AC_MSG_RESULT(no)
	saved_LIBS="$LIBS"
	LIBS="$LIBS -lresolv"
	AC_MSG_CHECKING(for res_search in -lresolv)
	AC_LINK_IFELSE([[
		#include <resolv.h>
		int main()
		{
			res_search (0, 0, 0, 0, 0);
			return 0;
		}
	]],[ 
	  RESOLVER_LIBS="-lresolv"
	  need_lib_resolve=yes
	  AC_MSG_RESULT(yes)
	],[ 
	  AC_MSG_RESULT(no)
	])
	  LIBS="$saved_LIBS" 
])


dnl check for res_ninit (thread-safe version of res_init)
dnl this detection code comes from Mozilla
AC_CACHE_CHECK([for res_ninit()], have_res_ninit,
	[AC_TRY_LINK([
        	  #ifdef linux
        	  #define _BSD_SOURCE 1
        	  #endif
        	  #include <resolv.h>
        ], [
		int foo = res_ninit (&_res);
	], [
		have_res_ninit=yes
	], [
		have_res_ninit=no
	])
])

if test "x$have_res_ninit" = "xyes"; then
    AC_DEFINE([HAVE_RES_NINIT], 1, [Indicates if res_ninit is available])
else
    AC_CHECK_LIB(bind, res_ninit, 
    	[AC_DEFINE(HAVE_RES_NINIT, 1, [Indicates if res_ninit is available])
	 RESOLVER_LIBS="-lbind",
    	 AC_CHECK_LIB(resolv, res_ninit, 
		[AC_DEFINE(HAVE_RES_NINIT, 1, [Indicates if res_ninit is available])
		 if test "x$need_lib_resolv" = "xno"; then
			RESOLVER_LIBS="-lresolv"
		 fi
		])
	])
fi


have_getaddrinfo=no
have_resolver=no
AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes; have_resolver=yes)
if test "x$have_getaddrinfo" != "xyes"; then

    # getaddrinfo is not in the default libraries.  See if it's in some other.
    for lib in bsd socket inet; do
        AC_CHECK_LIB($lib, getaddrinfo, [
					  LIBS="$LIBS -l$lib"
					  have_getaddrinfo=yes
					  have_resolver=yes
					  break
	   ])
    done
fi

if test "x$have_getaddrinfo" = "xyes"; then
	AC_DEFINE(USE_GETADDRINFO, 1, [Define to 1 if getaddrinfo is used for name resolution])
	AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 getaddrinfo is present on this system])
	AC_TRY_COMPILE([
		#include "confdefs.h"
		#include <sys/types.h>
		#include <sys/socket.h>
		#include <netinet/in.h>
		#include <netdb.h>

	],[
		struct addrinfo hints;
		
		hints.ai_flags = AI_ADDRCONFIG;
	],[
		AC_DEFINE(HAVE_AI_ADDRCONFIG, 1,
				[Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo])
	])
fi

if test "x$have_resolver" = "xno"; then
dnl looks like we dont have getaddrinfo try gethostbyname_r
AC_CHECK_FUNC(gethostbyname_r, [
	   dnl  First check for the glibc variant of gethostbyname_r
	   
	   AC_MSG_CHECKING(for glibc gethostbyname_r)
	   AC_TRY_LINK([
			 #include <netdb.h>
	   ], [
			 struct hostent result_buf;
			 char buf[1024];
			 struct hostent* result;
			 int h_errnop;

			 gethostbyname_r ("localhost",
						   &result_buf,
						   buf,
						   sizeof(buf),
						   &result,
						   &h_errnop);
	   ], [

			 dnl Have glibc gethostbyname_r

			 AC_MSG_RESULT(yes)
			 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1,
				[Define if you have a glibc-style gethostbyname_r()])
			 AC_DEFINE(USE_GETHOSTBYNAME_R, 1,
			     [Define to 1 if gethostbyname_r is used for name resolution])
			 have_resolver=yes

	   ], [
			 AC_MSG_RESULT(no)
        				

	   dnl  If we don't have glibc gethostbyname_r, check
	   dnl  for Solaris/Irix gethostbyname_r


	   AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
	   AC_TRY_LINK([
			 #include <netdb.h>
	   ], [
			 struct hostent result;
			 char buf[1024];
			 int h_errnop;

			 gethostbyname_r ("localhost",
						    &result,
						    buf,
						    sizeof(buf),
						    &h_errnop);

	   ], [

			 dnl Have Solaris/Irix gethostbyname_r

			 AC_MSG_RESULT(yes)
			 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1,
					 [Define if you have a Solaris-style gethostbyname_r()])
			 AC_DEFINE(USE_GETHOSTBYNAME_R, 1,
			     [Define to 1 if gethostbyname_r is used for name resolution])
		      have_resolver=yes

	  ], [

	           AC_MSG_RESULT(no)
	  
	   dnl  If don't have Solaris/Irix gethostbyname_r, check
	   dnl  for HP-UX gethostbyname_r

	   AC_MSG_CHECKING(for HP-UX gethostbyname_r)

	   AC_TRY_LINK([
			 #include <netdb.h>
	   ], [
			 struct hostent result;

			 char buf[1024];
			 gethostbyname_r ("localhost",
						   &result,
						   buf);
	   ], [
        
			 dnl Have HP-UX gethostbyname_r

			 AC_MSG_RESULT(yes)
			 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1,
					 [Define if you have an HP-UX-style gethostbyname_r()])
			 AC_DEFINE(USE_GETHOSTBYNAME_R, 1,
			     [Define to 1 if gethostbyname_r is used for name resolution])
			 have_resolver=yes
			 
	   ], [
			 AC_MSG_RESULT(no)
	   ] #hpux
     )] #solaris
  )] #glibc
)]) #check func
    
fi

if test x$have_resolver = "xno" ; then
   have_gethostbyname=no

   AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)

   if test $have_gethostbyname = no; then
	 # gethostbyname is not in the default libraries.  See if it's in some other.
	 for lib in bsd socket inet; do
		AC_CHECK_LIB($lib, gethostbyname, [
					    LIBS="$LIBS -l$lib"
					    have_gethostbyname=yes
					    have_resolver=yes

					    AC_DEFINE(USE_GETHOSTBYNAME, 1,
							 [Define if gethostbyname is used for name resolution])
					    break
		])
      done
   fi
fi
    
dnl ==============================================================================
dnl End of resolver functions check
dnl ==============================================================================

dnl ====================================================================
dnl Code for checking whether IPv6 is enabled on the system....
dnl ====================================================================
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
if test $enable_ipv6 = yes; then
  save_libs=$LIBS


  AC_TRY_COMPILE([ 
		#ifdef _WIN32
		#include <winsock2.h>
		#include <ws2tcpip.h>
		#else
		#include <sys/types.h>
		#include <sys/socket.h>
		#endif
    ], [
	     socket(AF_INET6, SOCK_STREAM, 0)
    ], [
          have_ipv6=yes
		AC_DEFINE(ENABLE_IPV6, [], [Define to enable IPv6 support])
    ], have_ipv6=no
  )
  
  AC_MSG_RESULT($have_ipv6)

fi
dnl ==============================================================================
dnl End of IPv6 checks
dnl ==============================================================================

PKG_CHECK_MODULES(LIBGNOMEVFS, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libxml-2.0 >= $XML_REQUIRED gnome-mime-data-2.0 $dbus_requirement)
LIBGNOMEVFS_CFLAGS="$LIBGNOMEVFS_CFLAGS $OPENSSL_CFLAGS $LIBGNUTLS_CFLAGS $HOWL_CFLAGS $AVAHI_CFLAGS"
LIBGNOMEVFS_LIBS="$LIBGNOMEVFS_LIBS $OPENSSL_LIBS $LIBGNUTLS_LIBS $HOWL_LIBS $AVAHI_LIBS $RESOLVER_LIBS"
AC_SUBST(LIBGNOMEVFS_CFLAGS)
AC_SUBST(LIBGNOMEVFS_LIBS)

PKG_CHECK_MODULES(LIBGNOMEVFSDAEMON, glib-2.0 $USE_HAL)
AC_SUBST(LIBGNOMEVFSDAEMON_CFLAGS)
AC_SUBST(LIBGNOMEVFSDAEMON_LIBS)

AC_ARG_WITH(dbus_service_dir, [  --with-dbus-service-dir=PATH choose directory for dbus service files, [default=PREFIX/share/dbus-1/services]], with_dbus_service_dir="$withval", with_dbus_service_dir=$datadir/dbus-1/services)
DBUS_SERVICE_DIR=$with_dbus_service_dir
AC_SUBST(DBUS_SERVICE_DIR)
						       	
dnl ****************************
dnl *** Checks for pty stuff ***
dnl ****************************

AC_CHECK_HEADERS(sys/un.h stropts.h termios.h utmp.h)

# Check for PTY handling functions.
AC_CHECK_FUNCS(getpt posix_openpt grantpt unlockpt ptsname ptsname_r)

# Pull in the right libraries for various functions which might not be
# bundled into an exploded libc.
AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"]))
if test x$have_socketpair = x1 ; then
	AC_DEFINE(HAVE_SOCKETPAIR,1,[Define if you have the socketpair function.])
fi

dnl =====================
dnl ACL checks
dnl =====================
acl_backends=""
ACL_LIBS=""

AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
AC_CHECK_LIB(sec,acl,[ACL_LIBS="$ACL_LIBS -lsec"])

AC_CACHE_CHECK([for Solaris ACL], gvfs_cv_HAVE_SOLARIS_ACLS,[
		acl_LIBS=$LIBS
		LIBS="$LIBS -lsec"
		AC_TRY_LINK([#include <sys/types.h>
#include <sys/acl.h>],
[ return acl ("/", GETACL, 0, NULL);],
gvfs_cv_HAVE_SOLARIS_ACLS=yes, gvfs_cv_HAVE_SOLARIS_ACLS=no)
		LIBS=$acl_LIBS])

AC_CACHE_CHECK([for POSIX ACL], gvfs_cv_HAVE_POSIX_ACLS,[
		acl_LIBS=$LIBS
		LIBS="$LIBS -lacl"
		AC_TRY_LINK([#include <sys/types.h>
#include <sys/acl.h>],
[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry (acl, entry_id, entry_p);],
gvfs_cv_HAVE_POSIX_ACLS=yes, gvfs_cv_HAVE_POSIX_ACLS=no)
		LIBS=$acl_LIBS])

if test x"$gvfs_cv_HAVE_SOLARIS_ACLS" = x"yes" ; then
    have_solaris_acl_support=yes
    acl_backends="solaris"

    AC_DEFINE(HAVE_SOLARIS_ACL,1,[Have Solaris ACLs])
    AC_CHECK_HEADERS([pwd.h grp.h])
fi

if test x"$gvfs_cv_HAVE_POSIX_ACLS" = x"yes" ; then
    have_posix_acl_support=yes
    acl_backends="posix"

    AC_DEFINE(HAVE_POSIX_ACL,1,[Have POSIX ACLs])
    AC_CHECK_FUNCS(acl_extended_file)
    
    AC_CHECK_HEADERS([pwd.h])
    if test "$ac_cv_header_pwd_h" = "yes"; then
	 	AC_CACHE_CHECK([for posix getpwuid_r],
			ac_cv_func_posix_getpwuid_r,
			[AC_TRY_RUN([
#include <errno.h>
#include <pwd.h>
int main () { 
    char buffer[10000];
    struct passwd pwd, *pwptr = &pwd;
    int error;
    errno = 0;
    error = getpwuid_r (0, &pwd, buffer, 
                        sizeof (buffer), &pwptr);
   return (error < 0 && errno == ENOSYS) 
	   || error == ENOSYS; 
}                               ],
				[ac_cv_func_posix_getpwuid_r=yes],
				[ac_cv_func_posix_getpwuid_r=no])])
		dnl GLIB_ASSERT_SET(ac_cv_func_posix_getpwuid_r)
		if test "$ac_cv_func_posix_getpwuid_r" = yes; then
			AC_DEFINE(HAVE_POSIX_GETPWUID_R,1,
				[Have POSIX function getpwuid_r])
		else
	 		AC_CACHE_CHECK([for nonposix getpwuid_r],
				ac_cv_func_nonposix_getpwuid_r,
				[AC_TRY_LINK([#include <pwd.h>],
                                	[char buffer[10000];
                                	struct passwd pwd;
                                	getpwuid_r (0, &pwd, buffer, 
                                        		sizeof (buffer));],
					[ac_cv_func_nonposix_getpwuid_r=yes],
					[ac_cv_func_nonposix_getpwuid_r=no])])
			dnl GLIB_ASSERT_SET(ac_cv_func_nonposix_getpwuid_r)
			if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then
				AC_DEFINE(HAVE_NONPOSIX_GETPWUID_R,1,
					[Have non-POSIX function getpwuid_r])
			fi
		fi
	fi 

	AC_CHECK_HEADERS([grp.h])

	AC_CHECK_FUNCS(getgrgid_r)
	AC_CHECK_FUNCS(getgrnam_r)
	AC_CHECK_FUNCS(getpwnam_r)
	
fi

AC_SUBST(ACL_LIBS)
AM_CONDITIONAL(HAVE_POSIX_ACL, test x"$have_posix_acl_support" = x"yes")
AM_CONDITIONAL(HAVE_SOLARIS_ACL, test x"$have_solaris_acl_support" = x"yes")

dnl =====================
dnl File system monitors
dnl =====================
fs_monitor_backends=""

dnl **********************
dnl *** inotify***
dnl **********************

inotify_support=no
AC_CHECK_HEADERS([sys/inotify.h],
		 [
		 inotify_support=yes
		 ])

AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"]) 

if test "$inotify_support" = "yes"; then
  fs_monitor_backends="inotify "
fi

dnl **********************
dnl *** Checks for FAM ***
dnl **********************

should_disable_fam=no

AC_ARG_ENABLE(fam, [  --disable-fam          build without enabling fam for file system monitoring],
			 [
				if test "x$enable_fam" = "xno"; then
					should_disable_fam=yes
					echo "Not building FAM support"
				fi
			 ]
			 )
FAM_MISSING_WARNING="Gnome-vfs depends on FAM to provide notification when files are altered (either through filesystem polling, or a kernel notification mechanism). If Gnome-vfs is built without FAM support, directories viewed with Nautilus or other applications will not remain in synch with the actual filesystem when they are altered by external processes. Particularly if you are a distributor please compile Nautilus with FAM support. FAM is available from http://oss.sgi.com/projects/fam/. A patch to add Linux Kernel 2.4 directory notify support to FAM (highly desirable) is available from http://people.redhat.com/alexl/files/"
FAM_LIBS=
if test "x$should_disable_fam" = "xno"; then
AC_CHECK_LIB(fam, FAMOpen,
  [AC_CHECK_HEADERS(fam.h,
    [AC_DEFINE(HAVE_FAM, [], [Define if we have FAM])
     FAM_LIBS="-lfam"]
     fs_monitor_backends="${fs_monitor_backends}fam",
    AC_MSG_WARN(*** FAM support will not be built (header files not found) $FAM_MISSING_WARNING ***))],
  AC_MSG_WARN(*** FAM support will not be built (FAM library not found) $FAM_MISSING_WARNING ***))
AC_SUBST(FAM_LIBS)
fi

dnl ****************************
dnl *** Check for libselinux ***
dnl ****************************
AC_ARG_ENABLE(selinux, [  --disable-selinux       build without selinux support])
msg_selinux=no
SELINUX_LIBS=
if test "x$enable_selinux" != "xno"; then

 AC_CHECK_LIB(selinux, is_selinux_enabled,
   [AC_CHECK_HEADERS(selinux/selinux.h,
     [AC_SEARCH_LIBS(lgetfilecon_raw, selinux, 
       [AC_DEFINE(HAVE_SELINUX, 1, [Define to 1 if libselinux is available])
        SELINUX_LIBS="-lselinux"
        msg_selinux=yes])
     ])
   ])
fi
AC_SUBST(SELINUX_LIBS)

dnl **************************
dnl *** Checks for gtk-doc ***
dnl **************************

GTK_DOC_CHECK([1.0])

dnl ******************************
dnl *** End checks for gtk-doc ***
dnl ******************************


dnl borrowed from gnu findutils
dnl and relicensed as LGPL by the FSF

AC_ARG_WITH(afs,
[  --with-afs              support -fstype afs],
[  AC_DEFINE(AFS, [], [Define if you have the Andrew File System])
  CPPFLAGS="$CPPFLAGS -I/usr/afsws/include"
  LIBS="$LIBS -L/usr/afsws/lib -L/usr/afsws/lib/afs -lsys -lrx -llwp"])

AC_MSG_CHECKING(how to get filesystem type)
fstype=no
# The order of these tests is important.
AC_TRY_CPP([#include <sys/statvfs.h>
#include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS, [],
							[Define to use SVR4 statvfs to get filesystem type]) fstype=SVR4)
if test $fstype = no; then
AC_TRY_CPP([#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/statfs.h>
#include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS, [],
							[Define to use SVR3.2 statfs to get filesystem type]) fstype=SVR3)
fi
if test $fstype = no; then
AC_TRY_CPP([#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/statfs.h>
#include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS, [],
							 [Define to use AIX3 statfs to get filesystem type]) fstype=AIX)
fi
if test $fstype = no; then  
AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT, [],
						    [Define to use 4.3BSD getmntent to get filesystem typ]) fstype=4.3BSD)
fi
if test $fstype = no; then  
AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS, [],
							   [Define to use 4.4BSD and OSF1 statfs to get filesystem typ]) fstype=4.4BSD/OSF1)
fi
if test $fstype = no; then  
AC_TRY_CPP([#include <sys/mount.h>
#include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT, [],
							   [Define to use Ultrix getmnt to get filesystem typ]) fstype=Ultrix)
fi
AC_MSG_RESULT($fstype)

dnl Final touch

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

dnl This is needed by `test/vfs-run.in'
TOP_BUILDDIR="`pwd`"
AC_SUBST(TOP_BUILDDIR)
    

dnl Disable rebuild of glib-mkenum -generated source code:
AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)

# define a MAINT-like variable REBUILD which is set if Perl
# is found, so autogenerated sources can be rebuilt
AC_CHECK_PROGS(PERL, perl5 perl)

AC_PATH_PROG(SSH_PROGRAM, ssh, "ssh")

REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
     test -n "$PERL" && \
     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
  REBUILD=
fi
AC_SUBST(REBUILD)


AC_OUTPUT([
Makefile
gnome-vfs.spec
gnome-vfs-zip
libgnomevfs/gnome-vfs-file-size.h
libgnomevfs/gnome-vfs-version.h
libgnomevfs/Makefile
imported/Makefile
imported/fnmatch/Makefile
imported/neon/Makefile
modules/Makefile
daemon/Makefile
schemas/Makefile
devel-docs/Makefile
devel-docs/gnome-vfs-tutorial/Makefile
po/Makefile.in
programs/Makefile
test/Makefile
test/vfs-run
doc/Makefile
doc/version.xml
gnome-vfs-2.0.pc
gnome-vfs-module-2.0.pc
])

chmod u+x test/vfs-run

dnl <= Configuration summary =>
profiler_enabled=no
test "$ENABLE_PROFILER" = 1 && profiler_enabled=yes
echo 
echo "Gnome VFS configuration summary:"
echo "
	IPv6 support:                $have_ipv6
	SSL support:                 $msg_ssl
      	Avahi support:		     $msg_avahi
      	Howl support:		     $msg_howl
	HAL  support:                $msg_hal
	Enable gnome-vfs-daemon:     $msg_daemon
	SELinux  support:            $msg_selinux
	File ACL backends:           $acl_backends
	Gtk Doc:                     $enable_gtk_doc
	FS monitor backends:         $fs_monitor_backends
	Samba method:		     $msg_samba
	CDDA method:		     $have_cdda
	Enable profiler:             $profiler_enabled
"