File: configure.in

package info (click to toggle)
afbackup 3.3.8.1beta2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,128 kB
  • ctags: 3,370
  • sloc: ansic: 46,932; sh: 4,654; tcl: 4,199; makefile: 536; csh: 416; perl: 133; sed: 93
file content (1067 lines) | stat: -rw-r--r-- 27,393 bytes parent folder | download
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
################### Start of $RCSfile: configure.in,v $ ##################
#
# $Source: /home/alb/afbackup/afbackup-3.3.8beta7/RCS/configure.in,v $
# $Id: configure.in,v 1.5 2004/07/08 20:34:44 alb Exp alb $
# $Date: 2004/07/08 20:34:44 $
# $Author: alb $
#
#
####### description ################################################
#
#
#
####################################################################

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

AC_INIT(backup.h)

PACKAGE=afbackup
VERSION=`[grep VERSION_STRING version.h|sed 's/^[^"]*"//g'|sed 's/"[^"]*$//g']`
dnl VERSION=`[grep VERSION_STRING version.h|awk '{l=$0;while(substr(l,1,1)!="\"" && l != "")l=substr(l,2);l=substr(l,2);while(substr(l,length(l)-1,1)!="\"" && l != "") l=substr(l,1,length(l)-1);l=substr(l,1,length(l)-1);print l}']`
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

ALL_LINGUAS="it de"

osname=`./prosname.sh`

ARCH="`./prosspec.sh` $*"
ARCH="`echo $ARCH`"		# for some stupid shells
if test -r config.setup ; then
  CONFARCH=`cat config.setup`
  if test "$CONFARCH" = "$ARCH" ; then
    echo "Already configured for this setup. Remove config.setup to re-configure."
    exit 0
  fi
fi
rm -f config.setup

AC_CONFIG_HEADER(config.h)

dnl initial settings

LDFLAGS="$EXTERNAL_LDFLAGS $LDFLAGS"
INCLUDES="$EXTERNAL_INCLUDES $INCLUDES"

dnl Checks for programs.

AC_PROG_CC
AC_PROG_CPP

AC_CHECK_PROG(ranlib, ranlib, ranlib)
AC_PROG_LN_S

dnl Checks for libraries.

dnl Checks for header files.

if test `uname` = "FreeBSD" ; then
  if test -r /usr/include/values.h ; then
    ac_cv_header_values_h=yes
  else
    ac_cv_header_values_h=no
  fi
fi

AC_ISC_POSIX
AM_GNU_GETTEXT

AC_HEADER_DIRENT
AC_HEADER_STDC

dnl AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(arpa/inet.h fcntl.h intl/locale.h limits.h malloc.h mntent.h netinet/ip.h netinet/tcp.h netinet/in_systm.h pthread.h regex.h stdint.h string.h strings.h sys/acl.h sys/fs_types.h sys/ioctl.h sys/mman.h sys/mode.h sys/mntctl.h sys/mnttab.h sys/mount.h sys/mtio.h sys/param.h sys/resource.h sys/select.h sys/statfs.h sys/statvfs.h sys/time.h sys/timers.h sys/ucred.h sys/vfs.h sys/vmount.h sys/wait.h termios.h termio.h time.h unistd.h values.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_STRUCT_ST_RDEV
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF

dnl Used by po/Makefile.in
AC_PROG_INSTALL

# This seems to have been forgotten for some strange reason
if test _"${gt_cv_func_gettext_libintl}" = _yes -o _"$ac_cv_lib_intl_bindtextdomain" = _yes ; then
  INTLLIBS="$INTLLIBS -lintl"
fi
INTL_HEADER="$nls_cv_header_intl"
AC_SUBST(INTL_HEADER)

AC_MSG_CHECKING(for sys_errlist declaration)
AC_CACHE_VAL(ac_cv_decl_sys_errlist_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",sys_errlist[0]);],
ac_cv_decl_sys_errlist_def=yes, ac_cv_decl_sys_errlist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist_def)
if test $ac_cv_decl_sys_errlist_def = yes; then
    AC_DEFINE(HAVE_SYS_ERRLIST_DEF)
fi

OPTIMIZE=-O2
if test $ac_cv_prog_gcc = no -a `echo $osname|grep 'HPUX'|wc -l` -gt 0 ; then
  EXTRACFLAGS="+Olibcalls -Ae -Dhpux -D__hpux -Dunix -Dnotdef"
  OPTIMIZE=-O
fi

AC_CHECK_TYPE(signal_t, int)
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(int16_t, short int)
AC_CHECK_TYPE(int8_t, signed char)
AC_CHECK_TYPE(uint32_t, unsigned)
AC_CHECK_TYPE(uint16_t, unsigned short)
AC_CHECK_TYPE(uint8_t, unsigned char)
dnl wasses net alles gibt
AC_CHECK_TYPE(u_int32_t, unsigned)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int8_t, unsigned char)

