1dnl
2dnl
3dnl Process this file with autoconf to produce a configure script.
4dnl
5dnl Copyright (C) 2000-2017 Kern Sibbald
6dnl License: BSD 2-Clause; see file LICENSE-FOSS
7dnl
8dnl require a recent autoconf
9AC_PREREQ(2.61)
10AC_INIT([bacula], m4_esyscmd([sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ../src/version.h src/version.h 2> /dev/null | tr -d '\n']))
11AC_CONFIG_SRCDIR(src/version.h)
12
13BUILD_DIR=`pwd`
14cd ..
15TOP_DIR=`pwd`
16cd ${BUILD_DIR}
17AC_SUBST(BUILD_DIR)
18AC_SUBST(TOP_DIR)
19AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
20AC_CONFIG_HEADERS(src/config.h:autoconf/config.h.in)
21
22dnl minimal Win32 stuff for "make clean"
23WIN32BUILDDIR=${BUILD_DIR}/src/win32
24WIN32MAINDIR=${BUILD_DIR}
25WIN32TOPDIR=${TOP_DIR}
26AC_SUBST(WIN32BUILDDIR)
27AC_SUBST(WIN32MAINDIR)
28AC_SUBST(WIN32TOPDIR)
29
30dnl search for true and false programs.
31AC_PATH_PROGS(TRUEPRG, true, :)
32AC_PATH_PROGS(FALSEPRG, false, :)
33
34
35dnl bacula version
36post_host=
37if test "x$BACULA" != x; then
38   post_host=`echo -${BACULA} | tr 'A-Z ' 'a-z-'`
39fi
40BACULA=${BACULA:-Bacula}
41VERSION=`sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
42RELEASE=`sed -n -e 's/^#define RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
43DATE=`sed -n -e 's/^#define BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
44LSMDATE=`sed -n -e 's/^#define LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
45BDB_VERSION=`sed -n -e 's/^#define BDB_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
46DEPKGS_VERSION=`sed -n -e 's/^#define DEPKGS_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
47DEPKGS_QT_VERSION=`sed -n -e 's/^#define DEPKGS_QT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
48BQT_VERSION=`sed -n -e 's/^#define BQT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
49VIX_VERSION=`sed -n -e 's/^#define VIX_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
50JAVA_VERSION=`sed -n -e 's/^#define JAVA_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
51NDMP_VERSION=`sed -n -e 's/^#define NDMP_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
52LIBRSYNC_VERSION=`sed -n -e 's/^#define LIBRSYNC_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
53AC_SUBST(VERSION)dnl
54AC_SUBST(DATE)dnl
55AC_SUBST(LSMDATE)dnl
56AC_SUBST(BACULA)dnl
57AC_SUBST(post_host)dnl
58AC_SUBST(BDB_VERSION)dnl
59AC_SUBST(DEPKGS_QT_VERSION)dnl
60AC_SUBST(DEPKGS_VERSION)dnl
61AC_SUBST(VIX_VERSION)dnl
62AC_SUBST(JAVA_VERSION)dnl
63AC_SUBST(NDMP_VERSION)dnl
64AC_SUBST(LIBRSYNC_VERSION)dnl
65
66
67dnl src/lib
68dnl can be overwritten by specific values from version.h
69LIBBAC_LT_RELEASE=`sed -n -e 's/^#.*LIBBAC_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
70LIBBACCFG_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCFG_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
71LIBBACPY_LT_RELEASE=`sed -n -e 's/^#.*LIBBACPY_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
72
73LIBBAC_LT_RELEASE=${LIBBAC_LT_RELEASE:-$VERSION}
74LIBBACCFG_LT_RELEASE=${LIBBACCFG_LT_RELEASE:-$VERSION}
75
76AC_SUBST(LIBBAC_LT_RELEASE)dnl
77AC_SUBST(LIBBACCFG_LT_RELEASE)dnl
78
79dnl src/cats
80dnl can be overwritten by specific values from version.h
81LIBBACSQL_LT_RELEASE=`sed -n -e 's/^#.*LIBBACSQL_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
82LIBBACCATS_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCATS_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
83
84LIBBACSQL_LT_RELEASE=${LIBBACSQL_LT_RELEASE:-$VERSION}
85LIBBACCATS_LT_RELEASE=${LIBBACCATS_LT_RELEASE:-$VERSION}
86
87AC_SUBST(LIBBACSQL_LT_RELEASE)dnl
88AC_SUBST(LIBBACCATS_LT_RELEASE)dnl
89
90dnl src/findlib
91dnl can be overwritten by specific values from version.h
92LIBBACFIND_LT_RELEASE=`sed -n -e 's/^#.*LIBBACFIND_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
93
94LIBBACFIND_LT_RELEASE=${LIBBACFIND_LT_RELEASE:-$VERSION}
95
96AC_SUBST(LIBBACFIND_LT_RELEASE)dnl
97
98dnl PFILES are platform or plugin specific files
99PFILES="platforms/Makefile"
100
101echo "configuring for ${BACULA} $VERSION ($DATE)"
102
103
104dnl -------------------------------------------------------
105dnl Check for compiler.
106dnl ------------------------------------------------------
107
108AC_PROG_CC		dnl this sets $GCC if using GNU C compiler
109AC_PROG_CXX
110AC_PROG_CC_C_O		dnl Determine if C compiler support -c -o.
111AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional.
112
113BASECC=`basename $CC`
114have_gcc=no
115if test x"$GCC" = "xyes"; then
116   AC_DEFINE(HAVE_GCC)
117   have_gcc=yes
118fi
119AC_PATH_PROG(CXX, $CXX, $CXX)
120if test ! -e $CXX; then
121   AC_MSG_ERROR(Unable to find C++ compiler)
122fi
123
124dnl -------------------------------------------------------
125dnl Check for multiarch.
126dnl ------------------------------------------------------
127AC_MSG_CHECKING(for multiarch system)
128multiarch=`$CC $CFLAGS -print-multiarch 2>/dev/null`
129AC_MSG_RESULT($multiarch)
130
131dnl -------------------------------------------------------
132dnl Check for programs.
133dnl ------------------------------------------------------
134AC_PROG_INSTALL
135AC_PATH_PROG(MV, mv, mv)
136dnl Alert !!!
137dnl If we name the variable RM it will shadow the RM variable in the configure script and we overwrite the
138dnl value with the name of the rm command and not rm -f which is its normal content. This gives all kind
139dnl of strange output of the configure script (like things don't exist etc.).
140dnl So we name it REMOVE (more software has run into this problem)
141AC_PATH_PROG(REMOVE, rm, rm)
142AC_PATH_PROG(CP, cp, cp)
143AC_PATH_PROG(SED, sed, sed)
144AC_PATH_PROG(ECHO, echo, echo)
145AC_PATH_PROG(CMP, cmp, cmp)
146AC_PATH_PROG(TBL, tbl, tbl)
147AC_PATH_PROG(AR, ar, ar)
148AC_PATH_PROG(OPENSSL, openssl, none)
149AC_PATH_PROG(MTX, mtx, mtx)
150AC_PATH_PROG(DD, dd, dd)
151AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
152AC_PATH_PROG(PYTHON, python, python)
153AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
154AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
155AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
156AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
157AC_PATH_PROG(QMAKE, qmake, none)
158AC_PATH_PROG(GMAKE, gmake, none)
159AC_PATH_PROG(PIDOF, pidof, pidof)
160AC_PROG_AWK
161# Some AWK programs fail, so test it and warn the user
162if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 }
163      { if ((prog == $2) || (("(" prog ")") == $2) ||
164      (("[" prog "]") == $2) ||
165      ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
166else
167  AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
168   The regex engine of $AWK is too broken to be used you
169   might want to install GNU AWK.
170   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
171fi
172THE_AWK=$AWK
173AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
174
175
176test -n "$ARFLAG" || ARFLAGS="cr"
177AC_SUBST(ARFLAGS)
178
179MAKE_SHELL=/bin/sh
180AC_SUBST(MAKE_SHELL)
181
182AC_SUBST(LOCAL_LIBS)
183AC_SUBST(LOCAL_CFLAGS)
184AC_SUBST(LOCAL_LDFLAGS)
185AC_SUBST(LOCAL_DEFS)
186
187dnl --------------------------------------------------
188dnl Libtool config
189dnl --------------------------------------------------
190use_libtool=yes
191AC_ARG_ENABLE(libtool,
192   AC_HELP_STRING([--enable-libtool], [enable building using GNU libtool @<:@default=yes@:>@]),
193   [
194       if test x$enableval = xno; then
195	  use_libtool=no
196       fi
197   ]
198)
199LT_INIT([shared disable-static])
200LT_LIB_DLLOAD
201LT_LANG([C++])
202
203if test x$use_libtool != xno; then
204   DEFAULT_OBJECT_TYPE=".lo"
205   DEFAULT_ARCHIVE_TYPE=".la"
206   DEFAULT_SHARED_OBJECT_TYPE=".la"
207   LIBTOOL="\$(LIBTOOL)"
208   LIBTOOL_INSTALL_TARGET="libtool-install"
209   LIBTOOL_UNINSTALL_TARGET="libtool-uninstall"
210   LIBTOOL_CLEAN_TARGET="libtool-clean"
211   QMAKE_LIBTOOL="${BUILD_DIR}/libtool"
212   FD_PLUGIN_DIR="src/plugins/fd"
213   have_plugins=yes
214else
215   DEFAULT_OBJECT_TYPE=".o"
216   DEFAULT_ARCHIVE_TYPE=".a"
217   DEFAULT_SHARED_OBJECT_TYPE=".so"
218   LIBTOOL="# \$(LIBTOOL)"
219   LIBTOOL_INSTALL_TARGET=""
220   LIBTOOL_UNINSTALL_TARGET=""
221   LIBTOOL_CLEAN_TARGET=""
222   QMAKE_LIBTOOL="# ${BUILD_DIR}/libtool"
223   FD_PLUGIN_DIR=""
224   have_plugins=no
225fi
226
227AC_SUBST(DEFAULT_OBJECT_TYPE)
228AC_SUBST(DEFAULT_ARCHIVE_TYPE)
229AC_SUBST(DEFAULT_SHARED_OBJECT_TYPE)
230AC_SUBST(LIBTOOL)
231AC_SUBST(LIBTOOL_INSTALL_TARGET)
232AC_SUBST(LIBTOOL_UNINSTALL_TARGET)
233AC_SUBST(LIBTOOL_CLEAN_TARGET)
234AC_SUBST(QMAKE_LIBTOOL)
235
236dnl --------------------------------------------------
237dnl Include file handling
238dnl --------------------------------------------------
239AC_ARG_ENABLE(includes,
240   AC_HELP_STRING([--enable-includes], [enable installing of include files @<:@default=no@:>@]),
241   [
242       if test x$enableval = xyes; then
243	  install_includes=yes
244       fi
245   ]
246)
247
248dnl It only makes sense to install include files when you install libraries which only happens when
249dnl libtool is enabled
250
251if test x$use_libtool != xno -a x$install_includes = xyes; then
252   INCLUDE_INSTALL_TARGET="install-includes"
253   INCLUDE_UNINSTALL_TARGET="uninstall-includes"
254else
255   INCLUDE_INSTALL_TARGET=""
256   INCLUDE_UNINSTALL_TARGET=""
257fi
258AC_SUBST(INCLUDE_INSTALL_TARGET)
259AC_SUBST(INCLUDE_UNINSTALL_TARGET)
260
261dnl --------------------------------------------------
262dnl Bacula OP Sys determination (see aclocal.m4)
263dnl --------------------------------------------------
264BA_CHECK_OPSYS
265
266dnl -----------------------------------------------------------
267dnl Bacula OPSys Distribution determination (see aclocal.m4)
268dnl ----------------------------------------------------------
269BA_CHECK_OPSYS_DISTNAME
270
271dnl --------------------------------------------------
272dnl Suppport for gettext (translations)
273dnl By default, $datarootdir is ${prefix}/share
274dnl --------------------------------------------------
275AM_GNU_GETTEXT([external])
276
277dnl ------------------------------------------------------------------
278dnl If the user has not set --prefix, we set our default to nothing.
279dnl In this case, if the user has not set --sysconfdir, we set it
280dnl to the package default of /etc/bacula.  If either --prefix or
281dnl --sysconfdir is set, we leave sysconfdir alone except to eval it.
282dnl If the user has not set --libdir, we set it to the package
283dnl default of /usr/lib. If either --prefix or --libdir is set,
284dnl we leave libdir alone except to eval it. If the user has not set
285dnl --includedir, we set it to the package default of /usr/include.
286dnl If either --prefix or --includedir is set, we leave includedir
287dnl alone except to eval it
288dnl ------------------------------------------------------------------
289os_name=`uname -s 2>/dev/null`
290if test x${prefix} = xNONE ; then
291   if test `eval echo ${sysconfdir}` = NONE/etc ; then
292      sysconfdir=/etc/bacula
293   fi
294
295   if test `eval echo ${libdir}` = NONE/lib ; then
296      case ${os_name} in
297      Linux)
298	 os_processor=`uname -p 2>/dev/null`
299	 case ${os_processor} in
300	 x86_64)
301	    libdir=/usr/lib64
302	    ;;
303	 *)
304	    libdir=/usr/lib
305	    ;;
306	 esac
307	 ;;
308      *)
309	 libdir=/usr/lib
310	 ;;
311      esac
312   fi
313
314   if test `eval echo ${includedir}` = NONE/include ; then
315      includedir=/usr/include
316   fi
317
318   if test `eval echo ${datarootdir}` = NONE/share ; then
319      datarootdir=/usr/share
320   fi
321   prefix=
322fi
323
324dnl -------------------------------------------------------------------------
325dnl  If the user has not set --exec-prefix, we default to ${prefix}
326dnl -------------------------------------------------------------------------
327if test x${exec_prefix} = xNONE ; then
328   exec_prefix=${prefix}
329fi
330
331sysconfdir=`eval echo ${sysconfdir}`
332datarootdir=`eval echo ${datarootdir}`
333docdir=`eval echo ${docdir}`
334htmldir=`eval echo ${htmldir}`
335libdir=`eval echo ${libdir}`
336includedir=`eval echo ${includedir}`
337localedir=`eval echo ${datarootdir}/locale`
338AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
339AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir")
340
341dnl ------------------------------------------------------------------
342dnl If the user has not set --sbindir, we set our default as /sbin
343dnl ------------------------------------------------------------------
344if test x$sbindir = x'${exec_prefix}/sbin' ; then
345   sbindir=${exec_prefix}/sbin
346fi
347sbindir=`eval echo ${sbindir}`
348
349dnl -------------------------------------------------------------------------
350dnl  If the user has not set --mandir, we default to /usr/share/man
351dnl -------------------------------------------------------------------------
352if test x$mandir = x'${datarootdir}/man' ; then
353   mandir=/usr/share/man
354fi
355
356dnl -------------------------------------------------------------------------
357dnl  If the user has not set --htmldir, we default to /usr/share/doc/bacula/html
358dnl -------------------------------------------------------------------------
359if test x$htmldir = x'/usr/share/doc/bacula/' ; then
360   htmldir=`eval echo ${docdir}html`
361fi
362
363dnl -------------------------------------------------------------------------
364dnl  If the user has not set --docdir, we default to /usr/share/doc/bacula
365dnl -------------------------------------------------------------------------
366if test x$docdir = x'/usr/share/doc/' ; then
367   docdir=`eval echo ${docdir}bacula`
368fi
369
370
371AC_PATH_PROGS(MSGFMT, msgfmt, no)
372if test "$MSGFMT" = "no"
373then
374   echo 'msgfmt program not found, disabling NLS !'
375   USE_NLS=no
376   USE_INCLUDED_LIBINTL=no
377#else
378   AM_GNU_GETTEXT
379fi
380
381support_smartalloc=yes
382support_readline=yes
383support_lzo=yes
384support_s3=yes
385support_conio=yes
386support_bat=no
387support_tls=no
388support_crypto=no
389support_static_tools=no
390support_static_fd=no
391support_static_sd=no
392support_static_dir=no
393support_static_cons=no
394build_client_only=no
395build_dird=yes
396build_stored=yes
397db_backends=""
398batch_insert_db_backends=""
399support_lockmgr=no
400
401dnl --------------------------------------------------------------------------
402dnl CHECKING COMMAND LINE OPTIONS
403dnl --------------------------------------------------------------------------
404
405dnl -------------------------------------------
406dnl bat (default off)
407dnl -------------------------------------------
408AC_ARG_ENABLE(bat,
409   AC_HELP_STRING([--enable-bat], [enable build of bat Qt4/5 GUI @<:@default=no@:>@]),
410   [
411       if test x$enableval = xyes; then
412	  AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4/5 GUI support enabled])
413	  support_bat=yes
414       fi
415   ]
416)
417
418BAT_DIR=
419if test x$support_bat = xyes; then
420dnl look for Qt4
421   abc=`$PKGCONFIG QtGui`
422   pkg=$?
423   if test $pkg = 0; then
424      BAT_DIR=src/qt-console
425   else
426dnl look for Qt5
427     abc=`$PKGCONFIG Qt5Gui`
428     pkg=$?
429     if test $pkg = 0; then
430	BAT_DIR="src/qt-console src/qt-console/tray-monitor"
431     else
432	AC_MSG_ERROR(Unable to find either Qt4 or Qt5 installation needed by bat)
433     fi
434   fi
435fi
436
437AC_SUBST(BAT_DIR)
438AC_SUBST(QWT_INC)
439AC_SUBST(QWT_LDFLAGS)
440AC_SUBST(QWT_LIB)
441AC_SUBST(QWT)
442
443dnl -------------------------------------------
444dnl smartalloc (default off)
445dnl -------------------------------------------
446AC_ARG_ENABLE(smartalloc,
447   AC_HELP_STRING([--enable-smartalloc], [enable smartalloc debugging support @<:@default=no@:>@]),
448   [
449       if test x$enableval = xno; then
450	  support_smartalloc=no
451       fi
452   ]
453)
454
455if test x$support_smartalloc = xyes; then
456   AC_DEFINE(SMARTALLOC, 1, [Set if you want Smartalloc enabled])
457fi
458
459dnl -------------------------------------------
460dnl Lock Manager (default off)
461dnl -------------------------------------------
462AC_ARG_ENABLE(lockmgr,
463   AC_HELP_STRING([--enable-lockmgr], [enable lock manager support @<:@default=no@:>@]),
464   [
465       if test x$enableval = xyes; then
466	  support_lockmgr=yes
467       fi
468   ]
469)
470
471if test x$support_lockmgr = xyes; then
472   AC_DEFINE(USE_LOCKMGR, 1, [Set if you want Lock Manager enabled])
473fi
474
475
476dnl -------------------------------------------
477dnl static-tools (default off)
478dnl -------------------------------------------
479AC_ARG_ENABLE(static-tools,
480   AC_HELP_STRING([--enable-static-tools], [enable static tape tools @<:@default=no@:>@]),
481   [
482       if test x$enableval = xyes; then
483	  if test x$use_libtool = xyes; then
484	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
485  please rerun configure with --disable-libtool])
486	  fi
487	  support_static_tools=yes
488       fi
489   ]
490)
491
492TTOOL_LDFLAGS=
493if test x$support_static_tools = xyes; then
494   TTOOL_LDFLAGS="-static"
495fi
496AC_SUBST(TTOOL_LDFLAGS)
497
498dnl -------------------------------------------
499dnl static-fd	 (default off)
500dnl -------------------------------------------
501AC_ARG_ENABLE(static-fd,
502   AC_HELP_STRING([--enable-static-fd], [enable static File daemon @<:@default=no@:>@]),
503   [
504       if test x$enableval = xyes; then
505	  if test x$use_libtool = xyes; then
506	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
507  please rerun configure with --disable-libtool])
508	  fi
509	  support_static_fd=yes
510       fi
511   ]
512)
513
514STATIC_FD=
515if test x$support_static_fd = xyes; then
516   STATIC_FD="static-bacula-fd"
517fi
518AC_SUBST(STATIC_FD)
519
520dnl -------------------------------------------
521dnl static-sd	 (default off)
522dnl -------------------------------------------
523AC_ARG_ENABLE(static-sd,
524   AC_HELP_STRING([--enable-static-sd], [enable static Storage daemon @<:@default=no@:>@]),
525   [
526       if test x$enableval = xyes; then
527	  if test x$use_libtool = xyes; then
528	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
529  please rerun configure with --disable-libtool])
530	  fi
531	  support_static_sd=yes
532       fi
533   ]
534)
535
536STATIC_SD=
537if test x$support_static_sd = xyes; then
538   STATIC_SD="static-bacula-sd"
539fi
540AC_SUBST(STATIC_SD)
541
542dnl -------------------------------------------
543dnl static-dir	 (default off)
544dnl -------------------------------------------
545AC_ARG_ENABLE(static-dir,
546   AC_HELP_STRING([--enable-static-dir], [enable static Director @<:@default=no@:>@]),
547   [
548       if test x$enableval = xyes; then
549	  if test x$use_libtool = xyes; then
550	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
551  please rerun configure with --disable-libtool])
552	  fi
553	  support_static_dir=yes
554       fi
555   ]
556)
557
558STATIC_DIR=
559if test x$support_static_dir = xyes; then
560   STATIC_DIR="static-bacula-dir"
561fi
562AC_SUBST(STATIC_DIR)
563
564dnl -------------------------------------------
565dnl static-cons  (default off)
566dnl -------------------------------------------
567AC_ARG_ENABLE(static-cons,
568   AC_HELP_STRING([--enable-static-cons], [enable static Console @<:@default=no@:>@]),
569   [
570       if test x$enableval = xyes; then
571	  if test x$use_libtool = xyes; then
572	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
573  please rerun configure with --disable-libtool])
574	  fi
575	  support_static_cons=yes
576       fi
577   ]
578)
579
580STATIC_CONS=
581if test x$support_static_cons = xyes; then
582   STATIC_CONS="static-bconsole"
583fi
584AC_SUBST(STATIC_CONS)
585
586dnl -------------------------------------------
587dnl client_only  (default off)
588dnl -------------------------------------------
589AC_ARG_ENABLE(client-only,
590   AC_HELP_STRING([--enable-client-only], [build client (File daemon) only @<:@default=no@:>@]),
591   [
592      if test x$enableval = xyes; then
593         build_client_only=yes
594         db_backends="None"
595         DB_BACKENDS="none"
596      fi
597   ]
598)
599if test x$build_client_only = xno; then
600   ALL_DIRS="subdirs"
601   AC_DEFINE(HAVE_CLIENT_ONLY, 1, [Set if we build only client])
602else
603   ALL_DIRS=""
604fi
605AC_SUBST(ALL_DIRS)
606
607dnl -------------------------------------------
608dnl director  (default on)
609dnl -------------------------------------------
610AC_ARG_ENABLE(build-dird,
611   AC_HELP_STRING([--enable-build-dird], [enable building of dird (Director) @<:@default=yes@:>@]),
612   [
613      if test x$enableval = xno; then
614         build_dird=no
615      fi
616   ]
617)
618
619DIRD_DIR="src/dird"
620DIR_TOOLS="DIRTOOLS"
621
622AC_SUBST(DIRD_DIR)
623AC_SUBST(DIR_TOOLS)
624
625dnl -------------------------------------------
626dnl stored  (default on)
627dnl -------------------------------------------
628AC_ARG_ENABLE(build-stored,
629   AC_HELP_STRING([--enable-build-stored], [enable building of stored (Storage daemon) @<:@default=yes@:>@]),
630   [
631      if test x$enableval = xno; then
632	 build_stored=no
633      fi
634   ]
635)
636if test x$build_stored = xyes; then
637   STORED_DIR="src/stored"
638else
639   STORED_DIR=""
640fi
641AC_SUBST(STORED_DIR)
642
643dnl ---------------------------------------------------
644dnl Check for conio (Bacula readline substitute)(
645dnl ---------------------------------------------------
646dnl this allows you to turn it completely off
647AC_ARG_ENABLE(conio,
648   AC_HELP_STRING([--disable-conio], [disable conio support @<:@default=no@:>@]),
649   [
650       if test x$enableval = xno; then
651	  support_conio=no
652       fi
653   ]
654)
655
656
657dnl ---------------------------------------------------
658dnl Check for IPv6 support
659dnl ---------------------------------------------------
660dnl this allows you to turn it completely off
661support_ipv6=yes
662AC_ARG_ENABLE(ipv6,
663   AC_HELP_STRING([--enable-ipv6], [enable ipv6 support @<:@default=yes@:>@]),
664   [
665       if test x$enableval = xno; then
666	  support_ipv6=no
667       fi
668   ]
669)
670
671if test x$support_ipv6 = xyes; then
672    AC_TRY_LINK([ #include <sys/types.h>
673#include <sys/socket.h>
674#include <netinet/in.h>], [struct in6_addr t=in6addr_any; t.s6_addr[0] = 0;],
675      [support_in6addr_any=yes], [support_in6addr_any=no])
676
677   if test x$support_in6addr_any = xno ; then
678       in6addr_any="const struct in6_addr in6addr_any"
679   else
680       in6addr_any="1"
681   fi
682
683   AC_TRY_LINK([ #include <sys/types.h>
684#include <sys/socket.h>
685#include <netinet/in.h>], [$in6addr_any; struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
686      [support_ipv6=yes], [support_ipv6=no])
687fi
688
689if test x$support_ipv6 = xyes; then
690   AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
691
692   if test x$support_in6addr_any = xno ; then
693      AC_DEFINE(NEED_IN6ADDR_ANY,1,[Whether to have in6addr_any support])
694   fi
695fi
696
697TERM_LIB=""
698AC_CHECK_HEADER(curses.h, [
699    AC_CHECK_LIB(tinfo, tgetent, [ TERM_LIB="-ltinfo" ], [
700      AC_CHECK_LIB(ncurses, tgetent, [ TERM_LIB="-lncurses" ], [
701	AC_CHECK_LIB(termcap, tgetent, [ TERM_LIB="-ltermcap" ])
702    ])
703  ])
704  ],
705  [  AC_CHECK_HEADERS(curses.h)
706     AC_CHECK_HEADER(term.h,
707       [ AC_CHECK_LIB(curses, tgetent,
708	 [ TERM_LIB="-lcurses" ] )
709       ])
710  ])
711
712
713got_conio="no"
714if test x$support_conio = xyes; then
715   if test x$TERM_LIB != x; then
716      CONS_LIBS=$TERM_LIB
717      CONS_OBJ="conio.o"
718      CONS_SRC="conio.c"
719      got_conio="yes"
720      support_readline=no
721      AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
722   else
723      echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "
724   fi
725fi
726
727
728dnl ---------------------------------------------------
729dnl Check for readline support/directory (default off)
730dnl ---------------------------------------------------
731dnl this allows you to turn it completely off
732AC_ARG_ENABLE(readline,
733   AC_HELP_STRING([--disable-readline], [disable readline support @<:@default=yes@:>@]),
734   [
735       if test x$enableval = xno; then
736	  support_readline=no
737       fi
738   ]
739)
740
741got_readline="no"
742READLINE_SRC=
743if test x$support_readline = xyes; then
744   AC_ARG_WITH(readline,
745      AC_HELP_STRING([--with-readline@<:@=DIR@:>@], [specify readline library directory]),
746      [
747	  case "$with_readline" in
748	  no)
749	     :
750	     ;;
751	  yes|*)
752	     if test -f ${with_readline}/readline.h; then
753		CONS_INC="-I${with_readline}"
754		CONS_LDFLAGS="-L$with_readline"
755	     elif test -f ${with_readline}/include/readline/readline.h; then
756		CONS_INC="-I${with_readline}/include/readline"
757		CONS_LDFLAGS="-L${with_readline}/lib"
758		with_readline="${with_readline}/include/readline"
759	     else
760		with_readline="/usr/include/readline"
761	     fi
762
763	     AC_CHECK_HEADER(${with_readline}/readline.h,
764		[
765		    AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
766		    CONS_LIBS="-lreadline -lhistory ${TERM_LIB}"
767		    got_readline="yes"
768		], [
769		    echo " "
770		    echo "readline.h not found. readline turned off ..."
771		    echo " "
772		]
773	     )
774	     ;;
775	  esac
776      ],[
777	 dnl check for standard readline library
778	 AC_CHECK_HEADER(/usr/include/readline/readline.h,
779	    [
780		AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
781		got_readline="yes"
782		CONS_INC="-I/usr/include/readline"
783		CONS_LIBS="-lreadline ${TERM_LIB}"
784	    ], [
785		dnl Did not find standard library, so try Bacula's default
786		AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h,
787		    [
788			AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
789			got_readline="yes"
790			CONS_INC="-I${TOP_DIR}/depkgs/readline"
791			CONS_LIBS="-lreadline -lhistory ${TERM_LIB}"
792			CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
793			PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
794		    ], [
795			echo " "
796			echo "readline.h not found. readline turned off ..."
797			echo " "
798		    ]
799		)
800	    ]
801	 )
802      ]
803   )
804fi
805
806AC_SUBST(CONS_INC)
807AC_SUBST(CONS_OBJ)
808AC_SUBST(CONS_SRC)
809AC_SUBST(CONS_LIBS)
810AC_SUBST(CONS_LDFLAGS)
811AC_SUBST(READLINE_SRC)
812
813dnl Minimal stuff for readline Makefile configuration
814MAKE_SHELL=/bin/sh
815AC_SUBST(MAKE_SHELL)
816AC_HEADER_STAT
817AC_HEADER_DIRENT
818AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr)
819AC_CHECK_FUNCS(lstat lchown lchmod futimes fchmod fchown lutimes)
820AC_CHECK_FUNCS(nanosleep nl_langinfo)
821AC_CHECK_FUNCS(be64toh htobe64)
822AC_CHECK_HEADERS(varargs.h)
823
824dnl End of readline/conio stuff
825dnl -----------------------------------------------------------------------
826
827dnl
828dnl Find where sockets are (especially for Solaris)
829dnl Do this before the TCP Wrappers test since tcp wrappers
830dnl uses the socket library and some linkers are stupid.
831dnl
832AC_CHECK_FUNC(socket,
833    AC_MSG_RESULT(using libc's socket),
834    AC_CHECK_LIB(xnet,socket)
835    AC_CHECK_LIB(socket,socket)
836    AC_CHECK_LIB(inet,socket))
837
838dnl -----------------------------------------------------------
839dnl Check whether user wants TCP wrappers support (default off)
840dnl -----------------------------------------------------------
841TCPW_MSG="no"
842WRAPLIBS=""
843AC_ARG_WITH(tcp-wrappers,
844   AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable tcpwrappers support]),
845   [
846       if test "x$withval" != "xno" ; then
847	  saved_LIBS="$LIBS"
848	  LIBS="$saved_LIBS -lwrap"
849	  AC_SEARCH_LIBS(nanosleep, [rt])
850	  AC_MSG_CHECKING(for libwrap)
851	  AC_TRY_LINK(
852	     [
853	       #include <sys/types.h>
854	       #include <tcpd.h>
855	       int deny_severity = 0;
856	       int allow_severity = 0;
857	       struct request_info *req;
858	     ], [
859		hosts_access(req);
860	     ], [
861		 AC_MSG_RESULT(yes)
862		 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
863		 TCPW_MSG="yes"
864		 LIBS="$saved_LIBS"
865		 WRAPLIBS="-lwrap"
866	     ], [
867		 LIBS="$saved_LIBS -lwrap -lnsl"
868		 WRAPLIBS="$saved_LIBS -lwrap -lnsl"
869		 AC_TRY_LINK(
870		   [
871		       #include <sys/types.h>
872		       #include <tcpd.h>
873		       int deny_severity = 0;
874		       int allow_severity = 0;
875		       struct request_info *req;
876		   ], [
877		       hosts_access(req);
878		   ], [
879		      AC_MSG_RESULT(yes)
880		      AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
881		      TCPW_MSG="yes"
882		      LIBS="$saved_LIBS"
883		      WRAPLIBS="-lwrap"
884		   ], [
885		      AC_MSG_ERROR([*** libwrap missing])
886		   ]
887		)
888	     ]
889	  )
890       fi
891   ]
892)
893
894dnl -----------------------------------------------------------
895dnl Check whether OpenSSL is available
896dnl -----------------------------------------------------------
897AC_MSG_CHECKING([for OpenSSL])
898dnl The following uses quadrigraphs:
899dnl '@<:@' = '['
900dnl '@:>@' = ']'
901AC_ARG_WITH(openssl,
902    AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
903    [
904	with_openssl_directory=${withval}
905    ]
906)
907
908if test "x$with_openssl_directory" != "xno"; then
909   OPENSSL_LIBS="-lssl -lcrypto"
910   OPENSSL_INC=""
911
912   if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
913      #
914      # Make sure the $with_openssl_directory also makes sense
915      #
916      if test -d "$with_openssl_directory/lib" -a -d "$with_openssl_directory/include"; then
917	 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
918	 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
919      fi
920   fi
921
922   saved_LIBS="${LIBS}"
923   saved_CFLAGS="${CFLAGS}"
924   LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
925   CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"
926
927   AC_TRY_LINK(
928      [
929	  #include <openssl/ssl.h>
930      ], [
931	   CRYPTO_set_id_callback(NULL);
932      ], [
933	  support_tls="yes"
934	  support_crypto="yes"
935      ], [
936	  support_tls="no"
937	  support_crypto="no"
938      ]
939   )
940
941   AC_TRY_LINK(
942      [
943	  #include <openssl/evp.h>
944      ], [
945	  EVP_sha512();
946      ], [
947	  ac_cv_openssl_sha2="yes"
948      ], [
949	  ac_cv_openssl_sha2="no"
950      ]
951   )
952
953   dnl Solaris disables greater than 128+ bit encryption in their OpenSSL
954   dnl implementation, presumably for export reasons. If 192bit AES
955   dnl is available, we assume that we're running with a 'non-export'
956   dnl openssl library.
957   AC_TRY_LINK(
958      [
959	  #include <openssl/evp.h>
960      ], [
961	  EVP_aes_192_cbc();
962      ], [
963	  ac_cv_openssl_export="no"
964      ], [
965	  ac_cv_openssl_export="yes"
966      ]
967   )
968
969   AC_MSG_RESULT([$support_tls])
970   if test "$support_tls" = "yes"; then
971      AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
972      AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
973      AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
974   fi
975
976   if test "$ac_cv_openssl_sha2" = "yes"; then
977      AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
978   fi
979
980   if test "$ac_cv_openssl_export" = "yes"; then
981      AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
982   fi
983
984   if test "$support_crypto" = "yes"; then
985      AC_CHECK_LIB(crypto, EVP_PKEY_encrypt_old, AC_DEFINE(HAVE_OPENSSLv1, 1, [Set if have OpenSSL version 1.x]))
986   fi
987
988   LIBS="${saved_LIBS}"
989   CFLAGS="${saved_CFLAGS}"
990else
991   support_tls="no"
992   support_crypto="no"
993   AC_MSG_RESULT([$support_tls])
994fi
995
996if test "$support_tls" = "no" -o "$support_crypto" = "no"; then
997   OPENSSL_LIBS=""
998   OPENSSL_INC=""
999fi
1000
1001AC_SUBST(OPENSSL_LIBS)
1002AC_SUBST(OPENSSL_INC)
1003
1004dnl -----------------------------------------------------------
1005dnl dlopen is needed for plugins
1006dnl -----------------------------------------------------------
1007AC_SEARCH_LIBS(dlopen, [dl])
1008
1009dnl -----------------------------------------------------------
1010dnl check for macOS IOKit
1011dnl -----------------------------------------------------------
1012IOKITLIBS=""
1013if test x${HAVE_DARWIN_OS_TRUE} = x; then
1014   AC_CHECK_HEADER(IOKit/pwr_mgt/IOPMLib.h,
1015      IOKITLIBS="-framework IOKit"
1016   )
1017fi
1018AC_SUBST(IOKITLIBS)
1019
1020dnl ------------------------------------------
1021dnl Where to place working dir
1022dnl ------------------------------------------
1023working_dir=`eval echo /opt/bacula/working`
1024AC_ARG_WITH(working-dir,
1025   AC_HELP_STRING([--with-working-dir=PATH], [specify path of Bacula working directory]),
1026   [
1027       if test "x$withval" != "xno" ; then
1028	 working_dir=$withval
1029       fi
1030   ]
1031)
1032
1033AC_SUBST(working_dir)
1034
1035dnl ------------------------------------------------------------------
1036dnl If the user has not set archivedir, we set our default as /tmp
1037dnl ------------------------------------------------------------------
1038archivedir=/tmp
1039AC_ARG_WITH(archivedir,
1040   AC_HELP_STRING([--with-archivedir=PATH], [specify path of SD archive directory]),
1041   [
1042       if test "x$withval" != "xno" ; then
1043	  archivedir=$withval
1044       fi
1045   ]
1046)
1047
1048AC_SUBST(archivedir)
1049
1050dnl ------------------------------------------------------------------
1051dnl Allow the user to specify the daemon resource name default hostname
1052dnl ------------------------------------------------------------------
1053basename=`hostname`
1054AC_ARG_WITH(basename,
1055   AC_HELP_STRING([--with-basename=RESNAME], [specify base resource name for daemons]),
1056   [
1057       if test "x$withval" != "xno" ; then
1058	  basename=$withval
1059       fi
1060   ]
1061)
1062
1063AC_SUBST(basename)
1064
1065dnl ------------------------------------------------------------------
1066dnl Allow the user to override the hostname (default = machine hostname)
1067dnl ------------------------------------------------------------------
1068hostname=`uname -n | cut -d '.' -f 1`
1069if test x${hostname} = x ; then
1070  hostname="localhost"
1071fi
1072dnl Make sure hostname is resolved
1073ping -c 1 $hostname 2>/dev/null 1>/dev/null
1074if test ! $? = 0; then
1075  hostname="localhost"
1076fi
1077AC_ARG_WITH(hostname,
1078   AC_HELP_STRING([--with-hostname=RESNAME], [specify host name for daemons]),
1079   [
1080       if test "x$withval" != "xno" ; then
1081	 hostname=$withval
1082       fi
1083   ]
1084)
1085
1086AC_SUBST(hostname)
1087
1088
1089dnl ------------------------------------------
1090dnl Where to place scriptdir (script files)
1091dnl ------------------------------------------
1092scriptdir=`eval echo ${sysconfdir}`
1093AC_ARG_WITH(scriptdir,
1094   AC_HELP_STRING([--with-scriptdir=PATH], [specify path of Bacula scripts directory]),
1095   [
1096       if test "x$withval" != "xno" ; then
1097	  scriptdir=$withval
1098       fi
1099   ]
1100)
1101
1102AC_SUBST(scriptdir)
1103
1104
1105dnl ------------------------------------------
1106dnl Where to place bsrdir (bsr files)
1107dnl ------------------------------------------
1108bsrdir=`eval echo /opt/bacula/bsr`
1109AC_ARG_WITH(bsrdir,
1110   AC_HELP_STRING([--with-bsrdir=PATH], [specify path of Bacula bsrs directory]),
1111   [
1112       if test "x$withval" != "xno" ; then
1113	  bsrdir=$withval
1114       fi
1115   ]
1116)
1117
1118AC_SUBST(bsrdir)
1119
1120dnl ------------------------------------------
1121dnl Where to place logdir
1122dnl ------------------------------------------
1123logdir=`eval echo /opt/bacula/log`
1124AC_ARG_WITH(logdir,
1125   AC_HELP_STRING([--with-logdir=PATH], [specify path of Bacula logs directory]),
1126   [
1127       if test "x$withval" != "xno" ; then
1128	  logdir=$withval
1129       fi
1130   ]
1131)
1132
1133AC_SUBST(logdir)
1134
1135
1136# ------------------------------------------
1137# Where to place plugindir (plugin files)
1138# ------------------------------------------
1139plugindir=`eval echo ${libdir}`
1140AC_ARG_WITH(plugindir,
1141   AC_HELP_STRING([--with-plugindir=PATH], [specify path of Bacula plugins directory]),
1142   [
1143       if test "x$withval" != "xno" ; then
1144	  plugindir=$withval
1145       fi
1146   ]
1147)
1148
1149AC_SUBST(plugindir)
1150
1151dnl ------------------------------------------
1152dnl Where to send dump email
1153dnl ------------------------------------------
1154
1155dnl ------------------------------------------
1156dnl Where to send dump email
1157dnl ------------------------------------------
1158dump_email=root@localhost
1159AC_ARG_WITH(dump-email,
1160   AC_HELP_STRING([--with-dump-email=EMAIL], [dump email address]),
1161   [
1162       if test "x$withval" != "xno" ; then
1163	  dump_email=$withval
1164       fi
1165   ]
1166)
1167
1168AC_SUBST(dump_email)
1169
1170dnl ------------------------------------------
1171dnl Where to send job email
1172dnl ------------------------------------------
1173job_email=root@localhost
1174AC_ARG_WITH(job-email,
1175   AC_HELP_STRING([--with-job-email=EMAIL], [job output email address]),
1176   [
1177       if test "x$withval" != "xno" ; then
1178	  job_email=$withval
1179       fi
1180   ]
1181)
1182
1183AC_SUBST(job_email)
1184
1185dnl ------------------------------------------
1186dnl Where to find smtp host
1187dnl ------------------------------------------
1188smtp_host=localhost
1189AC_ARG_WITH(smtp_host,
1190   AC_HELP_STRING([--with-smtp-host=HOST], [SMTP mail host address]),
1191   [
1192       if test "x$withval" != "xno" ; then
1193	  smtp_host=$withval
1194       fi
1195   ]
1196)
1197
1198AC_SUBST(smtp_host)
1199
1200dnl ------------------------------------
1201dnl Where to place pid files
1202dnl ------------------------------------
1203piddir=/var/run
1204AC_ARG_WITH(pid-dir,
1205   AC_HELP_STRING([--with-pid-dir=PATH], [specify location of Bacula pid files]),
1206   [
1207       if test "x$withval" != "xno" ; then
1208	  piddir=$withval
1209       fi
1210   ]
1211)
1212
1213AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
1214AC_SUBST(piddir)
1215
1216dnl ------------------------------------
1217dnl Where to place subsys "lock file"
1218dnl ------------------------------------
1219subsysdir=/var/run/subsys
1220if test -d /var/run/subsys; then
1221   subsysdir=/var/run/subsys
1222elif test -d /var/lock/subsys; then
1223   subsysdir=/var/lock/subsys
1224else
1225   subsysdir=/var/run/subsys
1226fi
1227AC_ARG_WITH(subsys-dir,
1228   AC_HELP_STRING([--with-subsys-dir=PATH], [specify location of Bacula subsys file]),
1229   [
1230       if test "x$withval" != "xno" ; then
1231	  subsysdir=$withval
1232       fi
1233   ]
1234)
1235
1236AC_SUBST(subsysdir)
1237
1238dnl ------------------------------------
1239dnl Where to start assigning ports
1240dnl ------------------------------------
1241baseport=9101
1242AC_ARG_WITH(baseport,
1243   AC_HELP_STRING([--with-baseport=PORT], [specify base port address for daemons]),
1244   [
1245       if test "x$withval" != "xno" ; then
1246	  baseport=$withval
1247       fi
1248   ]
1249)
1250
1251AC_SUBST(baseport)
1252dir_port=`expr $baseport`
1253fd_port=`expr $baseport + 1`
1254sd_port=`expr $fd_port + 1`
1255
1256AC_SUBST(dir_port)
1257AC_SUBST(fd_port)
1258AC_SUBST(sd_port)
1259
1260dnl ------------------------------------------
1261dnl Generate passwords
1262dnl ------------------------------------------
1263dir_password=
1264AC_ARG_WITH(dir-password,
1265   AC_HELP_STRING([--with-dir-password=PASSWORD], [specify Director's password]),
1266   [
1267       if test "x$withval" != "xno" ; then
1268	  dir_password=$withval
1269       fi
1270   ]
1271)
1272
1273if test "x$dir_password" = "x" ; then
1274   if test "x$OPENSSL" = "xnone" ; then
1275      key=`autoconf/randpass 33`
1276   else
1277      key=`openssl rand -base64 33`
1278   fi
1279   dir_password=$key
1280fi
1281
1282fd_password=
1283AC_ARG_WITH(fd-password,
1284   AC_HELP_STRING([--with-fd-password=PASSWORD], [specify Client's password]),
1285   [
1286       if test "x$withval" != "xno" ; then
1287	  fd_password=$withval
1288       fi
1289   ]
1290)
1291
1292if test "x$fd_password" = "x" ; then
1293   if test "x$OPENSSL" = "xnone" ; then
1294      key=`autoconf/randpass 37`
1295   else
1296      key=`openssl rand -base64 33`
1297   fi
1298   fd_password=$key
1299fi
1300
1301sd_password=
1302AC_ARG_WITH(sd-password,
1303   AC_HELP_STRING([--with-sd-password=PASSWORD], [specify Storage daemon's password]),
1304   [
1305       if test "x$withval" != "xno" ; then
1306	  sd_password=$withval
1307       fi
1308   ]
1309)
1310
1311if test "x$sd_password" = "x" ; then
1312   if test "x$OPENSSL" = "xnone" ; then
1313      key=`autoconf/randpass 41`
1314   else
1315      key=`openssl rand -base64 33`
1316   fi
1317   sd_password=$key
1318fi
1319
1320mon_dir_password=
1321AC_ARG_WITH(mon-dir-password,
1322   AC_HELP_STRING([--with-mon-dir-password=PASSWORD], [specify Director's password used by the monitor]),
1323   [
1324       if test "x$withval" != "xno" ; then
1325	  mon_dir_password=$withval
1326       fi
1327   ]
1328)
1329
1330if test "x$mon_dir_password" = "x" ; then
1331   if test "x$OPENSSL" = "xnone" ; then
1332      key=`autoconf/randpass 33`
1333   else
1334      key=`openssl rand -base64 33`
1335   fi
1336   mon_dir_password=$key
1337fi
1338
1339mon_fd_password=
1340AC_ARG_WITH(mon-fd-password,
1341   AC_HELP_STRING([--with-mon-fd-password=PASSWORD], [specify Client's password used by the monitor]),
1342   [
1343       if test "x$withval" != "xno" ; then
1344	  mon_fd_password=$withval
1345       fi
1346   ]
1347)
1348
1349if test "x$mon_fd_password" = "x" ; then
1350   if test "x$OPENSSL" = "xnone" ; then
1351      key=`autoconf/randpass 37`
1352   else
1353      key=`openssl rand -base64 33`
1354   fi
1355   mon_fd_password=$key
1356fi
1357
1358mon_sd_password=
1359AC_ARG_WITH(mon-sd-password,
1360   AC_HELP_STRING([--with-mon-sd-password=PASSWORD], [specify Storage daemon's password used by the monitor]),
1361   [
1362       if test "x$withval" != "xno" ; then
1363	  mon_sd_password=$withval
1364       fi
1365   ]
1366)
1367
1368if test "x$mon_sd_password" = "x" ; then
1369   if test "x$OPENSSL" = "xnone" ; then
1370      key=`autoconf/randpass 41`
1371   else
1372      key=`openssl rand -base64 33`
1373   fi
1374   mon_sd_password=$key
1375fi
1376
1377AC_SUBST(dir_password)
1378AC_SUBST(fd_password)
1379AC_SUBST(sd_password)
1380AC_SUBST(mon_dir_password)
1381AC_SUBST(mon_fd_password)
1382AC_SUBST(mon_sd_password)
1383
1384dnl
1385dnl Pickup any database name
1386dnl
1387db_name=bacula
1388AC_ARG_WITH(db_name,
1389   AC_HELP_STRING([--with-db-name=DBNAME], [specify database name @<:@default=bacula@:>@]),
1390   [
1391       if test "x$withval" != "x" ; then
1392	  db_name=$withval
1393       fi
1394   ]
1395)
1396AC_SUBST(db_name)
1397
1398db_user=bacula
1399AC_ARG_WITH(db_user,
1400   AC_HELP_STRING([--with-db-user=UNAME], [specify database user @<:@default=bacula@:>@]),
1401   [
1402       if test "x$withval" != "x" ; then
1403	  db_user=$withval
1404       fi
1405   ]
1406)
1407AC_SUBST(db_user)
1408
1409db_password=
1410AC_ARG_WITH(db_password,
1411   AC_HELP_STRING([--with-db-password=PWD], [specify database password @<:@default=*none*@:>@]),
1412   [
1413       if test "x$withval" != "x" ; then
1414	  db_password=$withval
1415       fi
1416   ]
1417)
1418AC_SUBST(db_password)
1419
1420dnl
1421dnl Pickup a database port
1422dnl
1423db_port=" "
1424AC_ARG_WITH(db_port,
1425   AC_HELP_STRING([--with-db-port=DBPORT], [specify a database port @<:@default=null@:>@]),
1426   [
1427       if test "x$withval" != "x" ; then
1428	  db_port=$withval
1429       fi
1430   ]
1431)
1432AC_SUBST(db_port)
1433
1434dnl
1435dnl Pickup MySQL SSL options for database user connection
1436dnl
1437db_ssl_options=
1438AC_ARG_WITH(db_ssl_options,
1439   AC_HELP_STRING([--with-db-ssl-options=DBSSLOPTIONS], [specify SSL options for database user connection @<:@default=null@:>@]),
1440   [
1441       if test "x$withval" != "x" ; then
1442	 db_ssl_options=$withval
1443       fi
1444   ]
1445)
1446AC_SUBST(db_ssl_options)
1447
1448#
1449# Handle users and groups for each daemon
1450#
1451dir_user=
1452AC_ARG_WITH(dir_user,
1453   AC_HELP_STRING([--with-dir-user=USER], [specify user for Director daemon]),
1454   [
1455       if test "x$withval" != "x" ; then
1456	   dir_user=$withval
1457       fi
1458   ]
1459)
1460
1461dir_group=
1462AC_ARG_WITH(dir_group,
1463   AC_HELP_STRING([--with-dir-group=GROUP], [specify group for Director daemon]),
1464   [
1465       if test "x$withval" != "x" ; then
1466	  dir_group=$withval
1467       fi
1468   ]
1469)
1470
1471sd_user=
1472AC_ARG_WITH(sd_user,
1473   AC_HELP_STRING([--with-sd-user=USER], [specify user for Storage daemon]),
1474   [
1475       if test "x$withval" != "x" ; then
1476	  sd_user=$withval
1477       fi
1478   ]
1479)
1480
1481sd_group=
1482AC_ARG_WITH(sd_group,
1483   AC_HELP_STRING([--with-sd-group=GROUP], [specify group for Storage daemon]),
1484   [
1485       if test "x$withval" != "x" ; then
1486	  sd_group=$withval
1487       fi
1488   ]
1489)
1490
1491fd_user=
1492AC_ARG_WITH(fd_user,
1493   AC_HELP_STRING([--with-fd-user=USER], [specify user for File daemon]),
1494   [
1495       if test "x$withval" != "x" ; then
1496	  fd_user=$withval
1497       fi
1498   ]
1499)
1500
1501fd_group=
1502AC_ARG_WITH(fd_group,
1503   AC_HELP_STRING([--with-fd-group=GROUP], [specify group for File daemon]),
1504   [
1505       if test "x$withval" != "x" ; then
1506	  fd_group=$withval
1507       fi
1508   ]
1509)
1510
1511AC_SUBST(dir_user)
1512AC_SUBST(dir_group)
1513AC_SUBST(sd_user)
1514AC_SUBST(sd_group)
1515AC_SUBST(fd_user)
1516AC_SUBST(fd_group)
1517
1518dnl
1519dnl allow setting default executable permissions
1520dnl
1521SBINPERM=0750
1522AC_ARG_WITH(sbin-perm,
1523   AC_HELP_STRING([--with-sbin-perm=MODE], [specify permissions for sbin binaries @<:@default=0750@:>@]),
1524   [
1525       if test "x$withval" != "x" ; then
1526	  SBINPERM=$withval
1527       fi
1528   ]
1529)
1530
1531AC_SUBST(SBINPERM)
1532
1533dnl ------------------------------------------
1534dnl Python Cython detection
1535dnl ------------------------------------------
1536CYTHON=cython
1537CYTHON_LIBS=
1538CYTHON_INC=
1539AC_ARG_WITH(cython,
1540   AC_HELP_STRING([--with-cython=cython], [Cython path]),
1541   [
1542       if test "x$withval" != "xno" ; then
1543       	  CYTHON=$withval
1544       fi
1545   ]
1546)
1547
1548$CYTHON -h > /dev/null 2> /dev/null
1549if test $? = 0; then
1550   if echo $CYTHON | grep cython3 > /dev/null; then
1551      PYTHON=python3
1552      CYTHON="$CYTHON -3"
1553   else
1554      PYTHON=python
1555      CYTHON="$CYTHON -2"
1556   fi
1557   CYTHON_LIBS=`${PYTHON}-config --libs 2>/dev/null`
1558   CYTHON_INC=`${PYTHON}-config --includes 2>/dev/null`
1559else
1560   CYTHON=
1561fi
1562
1563AC_SUBST(CYTHON)
1564AC_SUBST(CYTHON_LIBS)
1565AC_SUBST(CYTHON_INC)
1566
1567dnl -------------------------------------------
1568dnl enable batch attribute DB insert (default on)
1569dnl -------------------------------------------
1570support_batch_insert=yes
1571AC_ARG_ENABLE(batch-insert,
1572   AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=yes@:>@]),
1573   [
1574       if test x$enableval = xno; then
1575	  support_batch_insert=no
1576       fi
1577   ]
1578)
1579
1580if test x$support_batch_insert = xyes; then
1581   AC_DEFINE(USE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
1582fi
1583
1584dnl ------------------------------------------------
1585dnl Bacula check for various SQL database engines
1586dnl ------------------------------------------------
1587
1588dnl
1589dnl Set uncomment_dbi by default to '#' if DBI is enabled this will get reset
1590dnl
1591uncomment_dbi="#"
1592
1593BA_CHECK_POSTGRESQL_DB
1594
1595BA_CHECK_MYSQL_DB
1596
1597BA_CHECK_SQLITE3_DB
1598
1599dnl -------------------------------------------
1600dnl If no batch insert backend are enable set
1601dnl variable to None
1602dnl -------------------------------------------
1603if test -z "${batch_insert_db_backends}"; then
1604   batch_insert_db_backends="None"
1605fi
1606
1607dnl -------------------------------------------
1608dnl Make sure at least one database backend is found
1609dnl -------------------------------------------
1610if test "x${db_backends}" = "x" ; then
1611   echo " "
1612   echo " "
1613   echo "You have not specified either --enable-client-only or one of the"
1614   echo "supported databases: MySQL, PostgreSQL, or SQLite3."
1615   echo "This is not permitted. Please reconfigure."
1616   echo " "
1617   echo "Aborting the configuration ..."
1618   echo " "
1619   echo " "
1620   exit 1
1621fi
1622
1623dnl -------------------------------------------
1624dnl See how many catalog backends are configured.
1625dnl -------------------------------------------
1626case `echo $DB_BACKENDS | wc -w | sed -e 's/^ *//'` in
1627   1)
1628      DEFAULT_DB_TYPE="${DB_BACKENDS}"
1629      if test x$use_libtool = xno; then
1630	 SHARED_CATALOG_TARGETS=""
1631      else
1632	 SHARED_CATALOG_TARGETS="libbaccats-${DEFAULT_DB_TYPE}.la"
1633      fi
1634      ;;
1635   *)
1636      dnl ------------------------------------------------
1637      dnl Set the default backend to the first backend found
1638      dnl ------------------------------------------------
1639      DEFAULT_DB_TYPE=`echo ${DB_BACKENDS} | cut -d' ' -f1`
1640
1641      dnl ------------------------------------------------
1642      dnl For multiple backend we need libtool support.
1643      dnl ------------------------------------------------
1644      if test x$use_libtool = xno; then
1645	 echo " "
1646	 echo " "
1647	 echo "You have specified two or more of the"
1648	 echo "supported databases: MySQL, PostgreSQL, or SQLite3."
1649	 echo "This is not permitted when not using libtool Please reconfigure."
1650	 echo " "
1651	 echo "Aborting the configuration ..."
1652	 echo " "
1653	 echo " "
1654	 exit 1
1655      fi
1656
1657      SHARED_CATALOG_TARGETS=""
1658      for db_type in ${DB_BACKENDS}
1659      do
1660	 if test -z "${SHARED_CATALOG_TARGETS}"; then
1661	    SHARED_CATALOG_TARGETS="libbaccats-${db_type}.la"
1662	 else
1663	    SHARED_CATALOG_TARGETS="${SHARED_CATALOG_TARGETS} libbaccats-${db_type}.la"
1664	 fi
1665      done
1666      ;;
1667esac
1668
1669dnl -------------------------------------------
1670dnl Unset DB_LIBS when using libtool as we link the
1671dnl shared library using the right database lib no need to
1672dnl set DB_LIBS which is only used for non shared versions
1673dnl of the backends.
1674dnl -------------------------------------------
1675if test x$use_libtool = xyes; then
1676   DB_LIBS=""
1677fi
1678
1679AC_SUBST(uncomment_dbi)
1680AC_SUBST(DB_BACKENDS)
1681AC_SUBST(DB_LIBS)
1682AC_SUBST(DEFAULT_DB_TYPE)
1683AC_SUBST(SHARED_CATALOG_TARGETS)
1684
1685AC_DEFINE(PROTOTYPES)
1686
1687dnl --------------------------------------------------------------------------
1688dnl Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1689dnl
1690if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1691   if test -z "$CCOPTS"; then
1692      CCOPTS='-g -O2 -Wall'
1693   fi
1694   CFLAGS="$CCOPTS"
1695fi
1696
1697dnl A few others
1698AC_EXEEXT
1699
1700dnl See if we can use 64 bit file addresses
1701largefile_support="no"
1702AC_BAC_LARGEFILE
1703
1704AC_PATH_XTRA
1705
1706dnl --------------------------------------------------------------------------
1707dnl CHECKING FOR HEADER FILES
1708dnl --------------------------------------------------------------------------
1709AC_CHECK_HEADERS( \
1710   assert.h \
1711   fcntl.h \
1712   grp.h \
1713   pwd.h \
1714   libc.h \
1715   limits.h \
1716   stdarg.h \
1717   stdlib.h \
1718   stdint.h \
1719   inttypes.h \
1720   string.h \
1721   strings.h \
1722   termios.h \
1723   termcap.h \
1724   term.h \
1725   unistd.h \
1726   sys/bitypes.h \
1727   sys/byteorder.h \
1728   sys/ioctl.h \
1729   sys/select.h \
1730   sys/socket.h \
1731   sys/sockio.h \
1732   sys/stat.h \
1733   sys/time.h \
1734   sys/types.h \
1735   arpa/nameser.h \
1736   mtio.h \
1737   sys/mtio.h \
1738   sys/tape.h \
1739   regex.h \
1740   attr/attributes.h \
1741   attr/xattr.h \
1742)
1743AC_HEADER_STDC
1744AC_HEADER_MAJOR
1745AC_HEADER_DIRENT
1746AC_HEADER_STAT
1747AC_HEADER_SYS_WAIT
1748AC_HEADER_TIME
1749AC_STRUCT_ST_BLKSIZE
1750AC_STRUCT_ST_BLOCKS
1751AC_STRUCT_TIMEZONE
1752
1753dnl --------------------------------------------------------------------------
1754dnl Check for utime.h structure
1755dnl --------------------------------------------------------------------------
1756AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1757   [
1758       AC_TRY_COMPILE(
1759	  [
1760	      #include <sys/types.h>
1761	      #include <utime.h>
1762	  ], [
1763	      struct utimbuf foo
1764	  ], [
1765	      ba_cv_header_utime_h=yes
1766	  ], [
1767	      ba_cv_header_utime_h=no
1768	  ]
1769       )
1770   ]
1771)
1772test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])
1773
1774dnl --------------------------------------------------------------------------
1775dnl Check for socklen_t
1776dnl --------------------------------------------------------------------------
1777AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1778   [
1779       AC_TRY_COMPILE(
1780	  [
1781	      #include <sys/types.h>
1782	      #include <sys/socket.h>
1783	  ], [
1784	      socklen_t x
1785	  ], [
1786	     ba_cv_header_socklen_t=yes
1787	  ], [
1788	     ba_cv_header_socklen_t=no
1789	  ]
1790       )
1791   ]
1792)
1793test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T, 1, [Set if socklen_t exists])
1794
1795dnl --------------------------------------------------------------------------
1796dnl Check for ioctl request type
1797dnl --------------------------------------------------------------------------
1798AC_LANG(C++)
1799AC_CACHE_CHECK(for ioctl_req_t, ba_cv_header_ioctl_req_t,
1800   [
1801       AC_TRY_COMPILE(
1802	  [
1803	      #include <unistd.h>
1804	      #include <sys/types.h>
1805	      #include <sys/ioctl.h>
1806	  ], [
1807	      int (*d_ioctl)(int fd, unsigned long int request, ...);
1808	      d_ioctl = ::ioctl;
1809	  ], [
1810	     ba_cv_header_ioctl_req_t=yes
1811	  ], [
1812	     ba_cv_header_ioctl_req_t=no
1813	  ]
1814       )
1815   ]
1816)
1817test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [Set if ioctl request is unsigned long int])
1818
1819dnl Note: it is more correct to use AC_LANG(C++) but some of the older
1820dnl   *BSD systems still use old style C prototypes, which are wrong with
1821dnl   compiled with a C++ compiler.
1822AC_LANG(C)
1823
1824dnl --------------------------------------------------------------------------
1825dnl Check for typeof()
1826dnl --------------------------------------------------------------------------
1827AC_LANG_PUSH(C++)
1828AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
1829   [
1830       AC_TRY_RUN(
1831	  [
1832	      main(){char *a = 0; a = (typeof a)a;}
1833	  ], [
1834	      ba_cv_have_typeof=yes
1835	  ], [
1836	      ba_cv_have_typeof=no
1837	  ], [
1838	      ba_cv_have_typeof=no
1839	  ]
1840       )
1841   ]
1842)
1843test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
1844AC_LANG_POP(C++)
1845
1846AC_C_CONST
1847
1848AC_C_BIGENDIAN([AC_DEFINE([HAVE_BIG_ENDIAN], [1], [Big Endian])], [AC_DEFINE([HAVE_LITTLE_ENDIAN], [1], [Little Endian])])
1849
1850dnl --------------------------------------------------------------------------
1851dnl CHECKING FOR FILESYSTEM TYPE
1852dnl --------------------------------------------------------------------------
1853AC_MSG_CHECKING(how to get filesystem type)
1854fstype=no
1855# The order of these tests is important.
1856AC_TRY_CPP(
1857   [
1858       #include <sys/statvfs.h>
1859       #include <sys/fstyp.h>
1860   ],
1861   AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4
1862)
1863if test $fstype = no; then
1864   AC_TRY_CPP(
1865      [
1866	  #include <sys/statfs.h>
1867	  #include <sys/fstyp.h>
1868      ],
1869      AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3
1870   )
1871fi
1872if test $fstype = no; then
1873   AC_TRY_CPP(
1874      [
1875	  #include <sys/statfs.h>
1876	  #include <sys/vmount.h>
1877      ],
1878      AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX
1879   )
1880fi
1881if test $fstype = no; then
1882   AC_TRY_CPP(
1883      [
1884	  #include <mntent.h>
1885      ],
1886      AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD
1887   )
1888fi
1889if test $fstype = no; then
1890   AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1891fi
1892if test $fstype = no; then
1893   AC_TRY_CPP(
1894      [
1895	  #include <sys/mount.h>
1896	  #include <sys/fs_types.h>
1897      ],
1898      AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix
1899   )
1900fi
1901AC_MSG_RESULT($fstype)
1902
1903AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
1904
1905AC_CHECK_DECLS([O_CLOEXEC],,[AC_DEFINE([O_CLOEXEC],[0], [Defined to 0 if not provided])],
1906[[
1907#ifdef HAVE_FCNTL_H
1908# include <fcntl.h>
1909#endif
1910]])
1911
1912AC_CHECK_DECLS([FD_CLOEXEC],,[AC_DEFINE([FD_CLOEXEC],[0], [Defined to 0 if not provided])],
1913[[
1914#ifdef HAVE_FCNTL_H
1915# include <fcntl.h>
1916#endif
1917]])
1918
1919AC_CHECK_DECLS([SOCK_CLOEXEC],,[AC_DEFINE([SOCK_CLOEXEC],[0],[Defined to 0 if not provided])],
1920[[
1921#ifdef HAVE_SYS_SOCKET_H
1922# include <sys/socket.h>
1923#endif
1924]])
1925
1926AC_CACHE_CHECK(for close on exec modifier for fopen(), ac_cv_feature_stream_cloexec_flag,
1927   [if test $ac_cv_have_decl_O_CLOEXEC = yes ; then
1928	if test $ac_cv_have_decl_SOCK_CLOEXEC = yes ; then
1929	    ac_cv_feature_stream_cloexec_flag="e"
1930	fi
1931    fi])
1932
1933if test "x$ac_cv_feature_stream_cloexec_flag" = "xe" ; then
1934   AC_DEFINE(HAVE_STREAM_CLOEXEC,[0],[Defined to 0 if not provided])
1935fi
1936
1937AC_DEFINE_UNQUOTED([STREAM_CLOEXEC], "$ac_cv_feature_stream_cloexec_flag", [fopen() modifier for setting close on exec flag])
1938
1939AC_CHECK_FUNC(accept4, [AC_DEFINE(HAVE_ACCEPT4, 1, [Define to 1 if you have the 'accept4' function.])])
1940
1941dnl ---------------------------------------------------
1942dnl Check for S3 support/directory (default on)
1943dnl ---------------------------------------------------
1944dnl this allows you to turn it completely off
1945
1946AC_ARG_ENABLE(s3,
1947   AC_HELP_STRING([--disable-s3], [disable S3 support @<:@default=yes@:>@]),
1948   [
1949       if test x$enableval = xno; then
1950	  support_s3=no
1951       fi
1952   ]
1953)
1954
1955S3_INC=
1956S3_LIBS=
1957S3_LDFLAGS=
1958have_libs3=no
1959
1960if test x$support_s3 = xyes; then
1961   AC_ARG_WITH(s3,
1962      AC_HELP_STRING([--with-s3@<:@=DIR@:>@], [specify s3 library directory]),
1963      [
1964	  case "$with_s3" in
1965	  no)
1966	     :
1967	     ;;
1968	  yes|*)
1969	     if test -f ${with_s3}/include/libs3.h; then
1970		S3_INC="-I${with_s3}/include"
1971		S3_LDFLAGS="-L${with_s3}/lib"
1972		with_s3="${with_s3}/include"
1973	     else
1974		with_s3="/usr/include"
1975	     fi
1976
1977	     AC_CHECK_HEADER(${with_s3}/libs3.h,
1978		[
1979		    AC_DEFINE(HAVE_LIBS3, 1, [Define to 1 if you have libs3])
1980		    S3_LIBS="${S3_LDFLAGS} -ls3"
1981		    have_libs3="yes"
1982		], [
1983		    echo " "
1984		    echo "libs3.h not found. s3 turned off ..."
1985		    echo " "
1986		]
1987	     )
1988	     ;;
1989	  esac
1990      ],[
1991	 AC_CHECK_HEADER(libs3.h,
1992	 [
1993	    AC_CHECK_LIB(s3, S3_initialize,
1994	    [
1995	      S3_LIBS="-ls3"
1996	      AC_DEFINE(HAVE_LIBS3,1,[Define to 1 if you have libs3])
1997	      have_libs3=yes
1998	   ])
1999	 ])
2000      ])
2001fi
2002
2003AC_SUBST(S3_INC)
2004AC_SUBST(S3_LIBS)
2005
2006AC_LANG_PUSH(C++)
2007AC_CHECK_FUNCS(backtrace)
2008AC_LANG_POP(C++)
2009
2010dnl --------------------------------------------------------------------------
2011dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
2012dnl --------------------------------------------------------------------------
2013AC_TYPE_SIGNAL
2014SIGNAL_CHECK
2015AC_TYPE_MODE_T
2016AC_TYPE_UID_T
2017AC_TYPE_SIZE_T
2018AC_TYPE_PID_T
2019AC_TYPE_OFF_T
2020AC_TYPE_INTPTR_T
2021AC_TYPE_UINTPTR_T
2022AC_CHECK_TYPE(ino_t, unsigned long)
2023AC_CHECK_TYPE(dev_t, unsigned long)
2024AC_CHECK_TYPE(daddr_t, long)
2025AC_CHECK_TYPE(major_t, int)
2026AC_CHECK_TYPE(minor_t, int)
2027AC_CHECK_TYPE(ssize_t, int)
2028AC_STRUCT_ST_BLOCKS
2029AC_STRUCT_ST_RDEV
2030AC_STRUCT_TM
2031AC_C_CONST
2032AC_C_RESTRICT
2033
2034AC_CHECK_SIZEOF(char, 1)
2035AC_CHECK_SIZEOF(short int, 2)
2036AC_CHECK_SIZEOF(int, 4)
2037AC_CHECK_SIZEOF(long int, 4)
2038AC_CHECK_SIZEOF(long long int, 8)
2039AC_CHECK_SIZEOF(int *, 4)
2040
2041dnl Check for sys/types.h types
2042AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int,
2043   [
2044       AC_TRY_COMPILE(
2045	  [
2046	      #include <sys/types.h>
2047	  ], [
2048	      u_int a; a = 1;
2049	  ], [
2050	      ac_cv_have_u_int="yes"
2051	  ], [
2052	      ac_cv_have_u_int="no"
2053	  ]
2054       )
2055   ]
2056)
2057if test "x$ac_cv_have_u_int" = "xyes" ; then
2058   AC_DEFINE(HAVE_U_INT)
2059   have_u_int=1
2060fi
2061
2062AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t,
2063   [
2064       AC_TRY_COMPILE(
2065	  [
2066	      #include <sys/types.h>
2067	  ], [
2068	      intmax_t a; a = 1;
2069	  ], [
2070	      ac_cv_have_intmax_t="yes"
2071	  ], [
2072	      AC_TRY_COMPILE(
2073		 [
2074		     #include <stdint.h>
2075		 ], [
2076		     intmax_t a; a = 1;
2077		 ], [
2078		     ac_cv_have_intmax_t="yes"
2079		 ], [
2080		     ac_cv_have_intmax_t="no"
2081		 ]
2082	      )
2083	  ]
2084       )
2085   ]
2086)
2087if test "x$ac_cv_have_intmax_t" = "xyes" ; then
2088   AC_DEFINE(HAVE_INTMAX_T)
2089   have_intmax_t=1
2090fi
2091
2092AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t,
2093   [
2094       AC_TRY_COMPILE(
2095	  [
2096	      #include <sys/types.h>
2097	  ], [
2098	      u_intmax_t a; a = 1;
2099	  ], [
2100	      ac_cv_have_u_intmax_t="yes"
2101	  ], [
2102	      AC_TRY_COMPILE(
2103		 [
2104		     #include <stdint.h>
2105		 ], [
2106		    u_intmax_t a; a = 1;
2107		 ], [
2108		    ac_cv_have_u_intmax_t="yes"
2109		 ], [
2110		    ac_cv_have_u_intmax_t="no"
2111		 ]
2112	      )
2113	  ]
2114       )
2115   ]
2116)
2117if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
2118   AC_DEFINE(HAVE_U_INTMAX_T)
2119   have_u_intmax_t=1
2120fi
2121
2122AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t,
2123   [
2124       AC_TRY_COMPILE(
2125	  [
2126	      #include <sys/types.h>
2127	  ], [
2128	      int8_t a; int16_t b; int32_t c; a = b = c = 1;
2129	  ], [
2130	      ac_cv_have_intxx_t="yes"
2131	  ], [
2132	      ac_cv_have_intxx_t="no"
2133	  ]
2134       )
2135   ]
2136)
2137if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2138   AC_DEFINE(HAVE_INTXX_T)
2139   have_intxx_t=1
2140fi
2141
2142AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t,
2143   [
2144       AC_TRY_COMPILE(
2145	  [
2146	      #include <sys/types.h>
2147	  ], [
2148	      int64_t a; a = 1;
2149	  ], [
2150	      ac_cv_have_int64_t="yes"
2151	  ], [
2152	      ac_cv_have_int64_t="no"
2153	  ]
2154       )
2155   ]
2156)
2157if test "x$ac_cv_have_int64_t" = "xyes" ; then
2158   AC_DEFINE(HAVE_INT64_T)
2159   have_int64_t=1
2160fi
2161
2162AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t,
2163   [
2164       AC_TRY_COMPILE(
2165	  [
2166	      #include <sys/types.h>
2167	  ], [
2168	      u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;
2169	  ], [
2170	     ac_cv_have_u_intxx_t="yes"
2171	  ], [
2172	     ac_cv_have_u_intxx_t="no"
2173	  ]
2174       )
2175   ]
2176)
2177if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2178   AC_DEFINE(HAVE_U_INTXX_T)
2179   have_u_intxx_t=1
2180fi
2181
2182AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t,
2183   [
2184       AC_TRY_COMPILE(
2185	  [
2186	      #include <sys/types.h>
2187	  ], [
2188	      u_int64_t a; a = 1;
2189	  ], [
2190	     ac_cv_have_u_int64_t="yes"
2191	  ], [
2192	     ac_cv_have_u_int64_t="no"
2193	  ]
2194       )
2195   ]
2196)
2197if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2198   AC_DEFINE(HAVE_U_INT64_T)
2199   have_u_int64_t=1
2200fi
2201
2202if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2203    test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2204then
2205   AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2206   AC_TRY_COMPILE(
2207      [
2208	  #include <sys/bitypes.h>
2209      ], [
2210	  int8_t a; int16_t b; int32_t c;
2211	  u_int8_t e; u_int16_t f; u_int32_t g;
2212	  a = b = c = e = f = g = 1;
2213      ], [
2214	  AC_DEFINE(HAVE_U_INTXX_T)
2215	  AC_DEFINE(HAVE_INTXX_T)
2216	  AC_DEFINE(HAVE_SYS_BITYPES_H)
2217	  AC_MSG_RESULT(yes)
2218      ], [
2219	  AC_MSG_RESULT(no)
2220      ]
2221   )
2222fi
2223
2224if test -z "$have_u_intxx_t" ; then
2225   AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t,
2226      [
2227	  AC_TRY_COMPILE(
2228	     [
2229		 #include <sys/types.h>
2230	     ], [
2231		 uint8_t a; uint16_t b;
2232		 uint32_t c; a = b = c = 1;
2233	     ], [
2234		ac_cv_have_uintxx_t="yes"
2235	     ], [
2236		ac_cv_have_uintxx_t="no"
2237	     ]
2238	  )
2239      ]
2240   )
2241   if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2242      AC_DEFINE(HAVE_UINTXX_T)
2243   fi
2244fi
2245
2246if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
2247    test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2248then
2249   AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
2250   AC_TRY_COMPILE(
2251      [
2252	  #include <sys/bitypes.h>
2253      ], [
2254	  int64_t a; u_int64_t b;
2255	  a = b = 1;
2256      ], [
2257	  AC_DEFINE(HAVE_U_INT64_T)
2258	  AC_DEFINE(HAVE_INT64_T)
2259	  AC_MSG_RESULT(yes)
2260      ], [
2261	  AC_MSG_RESULT(no)
2262      ]
2263   )
2264fi
2265
2266if (test -z "$have_uintxx_t" && \
2267    test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2268then
2269   AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
2270   AC_TRY_COMPILE(
2271      [
2272	  #include <sys/bitypes.h>
2273      ], [
2274	  uint8_t a; uint16_t b;
2275	  uint32_t c; a = b = c = 1;
2276      ], [
2277	  AC_DEFINE(HAVE_UINTXX_T)
2278	  AC_MSG_RESULT(yes)
2279      ], [
2280	  AC_MSG_RESULT(no)
2281      ]
2282   )
2283fi
2284
2285dnl --------------------------------------------------------------------------
2286dnl CHECKING FOR REQUIRED LIBRARY FUNCTIONS
2287dnl --------------------------------------------------------------------------
2288AC_CHECK_FUNCS( \
2289   fork \
2290   getcwd \
2291   gethostname \
2292   getpid \
2293   gettimeofday \
2294   setpgid \
2295   setpgrp \
2296   setsid \
2297   signal \
2298   strerror \
2299   strncmp \
2300   strncpy \
2301   vfprintf \
2302   ,,
2303   [echo 'configure: cannot find needed function.'; exit 1]
2304)
2305
2306AC_CHECK_DECL(
2307    F_CLOSEM,
2308    AC_DEFINE(HAVE_FCNTL_F_CLOSEM, 1, [Set if you have 'F_CLOSEM' fcntl flag]),
2309    ,
2310    [#include <fcntl.h>]
2311)
2312
2313AC_CHECK_DECL(
2314    F_SETLK,
2315    AC_DEFINE(HAVE_FCNTL_LOCK, 1, [Set if fcntl supports file locking]),
2316    ,
2317    [#include <fcntl.h>]
2318)
2319
2320AC_CHECK_FUNC(closefrom, [AC_DEFINE(HAVE_CLOSEFROM, 1, [Define to 1 if you have the 'closefrom' function.])])
2321AC_CHECK_FUNCS(getpagesize, [AC_DEFINE(HAVE_GETPAGESIZE, 1, [Set if have getpagesize])])
2322AC_CHECK_FUNCS(malloc_trim, [AC_DEFINE(HAVE_MALLOC_TRIM, 1, [Set if have malloc_trim])])
2323
2324AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
2325AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
2326AC_CHECK_FUNCS(posix_fadvise)
2327AC_CHECK_FUNCS(posix_fallocate)
2328AC_CHECK_FUNCS(fdatasync)
2329AC_CHECK_FUNCS(realpath)
2330AC_CHECK_FUNCS(getrlimit)
2331
2332AC_CHECK_FUNCS(chflags)
2333
2334AC_TRY_LINK([
2335int f(int b) {
2336  return __builtin_bswap32(b);
2337}
2338],[int a = f(10);], [AC_DEFINE([HAVE_BSWAP32], 1, [Define to 1 if you have the '__builtin_bswap32' function ])])
2339
2340AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
2341
2342AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
2343   [
2344       AC_TRY_LINK(
2345	  [
2346	      #include <stdarg.h>
2347	      void use_va_copy(va_list args){va_list args2; va_copy(args2,args); va_end(args2);}
2348	      void call_use_va_copy(int junk,...){va_list args; va_start(args,junk); use_va_copy(args); va_end(args);}
2349	  ], [
2350	      call_use_va_copy(1,2,3)
2351	  ], [
2352	      ba_cv_va_copy=yes
2353	  ], [
2354	      ba_cv_va_copy=no
2355	  ]
2356       )
2357   ]
2358)
2359test $ba_cv_va_copy = yes && AC_DEFINE(HAVE_VA_COPY, 1, [Set if va_copy exists])
2360
2361dnl --------------------------------------------------------------------------
2362dnl CHECKING FOR THREAD SAFE FUNCTIONS
2363dnl --------------------------------------------------------------------------
2364AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
2365
2366# If resolver functions are not in libc check for -lnsl or -lresolv.
2367AC_CHECK_FUNC(gethostbyname_r,
2368    AC_MSG_RESULT(using libc's resolver),
2369    AC_CHECK_LIB(nsl,gethostbyname_r)
2370    AC_CHECK_LIB(resolv,gethostbyname_r))
2371
2372AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
2373AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
2374AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
2375AC_CHECK_FUNCS(getnameinfo, [AC_DEFINE(HAVE_GETNAMEINFO)])
2376
2377
2378dnl ----------------------------
2379dnl check sa_len of sockaddr
2380dnl ----------------------------
2381AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
2382   [
2383       AC_TRY_COMPILE(
2384	  [
2385	      #include <sys/socket.h>
2386	  ], [
2387	      struct sockaddr s; s.sa_len;
2388	  ], [
2389	     ac_cv_struct_sockaddr_sa_len=yes
2390	  ], [ac_cv_struct_sockaddr_sa_len=no
2391	  ]
2392       )
2393   ]
2394)
2395
2396if test $ac_cv_struct_sockaddr_sa_len = yes; then
2397  AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
2398fi
2399
2400dnl
2401dnl check for working getaddrinfo()
2402dnl
2403dnl Note that if the system doesn't have gai_strerror(), we
2404dnl can't use getaddrinfo() because we can't get strings
2405dnl describing the error codes.
2406dnl
2407AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,
2408   [
2409       AC_TRY_RUN(
2410	  [
2411	      #include <netdb.h>
2412	      #include <string.h>
2413	      #include <sys/types.h>
2414	      #include <sys/socket.h>
2415
2416	      void main(void) {
2417		  struct addrinfo hints, *ai;
2418		  int error;
2419
2420		  memset(&hints, 0, sizeof(hints));
2421		  hints.ai_family = AF_UNSPEC;
2422		  hints.ai_socktype = SOCK_STREAM;
2423		  error = getaddrinfo("127.0.0.1", NULL, &hints, &ai);
2424		  if (error) {
2425		      exit(1);
2426		  }
2427		  if (ai->ai_addr->sa_family != AF_INET) {
2428		      exit(1);
2429		  }
2430		  exit(0);
2431	      }
2432	  ],[
2433	      ac_cv_working_getaddrinfo="yes"
2434	  ],[
2435	      ac_cv_working_getaddrinfo="no"
2436	  ],[
2437	      ac_cv_working_getaddrinfo="yes"
2438	  ]
2439       )
2440   ]
2441)
2442AC_CHECK_FUNC(gai_strerror, [AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.])])
2443
2444if test "$ac_cv_working_getaddrinfo" = "yes"; then
2445  if test "$ac_cv_func_gai_strerror" != "yes"; then
2446    ac_cv_working_getaddrinfo="no"
2447  else
2448    AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if getaddrinfo exists and works])
2449  fi
2450fi
2451
2452AC_FUNC_STRFTIME
2453AC_FUNC_VPRINTF
2454AC_FUNC_ALLOCA
2455AC_FUNC_GETMNTENT
2456AC_CHECK_FUNCS(getmntinfo, [AC_DEFINE(HAVE_GETMNTINFO)])
2457AC_FUNC_CLOSEDIR_VOID
2458AC_FUNC_SETPGRP 	    dnl check for BSD setpgrp.
2459# AC_FUNC_FNMATCH    dnl use local version
2460
2461AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
2462
2463AC_CHECK_LIB(sun, getpwnam)
2464
2465AC_CHECK_HEADERS(zlib.h)
2466AC_CHECK_LIB(z, deflate, [ZLIBS="-lz"])
2467have_zlib=no
2468if test x$ZLIBS = x-lz; then
2469   AC_DEFINE(HAVE_LIBZ)
2470   have_zlib=yes
2471fi
2472AC_SUBST(ZLIBS)
2473
2474dnl
2475dnl Check if we have AFS on this system
2476dnl
2477AFS_CFLAGS=""
2478AFS_LIBS=""
2479support_afs=auto
2480AC_ARG_ENABLE(afs,
2481   AC_HELP_STRING([--disable-afs], [disable afs support @<:@default=auto@:>@]),
2482   [
2483       if test x$enableval = xyes; then
2484	  support_afs=yes
2485       elif test x$enableval = xno; then
2486	  support_afs=no
2487       fi
2488   ]
2489)
2490
2491have_afs=no
2492if test x$support_afs = xyes -o x$support_afs = xauto; then
2493   AC_ARG_WITH(afsdir,
2494      AC_HELP_STRING([--with-afsdir@<:@=DIR@:>@], [Directory holding AFS includes/libs]),
2495      with_afsdir=$withval
2496   )
2497
2498   dnl
2499   dnl Search in standard places, or --with-afsdir not specified
2500   dnl
2501   if test x$with_afsdir = x; then
2502      for root in /usr /usr/local; do
2503	 if test -d ${root}/include/afs/ ; then
2504	    with_afsdir=${root}
2505	    break
2506	 fi
2507	 if test -d ${root}/include/openafs/afs/ ; then
2508	    with_afsdir=${root}
2509	    break
2510	 fi
2511      done
2512   fi
2513
2514   if test -d ${with_afsdir}/include/afs/ ; then
2515      AFS_CFLAGS="-I${with_afsdir}/include"
2516   else
2517      if test -d ${with_afsdir}/include/openafs/afs/ ; then
2518	 AFS_CFLAGS="-I${with_afsdir}/include/openafs"
2519      fi
2520   fi
2521
2522   saved_CFLAGS="${CFLAGS}"
2523   saved_CPPFLAGS="${CPPFLAGS}"
2524   CFLAGS="${AFS_CFLAGS} ${saved_CFLAGS}"
2525   CPPFLAGS="${AFS_CFLAGS} ${saved_CPPFLAGS}"
2526
2527   AC_CHECK_HEADERS(afs/afsint.h)
2528   AC_TRY_CPP(
2529       [
2530	  #include <afs/afsint.h>
2531	  #include <afs/venus.h>
2532       ],
2533       AC_DEFINE(HAVE_AFS_VENUS_H,1,[Define to 1 if you have the <afs/venus.h> header file.])
2534   )
2535
2536   CFLAGS="${saved_CFLAGS}"
2537   CPPFLAGS="${saved_CPPFLAGS}"
2538
2539   dnl
2540   dnl See if we can find a libsys with the pioctl symbol in there
2541   dnl
2542   AC_MSG_CHECKING(for pioctl in AFS libsys)
2543   for dir in ${with_afsdir}/lib \
2544	      ${with_afsdir}/lib/afs \
2545	      ${with_afsdir}/lib/openafs \
2546	      ${with_afsdir}/lib64 \
2547	      ${with_afsdir}/lib64/afs \
2548	      ${with_afsdir}/lib64/openafs
2549   do
2550      for arch_type in .a .so
2551      do
2552	 A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} 2>/dev/null | grep pioctl`
2553	 pkg=$?
2554	 if test $pkg = 0; then
2555	    have_afs=yes
2556	    AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util${arch_type}"
2557	    break
2558	 fi
2559      done
2560   done
2561
2562   if test $have_afs = yes; then
2563      AC_MSG_RESULT(yes)
2564   else
2565      AC_MSG_RESULT(no)
2566   fi
2567
2568   if test x$support_afs = xyes -a $have_afs != yes; then
2569      AC_MSG_ERROR([afs support explicitly enabled but no supported afs implementation found,
2570  please either load the afs libraries or rerun configure without --enable-afs])
2571   else
2572      if test $have_afs = yes; then
2573	 AC_DEFINE(HAVE_AFS,1,[Define to 1 if your system has AFS support])
2574	 AC_DEFINE(HAVE_AFS_ACL,1,[Andrew FileSystem ACL support])
2575      fi
2576   fi
2577fi
2578AC_SUBST(AFS_CFLAGS)
2579AC_SUBST(AFS_LIBS)
2580
2581dnl ---------------------------------------------------
2582dnl Check for lzo support/directory (default on)
2583dnl ---------------------------------------------------
2584dnl this allows you to turn it completely off
2585
2586AC_ARG_ENABLE(lzo,
2587   AC_HELP_STRING([--disable-lzo], [disable lzo support @<:@default=yes@:>@]),
2588   [
2589       if test x$enableval = xno; then
2590	  support_lzo=no
2591       fi
2592   ]
2593)
2594
2595LZO_INC=
2596LZO_LIBS=
2597LZO_LDFLAGS=
2598
2599have_lzo="no"
2600if test x$support_lzo = xyes; then
2601   AC_ARG_WITH(lzo,
2602      AC_HELP_STRING([--with-lzo@<:@=DIR@:>@], [specify lzo library directory]),
2603      [
2604	  case "$with_lzo" in
2605	  no)
2606	     :
2607	     ;;
2608	  yes|*)
2609	     if test -f ${with_lzo}/include/lzo/lzoconf.h; then
2610		LZO_INC="-I${with_lzo}/include"
2611		LZO_LDFLAGS="-L${with_lzo}/lib"
2612		with_lzo="${with_lzo}/include"
2613	     else
2614		with_lzo="/usr/include"
2615	     fi
2616
2617	     AC_CHECK_HEADER(${with_lzo}/lzo/lzoconf.h,
2618		[
2619		    AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have LZO compression])
2620		    LZO_LIBS="${LZO_LDFLAGS} -llzo2"
2621		    have_lzo="yes"
2622		], [
2623		    echo " "
2624		    echo "lzoconf.h not found. lzo turned off ..."
2625		    echo " "
2626		]
2627	     )
2628	     ;;
2629	  esac
2630      ],[
2631	 AC_CHECK_HEADER(lzo/lzoconf.h,
2632	 [
2633	    AC_CHECK_HEADER(lzo/lzo1x.h,
2634	    [
2635	       AC_CHECK_LIB(lzo2, lzo1x_1_compress,
2636	       [
2637		 LZO_LIBS="-llzo2"
2638		 AC_DEFINE(HAVE_LZO,1,[Define to 1 if you have LZO compression])
2639		 have_lzo=yes
2640	       ])
2641	    ])
2642	 ])
2643      ])
2644fi
2645
2646AC_SUBST(LZO_INC)
2647AC_SUBST(LZO_LIBS)
2648
2649
2650dnl
2651dnl Check for ACL support and libraries
2652dnl
2653support_acl=auto
2654AC_ARG_ENABLE(acl,
2655   AC_HELP_STRING([--disable-acl], [disable acl support @<:@default=auto@:>@]),
2656   [
2657       if test x$enableval = xyes; then
2658	  support_acl=yes
2659       elif test x$enableval = xno; then
2660	  support_acl=no
2661       fi
2662   ]
2663)
2664
2665have_acl=no
2666have_extended_acl=no
2667if test x$support_acl = xyes -o x$support_acl = xauto; then
2668   AC_CHECK_HEADER(sys/acl.h, [ AC_DEFINE(HAVE_SYS_ACL_H,1,[Defines if your system have the sys/acl.h header file])] , )
2669
2670   dnl
2671   dnl First check for acl_get_file in libc
2672   dnl
2673   AC_CHECK_FUNC(acl_get_file,
2674   [
2675      have_acl=yes
2676   ])
2677
2678   dnl
2679   dnl Check for acl_get_file in libacl (Linux)
2680   dnl
2681   if test $have_acl = no; then
2682      AC_CHECK_LIB(acl, acl_get_file,
2683      [
2684	have_acl=yes
2685	if test $have_afs = yes; then
2686	 dnl
2687	 dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!!
2688	 dnl
2689	    if test -d /usr/lib64/; then
2690	       FDLIBS="-L/usr/lib64 -lacl $FDLIBS"
2691	    else
2692	       FDLIBS="-L/usr/lib -lacl $FDLIBS"
2693	    fi
2694	 else
2695	    FDLIBS="-lacl $FDLIBS"
2696	 fi
2697      ])
2698   fi
2699
2700   dnl
2701   dnl Check for acl_get_file in libpacl (OSF1)
2702   dnl and if ACL_TYPE_DEFAULT_DIR is defined.
2703   dnl
2704   if test $have_acl = no -a x${HAVE_OSF1_OS_TRUE} = x; then
2705      AC_CHECK_LIB(pacl, acl_get_file,
2706      [
2707	 have_acl=yes
2708	 FDLIBS="-lpacl $FDLIBS"
2709      ])
2710
2711      AC_MSG_CHECKING(for ACL_TYPE_DEFAULT_DIR in acl.h include file)
2712      grep ACL_TYPE_DEFAULT_DIR /usr/include/sys/acl.h > /dev/null 2>&1
2713      if test $? = 0; then
2714	 AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type])
2715	 AC_MSG_RESULT(yes)
2716      else
2717	 AC_MSG_RESULT(no)
2718      fi
2719   fi
2720
2721   dnl
2722   dnl On OSX check for availability of ACL_TYPE_EXTENDED
2723   dnl
2724   if test $have_acl = yes -a x${HAVE_DARWIN_OS_TRUE} = x; then
2725      AC_MSG_CHECKING(for ACL_TYPE_EXTENDED in acl.h include file)
2726      grep ACL_TYPE_EXTENDED /usr/include/sys/acl.h > /dev/null 2>&1
2727      if test $? = 0; then
2728	 AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type])
2729	 AC_MSG_RESULT(yes)
2730      else
2731	 AC_MSG_RESULT(no)
2732      fi
2733   fi
2734
2735   dnl
2736   dnl On FreeBSD check for availability of ACL_TYPE_NFS4
2737   dnl
2738   if test $have_acl = yes -a \
2739      x${HAVE_FREEBSD_OS_TRUE} = x; then
2740      AC_MSG_CHECKING(for ACL_TYPE_NFS4 in acl.h include file)
2741      grep ACL_TYPE_NFS4 /usr/include/sys/acl.h > /dev/null 2>&1
2742      if test $? = 0; then
2743    AC_DEFINE(HAVE_ACL_TYPE_NFS4,1,[Defines if your system have the ACL_TYPE_NFS4 acl type])
2744    AC_MSG_RESULT(yes)
2745      else
2746    AC_MSG_RESULT(no)
2747      fi
2748   fi
2749
2750   dnl
2751   dnl Check for acltotext and acl_totext (Solaris)
2752   dnl
2753   if test $have_acl = no -a \
2754      x${HAVE_SUN_OS_TRUE} = x; then
2755      AC_CHECK_LIB(sec, acltotext,
2756    [
2757	have_acl=yes
2758	FDLIBS="-lsec $FDLIBS"
2759
2760	AC_CHECK_LIB(sec, acl_totext,
2761      [
2762	  have_extended_acl=yes
2763      ]
2764	)
2765    ]
2766      )
2767   fi
2768
2769   dnl
2770   dnl Check for acl_get and aclx_get (AIX)
2771   dnl
2772   if test $have_acl = no -a \
2773	   x${HAVE_AIX_OS_TRUE} = x; then
2774      AC_CHECK_FUNC(acl_get,
2775	 [
2776	     have_acl=yes
2777
2778	     AC_CHECK_FUNC(aclx_get,
2779		[
2780		    have_extended_acl=yes
2781		]
2782	     )
2783	 ]
2784      )
2785   fi
2786
2787ACLOBJS=
2788   if test x$support_acl = xyes -a $have_acl != yes; then
2789      AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found,
2790  please either load the acl libraries or rerun configure without --enable-acl])
2791   else
2792      if test $have_acl = yes; then
2793	 AC_DEFINE([HAVE_ACL],1,[Normal acl support])
2794	 dnl
2795	 dnl Prepare obj building
2796	 dnl
2797	 if test x${HAVE_LINUX_OS_TRUE} = x; then
2798	    ACLOBJS="bacl.c bacl_linux.c"
2799	 fi
2800	 if test x${HAVE_SUN_OS_TRUE} = x; then
2801	    ACLOBJS="bacl.c bacl_solaris.c"
2802	 fi
2803	 if test x${HAVE_FREEBSD_OS_TRUE} = x; then
2804	    ACLOBJS="bacl.c bacl_freebsd.c"
2805	 fi
2806	 if test x${HAVE_DARWIN_OS_TRUE} = x; then
2807	    ACLOBJS="bacl.c bacl_osx.c"
2808	 fi
2809      fi
2810      if test $have_extended_acl = yes; then
2811	 AC_DEFINE([HAVE_EXTENDED_ACL],1,[Extended acl support])
2812      fi
2813   fi
2814fi
2815AC_SUBST(ACLOBJS)
2816
2817dnl
2818dnl Check for XATTR support
2819dnl
2820support_xattr=auto
2821AC_ARG_ENABLE(xattr,
2822   AC_HELP_STRING([--disable-xattr], [disable xattr support @<:@default=auto@:>@]),
2823   [
2824       if test x$enableval = xyes; then
2825	  support_xattr=yes
2826       elif test x$enableval = xno; then
2827	  support_xattr=no
2828       fi
2829   ]
2830)
2831
2832have_xattr=no
2833if test x$support_xattr = xyes -o x$support_xattr = xauto; then
2834   dnl
2835   dnl First check for *BSD support
2836   dnl When running on a BSD variant
2837   dnl
2838   if test x${HAVE_FREEBSD_OS_TRUE} = x -o \
2839	   x${HAVE_NETBSD_OS_TRUE} = x -o \
2840	   x${HAVE_OPENBSD_OS_TRUE} = x; then
2841      AC_CHECK_HEADER(sys/extattr.h, [ AC_DEFINE(HAVE_SYS_EXTATTR_H,1,[Defines if your system have the sys/extattr.h header file])] , )
2842      AC_CHECK_HEADER(libutil.h, [ AC_DEFINE(HAVE_LIBUTIL_H,1,[Defines if your system have the libutil.h header file])] , )
2843      AC_CHECK_FUNCS(extattr_get_link extattr_set_link extattr_list_link,
2844	 [
2845	     have_xattr=yes
2846	     AC_DEFINE([HAVE_EXTATTR_GET_LINK],1,[Define to 1 if you have the 'extattr_get_link' function.])
2847	     AC_DEFINE([HAVE_EXTATTR_SET_LINK],1,[Define to 1 if you have the 'extattr_set_link' function.])
2848	     AC_DEFINE([HAVE_EXTATTR_LIST_LINK],1,[Define to 1 if you have the 'extattr_list_link' function.])
2849	 ]
2850      )
2851
2852      if test $have_xattr = no; then
2853	 AC_CHECK_FUNCS(extattr_get_file extattr_set_file extattr_list_file,
2854	    [
2855		have_xattr=yes
2856		AC_DEFINE([HAVE_EXTATTR_GET_FILE],1,[Define to 1 if you have the 'extattr_get_file' function.])
2857		AC_DEFINE([HAVE_EXTATTR_SET_FILE],1,[Define to 1 if you have the 'extattr_set_file' function.])
2858		AC_DEFINE([HAVE_EXTATTR_LIST_FILE],1,[Define to 1 if you have the 'extattr_list_file' function.])
2859	    ]
2860	 )
2861      fi
2862
2863      if test $have_xattr = yes; then
2864	 have_extattr_string_in_libc=no
2865	 AC_CHECK_FUNCS(extattr_namespace_to_string extattr_string_to_namespace,
2866	    [
2867		have_extattr_string_in_libc=yes
2868		AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
2869		AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
2870	    ]
2871	 )
2872
2873	 dnl
2874	 dnl If extattr_namespace_to_string and extattr_string_to_namespace are not in libc see if they are in libutil
2875	 dnl
2876	 if test $have_extattr_string_in_libc = no; then
2877	    AC_CHECK_LIB(util, extattr_namespace_to_string extattr_string_to_namespace,
2878	       [
2879		   AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
2880		   AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
2881		   FDLIBS="-lutil $FDLIBS"
2882	       ]
2883	    )
2884	 fi
2885      fi
2886   fi
2887
2888   dnl
2889   dnl If we failed to find *BSD support try the AIX implementation of extented attributes (EA)
2890   dnl When running on AIX
2891   dnl
2892   if test $have_xattr = no -a \
2893	   x${HAVE_AIX_OS_TRUE} = x; then
2894      AC_CHECK_HEADER(sys/ea.h, [ AC_DEFINE(HAVE_SYS_EA_H,1,[Defines if your system have the sys/ea.h header file])] , )
2895      AC_CHECK_FUNCS(llistea lgetea lsetea,
2896	 [
2897	     have_xattr=yes
2898	     AC_DEFINE([HAVE_LLISTEA],1,[Define to 1 if you have the 'llistea' function.])
2899	     AC_DEFINE([HAVE_LGETEA],1,[Define to 1 if you have the 'lgetea' function.])
2900	     AC_DEFINE([HAVE_LSETEA],1,[Define to 1 if you have the 'lsetea' function.])
2901	 ]
2902      )
2903
2904      if test $have_xattr = no; then
2905	 AC_CHECK_FUNCS(listea getea setea,
2906	    [
2907		have_xattr=yes
2908		AC_DEFINE([HAVE_LISTEA],1,[Define to 1 if you have the 'listea' function.])
2909		AC_DEFINE([HAVE_GETEA],1,[Define to 1 if you have the 'getea' function.])
2910		AC_DEFINE([HAVE_SETEA],1,[Define to 1 if you have the 'setea' function.])
2911	    ]
2912	 )
2913      fi
2914   fi
2915
2916   dnl
2917   dnl If we failed to find AIX support try the TRU64 implementation of extented attributes
2918   dnl when running on a TRU64 OS.
2919   dnl
2920   if test $have_xattr = no -a \
2921	   x${HAVE_OSF1_OS_TRUE} = x; then
2922      AC_CHECK_HEADER(sys/proplist.h, [ AC_DEFINE(HAVE_SYS_PROPLIST_H,1,[Defines if your system have the sys/proplist.h header file])] , )
2923      AC_CHECK_FUNCS(getproplist get_proplist_entry sizeof_proplist_entry add_proplist_entry setproplist,
2924	 [
2925	     have_xattr=yes
2926	     AC_DEFINE([HAVE_GETPROPLIST],1,[Define to 1 if you have the 'getproplist' function.])
2927	     AC_DEFINE([HAVE_GET_PROPLIST_ENTRY],1,[Define to 1 if you have the 'get_proplist_entry' function.])
2928	     AC_DEFINE([HAVE_SIZEOF_PROPLIST_ENTRY],1,[Define to 1 if you have the 'sizeof_proplist_entry' function.])
2929	     AC_DEFINE([HAVE_ADD_PROPLIST_ENTRY],1,[Define to 1 if you have the 'add_proplist_entry' function.])
2930	     AC_DEFINE([HAVE_SETPROPLIST],1,[Define to 1 if you have the 'setproplist' function.])
2931	 ]
2932      )
2933   fi
2934
2935   dnl
2936   dnl If we failed to find TRU64 support try the SOLARIS implementation of extented and extensible attributes
2937   dnl when running on a Solaris.
2938   dnl
2939   if test $have_xattr = no -a \
2940      x${HAVE_SUN_OS_TRUE} = x; then
2941      AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , )
2942      AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , )
2943      AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , )
2944
2945      AC_CHECK_FUNCS(openat attropen unlinkat fchownat futimesat linkat,
2946	 [
2947	    have_xattr=yes
2948	    AC_DEFINE([HAVE_OPENAT],1,[Define to 1 if you have the 'openat' function.])
2949	    AC_DEFINE([HAVE_ATTROPEN],1,[Define to 1 if you have the 'attropen' function.])
2950	    AC_DEFINE([HAVE_UNLINKAT],1,[Define to 1 if you have the 'unlinkat' function.])
2951	    AC_DEFINE([HAVE_FCHOWNAT],1,[Define to 1 if you have the 'fchownat' function.])
2952	    AC_DEFINE([HAVE_FUTIMESAT],1,[Define to 1 if you have the 'futimesat' function.])
2953	    AC_DEFINE([HAVE_LINKAT],1,[Define to 1 if you have the 'linkat' function.])
2954	 ]
2955      )
2956
2957      if test $have_xattr = yes; then
2958	 AC_CHECK_LIB(nvpair, nvlist_next_nvpair,
2959	    [
2960	       AC_DEFINE([HAVE_NVLIST_NEXT_NVPAIR],1,[Define to 1 if you have the 'nvlist_next_nvpair' function.])
2961	       FDLIBS="-lnvpair $FDLIBS"
2962	    ]
2963	 )
2964      fi
2965   fi
2966
2967   dnl
2968   dnl If we failed to find Solaris support try the generic xattr support code
2969   dnl
2970   if test $have_xattr = no; then
2971      AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , )
2972      AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr,
2973	 [
2974	     have_xattr=yes
2975	     AC_DEFINE([HAVE_LLISTXATTR],1,[Define to 1 if you have the 'llistxattr' function.])
2976	     AC_DEFINE([HAVE_LGETXATTR],1,[Define to 1 if you have the 'lgetxattr' function.])
2977	     AC_DEFINE([HAVE_LSETXATTR],1,[Define to 1 if you have the 'lsetxattr' function.])
2978	 ]
2979      )
2980
2981      if test $have_xattr = no; then
2982	 AC_CHECK_FUNCS(listxattr getxattr setxattr,
2983	    [
2984		have_xattr=yes
2985		AC_DEFINE([HAVE_LISTXATTR],1,[Define to 1 if you have the 'listxattr' function.])
2986		AC_DEFINE([HAVE_GETXATTR],1,[Define to 1 if you have the 'getxattr' function.])
2987		AC_DEFINE([HAVE_SETXATTR],1,[Define to 1 if you have the 'setxattr' function.])
2988	    ]
2989	 )
2990      fi
2991   fi
2992
2993XATTROBJS=
2994   if test x$support_xattr = xyes -a $have_xattr != yes; then
2995      AC_MSG_ERROR([xattr support explicitly enabled but no supported xattr implementation found,
2996  please either load the xattr libraries or rerun configure without --enable-xattr])
2997   else
2998      if test $have_xattr = yes; then
2999	 AC_DEFINE([HAVE_XATTR],1,[Extended Attributes support])
3000	 dnl
3001	 dnl Prepare obj building
3002	 dnl
3003	 if test x${HAVE_LINUX_OS_TRUE} = x; then
3004	    XATTROBJS="bxattr.c bxattr_linux.c"
3005	 fi
3006	 if test x${HAVE_SUN_OS_TRUE} = x; then
3007	    XATTROBJS="bxattr.c bxattr_solaris.c"
3008	 fi
3009	 if test x${HAVE_FREEBSD_OS_TRUE} = x; then
3010	    XATTROBJS="bxattr.c bxattr_freebsd.c"
3011	 fi
3012	 if test x${HAVE_DARWIN_OS_TRUE} = x; then
3013	    XATTROBJS="bxattr.c bxattr_osx.c"
3014	 fi
3015      fi
3016   fi
3017fi
3018AC_SUBST(XATTROBJS)
3019
3020dnl
3021dnl Check for pthread libraries
3022dnl
3023PTHREAD_LIB=""
3024AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
3025   [
3026       AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
3027	  [
3028	      AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
3029		 [
3030		     AC_CHECK_FUNC(pthread_create)
3031		 ]
3032	      )
3033	  ]
3034       )
3035   ]
3036)
3037
3038dnl
3039dnl Enable/Disable plugin support
3040dnl
3041
3042PLUGCONFILES=""
3043
3044dnl Docker Plugin
3045support_docker=auto
3046AC_ARG_ENABLE(docker-plugin,
3047   AC_HELP_STRING([--disable-docker-plugin], [disable Docker plugin support @<:@default=auto@:>@]),
3048   [
3049      if test x$enableval = xyes; then
3050         support_docker=yes
3051      elif test x$enableval = xno; then
3052         support_docker=disabled
3053      fi
3054   ]
3055)
3056if test x$support_docker = xyes -o x$support_docker = xauto; then
3057   AC_CHECK_PROG(docker_bin, docker, yes, no, "/usr/bin/")
3058   if test x$docker_bin = xyes; then
3059      support_docker=yes
3060      FD_PLUGIN_DIR="$FD_PLUGIN_DIR src/plugins/fd/docker"
3061      PLUGCONFILES="${PLUGCONFILES} src/plugins/fd/docker/Makefile"
3062   else
3063      if test x$support_docker = xyes; then
3064         echo " "
3065         echo "You enabled a Docker Plugin build but 'docker' command not found."
3066         echo " "
3067         exit 1
3068      fi
3069      support_docker=no
3070   fi
3071fi
3072
3073AC_SUBST(FD_PLUGIN_DIR)
3074
3075dnl
3076dnl Check for headers, functions and libraries required to support
3077dnl keeping readall capabilities
3078dnl
3079AC_CHECK_HEADERS(sys/prctl.h sys/capability.h)
3080AC_CHECK_FUNCS(prctl setreuid)
3081AC_CHECK_LIB([cap], [cap_set_proc], [CAP_LIBS="-lcap"], [CAP_LIBS=])
3082if test x$CAP_LIBS = x-lcap; then
3083   AC_DEFINE(HAVE_LIBCAP, 1, [Define if you have libcap])
3084fi
3085AC_SUBST(CAP_LIBS)
3086
3087AC_SUBST(FDLIBS)
3088AC_DEFINE(FDLIBS)
3089
3090CFLAGS=${CFLAGS--O}
3091
3092if test x$have_gcc = xyes ; then
3093   CPPFLAGS="$CPPFLAGS -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti"
3094   CFLAGS="$CFLAGS -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti"
3095fi
3096LDFLAGS=${LDFLAGS--O}
3097CPPFLAGS="$CPPFLAGS"
3098CFLAGS="$CFLAGS"
3099AC_SUBST(DEBUG)
3100AC_SUBST(DINCLUDE)
3101AC_SUBST(CFLAGS)
3102AC_SUBST(CPPFLAGS)
3103AC_SUBST(LDFLAGS)
3104AC_SUBST(X_CFLAGS)
3105AC_SUBST(DEFS)
3106AC_SUBST(LIBS)
3107AC_SUBST(DLIB)
3108AC_SUBST(X_LIBS)
3109AC_SUBST(X_EXTRA_LIBS)
3110AC_SUBST(WCFLAGS)
3111AC_SUBST(WLDFLAGS)
3112AC_SUBST(WRAPLIBS)
3113
3114dnl extra configurable objects
3115OBJLIST=
3116AC_SUBST(OBJLIST)
3117
3118lld="lld"
3119llu="llu"
3120
3121WCFLAGS=
3122WLDFLAGS=
3123
3124dnl
3125dnl Finally we set appropriate distribution specific
3126dnl  variables and defaults
3127dnl
3128PSCMD="ps -e"
3129WIN32=
3130MACOSX=
3131COMPRESS_MANPAGES=yes
3132
3133case "$DISTNAME" in
3134aix)
3135   DISTVER=`uname -r`
3136   PSCMD="ps -e -o pid,comm"
3137   PFILES="${PFILES} platforms/aix/Makefile"
3138   TAPEDRIVE="/dev/rmt0.1"
3139  ;;
3140alpha)
3141   DISTVER=`uname -r`
3142   PTHREAD_LIB="-lpthread -lexc"
3143   if test "${CC}" = "gcc" ; then
3144      lld="lld"
3145      llu="llu"
3146   else
3147      lld="ld"
3148      llu="lu"
3149   fi
3150   TAPEDRIVE="/dev/nrmt0"
3151  ;;
3152bsdi)
3153   DISTVER=`uname -a |awk '{print $3}'`
3154   TAPEDRIVE="/dev/nrmt0"
3155   PTHREAD_LIB="-pthread"
3156   CFLAGS="${CFLAGS} -pthread"
3157   PSCMD="ps -ax -o pid,command"
3158   lld="qd"
3159   llu="qu"
3160   PFILES="${PFILES} \
3161       platforms/bsdi/Makefile \
3162       platforms/bsdi/bacula-fd \
3163       platforms/bsdi/bacula-sd \
3164       platforms/bsdi/bacula-dir"
3165   largefile_support="yes"
3166  ;;
3167cygwin)
3168   DISTVER=`uname -a |awk '{print $3}'`
3169   TAPEDRIVE="/dev/nrst0"
3170   WIN32=win32
3171   WCFLAGS="-mwindows"
3172   WLDFLAGS="-mwindows"
3173  ;;
3174darwin)
3175   DISTVER=`uname -r`
3176   TAPEDRIVE="/dev/nst0"
3177   PSCMD="ps -e -o pid,command"
3178   MACOSX=macosx
3179   PFILES="${PFILES} \
3180      platforms/darwin/Makefile"
3181  ;;
3182osx)
3183   DISTVER=`uname -r`
3184   TAPEDRIVE="/dev/nst0"
3185   PSCMD="ps -e -o pid,command"
3186   MACOSX=macosx
3187   PFILES="${PFILES} \
3188      platforms/osx/Makefile"
3189  ;;
3190debian)
3191   if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
3192      DISTNAME="ubuntu"
3193   fi
3194   DISTVER=`cat /etc/debian_version`
3195   if test -f /etc/lsb-release ; then
3196      . /etc/lsb-release
3197      if test "x$DISTRIB_ID" != "x" ; then
3198	 DISTNAME=$DISTRIB_ID
3199      fi
3200      if test "x$DISTRIB_RELEASE" != "x" ; then
3201	 DISTVER=$DISTRIB_RELEASE
3202      fi
3203   fi
3204   if test "$DISTNAME" = "Ubuntu" ; then
3205      DISTNAME="ubuntu"
3206   fi
3207   TAPEDRIVE="/dev/nst0"
3208   PSCMD="ps -e -o pid,command"
3209   if test "$DISTNAME" = "ubuntu" ; then
3210      PFILES="${PFILES} \
3211	 platforms/ubuntu/Makefile \
3212	 platforms/ubuntu/bacula-fd \
3213	 platforms/ubuntu/bacula-sd \
3214	 platforms/ubuntu/bacula-dir"
3215   else
3216      PFILES="${PFILES} \
3217	 platforms/debian/Makefile \
3218	 platforms/debian/bacula-fd \
3219	 platforms/debian/bacula-sd \
3220	 platforms/debian/bacula-dir"
3221   fi
3222  ;;
3223freebsd)
3224   DISTVER=`uname -a |awk '{print $3}'`
3225   VER=`echo $DISTVER | cut -c 1`
3226   if test x$VER = x4 ; then
3227      PTHREAD_LIB="${PTHREAD_LIBS:--pthread}"
3228      CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS:--pthread}"
3229   fi
3230   lld="qd"
3231   llu="qu"
3232   TAPEDRIVE="/dev/nrsa0"
3233   PSCMD="ps -ax -o pid,command"
3234   PFILES="${PFILES} \
3235       platforms/freebsd/Makefile \
3236       platforms/freebsd/bacula-fd \
3237       platforms/freebsd/bacula-sd \
3238       platforms/freebsd/bacula-dir"
3239   largefile_support="yes"
3240  ;;
3241hurd)
3242   DISTVER=`uname -r`
3243   TAPEDRIVE="/dev/nst0"
3244   PSCMD="ps -e -o pid,command"
3245   PFILES="${PFILES} \
3246       platforms/hurd/Makefile \
3247       platforms/hurd/bacula-fd \
3248       platforms/hurd/bacula-sd \
3249       platforms/hurd/bacula-dir"
3250  ;;
3251hpux)
3252   PSCMD="UNIX95=1; ps -e -o pid,comm"
3253   CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
3254   DISTVER=`uname -r`
3255   TAPEDRIVE="/dev/rmt/0hnb"
3256   PTHREAD_LIB="-lpthread"
3257   AC_DEFINE([_INCLUDE_LONGLONG])
3258  ;;
3259irix)
3260   DISTVER=`uname -r`
3261   TAPEDRIVE="/dev/rmt/0cbn"
3262   PSCMD="ps -e -o pid,comm"
3263   PFILES="${PFILES} \
3264       platforms/irix/Makefile \
3265       platforms/irix/bacula-fd \
3266       platforms/irix/bacula-sd \
3267       platforms/irix/bacula-dir"
3268  ;;
3269netbsd)
3270   DISTVER=`uname -a |awk '{print $3}'`
3271   lld="qd"
3272   llu="qu"
3273   TAPEDRIVE="/dev/nrst0"
3274   PSCMD="ps -ax -o pid,command"
3275   PTHREAD_LIB="-pthread"
3276   CFLAGS="${CFLAGS} -pthread"
3277  ;;
3278openbsd)
3279   DISTVER=`uname -a |awk '{print $3}'`
3280   lld="qd"
3281   llu="qu"
3282   TAPEDRIVE="/dev/nrst0"
3283   PSCMD="ps -ax -o pid,command"
3284   PTHREAD_LIB="-pthread"
3285   CFLAGS="${CFLAGS} -pthread"
3286   PFILES="${PFILES} \
3287       platforms/openbsd/Makefile \
3288       platforms/openbsd/bacula-fd \
3289       platforms/openbsd/bacula-sd \
3290       platforms/openbsd/bacula-dir"
3291  ;;
3292redhat)
3293   if test -f /etc/whitebox-release ; then
3294      f=/etc/whitebox-release
3295   else
3296      f=/etc/redhat-release
3297   fi
3298   if test `cat $f | grep release |\
3299	 cut -f 3 -d ' '`x = "Enterprise"x ; then
3300      DISTVER="Enterprise "`cat $f | grep release |\
3301	  cut -f 6 -d ' '`
3302   else
3303       DISTVER=`cat /etc/redhat-release | grep release |\
3304	   cut -f 5 -d ' '`
3305   fi
3306   TAPEDRIVE="/dev/nst0"
3307   PSCMD="ps -e -o pid,command"
3308   PFILES="${PFILES} \
3309       platforms/redhat/Makefile \
3310       platforms/redhat/bacula-fd \
3311       platforms/redhat/bacula-sd \
3312       platforms/redhat/bacula-dir
3313       "
3314  ;;
3315mandrake)
3316   DISTVER=`cat /etc/mandrake-release | grep release |\
3317      cut -f 5 -d ' '`
3318   TAPEDRIVE="/dev/nst0"
3319   PSCMD="ps -e -o pid,command"
3320   PFILES="${PFILES} \
3321       platforms/mandrake/Makefile \
3322       platforms/mandrake/bacula-fd \
3323       platforms/mandrake/bacula-sd \
3324       platforms/mandrake/bacula-dir \
3325       "
3326  ;;
3327gentoo)
3328   DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
3329   TAPEDRIVE="/dev/nst0"
3330   PSCMD="ps -e -o pid,command"
3331   PFILES="${PFILES} \
3332       platforms/gentoo/Makefile \
3333    platforms/gentoo/bacula-init \
3334       platforms/gentoo/bacula-fd \
3335       platforms/gentoo/bacula-sd \
3336       platforms/gentoo/bacula-dir"
3337  ;;
3338slackware)
3339   DISTVER=`cat /etc/slackware-version`
3340   TAPEDRIVE="/dev/nst0"
3341   PSCMD="ps -e -o pid,command"
3342   PFILES="${PFILES} \
3343       platforms/slackware/Makefile \
3344       platforms/slackware/rc.bacula-fd \
3345       platforms/slackware/rc.bacula-sd \
3346       platforms/slackware/rc.bacula-dir\
3347       platforms/slackware/functions.bacula"
3348  ;;
3349solaris)
3350   DISTVER=`uname -r`
3351   TAPEDRIVE="/dev/rmt/0cbn"
3352   PSCMD="ps -e -o pid,comm"
3353   PFILES="${PFILES} \
3354       platforms/solaris/Makefile \
3355       platforms/solaris/bacula-fd \
3356       platforms/solaris/bacula-sd \
3357       platforms/solaris/bacula-dir"
3358   COMPRESS_MANPAGES=
3359   case ${DISTVER} in
3360   5.5|5.6)
3361      AC_DEFINE(HAVE_OLD_SOCKOPT)
3362      AC_DEFINE(USE_THR_SETCONCURRENCY)
3363      ;;
3364   5.7|5.8)
3365      AC_DEFINE(USE_THR_SETCONCURRENCY)
3366      ;;
3367   5.10)
3368      AC_DEFINE(HAVE_SOLARIS10, 1, [Set if building on Solaris 10])
3369      ;;
3370   *)
3371      ;;
3372   esac
3373   LIBS="$LIBS -lresolv -lrt"
3374  ;;
3375suse)
3376   DISTVER=`cat /etc/SuSE-release |grep VERSION|\
3377       cut -f 3 -d ' '`
3378   TAPEDRIVE="/dev/nst0"
3379   PSCMD="ps -e -o pid,command"
3380   PFILES="${PFILES} \
3381       platforms/suse/Makefile \
3382       platforms/suse/bacula-fd \
3383       platforms/suse/bacula-sd \
3384       platforms/suse/bacula-dir \
3385       platforms/suse/bacula"
3386  ;;
3387suse5)
3388   DISTNAME=suse
3389   DISTVER=5.x
3390   TAPEDRIVE="/dev/nst0"
3391   PSCMD="ps -e -o pid,command"
3392   PFILES="${PFILES} \
3393       platforms/suse/Makefile \
3394       platforms/suse/bacula-fd \
3395       platforms/suse/bacula-sd \
3396       platforms/suse/bacula-dir"
3397  ;;
3398unknown)
3399   DISTVER=unknown
3400   TAPEDRIVE="/dev/nst0"
3401  ;;
3402*)
3403  echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
3404  ;;
3405esac
3406
3407dnl -------------------------------------------
3408dnl systemd (default off)
3409dnl -------------------------------------------
3410AC_MSG_CHECKING(for systemd support)
3411AC_ARG_WITH(systemd,
3412   AC_HELP_STRING([--with-systemd@<:@=UNITDIR@:>@], [Include systemd support. UNITDIR is where systemd system .service files are located, default is to ask systemctl.]),
3413   [
3414       if test "$withval" != "no"; then
3415	   if test "$withval" = "yes"; then
3416	       SYSTEMD_UNITDIR="/lib/systemd/system"
3417	   else
3418	       dnl Use user supplied path
3419	       SYSTEMD_UNITDIR="${withval}"
3420	   fi
3421
3422	   PFILES="${PFILES} \
3423		   platforms/systemd/Makefile \
3424		   platforms/systemd/bacula.conf \
3425		   platforms/systemd/bacula-dir.service \
3426		   platforms/systemd/bacula-fd.service \
3427		   platforms/systemd/bacula-sd.service"
3428	   AC_DEFINE(HAVE_SYSTEMD, 1, [Define to 1 if systemd support should be enabled])
3429	   AC_MSG_RESULT(yes)
3430	   support_systemd="yes"
3431       else
3432	   AC_MSG_RESULT(no)
3433	   support_systemd="no"
3434       fi
3435   ],[
3436       support_systemd="no"
3437       AC_MSG_RESULT(no)
3438   ]
3439)
3440AC_SUBST(SYSTEMD_UNITDIR)
3441
3442AC_SUBST(hostname)
3443
3444LIBS="$PTHREAD_LIB $LIBS"
3445
3446AC_DEFINE_UNQUOTED(lld, "$lld")
3447AC_DEFINE_UNQUOTED(llu, "$llu")
3448AC_SUBST(TAPEDRIVE)
3449AC_SUBST(PSCMD)
3450AC_SUBST(WIN32)
3451AC_SUBST(MACOSX)
3452AC_SUBST(DISTNAME)
3453AC_SUBST(DISTVER)
3454AC_SUBST(COMPRESS_MANPAGES)
3455
3456dnl common parts of the Makefile
3457MCOMMON=./autoconf/Make.common
3458AC_SUBST_FILE(MCOMMON)
3459
3460dnl Insanity check
3461if test "x${subsysdir}" = "x${sbindir}" ; then
3462   echo " "
3463   echo " "
3464   echo "You have set both --sbindir and --with-subsys-dir"
3465   echo "  equal to: ${subsysdir} "
3466   echo "This is not permitted. Please reconfigure."
3467   echo " "
3468   echo "Aborting configuration ..."
3469   echo " "
3470   echo " "
3471   exit 1
3472fi
3473
3474AC_CONFIG_FILES([
3475   autoconf/Make.common \
3476   Makefile \
3477   manpages/Makefile \
3478   scripts/btraceback \
3479   scripts/bconsole \
3480   scripts/baculabackupreport \
3481   scripts/bacula \
3482   scripts/bacula-ctl-dir \
3483   scripts/bacula-ctl-fd \
3484   scripts/bacula-ctl-sd \
3485   scripts/devel_bacula \
3486   scripts/Makefile \
3487   scripts/logrotate \
3488   scripts/mtx-changer \
3489   scripts/disk-changer \
3490   scripts/logwatch/Makefile \
3491   scripts/logwatch/logfile.bacula.conf \
3492   scripts/bat.desktop \
3493   scripts/bat.desktop.xsu \
3494   scripts/bat.desktop.consolehelper \
3495   scripts/bat.console_apps \
3496   scripts/bacula-tray-monitor.desktop \
3497   src/Makefile \
3498   src/host.h \
3499   src/console/Makefile \
3500   src/console/bconsole.conf \
3501   src/qt-console/bat.conf \
3502   src/qt-console/bat.pro \
3503   src/qt-console/bat.pro.mingw32 \
3504   src/qt-console/bat.pro.mingw64 \
3505   src/qt-console/install_conf_file \
3506   src/qt-console/tray-monitor/tray-monitor.conf \
3507   src/qt-console/tray-monitor/bacula-tray-monitor.conf \
3508   src/qt-console/tray-monitor/tray-monitor.pro \
3509   src/qt-console/tray-monitor/tray-monitor.pro.mingw32 \
3510   src/qt-console/tray-monitor/tray-monitor.pro.mingw64 \
3511   src/qt-console/tray-monitor/install_conf_file \
3512   src/dird/Makefile \
3513   src/dird/bacula-dir.conf \
3514   src/lib/Makefile \
3515   src/stored/Makefile \
3516   src/stored/bacula-sd.conf \
3517   src/filed/Makefile \
3518   src/filed/bacula-fd.conf \
3519   src/cats/Makefile \
3520   src/cats/make_catalog_backup.pl \
3521   src/cats/make_catalog_backup \
3522   src/cats/delete_catalog_backup \
3523   src/cats/create_postgresql_database \
3524   src/cats/update_postgresql_tables \
3525   src/cats/make_postgresql_tables \
3526   src/cats/grant_postgresql_privileges \
3527   src/cats/drop_postgresql_tables \
3528   src/cats/drop_postgresql_database \
3529   src/cats/create_mysql_database \
3530   src/cats/update_mysql_tables \
3531   src/cats/make_mysql_tables \
3532   src/cats/grant_mysql_privileges \
3533   src/cats/drop_mysql_tables \
3534   src/cats/drop_mysql_database \
3535   src/cats/create_sqlite3_database \
3536   src/cats/update_sqlite3_tables \
3537   src/cats/make_sqlite3_tables \
3538   src/cats/grant_sqlite3_privileges \
3539   src/cats/drop_sqlite3_tables \
3540   src/cats/drop_sqlite3_database \
3541   src/cats/sqlite \
3542   src/cats/mysql \
3543   src/cats/create_bacula_database \
3544   src/cats/update_bacula_tables \
3545   src/cats/grant_bacula_privileges \
3546   src/cats/make_bacula_tables \
3547   src/cats/drop_bacula_tables \
3548   src/cats/drop_bacula_database \
3549   src/cats/install-default-backend \
3550   src/findlib/Makefile \
3551   src/tools/Makefile \
3552   src/plugins/fd/Makefile \
3553   src/plugins/sd/Makefile \
3554   src/plugins/dir/Makefile \
3555   po/Makefile.in \
3556   updatedb/update_mysql_tables \
3557   updatedb/update_sqlite3_tables \
3558   updatedb/update_postgresql_tables \
3559   updatedb/update_mysql_tables_9_to_10 \
3560   updatedb/update_sqlite3_tables_9_to_10 \
3561   updatedb/update_postgresql_tables_9_to_10 \
3562   updatedb/update_mysql_tables_10_to_11 \
3563   updatedb/update_sqlite3_tables_10_to_11 \
3564   updatedb/update_postgresql_tables_10_to_11 \
3565   updatedb/update_mysql_tables_11_to_12 \
3566   updatedb/update_sqlite3_tables_11_to_12 \
3567   updatedb/update_postgresql_tables_11_to_12 \
3568   examples/nagios/check_bacula/Makefile \
3569   platforms/rpms/redhat/bacula.spec \
3570   platforms/rpms/redhat/bacula-bat.spec \
3571   platforms/rpms/redhat/bacula-docs.spec \
3572   platforms/rpms/redhat/bacula-mtx.spec \
3573   platforms/rpms/suse/bacula.spec \
3574   platforms/rpms/suse/bacula-bat.spec \
3575   platforms/rpms/suse/bacula-docs.spec \
3576   platforms/rpms/suse/bacula-mtx.spec \
3577   $PLUGCONFILES \
3578   $PFILES
3579])
3580AC_OUTPUT
3581
3582if test "${support_bat}" = "yes" ; then
3583   if test "x$QMAKE" = "xnone"; then
3584      AC_MSG_ERROR([Could not find qmake $PATH. Check your Qt installation])
3585   fi
3586
3587   cd src/qt-console
3588   echo "Creating bat Makefile"
3589   touch bat
3590   chmod 755 bat
3591   rm -f Makefile
3592   rm -rf moc32 obj32 moc64 obj64 ui32 ui64
3593   $QMAKE
3594   ${MAKE:-make} clean
3595
3596   cd tray-monitor
3597   echo "Creating tray-monitor Makefile"
3598   rm -f Makefile
3599   rm -rf moc32 obj32 moc64 obj64 ui32 ui64
3600   $QMAKE
3601   ${MAKE:-make} clean
3602   $QMAKE
3603   ${MAKE:-make} clean
3604   cd ${BUILD_DIR}
3605fi
3606
3607dnl
3608dnl if CC is gcc, we can rebuild the dependencies (since the depend rule
3609dnl requires gcc).  If it's not, don't rebuild dependencies
3610dnl
3611if test X"$GCC" = "Xyes" ; then
3612  echo "Doing make of dependencies"
3613  ${MAKE:-make} depend
3614fi
3615
3616cd src/qt-console
3617chmod 755 install_conf_file build-depkgs-qt-console
3618cd tray-monitor
3619chmod 755 install_conf_file build-depkgs-qt-console
3620cd ${BUILD_DIR}
3621
3622cd scripts
3623chmod 755 bacula btraceback mtx-changer
3624chmod 755 bconsole disk-changer devel_bacula logrotate
3625cd ..
3626
3627c=updatedb
3628chmod 755 $c/update_mysql_tables_10_to_11   $c/update_sqlite3_tables_10_to_11
3629chmod 755 $c/update_postgresql_tables_10_to_11
3630chmod 755 $c/update_mysql_tables_11_to_12   $c/update_sqlite3_tables_11_to_12
3631chmod 755 $c/update_postgresql_tables_11_to_12
3632
3633
3634c=src/cats
3635
3636chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
3637chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
3638
3639chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
3640chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
3641
3642chmod 755 $c/create_sqlite3_database   $c/update_sqlite3_tables  $c/make_sqlite3_tables
3643chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables	 $c/drop_sqlite3_database
3644
3645chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
3646chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
3647
3648chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  $c/make_catalog_backup.pl
3649chmod 755 $c/sqlite
3650chmod 755 $c/mysql
3651
3652chmod 755 $c/install-default-backend
3653
3654chmod 755 src/win32/build-depkgs-mingw32 src/win32/build-depkgs-mingw-w64
3655
3656if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
3657   largefile_support="yes"
3658fi
3659
3660dnl Only try to find out the version number of the compiler when we know its some kind of GCC compiler
3661if test X"$GCC" = "Xyes" ; then
3662   dnl
3663   dnl A whole lot of hand springs to get the compiler version.
3664   dnl	This is because gcc changed the output in version 3.0
3665   dnl
3666   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
3667   if test "x${CCVERSION}" = "x" ; then
3668      CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
3669   fi
3670   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
3671   if test x"${CXXVERSION}" = x ; then
3672      CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
3673   fi
3674fi
3675
3676# clean up any old junk
3677echo " "
3678echo "Cleaning up"
3679echo " "
3680${MAKE:-make} clean
3681
3682echo "
3683Configuration on `date`:
3684
3685   Host:                      ${host}${post_host} -- ${DISTNAME} ${DISTVER}
3686   Bacula version:            ${BACULA} ${VERSION} (${DATE})
3687   Source code location:      ${srcdir}
3688   Install binaries:          ${sbindir}
3689   Install libraries:         ${libdir}
3690   Install config files:      ${sysconfdir}
3691   Scripts directory:         ${scriptdir}
3692   Archive directory:         ${archivedir}
3693   Working directory:         ${working_dir}
3694   PID directory:             ${piddir}
3695   Subsys directory:          ${subsysdir}
3696   Man directory:             ${mandir}
3697   Data directory:            ${datarootdir}
3698   Plugin directory:          ${plugindir}
3699   C Compiler:                ${CC} ${CCVERSION}
3700   C++ Compiler:              ${CXX} ${CXXVERSION}
3701   Compiler flags:            ${WCFLAGS} ${CFLAGS}
3702   Linker flags:              ${WLDFLAGS} ${LDFLAGS}
3703   Libraries:                 ${LIBS}
3704   Statically Linked Tools:   ${support_static_tools}
3705   Statically Linked FD:      ${support_static_fd}
3706   Statically Linked SD:      ${support_static_sd}
3707   Statically Linked DIR:     ${support_static_dir}
3708   Statically Linked CONS:    ${support_static_cons}
3709   Database backends:         ${db_backends}
3710   Database port:             ${db_port}
3711   Database name:             ${db_name}
3712   Database user:             ${db_user}
3713   Database SSL options:      ${db_ssl_options}
3714
3715   Job Output Email:          ${job_email}
3716   Traceback Email:           ${dump_email}
3717   SMTP Host Address:         ${smtp_host}
3718
3719   Director Port:             ${dir_port}
3720   File daemon Port:          ${fd_port}
3721   Storage daemon Port:       ${sd_port}
3722
3723   Director User:             ${dir_user}
3724   Director Group:            ${dir_group}
3725   Storage Daemon User:       ${sd_user}
3726   Storage DaemonGroup:       ${sd_group}
3727   File Daemon User:          ${fd_user}
3728   File Daemon Group:         ${fd_group}
3729
3730   Large file support:        $largefile_support
3731   Bacula conio support:      ${got_conio} ${CONS_LIBS}
3732   readline support:          ${got_readline} ${PRTREADLINE_SRC}
3733   TCP Wrappers support:      ${TCPW_MSG} ${WRAPLIBS}
3734   TLS support:               ${support_tls}
3735   Encryption support:        ${support_crypto}
3736   ZLIB support:              ${have_zlib}
3737   LZO support:               ${have_lzo}
3738   S3 support:                ${have_libs3}
3739   enable-smartalloc:         ${support_smartalloc}
3740   enable-lockmgr:            ${support_lockmgr}
3741   bat support:               ${support_bat}
3742   client-only:               ${build_client_only}
3743   build-dird:                ${build_dird}
3744   build-stored:              ${build_stored}
3745   Plugin support:            ${have_plugins}
3746   AFS support:               ${have_afs}
3747   ACL support:               ${have_acl}
3748   XATTR support:             ${have_xattr}
3749   systemd support:           ${support_systemd} ${SYSTEMD_UNITDIR}
3750   Batch insert enabled:      ${batch_insert_db_backends}
3751
3752   Plugins:
3753   - Docker:                  ${support_docker}
3754  " > config.out
3755
3756# create a small shell script useful for support with
3757# configure options and config.out info
3758cat > scripts/bacula_config << EOF
3759#!/bin/sh
3760cat << __EOC__
3761$ $0 $ac_configure_args
3762EOF
3763cat config.out >> scripts/bacula_config
3764echo __EOC__ >> scripts/bacula_config
3765chmod 755 scripts/bacula_config
3766
3767cat config.out
3768