3 dnl# Process this file with autoconf to produce a configure script.
12 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
13 AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in)
15 dnl require a recent autoconf
19 dnl search for true and false programs.
20 AC_PATH_PROGS(TRUEPRG, true, :)
21 AC_PATH_PROGS(FALSEPRG, false, :)
25 VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
26 DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
27 LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
31 echo "configuring for bacula $VERSION ($DATE)"
34 dnl -------------------------------------------------------
35 dnl# Check for compiler.
36 dnl ------------------------------------------------------
40 AC_PROG_CC_C_O dnl Determine if C compiler support -c -o.
41 AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional.
45 if test "x$BASECC" = xgcc; then
49 AC_PATH_PROG(CXX, $CXX, $CXX)
50 if test ! -e $CXX; then
51 AC_MSG_ERROR(Unable to find C++ compiler)
54 dnl -------------------------------------------------------
55 dnl# Check for programs.
56 dnl ------------------------------------------------------
59 AC_PATH_PROG(MV, mv, mv)
60 AC_PATH_PROG(RM, rm, rm)
61 AC_PATH_PROG(CP, cp, cp)
62 AC_PATH_PROG(SED, sed, sed)
63 AC_PATH_PROG(ECHO, echo, echo)
64 AC_PATH_PROG(CMP, cmp, cmp)
65 AC_PATH_PROG(TBL, tbl, tbl)
66 AC_PATH_PROG(AR, ar, ar)
67 dnl AC_PATH_PROG(RANLIB, ranlib, ranlib)
68 AC_PATH_PROG(OPENSSL, openssl, none)
69 AC_PATH_PROG(MTX, mtx, mtx)
70 AC_PATH_PROG(DD, dd, dd)
71 AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
72 AC_PATH_PROG(PYTHON, python, python)
73 AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
74 AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
75 AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
76 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
77 AC_PATH_PROG(QMAKE, qmake, none)
78 AC_PATH_PROG(QMAKEQT4, qmake-qt4, none)
79 AC_ARG_VAR(WXCONFIG, [wx-config command. On some systems, you must set it to wx-config-2.6 to use wxWidgets 2.6.])
80 if test "x$WXCONFIG" = x; then
83 AC_PATH_PROG(WXCONFIG, ${WXCONFIG}, ${WXCONFIG})
84 AC_ARG_VAR(WXFLAGS, [Parameters to pass to wx-config (e.g. --unicode=no).])
85 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
86 AC_PATH_PROG(PIDOF, pidof, pidof)
88 # Some AWK programs fail, so test it and warn the user
89 if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 }
90 { if ((prog == $2) || (("(" prog ")") == $2) ||
91 (("[" prog "]") == $2) ||
92 ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
94 AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
95 The regex engine of $AWK is too broken to be used you
96 might want to install GNU AWK.
97 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
100 AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
103 test -n "$ARFLAG" || ARFLAGS="cr"
110 AC_SUBST(LOCAL_CFLAGS)
111 AC_SUBST(LOCAL_LDFLAGS)
114 dnl --------------------------------------------------
115 dnl Bacula OP Sys determination (see aclocal.m4)
116 dnl --------------------------------------------------
119 # -----------------------------------------------------------
120 dnl Bacula OPSys Distribution determination (see aclocal.m4)
121 # ----------------------------------------------------------
122 BA_CHECK_OPSYS_DISTNAME
124 # --------------------------------------------------
125 # Suppport for gettext (translations)
126 # By default, $datadir is ${prefix}/share
127 # --------------------------------------------------
128 AM_GNU_GETTEXT([external])
129 if test x${prefix} = xNONE ; then
130 if test `eval echo ${datadir}` = NONE/share ; then
135 # ------------------------------------------------------------------
136 # If the user has not set --prefix, we set our default to nothing.
137 # In this case, if the user has not set --sysconfdir, we set it
138 # to the package default of /etc/bacula. If either --prefix or
139 # --sysconfdir is set, we leave sysconfdir alone except to eval it.
140 # ------------------------------------------------------------------
141 if test x${prefix} = xNONE ; then
142 if test `eval echo ${sysconfdir}` = NONE/etc ; then
143 sysconfdir=/etc/bacula
147 sysconfdir=`eval echo ${sysconfdir}`
148 datadir=`eval echo ${datadir}`
149 localedir=`eval echo ${datadir}/locale`
150 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir")
151 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
153 # -------------------------------------------------------------------------
154 # If the user has not set --exec-prefix, we default to ${prefix}
155 # -------------------------------------------------------------------------
156 if test x${exec_prefix} = xNONE ; then
157 exec_prefix=${prefix}
160 # ------------------------------------------------------------------
161 # If the user has not set --sbindir, we set our default as /sbin
162 # ------------------------------------------------------------------
163 if test x$sbindir = x'${exec_prefix}/sbin' ; then
164 sbindir=${exec_prefix}/sbin
166 sbindir=`eval echo ${sbindir}`
169 # -------------------------------------------------------------------------
170 # If the user has not set --mandir, we default to /usr/share/man
171 # -------------------------------------------------------------------------
172 if test x$mandir = x'${prefix}/man' ; then
173 mandir=/usr/share/man
177 AC_PATH_PROGS(MSGFMT, msgfmt, no)
178 if test "$MSGFMT" = "no"
180 echo 'msgfmt program not found, disabling NLS !'
182 USE_INCLUDED_LIBINTL=no
191 support_postgresql=no
193 support_smartalloc=yes
198 support_wx_console=no
203 support_static_tools=no
206 support_static_dir=no
207 support_static_cons=no
216 dnl# --------------------------------------------------------------------------
217 dnl# CHECKING COMMAND LINE OPTIONS
218 dnl# --------------------------------------------------------------------------
220 # -------------------------------------------
221 # gnome (default off)
222 # -------------------------------------------
224 [ --enable-gnome enable build of bgnome-console GUI [disabled]],
225 [if test x$enableval = xyes; then
230 if test x$support_gnome = xyes; then
231 abc=`$PKGCONFIG --exists libgnomeui-2.0`
233 if test $pkg = 0; then
234 GNOME_INCLUDEDIR=`$PKGCONFIG --cflags-only-I libgnomeui-2.0`
235 GNOMEUI_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
236 GNOME_LIBDIR=`$PKGCONFIG --libs libgnomeui-2.0`
237 GNOME_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
238 AC_SUBST(GNOME_INCLUDEDIR)
239 AC_SUBST(GNOMEUI_LIBS)
240 AC_SUBST(GNOME_LIBDIR)
242 GNOME_DIR=src/gnome2-console
243 gnome_version="Version 2.x"
245 AC_MSG_ERROR(Unable to find Gnome 2 installation)
250 # -------------------------------------------
252 # -------------------------------------------
254 [ --enable-bat enable build of bat Qt4 GUI [disabled]],
255 [if test x$enableval = xyes; then
256 AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4 GUI support enabled])
261 if test x$support_bat = xyes; then
262 abc=`$PKGCONFIG --atleast-version=4.2 QtGui`
264 if test $pkg = 0; then
265 BAT_DIR=src/qt-console
267 AC_MSG_ERROR(Unable to find Qt4 installation needed by bat)
272 # If bat is enabled, we need the qwt library
276 if test x$support_bat = xyes; then
277 AC_MSG_CHECKING(for qwt support)
279 [ --with-qwt@<:@=DIR@:>@ specify qwt library directory],
285 if test -f ${with_qwt}/include/qwt.h; then
286 QWT_INC="${with_qwt}/include"
287 QWT_LDFLAGS="-L${with_qwt}/lib"
294 # Search in standard places, or --with-qwt not specified
296 if test x$QWT_INC = x; then
297 for root in /usr /usr/local; do
298 for ver in qwt qwt5 qwt-qt4; do
299 if test -f ${root}/include/${ver}/qwt.h; then
300 QWT_INC="${root}/include/${ver}"
301 if test -d ${root}/lib64/; then
302 QWT_LDFLAGS="-L${root}/lib64"
304 QWT_LDFLAGS="-L${root}/lib"
312 if test x$QWT_INC = x; then
314 AC_MSG_ERROR(Unable to find qwt package needed by bat)
324 AC_SUBST(QWT_LDFLAGS)
327 # -------------------------------------------
328 # bwx-console (default off)
329 # -------------------------------------------
330 AC_ARG_ENABLE(bwx-console,
331 [ --enable-bwx-console enable build of wxWidgets console [disabled]],
332 [if test x$enableval = xyes; then
333 support_wx_console=yes
337 if test x$support_wx_console = xyes; then
338 abc=`$WXCONFIG $WXFLAGS --cppflags`
340 if test $pkg = 0; then
341 wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
342 WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
343 WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
345 AC_SUBST(WXCONS_CPPFLAGS)
346 AC_SUBST(WXCONS_LDFLAGS)
347 WX_DIR=src/wx-console
350 echo "wx-config program not found. bwx-console disabled."
352 support_wx_console=no
358 # -------------------------------------------
359 # tray-monitor (default off)
360 # -------------------------------------------
361 AC_ARG_ENABLE(tray-monitor,
362 [ --enable-tray-monitor enable build of Gnome tray monitor (compatible with KDE) [disabled]],
363 [if test x$enableval = xyes; then
364 support_tray_monitor=yes
368 if test x$support_tray_monitor = xyes; then
369 abc=`$PKGCONFIG --exists gtk+-2.0`
371 if test $pkg = 0; then
372 TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
373 TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
374 AC_SUBST(TRAY_MONITOR_CPPFLAGS)
375 AC_SUBST(TRAY_MONITOR_LDFLAGS)
376 TRAY_MONITOR_DIR=src/tray-monitor
377 abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
379 if test $pkg = 0; then
380 AC_DEFINE(HAVE_GTK_2_4, 1, [Set if you have GTK 4.2 or greater loaded])
384 AC_SUBST(TRAY_MONITOR_DIR)
386 # -------------------------------------------
387 # smartalloc (default off)
388 # -------------------------------------------
389 AC_ARG_ENABLE(smartalloc,
390 [ --enable-smartalloc enable smartalloc debugging support [disabled]],
391 [if test x$enableval = xno; then
392 support_smartalloc=no
395 if test x$support_smartalloc = xyes; then
396 AC_DEFINE(SMARTALLOC, 1, [Set if you want Smartalloc enabled])
399 # -------------------------------------------
400 # faketape (default off)
401 # -------------------------------------------
402 AC_ARG_ENABLE(faketape,
403 [ --enable-faketape enable faketape debugging support [disabled]],
404 [if test x$enableval = xyes; then
408 if test x$support_faketape = xyes; then
409 AC_DEFINE(USE_FAKETAPE, 1, [Set if you want faketape enabled])
412 # -------------------------------------------
413 # static-tools (default off)
414 # -------------------------------------------
415 AC_ARG_ENABLE(static-tools,
416 [ --enable-static-tools enable static tape tools [disabled]],
417 [if test x$enableval = xyes; then
418 support_static_tools=yes
422 if test x$support_static_tools = xyes; then
423 TTOOL_LDFLAGS="-static"
425 AC_SUBST(TTOOL_LDFLAGS)
427 # -------------------------------------------
428 # static-fd (default off)
429 # -------------------------------------------
430 AC_ARG_ENABLE(static-fd,
431 [ --enable-static-fd enable static File daemon [disabled]],
432 [if test x$enableval = xyes; then
433 support_static_fd=yes
437 if test x$support_static_fd = xyes; then
438 STATIC_FD="static-bacula-fd"
442 # -------------------------------------------
443 # static-sd (default off)
444 # -------------------------------------------
445 AC_ARG_ENABLE(static-sd,
446 [ --enable-static-sd enable static Storage daemon [disabled]],
447 [if test x$enableval = xyes; then
448 support_static_sd=yes
452 if test x$support_static_sd = xyes; then
453 STATIC_SD="static-bacula-sd"
457 # -------------------------------------------
458 # static-dir (default off)
459 # -------------------------------------------
460 AC_ARG_ENABLE(static-dir,
461 [ --enable-static-dir enable static Director [disabled]],
462 [if test x$enableval = xyes; then
463 support_static_dir=yes
467 if test x$support_static_dir = xyes; then
468 STATIC_DIR="static-bacula-dir"
472 # -------------------------------------------
473 # static-cons (default off)
474 # -------------------------------------------
475 AC_ARG_ENABLE(static-cons,
476 [ --enable-static-cons enable static Console [disabled]],
477 [if test x$enableval = xyes; then
478 support_static_cons=yes
484 if test x$support_static_cons = xyes; then
485 STATIC_CONS="static-bconsole"
486 STATIC_GNOME_CONS="static-bgnome-console"
487 STATIC_WX_CONS="static-bwx-console"
489 AC_SUBST(STATIC_CONS)
490 AC_SUBST(STATIC_GNOME_CONS)
491 AC_SUBST(STATIC_WX_CONS)
493 # -------------------------------------------
494 # client_only (default off)
495 # -------------------------------------------
496 AC_ARG_ENABLE(client-only,
497 [ --enable-client-only build client (File daemon) only [disabled]],
498 [if test x$enableval = xyes; then
499 build_client_only=yes
503 if test x$build_client_only = xno; then
510 # -------------------------------------------
511 # director (default on)
512 # -------------------------------------------
513 AC_ARG_ENABLE(build-dird,
514 [ --enable-build-dird enable building of dird (Director) [enabled]],
515 [if test x$enableval = xno; then
518 if test x$build_dird = xyes; then
523 DIR_TOOLS="NODIRTOOLS"
528 # -------------------------------------------
529 # stored (default on)
530 # -------------------------------------------
531 AC_ARG_ENABLE(build-stored,
532 [ --enable-build-stored enable building of stored (Storage daemon) [enabled]],
533 [if test x$enableval = xno; then
536 if test x$build_stored = xyes; then
537 STORED_DIR="src/stored"
543 # ---------------------------------------------------
544 # Check for conio (Bacula readline substitute)(
545 # ---------------------------------------------------
546 # this allows you to turn it completely off
548 [ --disable-conio disable conio support [enabled]
550 [if test x$enableval = xno; then
556 # ---------------------------------------------------
557 # Check for IPv6 support
558 # ---------------------------------------------------
559 # this allows you to turn it completely off
562 [ --enable-ipv6 enable ipv6 support [enabled]
564 [if test x$enableval = xno; then
569 if test x$support_ipv6 = xyes; then
570 AC_TRY_LINK([ #include <sys/types.h>
571 #include <sys/socket.h>
572 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
573 [support_ipv6=yes], [support_ipv6=no])
576 if test x$support_ipv6 = xyes; then
577 AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
583 if test x$support_conio = xyes; then
584 AC_CHECK_HEADER(termcap.h,
585 [ AC_CHECK_LIB(termcap, tgetent,
586 [ CONS_LIBS="-ltermcap"
591 AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
593 [ AC_CHECK_LIB(ncurses, tgetent,
594 [ CONS_LIBS="-lncurses"
599 AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
604 AC_CHECK_HEADERS(curses.h)
605 AC_CHECK_HEADER(term.h,
606 [ AC_CHECK_LIB(curses, tgetent,
607 [ CONS_LIBS="-lcurses"
612 AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
615 [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
624 # ---------------------------------------------------
625 # Check for readline support/directory (default off)
626 # ---------------------------------------------------
627 # this allows you to turn it completely off
628 AC_ARG_ENABLE(readline,
629 [ --disable-readline disable readline support [disable]
631 [if test x$enableval = xno; then
637 if test x$support_readline = xyes; then
638 AC_ARG_WITH(readline,
639 [ --with-readline@<:@=DIR@:>@ specify readline library directory],
641 case "$with_readline" in
644 if test -f ${with_readline}/readline.h; then
645 CONS_INC="-I${with_readline}"
646 CONS_LDFLAGS="-L$with_readline"
647 elif test -f ${with_readline}/include/readline/readline.h; then
648 CONS_INC="-I${with_readline}/include/readline"
649 CONS_LDFLAGS="-L${with_readline}/lib"
650 with_readline="${with_readline}/include/readline"
652 with_readline="/usr/include/readline"
654 AC_CHECK_HEADER(${with_readline}/readline.h,
655 [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
656 CONS_LIBS="-lreadline -lhistory -ltermcap"
660 echo "readline.h not found. readline turned off ..."
667 # check for standard readline library
668 AC_CHECK_HEADER(/usr/include/readline/readline.h,
669 [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
671 CONS_INC="-I/usr/include/readline"
672 CONS_LIBS="-lreadline -ltermcap"
674 # Did not find standard library, so try Bacula's default
675 AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h,
676 [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
678 CONS_INC="-I${TOP_DIR}/depkgs/readline"
679 CONS_LIBS="-lreadline -lhistory -ltermcap"
680 CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
681 PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
684 echo "readline.h not found. readline turned off ..."
700 AC_SUBST(CONS_LDFLAGS)
701 AC_SUBST(READLINE_SRC)
703 # Minimal stuff for readline Makefile configuration
708 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
709 AC_CHECK_FUNCS(nanosleep nl_langinfo)
710 AC_CHECK_HEADERS(varargs.h)
712 # End of readline/conio stuff
713 # -----------------------------------------------------------------------
715 # -----------------------------------------------------------------------
716 # Check for Python support
718 AC_MSG_CHECKING(for Python support)
721 --with-python@<:@=DIR@:>@ Include Python support. DIR is the Python base
722 install directory, default is to search through
723 a number of common places for the Python files.],
727 if test "$withval" != "no"; then
728 if test "$withval" = "yes"; then
729 for python_root in /usr /usr/local /usr/sfw; do
730 for ver in python2.2 python2.3 python2.4 python2.5; do
731 if test -f $python_root/include/${ver}/Python.h; then
732 PYTHON_INCDIR=-I$python_root/include/${ver}
733 if test -d $python_root/lib64/${ver}/config; then
734 PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
736 PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
742 if test x$PYTHON_INCDIR = x; then
743 if test -f $prefix/include/Python.h; then
744 PYTHON_INCDIR=-I$prefix/include
745 if test -d $prefix/lib64/config; then
746 PYTHON_LIBS="-L$prefix/lib64/config -lpython"
748 PYTHON_LIBS="-L$prefix/lib/config -lpython"
752 AC_MSG_ERROR(Unable to find Python.h in standard locations)
756 if test -f $withval/Python.h; then
757 PYTHON_INCDIR=-I$withval
758 PYTHON_LIBS="-L$withval/config -lpython"
759 elif test -f $withval/include/Python.h; then
760 PYTHON_INCDIR=-I$withval/include
761 if test -d $withval/lib64/config; then
762 PYTHON_LIBS="-L$withval/lib64/config -lpython"
764 PYTHON_LIBS="-L$withval/lib/config -lpython"
766 elif test -f $withval/include/python/Python.h; then
767 PYTHON_INCDIR=-I$withval/include/python
768 if test -d $withval/lib64/python/config; then
769 PYTHON_LIBS="-L$withval/lib64/python/config -lpython"
771 PYTHON_LIBS="-L$withval/lib/python/config -lpython"
775 AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
778 AC_DEFINE([HAVE_PYTHON], 1)
781 AC_MSG_NOTICE(checking for more Python libs)
782 saved_LIBS="$LIBS"; LIBS=
783 AC_SEARCH_LIBS(shm_open, [rt])
784 AC_CHECK_LIB(util, openpty)
785 PYTHON_LIBS="$PYTHON_LIBS $LIBS"
793 AC_SUBST(PYTHON_LIBS)
794 AC_SUBST(PYTHON_INCDIR)
797 # Find where sockets are (especially for Solaris)
798 # Do this before the TCP Wrappers test since tcp wrappers
799 # uses the socket library and some linkers are stupid.
801 AC_CHECK_FUNC(socket,
802 AC_MSG_RESULT(using libc's socket),
803 AC_CHECK_LIB(xnet,socket)
804 AC_CHECK_LIB(socket,socket)
805 AC_CHECK_LIB(inet,socket))
808 # -----------------------------------------------------------
809 # Check whether user wants TCP wrappers support (default off)
810 # -----------------------------------------------------------
813 AC_ARG_WITH(tcp-wrappers,
814 [ --with-tcp-wrappers@<:@=DIR@:>@ enable tcpwrappers support],
816 if test "x$withval" != "xno" ; then
818 LIBS="$saved_LIBS -lwrap"
819 AC_MSG_CHECKING(for libwrap)
820 AC_SEARCH_LIBS(nanosleep, [rt])
822 [ #include <sys/types.h>
824 int deny_severity = 0;
825 int allow_severity = 0;
826 struct request_info *req; ],
827 [ hosts_access(req); ],
830 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
835 LIBS="$saved_LIBS -lwrap -lnsl"
836 WRAPLIBS="$saved_LIBS -lwrap -lnsl"
838 [ #include <sys/types.h>
840 int deny_severity = 0;
841 int allow_severity = 0;
842 struct request_info *req; ],
843 [ hosts_access(req); ],
846 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
851 [AC_MSG_ERROR([*** libwrap missing]) ] ]
858 # -----------------------------------------------------------
859 # Check whether OpenSSL is available
860 # -----------------------------------------------------------
861 AC_MSG_CHECKING([for OpenSSL])
862 dnl The following uses quadrigraphs:
866 AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
867 [with_openssl_directory=${withval}])
869 if test "x$with_openssl_directory" != "x"; then
870 OPENSSL_LIBS="-lssl -lcrypto"
873 if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
874 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
875 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
879 saved_CFLAGS="${CFLAGS}"
880 LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
881 CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"
883 AC_TRY_LINK([ #include <openssl/ssl.h> ],
884 [ CRYPTO_set_id_callback(NULL); ],
892 AC_TRY_LINK([ #include <openssl/evp.h> ],
894 [ ac_cv_openssl_sha2="yes" ],
895 [ ac_cv_openssl_sha2="no" ]
898 # Solaris disables greater than 128+ bit encryption in their OpenSSL
899 # implementation, presumably for export reasons. If 192bit AES
900 # is available, we assume that we're running with a 'non-export'
902 AC_TRY_LINK([ #include <openssl/evp.h> ],
903 [ EVP_aes_192_cbc(); ],
904 [ ac_cv_openssl_export="no" ],
905 [ ac_cv_openssl_export="yes" ]
909 CFLAGS="${saved_CFLAGS}"
911 if test "$support_tls" = "yes"; then
912 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
913 AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
914 AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
917 if test "$ac_cv_openssl_sha2" = "yes"; then
918 AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
921 if test "$ac_cv_openssl_export" = "yes"; then
922 AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
931 AC_MSG_RESULT([$support_tls])
932 AC_SUBST(OPENSSL_LIBS)
933 AC_SUBST(OPENSSL_INC)
936 # -----------------------------------------------------------
937 # dlopen is needed for plugins
938 # -----------------------------------------------------------
939 AC_SEARCH_LIBS(dlopen, [dl])
941 # ------------------------------------------
942 # Where to place working dir
943 # ------------------------------------------
944 working_dir=`eval echo ${prefix}/var/bacula/working`
945 AC_ARG_WITH(working-dir,
946 [ --with-working-dir=PATH specify path of Bacula working directory],
948 if test "x$withval" != "xno" ; then
954 AC_SUBST(working_dir)
956 # ------------------------------------------------------------------
957 # If the user has not set archivedir, we set our default as /tmp
958 # ------------------------------------------------------------------
960 AC_ARG_WITH(archivedir,
961 [ --with-archivedir=PATH specify path of SD archive directory],
963 if test "x$withval" != "xno" ; then
973 # ------------------------------------------
974 # Where to place scriptdir (script files)
975 # ------------------------------------------
976 scriptdir=`eval echo ${sysconfdir}`
977 AC_ARG_WITH(scriptdir,
978 [ --with-scriptdir=PATH specify path of Bacula scripts directory],
980 if test "x$withval" != "xno" ; then
989 # ------------------------------------------
990 # Where to send dump email
991 # ------------------------------------------
992 dump_email=root@localhost
993 AC_ARG_WITH(dump-email,
994 [ --with-dump-email=EMAIL dump email address],
996 if test "x$withval" != "xno" ; then
1002 AC_SUBST(dump_email)
1004 # ------------------------------------------
1005 # Where to send job email
1006 # ------------------------------------------
1007 job_email=root@localhost
1008 AC_ARG_WITH(job-email,
1009 [ --with-job-email=EMAIL job output email address],
1011 if test "x$withval" != "xno" ; then
1019 # ------------------------------------------
1020 # Where to find smtp host
1021 # ------------------------------------------
1023 AC_ARG_WITH(smtp_host,
1024 [ --with-smtp-host=HOST SMTP mail host address],
1026 if test "x$withval" != "xno" ; then
1035 # ------------------------------------
1036 # Where to place pid files
1037 # ------------------------------------
1039 AC_ARG_WITH(pid-dir,
1040 [ --with-pid-dir=PATH specify location of Bacula pid files],
1042 if test "x$withval" != "xno" ; then
1048 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
1052 # ------------------------------------
1053 # Where to place subsys "lock file"
1054 # ------------------------------------
1055 subsysdir=/var/run/subsys
1056 if test -d /var/run/subsys; then
1057 subsysdir=/var/run/subsys
1058 elif test -d /var/lock/subsys; then
1059 subsysdir=/var/lock/subsys
1061 subsysdir=/var/run/subsys
1063 AC_ARG_WITH(subsys-dir,
1064 [ --with-subsys-dir=PATH specify location of Bacula subsys file],
1066 if test "x$withval" != "xno" ; then
1076 # ------------------------------------
1077 # Where to start assigning ports
1078 # ------------------------------------
1080 AC_ARG_WITH(baseport,
1081 [ --with-baseport=PORT specify base port address for daemons],
1083 if test "x$withval" != "xno" ; then
1090 dir_port=`expr $baseport`
1091 fd_port=`expr $baseport + 1`
1092 sd_port=`expr $fd_port + 1`
1099 # ------------------------------------------
1100 # Generate passwords
1101 # ------------------------------------------
1103 AC_ARG_WITH(dir-password,
1104 [ --with-dir-password=PASSWORD specify Director's password],
1106 if test "x$withval" != "xno" ; then
1107 dir_password=$withval
1112 if test "x$dir_password" = "x" ; then
1113 if test "x$OPENSSL" = "xnone" ; then
1114 key=`autoconf/randpass 33`
1116 key=`openssl rand -base64 33`
1122 AC_ARG_WITH(fd-password,
1123 [ --with-fd-password=PASSWORD specify Client's password],
1125 if test "x$withval" != "xno" ; then
1126 fd_password=$withval
1131 if test "x$fd_password" = "x" ; then
1132 if test "x$OPENSSL" = "xnone" ; then
1133 key=`autoconf/randpass 37`
1135 key=`openssl rand -base64 33`
1141 AC_ARG_WITH(sd-password,
1142 [ --with-sd-password=PASSWORD specify Storage daemon's password],
1144 if test "x$withval" != "xno" ; then
1145 sd_password=$withval
1150 if test "x$sd_password" = "x" ; then
1151 if test "x$OPENSSL" = "xnone" ; then
1152 key=`autoconf/randpass 41`
1154 key=`openssl rand -base64 33`
1160 AC_ARG_WITH(mon-dir-password,
1161 [ --with-mon-dir-password=PASSWORD specify Director's password used by the monitor],
1163 if test "x$withval" != "xno" ; then
1164 mon_dir_password=$withval
1169 if test "x$mon_dir_password" = "x" ; then
1170 if test "x$OPENSSL" = "xnone" ; then
1171 key=`autoconf/randpass 33`
1173 key=`openssl rand -base64 33`
1175 mon_dir_password=$key
1179 AC_ARG_WITH(mon-fd-password,
1180 [ --with-mon-fd-password=PASSWORD specify Client's password used by the monitor],
1182 if test "x$withval" != "xno" ; then
1183 mon_fd_password=$withval
1188 if test "x$mon_fd_password" = "x" ; then
1189 if test "x$OPENSSL" = "xnone" ; then
1190 key=`autoconf/randpass 37`
1192 key=`openssl rand -base64 33`
1194 mon_fd_password=$key
1198 AC_ARG_WITH(mon-sd-password,
1199 [ --with-mon-sd-password=PASSWORD specify Storage daemon's password used by the monitor],
1201 if test "x$withval" != "xno" ; then
1202 mon_sd_password=$withval
1207 if test "x$mon_sd_password" = "x" ; then
1208 if test "x$OPENSSL" = "xnone" ; then
1209 key=`autoconf/randpass 41`
1211 key=`openssl rand -base64 33`
1213 mon_sd_password=$key
1216 AC_SUBST(dir_password)
1217 AC_SUBST(fd_password)
1218 AC_SUBST(sd_password)
1219 AC_SUBST(mon_dir_password)
1220 AC_SUBST(mon_fd_password)
1221 AC_SUBST(mon_sd_password)
1224 # Pickup any database name
1227 AC_ARG_WITH(db_name,
1228 [ --with-db-name=DBNAME specify database name (default bacula)],
1230 if test "x$withval" != "x" ; then
1238 AC_ARG_WITH(db_user,
1239 [ --with-db-user=UNAME specify database user (default bacula)],
1241 if test "x$withval" != "x" ; then
1250 # Handle users and groups for each daemon
1253 AC_ARG_WITH(dir_user,
1254 [ --with-dir-user=USER specify user for Director daemon],
1256 if test "x$withval" != "x" ; then
1263 AC_ARG_WITH(dir_group,
1264 [ --with-dir-group=GROUP specify group for Director daemon],
1266 if test "x$withval" != "x" ; then
1273 AC_ARG_WITH(sd_user,
1274 [ --with-sd-user=USER specify user for Storage daemon],
1276 if test "x$withval" != "x" ; then
1283 AC_ARG_WITH(sd_group,
1284 [ --with-sd-group=GROUP specify group for Storage daemon],
1286 if test "x$withval" != "x" ; then
1293 AC_ARG_WITH(fd_user,
1294 [ --with-fd-user=USER specify user for File daemon],
1296 if test "x$withval" != "x" ; then
1303 AC_ARG_WITH(fd_group,
1304 [ --with-fd-group=GROUP specify group for File daemon],
1306 if test "x$withval" != "x" ; then
1320 # allow setting default executable permissions
1323 AC_ARG_WITH(sbin-perm,
1324 [ --with-sbin-perm=MODE specify permissions for sbin binaries (0754)],
1326 if test "x$withval" != "x" ; then
1334 # ------------------------------------------------
1335 # Bacula check for various SQL database engines
1336 # ------------------------------------------------
1338 BA_CHECK_POSTGRESQL_DB
1353 # -------------------------------------------
1354 # enable batch attribute DB insert (default on)
1355 # -------------------------------------------
1356 support_batch_insert=no
1357 A=`nm $SQL_LIB | grep pthread_mutex_lock`
1359 if test $pkg = 0; then
1360 support_batch_insert=yes
1361 AC_ARG_ENABLE(batch-insert,
1362 [ --enable-batch-insert enable the DB batch insert code [disabled]],
1363 [if test x$enableval = xno; then
1364 support_batch_insert=no
1366 support_batch_insert=yes
1370 # Check if postgresql support batch mode
1371 if test x$DB_TYPE = xpostgresql; then
1372 A=`nm $SQL_LIB | grep PQputCopyData`
1374 if test $pkg != 0; then
1375 support_batch_insert=no
1379 if test x$DB_TYPE = xdbi; then
1383 # Check for batch insert
1384 if test $DB_PROG = postgresql; then
1385 A=`nm $DB_PROG_LIB | grep PQputCopyData`
1389 if test $DB_PROG = mysql; then
1390 A=`nm $DB_PROG_LIB | grep pthread_mutex_lock`
1394 if test $pkg = 0; then
1395 AC_ARG_ENABLE(batch-insert,
1396 [ --enable-batch-insert enable the DB batch insert code [disabled]],
1397 [if test x$enableval = xno; then
1398 support_batch_insert=no
1400 support_batch_insert=yes
1405 if test $support_batch_insert = yes ; then
1406 AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
1410 AC_DEFINE(PROTOTYPES)
1412 dnl# --------------------------------------------------------------------------
1413 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1415 if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1416 if test -z "$CCOPTS"; then
1417 CCOPTS='-g -O2 -Wall'
1426 dnl See if we can use 64 bit file addresses
1427 largefile_support="no"
1433 dnl# --------------------------------------------------------------------------
1434 dnl# CHECKING FOR HEADER FILES
1435 dnl# --------------------------------------------------------------------------
1474 AC_STRUCT_ST_BLKSIZE
1478 dnl# --------------------------------------------------------------------------
1479 dnl# Check for utime.h structure
1480 dnl# --------------------------------------------------------------------------
1481 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1483 #include <sys/types.h>
1484 #include <utime.h>], [struct utimbuf foo],
1485 ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
1486 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])
1488 dnl# --------------------------------------------------------------------------
1489 dnl# Check for socklen_t
1490 dnl# --------------------------------------------------------------------------
1491 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1493 #include <sys/types.h>
1494 #include <sys/socket.h>],
1496 ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
1497 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
1499 dnl# --------------------------------------------------------------------------
1500 dnl# Check for bigendian
1501 dnl# --------------------------------------------------------------------------
1502 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
1504 [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
1505 [ba_cv_bigendian=yes],
1506 [ba_cv_bigendian=no],
1507 [ba_cv_bigendian=no])])
1508 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
1510 dnl# --------------------------------------------------------------------------
1511 dnl# Check for typeof()
1512 dnl# --------------------------------------------------------------------------
1514 AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
1516 [main(){char *a = 0; a = (typeof a)a;}],
1517 [ba_cv_have_typeof=yes],
1518 [ba_cv_have_typeof=no],
1519 [ba_cv_have_typeof=no])])
1520 test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
1526 dnl# --------------------------------------------------------------------------
1527 dnl# CHECKING FOR FILESYSTEM TYPE
1528 dnl# --------------------------------------------------------------------------
1529 AC_MSG_CHECKING(how to get filesystem type)
1531 # The order of these tests is important.
1532 AC_TRY_CPP([#include <sys/statvfs.h>
1533 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
1534 if test $fstype = no; then
1535 AC_TRY_CPP([#include <sys/statfs.h>
1536 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
1538 if test $fstype = no; then
1539 AC_TRY_CPP([#include <sys/statfs.h>
1540 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
1542 if test $fstype = no; then
1543 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
1545 if test $fstype = no; then
1546 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1548 if test $fstype = no; then
1549 AC_TRY_CPP([#include <sys/mount.h>
1550 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
1552 AC_MSG_RESULT($fstype)
1554 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
1556 dnl# --------------------------------------------------------------------------
1557 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
1558 dnl# --------------------------------------------------------------------------
1566 AC_CHECK_TYPE(ino_t, unsigned long)
1567 AC_CHECK_TYPE(dev_t, unsigned long)
1568 AC_CHECK_TYPE(daddr_t, long)
1569 AC_CHECK_TYPE(major_t, int)
1570 AC_CHECK_TYPE(minor_t, int)
1571 AC_CHECK_TYPE(ssize_t, int)
1578 AC_CHECK_SIZEOF(char, 1)
1579 AC_CHECK_SIZEOF(short int, 2)
1580 AC_CHECK_SIZEOF(int, 4)
1581 AC_CHECK_SIZEOF(long int, 4)
1582 AC_CHECK_SIZEOF(long long int, 8)
1583 AC_CHECK_SIZEOF(int *, 4)
1585 # Check for sys/types.h types
1586 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1588 [ #include <sys/types.h> ],
1590 [ ac_cv_have_u_int="yes" ],
1591 [ ac_cv_have_u_int="no" ]
1594 if test "x$ac_cv_have_u_int" = "xyes" ; then
1595 AC_DEFINE(HAVE_U_INT)
1599 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
1601 [ #include <sys/types.h> ],
1602 [ intmax_t a; a = 1;],
1603 [ ac_cv_have_intmax_t="yes" ],
1606 [ #include <stdint.h> ],
1607 [ intmax_t a; a = 1;],
1608 [ ac_cv_have_intmax_t="yes" ],
1609 [ ac_cv_have_intmax_t="no" ]
1615 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
1616 AC_DEFINE(HAVE_INTMAX_T)
1621 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
1623 [ #include <sys/types.h> ],
1624 [ u_intmax_t a; a = 1;],
1625 [ ac_cv_have_u_intmax_t="yes" ],
1628 [ #include <stdint.h> ],
1629 [ u_intmax_t a; a = 1;],
1630 [ ac_cv_have_u_intmax_t="yes" ],
1631 [ ac_cv_have_u_intmax_t="no" ]
1636 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
1637 AC_DEFINE(HAVE_U_INTMAX_T)
1642 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1644 [ #include <sys/types.h> ],
1645 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1646 [ ac_cv_have_intxx_t="yes" ],
1647 [ ac_cv_have_intxx_t="no" ]
1650 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1651 AC_DEFINE(HAVE_INTXX_T)
1655 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1657 [ #include <sys/types.h> ],
1658 [ int64_t a; a = 1;],
1659 [ ac_cv_have_int64_t="yes" ],
1660 [ ac_cv_have_int64_t="no" ]
1663 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1664 AC_DEFINE(HAVE_INT64_T)
1668 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1670 [ #include <sys/types.h> ],
1671 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1672 [ ac_cv_have_u_intxx_t="yes" ],
1673 [ ac_cv_have_u_intxx_t="no" ]
1676 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1677 AC_DEFINE(HAVE_U_INTXX_T)
1681 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1683 [ #include <sys/types.h> ],
1684 [ u_int64_t a; a = 1;],
1685 [ ac_cv_have_u_int64_t="yes" ],
1686 [ ac_cv_have_u_int64_t="no" ]
1689 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1690 AC_DEFINE(HAVE_U_INT64_T)
1694 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1695 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1697 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1699 [ #include <sys/bitypes.h> ],
1700 [ int8_t a; int16_t b; int32_t c;
1701 u_int8_t e; u_int16_t f; u_int32_t g;
1702 a = b = c = e = f = g = 1; ],
1703 [ AC_DEFINE(HAVE_U_INTXX_T)
1704 AC_DEFINE(HAVE_INTXX_T)
1705 AC_DEFINE(HAVE_SYS_BITYPES_H)
1706 AC_MSG_RESULT(yes) ],
1707 [ AC_MSG_RESULT(no)]
1711 if test -z "$have_u_intxx_t" ; then
1712 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1714 [ #include <sys/types.h> ],
1715 [ uint8_t a; uint16_t b;
1716 uint32_t c; a = b = c = 1; ],
1717 [ ac_cv_have_uintxx_t="yes" ],
1718 [ ac_cv_have_uintxx_t="no" ]
1721 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1722 AC_DEFINE(HAVE_UINTXX_T)
1726 if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
1727 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1729 AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
1731 [ #include <sys/bitypes.h> ],
1732 [ int64_t a; u_int64_t b;
1734 [ AC_DEFINE(HAVE_U_INT64_T)
1735 AC_DEFINE(HAVE_INT64_T)
1736 AC_MSG_RESULT(yes) ],
1737 [ AC_MSG_RESULT(no)]
1741 if (test -z "$have_uintxx_t" && \
1742 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1744 AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
1746 [ #include <sys/bitypes.h> ],
1747 [ uint8_t a; uint16_t b;
1748 uint32_t c; a = b = c = 1; ],
1749 [ AC_DEFINE(HAVE_UINTXX_T)
1750 AC_MSG_RESULT(yes) ],
1751 [ AC_MSG_RESULT(no)]
1759 dnl# --------------------------------------------------------------------------
1760 dnl# CHECKING FOR REQUIRED LIBRARY FUNCTIONS
1761 dnl# --------------------------------------------------------------------------
1777 [echo 'configure: cannot find needed function.'; exit 1]
1780 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1781 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1782 AC_CHECK_FUNCS(posix_fadvise)
1783 AC_CHECK_FUNCS(fdatasync)
1785 AC_CHECK_FUNCS(chflags)
1787 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
1789 AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
1792 void use_va_copy(va_list args){va_list args2; va_copy(args2,args); va_end(args2);}
1793 void call_use_va_copy(int junk,...){va_list args; va_start(args,junk); use_va_copy(args); va_end(args);}
1795 [call_use_va_copy(1,2,3)],
1796 ba_cv_va_copy=yes, ba_cv_va_copy=no)])
1797 test $ba_cv_va_copy = yes && AC_DEFINE(HAVE_VA_COPY, 1, [Set if va_copy exists])
1800 dnl# --------------------------------------------------------------------------
1801 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1802 dnl# --------------------------------------------------------------------------
1803 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1805 # If resolver functions are not in libc check for -lnsl or -lresolv.
1806 AC_CHECK_FUNC(gethostbyname_r,
1807 AC_MSG_RESULT(using libc's resolver),
1808 AC_CHECK_LIB(nsl,gethostbyname_r)
1809 AC_CHECK_LIB(resolv,gethostbyname_r))
1813 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1814 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
1815 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
1817 dnl ----------------------------
1818 dnl check sa_len of sockaddr
1819 dnl ----------------------------
1820 AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
1821 [AC_TRY_COMPILE([#include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
1822 ac_cv_struct_sockaddr_sa_len=yes, ac_cv_struct_sockaddr_sa_len=no)])
1824 if test $ac_cv_struct_sockaddr_sa_len = yes; then
1825 AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
1835 AC_FUNC_CLOSEDIR_VOID
1836 AC_FUNC_SETPGRP dnl check for BSD setpgrp.
1837 # AC_FUNC_FNMATCH dnl use local version
1840 AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
1843 AC_CHECK_LIB(sun, getpwnam)
1845 AC_CHECK_HEADERS(zlib.h)
1846 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1848 if test x$FDLIBS = x-lz; then
1849 AC_DEFINE(HAVE_LIBZ)
1854 # Check for ACL libraries
1857 AC_CHECK_HEADER(sys/acl.h)
1858 AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
1859 [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"],
1860 [AC_CHECK_LIB(sec, acltotext, [have_acl=yes; FDLIBS="-lsec $FDLIBS"])]
1863 if test $have_acl = yes; then
1867 dnl Check for pthread libraries
1869 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1870 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1871 [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1872 [AC_CHECK_FUNC(pthread_create)]
1883 if test x$have_gcc = xyes ; then
1884 CPPFLAGS="$CPPFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1885 CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1887 LDFLAGS=${LDFLAGS--O}
1888 DB_LIBS="${SQL_LFLAGS}"
1889 CPPFLAGS="$CPPFLAGS"
1902 AC_SUBST(X_EXTRA_LIBS)
1907 dnl# extra configurable objects
1918 # Finally we set appropriate distribution specific
1919 # variables and defaults
1921 # PFILES are platform specific files
1922 PFILES="platforms/Makefile"
1926 hostname=`uname -n | cut -d '.' -f 1`
1927 if test x${hostname} = x ; then
1928 hostname="localhost"
1933 PSCMD="ps -e -o pid,comm"
1935 platforms/aix/Makefile"
1936 TAPEDRIVE="/dev/rmt0.1"
1940 PTHREAD_LIB="-lpthread -lexc"
1941 if test "${CC}" = "gcc" ; then
1948 TAPEDRIVE="/dev/nrmt0"
1951 DISTVER=`uname -a |awk '{print $3}'`
1952 TAPEDRIVE="/dev/nrmt0"
1953 PTHREAD_LIB="-pthread"
1954 CFLAGS="${CFLAGS} -pthread"
1955 PSCMD="ps -ax -o pid,command"
1959 platforms/bsdi/Makefile \
1960 platforms/bsdi/bacula-fd \
1961 platforms/bsdi/bacula-sd \
1962 platforms/bsdi/bacula-dir"
1963 largefile_support="yes"
1966 DISTVER=`uname -a |awk '{print $3}'`
1967 TAPEDRIVE="/dev/nrst0"
1970 WLDFLAGS="-mwindows"
1974 TAPEDRIVE="/dev/nst0"
1975 PSCMD="ps -e -o pid,command"
1978 platforms/darwin/Makefile"
1981 if `grep -q ubuntu /etc/apt/sources.list`; then
1984 DISTVER=`cat /etc/debian_version`
1985 if test -f /etc/lsb-release ; then
1987 if test "x$DISTRIB_ID" != "x" ; then
1988 DISTNAME=$DISTRIB_ID
1990 if test "x$DISTRIB_RELEASE" != "x" ; then
1991 DISTVER=$DISTRIB_RELEASE
1994 if test "$DISTNAME" = "Ubuntu" ; then
1997 TAPEDRIVE="/dev/nst0"
1998 PSCMD="ps -e -o pid,command"
1999 if test "$DISTNAME" = "ubuntu" ; then
2001 platforms/ubuntu/Makefile \
2002 platforms/ubuntu/bacula-fd \
2003 platforms/ubuntu/bacula-sd \
2004 platforms/ubuntu/bacula-dir"
2007 platforms/debian/Makefile \
2008 platforms/debian/bacula-fd \
2009 platforms/debian/bacula-sd \
2010 platforms/debian/bacula-dir"
2014 DISTVER=`uname -a |awk '{print $3}'`
2015 VER=`echo $DISTVER | cut -c 1`
2016 if test x$VER = x4 ; then
2017 PTHREAD_LIB="${PTHREAD_LIBS:--pthread}"
2018 CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS:--pthread}"
2022 TAPEDRIVE="/dev/nrsa0"
2023 PSCMD="ps -ax -o pid,command"
2025 platforms/freebsd/Makefile \
2026 platforms/freebsd/bacula-fd \
2027 platforms/freebsd/bacula-sd \
2028 platforms/freebsd/bacula-dir"
2029 largefile_support="yes"
2032 PSCMD="UNIX95=1; ps -e -o pid,comm"
2033 CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
2035 TAPEDRIVE="/dev/rmt/0hnb"
2036 PTHREAD_LIB="-lpthread"
2037 AC_DEFINE([_INCLUDE_LONGLONG])
2041 TAPEDRIVE="/dev/rmt/0cbn"
2042 PSCMD="ps -e -o pid,comm"
2044 platforms/irix/Makefile \
2045 platforms/irix/bacula-fd \
2046 platforms/irix/bacula-sd \
2047 platforms/irix/bacula-dir"
2050 DISTVER=`uname -a |awk '{print $3}'`
2053 TAPEDRIVE="/dev/nrst0"
2054 PSCMD="ps -ax -o pid,command"
2055 PTHREAD_LIB="-pthread"
2056 CFLAGS="${CFLAGS} -pthread"
2059 DISTVER=`uname -a |awk '{print $3}'`
2062 TAPEDRIVE="/dev/nrst0"
2063 PSCMD="ps -ax -o pid,command"
2064 PTHREAD_LIB="-pthread"
2065 CFLAGS="${CFLAGS} -pthread"
2067 platforms/openbsd/Makefile \
2068 platforms/openbsd/bacula-fd \
2069 platforms/openbsd/bacula-sd \
2070 platforms/openbsd/bacula-dir"
2073 if test -f /etc/whitebox-release ; then
2074 f=/etc/whitebox-release
2076 f=/etc/redhat-release
2078 if test `cat $f | grep release |\
2079 cut -f 3 -d ' '`x = "Enterprise"x ; then
2080 DISTVER="Enterprise "`cat $f | grep release |\
2083 DISTVER=`cat /etc/redhat-release | grep release |\
2086 TAPEDRIVE="/dev/nst0"
2087 PSCMD="ps -e -o pid,command"
2089 platforms/redhat/Makefile \
2090 platforms/redhat/bacula-fd \
2091 platforms/redhat/bacula-sd \
2092 platforms/redhat/bacula-dir \
2093 platforms/redhat/bacula.spec \
2097 DISTVER=`cat /etc/mandrake-release | grep release |\
2099 TAPEDRIVE="/dev/nst0"
2100 PSCMD="ps -e -o pid,command"
2102 platforms/mandrake/Makefile \
2103 platforms/mandrake/bacula-fd \
2104 platforms/mandrake/bacula-sd \
2105 platforms/mandrake/bacula-dir \
2106 platforms/mandrake/bacula.spec \
2110 DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
2111 TAPEDRIVE="/dev/nst0"
2112 PSCMD="ps -e -o pid,command"
2114 platforms/gentoo/Makefile \
2115 platforms/gentoo/bacula-init \
2116 platforms/gentoo/bacula-fd \
2117 platforms/gentoo/bacula-sd \
2118 platforms/gentoo/bacula-dir"
2121 DISTVER=`cat /etc/slackware-version`
2122 TAPEDRIVE="/dev/nst0"
2123 PSCMD="ps -e -o pid,command"
2125 platforms/slackware/Makefile \
2126 platforms/slackware/rc.bacula-fd \
2127 platforms/slackware/rc.bacula-sd \
2128 platforms/slackware/rc.bacula-dir\
2129 platforms/slackware/functions.bacula"
2133 TAPEDRIVE="/dev/rmt/0cbn"
2134 PSCMD="ps -e -o pid,comm"
2136 platforms/solaris/Makefile \
2137 platforms/solaris/bacula-fd \
2138 platforms/solaris/bacula-sd \
2139 platforms/solaris/bacula-dir"
2140 if test x$DISTVER = x5.6 ; then
2141 AC_DEFINE(HAVE_OLD_SOCKOPT)
2143 LIBS="$LIBS -lresolv"
2146 DISTVER=`cat /etc/SuSE-release |grep VERSION|\
2148 TAPEDRIVE="/dev/nst0"
2149 PSCMD="ps -e -o pid,command"
2151 platforms/suse/Makefile \
2152 platforms/suse/bacula-fd \
2153 platforms/suse/bacula-sd \
2154 platforms/suse/bacula-dir \
2155 platforms/suse/bacula \
2156 platforms/suse/bacula.spec"
2161 TAPEDRIVE="/dev/nst0"
2162 PSCMD="ps -e -o pid,command"
2164 platforms/suse/Makefile \
2165 platforms/suse/bacula-fd \
2166 platforms/suse/bacula-sd \
2167 platforms/suse/bacula-dir"
2171 TAPEDRIVE="/dev/nst0"
2174 echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
2180 LIBS="$PTHREAD_LIB $LIBS"
2182 AC_DEFINE_UNQUOTED(lld, "$lld")
2183 AC_DEFINE_UNQUOTED(llu, "$llu")
2191 dnl# common parts of the Makefile
2192 MCOMMON=./autoconf/Make.common
2193 AC_SUBST_FILE(MCOMMON)
2196 if test "x${subsysdir}" = "x${sbindir}" ; then
2199 echo "You have set both --sbindir and --with-subsys-dir"
2200 echo " equal to: ${subsysdir} "
2201 echo "This is not permitted. Please reconfigure."
2203 echo "Aborting configuration ..."
2209 AC_OUTPUT([autoconf/Make.common \
2212 scripts/startmysql \
2214 scripts/btraceback \
2220 scripts/bacula-ctl-dir \
2221 scripts/bacula-ctl-fd \
2222 scripts/bacula-ctl-sd \
2223 scripts/devel_bacula \
2226 scripts/bacula.desktop.gnome1 \
2227 scripts/bacula.desktop.gnome2 \
2228 scripts/bacula.desktop.gnome1.consolehelper \
2229 scripts/bacula.desktop.gnome2.consolehelper \
2230 scripts/bacula.desktop.gnome1.xsu \
2231 scripts/bacula.desktop.gnome2.xsu \
2232 scripts/bgnome-console.console_apps \
2233 scripts/mtx-changer \
2234 scripts/disk-changer \
2235 scripts/dvd-handler \
2236 scripts/dvd-simulator \
2237 scripts/bacula-tray-monitor.desktop \
2238 scripts/logwatch/Makefile \
2239 scripts/logwatch/logfile.bacula.conf \
2240 scripts/wxconsole.console_apps \
2241 scripts/wxconsole.desktop.consolehelper \
2242 scripts/wxconsole.desktop.xsu \
2243 scripts/bat.desktop \
2244 scripts/bat.desktop.xsu \
2245 scripts/bat.desktop.consolehelper \
2246 scripts/bat.console_apps \
2249 src/console/Makefile \
2250 src/console/bconsole.conf \
2251 src/gnome2-console/Makefile \
2252 src/gnome2-console/bgnome-console.conf \
2253 src/qt-console/bat.conf \
2254 src/qt-console/bat.pro \
2255 src/qt-console/install_conf_file \
2256 src/wx-console/Makefile \
2257 src/wx-console/bwx-console.conf \
2258 src/tray-monitor/Makefile \
2259 src/tray-monitor/tray-monitor.conf \
2261 src/dird/bacula-dir.conf \
2263 src/stored/Makefile \
2264 src/stored/bacula-sd.conf \
2265 src/filed/Makefile \
2266 src/filed/bacula-fd.conf \
2268 src/cats/make_catalog_backup \
2269 src/cats/delete_catalog_backup \
2270 src/cats/create_postgresql_database \
2271 src/cats/update_postgresql_tables \
2272 src/cats/make_postgresql_tables \
2273 src/cats/grant_postgresql_privileges \
2274 src/cats/drop_postgresql_tables \
2275 src/cats/drop_postgresql_database \
2276 src/cats/create_mysql_database \
2277 src/cats/update_mysql_tables \
2278 src/cats/make_mysql_tables \
2279 src/cats/grant_mysql_privileges \
2280 src/cats/drop_mysql_tables \
2281 src/cats/drop_mysql_database \
2282 src/cats/create_sqlite_database \
2283 src/cats/update_sqlite_tables \
2284 src/cats/make_sqlite_tables \
2285 src/cats/grant_sqlite_privileges \
2286 src/cats/drop_sqlite_tables \
2287 src/cats/drop_sqlite_database \
2288 src/cats/create_sqlite3_database \
2289 src/cats/update_sqlite3_tables \
2290 src/cats/make_sqlite3_tables \
2291 src/cats/grant_sqlite3_privileges \
2292 src/cats/drop_sqlite3_tables \
2293 src/cats/drop_sqlite3_database \
2296 src/cats/create_bdb_database \
2297 src/cats/update_bdb_tables \
2298 src/cats/make_bdb_tables \
2299 src/cats/grant_bdb_privileges \
2300 src/cats/drop_bdb_tables \
2301 src/cats/drop_bdb_database \
2302 src/cats/create_bacula_database \
2303 src/cats/update_bacula_tables \
2304 src/cats/grant_bacula_privileges \
2305 src/cats/make_bacula_tables \
2306 src/cats/drop_bacula_tables \
2307 src/cats/drop_bacula_database \
2308 src/findlib/Makefile \
2309 src/tools/Makefile \
2311 updatedb/update_mysql_tables_10_to_11 \
2312 updatedb/update_sqlite3_tables_10_to_11 \
2313 updatedb/update_postgresql_tables_10_to_11 \
2314 updatedb/update_sqlite_tables_10_to_11 \
2319 if test "${support_bat}" = "yes" ; then
2320 if test "x$QMAKE" = "xnone" && test "x$QMAKEQT4" = "xnone"; then
2321 echo "Could not find qmake or qmake-qt4 in $PATH. Check your Qt installation"
2327 if test "x$QMAKEQT4" != "xnone"; then
2334 chmod 755 install_conf_file build-depkgs-qt-console
2335 echo "Creating bat Makefile"
2340 echo "Doing make of dependencies"
2341 ${MAKE:-make} depend
2344 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
2345 chmod 755 dvd-handler dvd-simulator
2346 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
2350 chmod 755 $c/update_mysql_tables_10_to_11 $c/update_sqlite3_tables_10_to_11
2351 chmod 755 $c/update_postgresql_tables_10_to_11 $c/update_sqlite_tables_10_to_11
2355 chmod 755 $c/create_bacula_database $c/update_bacula_tables $c/make_bacula_tables
2356 chmod 755 $c/grant_bacula_privileges $c/drop_bacula_tables $c/drop_bacula_database
2358 chmod 755 $c/create_bdb_database $c/update_bdb_tables $c/make_bdb_tables
2359 chmod 755 $c/grant_bdb_privileges $c/drop_bdb_tables $c/drop_bdb_database
2361 chmod 755 $c/create_mysql_database $c/update_mysql_tables $c/make_mysql_tables
2362 chmod 755 $c/grant_mysql_privileges $c/drop_mysql_tables $c/drop_mysql_database
2364 chmod 755 $c/create_sqlite_database $c/update_sqlite_tables $c/make_sqlite_tables
2365 chmod 755 $c/grant_sqlite_privileges $c/drop_sqlite_tables $c/drop_sqlite_database
2367 chmod 755 $c/create_sqlite3_database $c/update_sqlite3_tables $c/make_sqlite3_tables
2368 chmod 755 $c/grant_sqlite3_privileges $c/drop_sqlite3_tables $c/drop_sqlite3_database
2370 chmod 755 $c/create_postgresql_database $c/update_postgresql_tables $c/make_postgresql_tables
2371 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables $c/drop_postgresql_database
2373 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup
2377 chmod 755 src/win32/build-depkgs-mingw32
2381 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
2382 largefile_support="yes"
2386 # A whole lot of hand springs to get the compiler version.
2387 # This is because gcc changed the output in version 3.0
2389 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2390 if test "x${CCVERSION}" = "x" ; then
2391 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2393 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2394 if test x"${CXXVERSION}" = x ; then
2395 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2398 if test "x${subsysdir}" = "x${sbindir}" ; then
2401 echo "You have set --sbindir and --with-subsys-dir"
2402 echo " both equal to: ${subsysdir} "
2403 echo " This is not permitted. Please reconfigure."
2405 echo "Aborting configuration ..."
2411 if test "x${db_type}" = "xInternal" ; then
2414 echo "You have not specified either --enable-client-only or one of the"
2415 echo " supported databases: MySQL, PostgreSQL, SQLite3, SQLite or DBI."
2416 echo " This is not permitted. Please reconfigure."
2418 echo "Aborting the configuration ..."
2425 Configuration on `date`:
2427 Host: $host -- ${DISTNAME} ${DISTVER}
2428 Bacula version: ${VERSION} (${DATE})
2429 Source code location: ${srcdir}
2430 Install binaries: ${sbindir}
2431 Install config files: ${sysconfdir}
2432 Scripts directory: ${scriptdir}
2433 Archive directory: ${archivedir}
2434 Working directory: ${working_dir}
2435 PID directory: ${piddir}
2436 Subsys directory: ${subsysdir}
2437 Man directory: ${mandir}
2438 Data directory: ${datadir}
2439 C Compiler: ${CC} ${CCVERSION}
2440 C++ Compiler: ${CXX} ${CXXVERSION}
2441 Compiler flags: ${WCFLAGS} ${CFLAGS}
2442 Linker flags: ${WLDFLAGS} ${LDFLAGS}
2444 Statically Linked Tools: ${support_static_tools}
2445 Statically Linked FD: ${support_static_fd}
2446 Statically Linked SD: ${support_static_sd}
2447 Statically Linked DIR: ${support_static_dir}
2448 Statically Linked CONS: ${support_static_cons}
2449 Database type: ${db_type}
2450 Database lib: ${DB_LIBS}
2451 Database name: ${db_name}
2452 Database user: ${db_user}
2454 Job Output Email: ${job_email}
2455 Traceback Email: ${dump_email}
2456 SMTP Host Address: ${smtp_host}
2458 Director Port: ${dir_port}
2459 File daemon Port: ${fd_port}
2460 Storage daemon Port: ${sd_port}
2462 Director User: ${dir_user}
2463 Director Group: ${dir_group}
2464 Storage Daemon User: ${sd_user}
2465 Storage DaemonGroup: ${sd_group}
2466 File Daemon User: ${fd_user}
2467 File Daemon Group: ${fd_group}
2469 SQL binaries Directory ${SQL_BINDIR}
2471 Large file support: $largefile_support
2472 Bacula conio support: ${got_conio} ${CONS_LIBS}
2473 readline support: ${got_readline} ${PRTREADLINE_SRC}
2474 TCP Wrappers support: ${TCPW_MSG} ${WRAPLIBS}
2475 TLS support: ${support_tls}
2476 Encryption support: ${support_crypto}
2477 ZLIB support: ${have_zlib}
2478 enable-smartalloc: ${support_smartalloc}
2479 enable-faketape: ${support_faketape}
2480 bat support: ${support_bat} ${QWT_LDFLAGS}
2481 enable-gnome: ${support_gnome} ${gnome_version}
2482 enable-bwx-console: ${support_wx_console} ${wx_version}
2483 enable-tray-monitor: ${support_tray_monitor}
2484 client-only: ${build_client_only}
2485 build-dird: ${build_dird}
2486 build-stored: ${build_stored}
2487 ACL support: ${have_acl}
2488 Python support: ${support_python} ${PYTHON_LIBS}
2489 Batch insert enabled: ${support_batch_insert}