AC_ARG_ENABLE(threads, [  --disable-threads       do not configure threads], 
    if test "x$enable_threads" != xyes; then enable_threads=no; fi,
    enable_threads=yes)

if test $enable_threads = yes ; then
  # cannot use pthread_create here, cause IRIX will fail compiling.
  # Solaris has pthread functions in libc, but they don't work, so
  # we have to check for libpthread or libthread FIRST.
  # BTW the m4 autoconf syntax constraints are terrible.
  AC_CHECK_LIB(pthread, pthread_join, libpthread=yes, libpthread=no)
  if test $libpthread = yes ; then
    AC_DEFINE(HAVE_PTHREAD_JOIN)
    LIBS="$LIBS -lpthread"
  else
    AC_CHECK_LIB(thread, pthread_join, libthread=yes, libthread=no)
    if test $libthread = yes ; then
      LIBS="$LIBS -lthread"
      AC_DEFINE(HAVE_PTHREAD_JOIN)
    else
      AC_CHECK_FUNC(pthread_join, libc=yes, libc=no)
      if test $libc = yes ; then
	AC_DEFINE(HAVE_PTHREAD_JOIN)
      else
	AC_MSG_CHECKING(for FreeBSD-like pthreads)
	LIBS_BEFORE="$LIBS"
	CPPFLAGS_BEFORE="$CPPFLAGS"
	LIBS="$LIBS -pthread"
	CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
	AC_CACHE_VAL(ac_cv_decl_freebsd_pthreads,
	[AC_TRY_LINK([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[pthread_join();],
	ac_cv_decl_freebsd_pthreads=yes, ac_cv_decl_freebsd_pthreads=no)
	])
	AC_MSG_RESULT($ac_cv_decl_freebsd_pthreads)
	if test $ac_cv_decl_freebsd_pthreads = yes; then
	  AC_DEFINE(HAVE_PTHREAD_JOIN)
	  SYSDEFINES="$SYSDEFINES -D_THREAD_SAFE"
	else
	  LIBS="$LIBS_BEFORE"
	  CPPFLAGS="$CPPFLAGS_BEFORE"
	fi
      fi
    fi
  fi
fi

checkBoth=0
AC_CHECK_FUNC(connect, checkSocket=0, checkSocket=1)
if test "$checkSocket" = 1; then
    AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
fi
if test "$checkBoth" = 1; then
    oldLibs=$LIBS
    LIBS="$LIBS -lsocket -lnsl"
    AC_CHECK_FUNC(accept, checkNsl=0, [LIBS=$oldLibs])
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))

AC_CHECK_FUNCS(bsearch door_create drand48 endmntent getcwd getfsstat getipnodebyname getipnodebyaddr getmntent gettimeofday inet_ntoa inet_ntop isatty isnan lchown lfind lsearch madvise memmove mkfifo mktime mnt_names mntctl putenv qsort rand re_comp regcomp re_compile_pattern rint seed48 select setenv seteuid setreuid setresuid setegid setmntent setregid setresgid setitimer sighold sigrelse socket strcasecmp strncasecmp strcasestr strdup strerror strrstr strstr timer_create uname acl setacl chacl sys_errlist stat64 statfs statvfs unsetenv vsnprintf vsyslog)

AC_MSG_CHECKING(for environ array)
AC_CACHE_VAL(ac_cv_decl_environ,
[AC_TRY_COMPILE([
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern char ** environ;],[printf("%s",environ[0]);],
ac_cv_decl_environ=yes, ac_cv_decl_environ=no)
])
AC_MSG_RESULT($ac_cv_decl_environ)
if test $ac_cv_decl_environ = yes; then
    AC_DEFINE(HAVE_ENVIRON)
fi

AC_CHECK_LIB(acl, acl_get_file, acl_get_file=yes, acl_get_file=no)
if test $acl_get_file = yes ; then
  LIBS="-lacl $LIBS"
else
  AC_CHECK_LIB(pacl, acl_get_file, acl_get_file=yes, acl_get_file=no)
  if test $acl_get_file = yes ; then
    LIBS="-lpacl $LIBS"
  else
    SAVED_LIBS="$LIBS"
    LIBS="-lacl $LIBS"
    AC_CHECK_LIB(attr, acl_get_file, acl_get_file=yes, acl_get_file=no)
    if test $acl_get_file = yes ; then
      LIBS="-lattr $LIBS"
    else
      LIBS="-lattr $SAVED_LIBS"
      unset ac_cv_lib_acl_acl_get_file
      AC_CHECK_LIB(acl, acl_get_file, acl_get_file=yes, acl_get_file=no)
      if test $acl_get_file = yes ; then
        LIBS="-lacl $LIBS"
      else
        LIBS="$SAVED_LIBS"
        AC_CHECK_FUNC(acl_get_file, acl_get_file=yes, acl_get_file=no)
      fi
    fi
  fi
fi

if test "$ac_cv_func_re_comp" != yes ; then
    AC_CHECK_LIB(compat, re_comp, [LIBS="$LIBS -lcompat"])
    unset ac_cv_func_re_comp
    AC_CHECK_FUNCS(re_comp)
fi
if test "$ac_cv_func_stat64" = yes ; then
    AC_DEFINE(_64_BIT_FILESIZE_)
fi

if test "$ac_cv_func_getmntent" = yes ; then
  AC_MSG_CHECKING(for two-args getmntent)
  AC_CACHE_VAL(ac_cv_two_args_getmntent,
    AC_TRY_LINK_WITH_TEST([
#include <stdio.h>
#include <signal.h>
void sigh(int sig){ exit(42); }], [
 FILE * fp; signal(SIGSEGV, sigh); signal(SIGBUS, sigh);
 fp = fopen("/etc/passwd", "r"); /* file exists on every Unix */
 getmntent(fp, (void*)1); /* segfault, if 2nd argument used */],
	$ac_word, ac_cv_two_args_getmntent=no, ac_cv_two_args_getmntent=yes))
  AC_MSG_RESULT($ac_cv_two_args_getmntent)
fi
if test _"$ac_cv_two_args_getmntent" = _yes ; then
  AC_DEFINE(HAVE_GETMNTENT_TWO_ARGS)
fi

if test "$ac_cv_func_statfs" = yes -a "$ac_cv_func_statvfs" = no ; then
  AC_MSG_CHECKING(for f_bavail in struct statfs)
  AC_CACHE_VAL(ac_cv_struct_stat_bavail,
    AC_TRY_LINK([
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>	/* this one is for FreeBSD */
#endif
#include <sys/types.h>	/* this one is for SunOS-4 */
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
], [ struct statfs statfsb; statfsb.f_bavail; ],
	ac_cv_struct_stat_bavail=yes, ac_cv_struct_stat_bavail=no))
  AC_MSG_RESULT($ac_cv_struct_stat_bavail)
else
  ac_cv_func_statvfs=yes
fi
if test _"$ac_cv_struct_stat_bavail" = _yes ; then
  AC_DEFINE(HAVE_STRUCT_STAT_BAVAIL)
fi

AC_MSG_CHECKING(for IPv6 implementation)
AC_CACHE_VAL(ac_cv_struct_in6_addr,
  AC_TRY_LINK([
#include <netinet/in.h>
], [ struct in6_addr in6; struct sockaddr_in6 sock6; ],
	ac_cv_struct_in6_addr=yes, ac_cv_struct_in6_addr=no))
AC_MSG_RESULT($ac_cv_struct_in6_addr)
if test _"$ac_cv_struct_in6_addr" = _yes ; then
  AC_DEFINE(HAVE_IP6)
fi

test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix=${prefix}

deftmpdir="/tmp"
AC_ARG_WITH(tmpdir,
    [   --with-tmpdir=DIR   temporary files in DIR [/tmp]],
    [
	if test "$withval"; then
	    tmpdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-tmpdir
 option.])
	fi
    ]
)
: ${tmpdir:="$deftmpdir"}
tmpdir=`(
    eval echo "$tmpdir"
)`
if test "$tmpdir" != "$deftmpdir" ; then
  SYSDEFINES="$SYSDEFINES"' -DTMPDIR=\"'"$tmpdir"'\"'
fi

AC_SUBST(SYSDEFINES)

AC_ARG_WITH(utilslibdir,
    [   --with-utilslibdir=DIR   server configuration files in DIR [prefix/lib]],
    [
	if test "$withval"; then
	    utilslibdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-utilslibdir
 option.])
	fi
    ]
)
: ${utilslibdir:='$prefix/lib'}
utilslibdir=`(
    eval echo "$utilslibdir"
)`
AC_SUBST(utilslibdir)
AC_ARG_WITH(utilsincdir,
    [   --with-utilsincdir=DIR   server configuration files in DIR [prefix/include]],
    [
	if test "$withval"; then
	    utilsincdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-utilsincdir
 option.])
	fi
    ]
)
: ${utilsincdir:='$prefix/include'}
utilsincdir=`(
    eval echo "$utilsincdir"
)`
AC_SUBST(utilsincdir)
AC_ARG_WITH(utilsbindir,
    [   --with-utilsbindir=DIR   server configuration files in DIR [prefix/bin]],
    [
	if test "$withval"; then
	    utilsbindir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-utilsbindir
 option.])
	fi
    ]
)
: ${utilsbindir:='$prefix/bin'}
utilsbindir=`(
    eval echo "$utilsbindir"
)`
AC_SUBST(utilsbindir)

prefixext=yes
AC_ARG_WITH(prefixext,
    [   --with-prefixext=YESNO extend prefix with /backup [yes]],
    [
	if test "$withval"; then
	    prefixext="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-prefixext
 option.])
	fi
    ]
)
subdir="/backup"
if test $prefixext != "yes" ; then
  subdir=""
fi

dnl *** server side ***
AC_ARG_WITH(serverdir,
    [   --with-serverdir=DIR   server installation in DIR [prefix/subdir/server]],
    [
	if test "$withval"; then
	    serverdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-serverdir
 option.])
	fi
    ]
)
: ${serverdir:='$prefix$subdir/server'}
serverdir=`(
    eval echo "$serverdir"
)`
AC_SUBST(serverdir)
dnl *** serverbindir
AC_ARG_WITH(serverbindir,
    [   --with-serverbindir=DIR   server binaries in DIR [serverdir/bin]],
    [
	if test "$withval"; then
	    serverbindir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-serverbindir
 option.])
	fi
    ]
)
: ${serverbindir:='$serverdir/bin'}
serverbindir=`(
    eval echo "$serverbindir"
)`
AC_SUBST(serverbindir)
dnl *** serverlibdir
AC_ARG_WITH(serverlibdir,
    [   --with-serverlibdir=DIR   server configuration files in DIR [serverdir/lib]],
    [
	if test "$withval"; then
	    serverlibdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-serverlibdir
 option.])
	fi
    ]
)
: ${serverlibdir:='$serverdir/lib'}
serverlibdir=`(
    eval echo "$serverlibdir"
)`
AC_SUBST(serverlibdir)
dnl *** serverconfdir
AC_ARG_WITH(serverconfdir,
    [   --with-serverconfdir=DIR   server configuration files in DIR [serverdir/etc]],
    [
	if test "$withval"; then
	    serverconfdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-serverconfdir
 option.])
	fi
    ]
)
: ${serverconfdir:='$serverdir/etc'}
serverconfdir=`(
    eval echo "$serverconfdir"
)`
AC_SUBST(serverconfdir)
dnl *** servervardir
AC_ARG_WITH(servervardir,
    [   --with-servervardir=DIR   variable server files in DIR [serverdir/var]],
    [
	if test "$withval"; then
	    servervardir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-servervardir
 option.])
	fi
    ]
)
: ${servervardir:='$serverdir/var'}
servervardir=`(
    eval echo "$servervardir"
)`
AC_SUBST(servervardir)
dnl *** servermandir
AC_ARG_WITH(servermandir,
    [   --with-servermandir=DIR   variable server files in DIR [serverdir/man]],
    [
	if test "$withval"; then
	    servermandir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-servermandir
 option.])
	fi
    ]
)
: ${servermandir:='$serverdir/man'}
servermandir=`(
    eval echo "$servermandir"
)`
AC_SUBST(servermandir)
dnl *** serverlogdir
AC_ARG_WITH(serverlogdir,
    [   --with-serverlogdir=DIR   server log files in DIR [serverdir/var]],
    [
	if test "$withval"; then
	    serverlogdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-serverlogdir
 option.])
	fi
    ]
)
: ${serverlogdir:='$serverdir/var'}
serverlogdir=`(
    eval echo "$serverlogdir"
)`
AC_SUBST(serverlogdir)

dnl *** client side ***
AC_ARG_WITH(clientdir,
    [   --with-clientdir=DIR   client installation in DIR [prefix/subdir/client]],
    [
	if test "$withval"; then
	    clientdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientdir
 option.])
	fi
    ]
)
: ${clientdir:='$prefix$subdir/client'}
clientdir=`(
    eval echo "$clientdir"
)`
AC_SUBST(clientdir)
dnl *** clientbindir
AC_ARG_WITH(clientbindir,
    [   --with-clientbindir=DIR   client binaries in DIR [clientdir/bin]],
    [
	if test "$withval"; then
	    clientbindir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientbindir
 option.])
	fi
    ]
)
: ${clientbindir:='$clientdir/bin'}
clientbindir=`(
    eval echo "$clientbindir"
)`
AC_SUBST(clientbindir)
dnl *** clientlibdir
AC_ARG_WITH(clientlibdir,
    [   --with-clientlibdir=DIR   client configuration files in DIR [clientdir/lib]],
    [
	if test "$withval"; then
	    clientlibdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientlibdir
 option.])
	fi
    ]
)
: ${clientlibdir:='$clientdir/lib'}
clientlibdir=`(
    eval echo "$clientlibdir"
)`
AC_SUBST(clientlibdir)
dnl *** clientvardir
AC_ARG_WITH(clientvardir,
    [   --with-clientvardir=DIR   variable client files in DIR [clientdir/var]],
    [
	if test "$withval"; then
	    clientvardir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientvardir
 option.])
	fi
    ]
)
: ${clientvardir:='$clientdir/var'}
clientvardir=`(
    eval echo "$clientvardir"
)`
AC_SUBST(clientvardir)
dnl *** clientmandir
AC_ARG_WITH(clientmandir,
    [   --with-clientmandir=DIR   variable client files in DIR [clientdir/man]],
    [
	if test "$withval"; then
	    clientmandir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientmandir
 option.])
	fi
    ]
)
: ${clientmandir:='$clientdir/man'}
clientmandir=`(
    eval echo "$clientmandir"
)`
AC_SUBST(clientmandir)
dnl *** clientlogdir
AC_ARG_WITH(clientlogdir,
    [   --with-clientlogdir=DIR   client log files in DIR [clientdir/var]],
    [
	if test "$withval"; then
	    clientlogdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientlogdir
 option.])
	fi
    ]
)
: ${clientlogdir:='$clientdir/var'}
clientlogdir=`(
    eval echo "$clientlogdir"
)`
AC_SUBST(clientlogdir)
dnl *** clientconfdir
AC_ARG_WITH(clientconfdir,
    [   --with-clientconfdir=DIR   client log files in DIR [clientdir/etc]],
    [
	if test "$withval"; then
	    clientconfdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientconfdir
 option.])
	fi
    ]
)
: ${clientconfdir:='$clientdir/etc'}
clientconfdir=`(
    eval echo "$clientconfdir"
)`
AC_SUBST(clientconfdir)
dnl *** rexecdir
AC_ARG_WITH(rexecdir,
    [   --with-rexecdir=DIR   binaries for remote execution in DIR [prefix/rexec]],
    [
	if test "$withval"; then
	    REXECDIR="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-rexecdir
 option.])
	fi
    ]
)
: ${REXECDIR:='$prefix$subdir/rexec'}
REXECDIR=`(
    eval echo "$REXECDIR"
)`
AC_SUBST(REXECDIR)
dnl *** clientconf
AC_ARG_WITH(clientconf,
    [   --with-clientconf=NAME   NAME for client configuration [backup.conf]],
    [
	if test "$withval"; then
	    clientconf="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-clientconf
 option.])
	fi
    ]
)
: ${clientconf:=backup.conf}
clientconf=`(
    eval echo "$clientconf"
)`
AC_SUBST(clientconf)
dnl *** serverconf
AC_ARG_WITH(serverconf,
    [   --with-serverconf=NAME   NAME for server configuration [backup.conf]],
    [
	if test "$withval"; then
	    serverconf="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-serverconf
 option.])
	fi
    ]
)
: ${serverconf:=backup.conf}
serverconf=`(
    eval echo "$serverconf"
)`
AC_SUBST(serverconf)
dnl *** commondir
AC_ARG_WITH(commondir,
    [   --with-commondir=DIR   software for client and server will reside in DIR [prefix/common]],
    [
	if test "$withval"; then
	    commondir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-commondir
 option.])
	fi
    ]
)
: ${commondir:='$prefix$subdir/common'}
commondir=`(
    eval echo "$commondir"
)`
AC_SUBST(commondir)
dnl *** commondatadir
AC_ARG_WITH(commondatadir,
    [   --with-commondatadir=DIR   architecture independent data for client and server will reside in DIR [commondir/share]],
    [
	if test "$withval"; then
	    commondatadir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-commondatadir
 option.])
	fi
    ]
)
: ${commondatadir:='$commondir/share'}
commondatadir=`(
    eval echo "$commondatadir"
)`
AC_SUBST(commondatadir)
dnl *** commonshlibdir
AC_ARG_WITH(commonshlibdir,
    [   --with-commonshlibdir=DIR   architecture independent program text for client and server will reside in DIR [commondatadir/lib]],
    [
	if test "$withval"; then
	    commonshlibdir="$withval"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-commonshlibdir
 option.])
	fi
    ]
)
: ${commonshlibdir:='$commondatadir/lib'}
commonshlibdir=`(
    eval echo "$commonshlibdir"
)`
AC_SUBST(commonshlibdir)


dnl DES stuff

usedes=no
AC_ARG_WITH(des,
    [   --with-des   for client/server authentication [no]],
    [
	usedes=yes
	des_include=../libdes
	des_libdir=`echo $des_include|sed 's#include$#lib#g'`
	des_header=des.h
	des_ldflag=-ldes
    ]
)

AC_ARG_WITH(des-include,
    [   --with-des-include=DIR   des header file in DIR [../libdes]],
    [
	if test "$withval"; then
	    usedes=yes
	    des_include="$withval"
	    des_libdir="$des_include"
	    des_header=des.h
	    des_ldflag=-ldes
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-des-include
 option.])
	fi
    ]
)

AC_ARG_WITH(des-header,
    [   --with-des-header=NAME   NAME is des header file [des.h]],
    [
	if test "$withval"; then
	    usedes=yes
	    des_header="$withval"
	    des_ldflag=-ldes
	    if test _"$des_include" = _ ; then
		des_include=../libdes
		des_libdir="$des_include"
	    fi
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-des-header
 option.])
	fi
    ]
)

AC_ARG_WITH(des-libdir,
    [   --with-des-libdir=DIR   des library is in DIR [../libdes]],
    [
	if test "$withval"; then
	    usedes=yes
	    des_libdir="$withval"
	    des_ldflag=-ldes
	    if test _"$des_include" = _ ; then
		des_include="$des_libdir"
	    fi
	    if test _"$des_header" = _ ; then
		des_header="des.h"
	    fi
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-des-libdir
 option.])
	fi
    ]
)

AC_ARG_WITH(des-ldflag,
    [   --with-des-ldflag=LIB   des library is specified by LIB [-ldes]],
    [
	if test "$withval"; then
	    usedes=yes
	    des_ldflag="$withval"
	    if test _"$des_include" = _ ; then
		des_include=../libdes
	    fi
	    if test _"$des_header" = _ ; then
		des_header="des.h"
	    fi
	    if test _"$des_libdir" = _ ; then
		des_libdir="$des_include"
	    fi
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-des-ldflag
 option.])
	fi
    ]
)

if test $usedes = "no" ; then
  DESINCLUDEPATH=""
  DESDEFINES=""
  DESLIB=""
  DESLIBPATH=""
  DESHEADER=""
  DESCRPT=""
else
  if test `echo $des_ldflag|grep '^lib'|wc -l` -gt 0 ; then
    des_ldflag=`echo $des_ldflag|sed 's/^lib/-l/g;s/[.].*//g'`
  fi

  DESINCLUDEPATH="-I$des_include"
  DESDEFINES="-DHAVE_DES_ENCRYPTION"
  DESHEADER="$des_header"
  DESLIBPATH="-L$des_libdir"
  DESLIB="$des_ldflag"
  DESCRPT="__descrpt"
fi

AC_SUBST(DESDEFINES)
AC_SUBST(DESINCLUDEPATH)
AC_SUBST(DESLIBPATH)
AC_SUBST(DESLIB)
AC_SUBST(DESHEADER)
AC_SUBST(DESCRPT)


dnl zlib stuff

usezlib=no
AC_ARG_WITH(zlib,
    [   --with-zlib   for builtin compression [no]],
    [
	usezlib=yes
	zlib_include=/usr/local/include
	zlib_libdir=`echo $zlib_include|sed 's#include$#lib#g'`
    ]
)

AC_ARG_WITH(zlib-include,
    [   --with-zlib-include=DIR   zlib header file in DIR [/usr/local/include]],
    [
	if test "$withval"; then
	    usezlib=yes
	    zlib_include="$withval"
	    zlib_libdir="$zlib_include"
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-zlib-include
 option.])
	fi
    ]
)

AC_ARG_WITH(zlib-libdir,
    [   --with-zlib-libdir=DIR   zlib library is in DIR [/usr/local/lib]],
    [
	if test "$withval"; then
	    usezlib=yes
	    zlib_libdir="$withval"
	    if test _"$zlib_include" = _ ; then
		zlib_include="$zlib_libdir"
	    fi
	else
	    AC_MSG_WARN([*** You must supply an argument to the --with-zlib-libdir
 option.])
	fi
    ]
)

AC_SUBST(commondir)
AC_SUBST(commondatadir)
AC_SUBST(commonshlibdir)


if test $usezlib = "no" ; then
  ZLIB_INCLUDEPATH=""
  ZLIB_DEFINES=""
  ZLIB_LIB=""
  ZLIB_LIBPATH=""
  ZIP=""
else
  ZLIB_INCLUDEPATH="-I$zlib_include"
  ZLIB_DEFINES="-DUSE_ZLIB"
  ZLIB_LIBPATH="-L$zlib_libdir"
  ZLIB_LIB="-lz"
  ZIP="__z"
fi

AC_SUBST(ZLIB_DEFINES)
AC_SUBST(ZLIB_INCLUDEPATH)
AC_SUBST(ZLIB_LIBPATH)
AC_SUBST(ZLIB_LIB)
AC_SUBST(ZIP)

AC_ARG_WITH(strip,
    [   --with-strip   strip binaries during installation [yes]],
    [ ]
)
STRIP="strip"
if test "$with_strip" = no ; then
  STRIP="echo Not stripped: "
fi

AC_SUBST(STRIP)

locspec=`echo $prefix|tr '/' '^'`
AC_SUBST(locspec)

AC_SUBST(EXTRACFLAGS)
AC_SUBST(OPTIMIZE)

AC_SUBST(osname)
AC_SUBST(CC)

HEADERS="regex.h limits.h values.h stdint.h"
for header in $HEADERS ; do
  safeval=`echo "$header" | sed 'y%./+-%__p_%'`
  uppersafeval=`echo $safeval|tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  VNAM=DONT_INC_$uppersafeval
  eval $VNAM=DONT_
  eval isset='$'ac_cv_header_$safeval
  if test $isset = yes ; then
    eval $VNAM=""
  fi
done
TYPES="int32_t uint32_t int16_t uint16_t int8_t uint8_t u_int32_t u_int16_t u_int8_t"
for type in $TYPES ; do
  safeval=`echo "$type" | sed 'y%./+-%__p_%'`
  uppersafeval=`echo $safeval|tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  VNAM=DONT_TYPE_$uppersafeval
  eval $VNAM=DONT_
  eval isset='$'ac_cv_type_$safeval
  if test $isset = yes ; then
    eval $VNAM=""
  fi
done

DONT_DECL_RE_UTILS="DONT_"
DONT_DECL_POSIX_REGEX="DONT_"
if test $ac_cv_func_re_compile_pattern != yes ; then
  DONT_DECL_RE_UTILS=""
fi
if test $ac_cv_func_regcomp != yes ; then
  DONT_DECL_POSIX_REGEX=""
fi
AC_SUBST(DONT_INC_REGEX_H)
AC_SUBST(DONT_INC_LIMITS_H)
AC_SUBST(DONT_INC_VALUES_H)
AC_SUBST(DONT_INC_STDINT_H)
AC_SUBST(DONT_TYPE_INT32_T)
AC_SUBST(DONT_TYPE_INT16_T)
AC_SUBST(DONT_TYPE_INT8_T)
AC_SUBST(DONT_TYPE_UINT32_T)
AC_SUBST(DONT_TYPE_UINT16_T)
AC_SUBST(DONT_TYPE_UINT8_T)
AC_SUBST(DONT_TYPE_U_INT32_T)
AC_SUBST(DONT_TYPE_U_INT16_T)
AC_SUBST(DONT_TYPE_U_INT8_T)
AC_SUBST(DONT_DECL_RE_UTILS)
AC_SUBST(DONT_DECL_POSIX_REGEX)

FUNCTIONS="strrstr strcasestr memmove qsort bsearch lsearch lfind rint isnan isatty re_comp"
for function in $FUNCTIONS ; do
  safeval=`echo "$function" | sed 'y%./+-%__p_%'`
  uppersafeval=`echo $safeval|tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  VNAM=DONT_DEF_$uppersafeval
  eval $VNAM=DONT_
  eval isset='$'ac_cv_func_$safeval
  if test $isset != yes ; then
    eval $VNAM=""
  fi
done
AC_SUBST(DONT_DEF_STRRSTR)
AC_SUBST(DONT_DEF_STRCASESTR)
AC_SUBST(DONT_DEF_MEMMOVE)
AC_SUBST(DONT_DEF_QSORT)
AC_SUBST(DONT_DEF_BSEARCH)
AC_SUBST(DONT_DEF_LSEARCH)
AC_SUBST(DONT_DEF_LFIND)
AC_SUBST(DONT_DEF_RINT)
AC_SUBST(DONT_DEF_ISATTY)
AC_SUBST(DONT_DEF_ISNAN)
AC_SUBST(DONT_DEF_RE_COMP)


DONT_INC_TIME_H=DONT_
DONT_INC_SYS_TIME_H=DONT_
if test $ac_cv_header_time_h ; then
  DONT_INC_TIME_H=""
fi
if test $ac_cv_header_time = yes ; then
  DONT_INC_TIME_H=""
  DONT_INC_SYS_TIME_H=""
else
  if test $ac_cv_header_sys_time_h = yes ; then
    DONT_INC_SYS_TIME_H=""
  fi
fi
DONT_INC_SYS_TIMERS_H=DONT_
if test $ac_cv_header_sys_timers_h = yes ; then
  DONT_INC_SYS_TIMERS_H=""
fi

AC_SUBST(DONT_INC_TIME_H)
AC_SUBST(DONT_INC_SYS_TIME_H)
AC_SUBST(DONT_INC_SYS_TIMERS_H)

DONT_USE_SOLARIS2_ACLS="DONT_"
if test $ac_cv_header_sys_acl_h = yes -a $ac_cv_func_acl = yes ; then
  DONT_USE_SOLARIS2_ACLS=""
fi
AC_SUBST(DONT_USE_SOLARIS2_ACLS)

DONT_USE_HPUX10_ACLS="DONT_"
if test $ac_cv_header_sys_acl_h = yes -a $ac_cv_func_setacl = yes ; then
  DONT_USE_HPUX10_ACLS=""
fi
AC_SUBST(DONT_USE_HPUX10_ACLS)

DONT_USE_POSIX_ACLS="DONT_"
if test $ac_cv_header_sys_acl_h = yes -a $acl_get_file = yes ; then
  DONT_USE_POSIX_ACLS=""
  AC_CHECK_FUNC(acl_free_text, AC_DEFINE(HAVE_ACL_FREE_TEXT))
  AC_CHECK_FUNC(acl_to_short_text, AC_DEFINE(HAVE_ACL_TO_SHORT_TEXT))
fi
AC_SUBST(DONT_USE_POSIX_ACLS)

AC_SUBST(LDFLAGS)
AC_SUBST(INCLUDES)

AC_OUTPUT(lconf.h budefs.h des_aux.h Makefile server.conf client.conf shwish.head xcc xsc xrs xss clientconfig serverconfig autocptapes afclient.8 cartis.8 cartready.8 afserver.8 afmserver.8 label_tape.8 cart_ctl.8 full_backup.8 incr_backup.8 afrestore.8 afverify.8 update_indexes.8 copy_tape.8 xafrestore.8 afclient.conf.8 afserver.conf.8 CONFIG intl/Makefile po/Makefile.in)

echo "$ARCH" > config.setup