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
279 if test x$support_bat = xyes; then
280 AC_MSG_CHECKING(for qwt support)
282 [ --with-qwt@<:@=DIR@:>@ specify qwt library directory],
289 if test -f ${with_qwt}/include/qwt.h; then
290 QWT_INC="${with_qwt}/include"
291 QWT_LDFLAGS="-L${with_qwt}/lib"
300 # Search in standard places, or --with-qwt not specified
302 if test $no_qwt = no; then
303 if test x$QWT_INC = x; then
304 for root in /usr /usr/local; do
305 for ver in qwt qwt5 qwt-qt4; do
306 if test -f ${root}/include/${ver}/qwt.h; then
307 QWT_INC="${root}/include/${ver}"
308 if test -d ${root}/lib64/; then
309 QWT_LDFLAGS="-L${root}/lib64"
311 QWT_LDFLAGS="-L${root}/lib"
322 if test x$QWT_INC = x; then
325 AC_DEFINE(HAVE_QWT, 1, [Set if bat QWT library found])
332 AC_SUBST(QWT_LDFLAGS)
337 # -------------------------------------------
338 # bwx-console (default off)
339 # -------------------------------------------
340 AC_ARG_ENABLE(bwx-console,
341 [ --enable-bwx-console enable build of wxWidgets console [disabled]],
342 [if test x$enableval = xyes; then
343 support_wx_console=yes
347 if test x$support_wx_console = xyes; then
348 abc=`$WXCONFIG $WXFLAGS --cppflags`
350 if test $pkg = 0; then
351 wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
352 WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
353 WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
355 AC_SUBST(WXCONS_CPPFLAGS)
356 AC_SUBST(WXCONS_LDFLAGS)
357 WX_DIR=src/wx-console
360 echo "wx-config program not found. bwx-console disabled."
362 support_wx_console=no
368 # -------------------------------------------
369 # tray-monitor (default off)
370 # -------------------------------------------
371 AC_ARG_ENABLE(tray-monitor,
372 [ --enable-tray-monitor enable build of Gnome tray monitor (compatible with KDE) [disabled]],
373 [if test x$enableval = xyes; then
374 support_tray_monitor=yes
378 if test x$support_tray_monitor = xyes; then
379 abc=`$PKGCONFIG --exists gtk+-2.0`
381 if test $pkg = 0; then
382 TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
383 TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
384 AC_SUBST(TRAY_MONITOR_CPPFLAGS)
385 AC_SUBST(TRAY_MONITOR_LDFLAGS)
386 TRAY_MONITOR_DIR=src/tray-monitor
387 abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
389 if test $pkg = 0; then
390 AC_DEFINE(HAVE_GTK_2_4, 1, [Set if you have GTK 4.2 or greater loaded])
394 AC_SUBST(TRAY_MONITOR_DIR)
396 # -------------------------------------------
397 # smartalloc (default off)
398 # -------------------------------------------
399 AC_ARG_ENABLE(smartalloc,
400 [ --enable-smartalloc enable smartalloc debugging support [disabled]],
401 [if test x$enableval = xno; then
402 support_smartalloc=no
405 if test x$support_smartalloc = xyes; then
406 AC_DEFINE(SMARTALLOC, 1, [Set if you want Smartalloc enabled])
409 # -------------------------------------------
410 # faketape (default off)
411 # -------------------------------------------
412 AC_ARG_ENABLE(faketape,
413 [ --enable-faketape enable faketape debugging support [disabled]],
414 [if test x$enableval = xyes; then
418 if test x$support_faketape = xyes; then
419 AC_DEFINE(USE_FAKETAPE, 1, [Set if you want faketape enabled])
422 # -------------------------------------------
423 # static-tools (default off)
424 # -------------------------------------------
425 AC_ARG_ENABLE(static-tools,
426 [ --enable-static-tools enable static tape tools [disabled]],
427 [if test x$enableval = xyes; then
428 support_static_tools=yes
432 if test x$support_static_tools = xyes; then
433 TTOOL_LDFLAGS="-static"
435 AC_SUBST(TTOOL_LDFLAGS)
437 # -------------------------------------------
438 # static-fd (default off)
439 # -------------------------------------------
440 AC_ARG_ENABLE(static-fd,
441 [ --enable-static-fd enable static File daemon [disabled]],
442 [if test x$enableval = xyes; then
443 support_static_fd=yes
447 if test x$support_static_fd = xyes; then
448 STATIC_FD="static-bacula-fd"
452 # -------------------------------------------
453 # static-sd (default off)
454 # -------------------------------------------
455 AC_ARG_ENABLE(static-sd,
456 [ --enable-static-sd enable static Storage daemon [disabled]],
457 [if test x$enableval = xyes; then
458 support_static_sd=yes
462 if test x$support_static_sd = xyes; then
463 STATIC_SD="static-bacula-sd"
467 # -------------------------------------------
468 # static-dir (default off)
469 # -------------------------------------------
470 AC_ARG_ENABLE(static-dir,
471 [ --enable-static-dir enable static Director [disabled]],
472 [if test x$enableval = xyes; then
473 support_static_dir=yes
477 if test x$support_static_dir = xyes; then
478 STATIC_DIR="static-bacula-dir"
482 # -------------------------------------------
483 # static-cons (default off)
484 # -------------------------------------------
485 AC_ARG_ENABLE(static-cons,
486 [ --enable-static-cons enable static Console [disabled]],
487 [if test x$enableval = xyes; then
488 support_static_cons=yes
494 if test x$support_static_cons = xyes; then
495 STATIC_CONS="static-bconsole"
496 STATIC_GNOME_CONS="static-bgnome-console"
497 STATIC_WX_CONS="static-bwx-console"
499 AC_SUBST(STATIC_CONS)
500 AC_SUBST(STATIC_GNOME_CONS)
501 AC_SUBST(STATIC_WX_CONS)
503 # -------------------------------------------
504 # client_only (default off)
505 # -------------------------------------------
506 AC_ARG_ENABLE(client-only,
507 [ --enable-client-only build client (File daemon) only [disabled]],
508 [if test x$enableval = xyes; then
509 build_client_only=yes
513 if test x$build_client_only = xno; then
520 # -------------------------------------------
521 # director (default on)
522 # -------------------------------------------
523 AC_ARG_ENABLE(build-dird,
524 [ --enable-build-dird enable building of dird (Director) [enabled]],
525 [if test x$enableval = xno; then
528 if test x$build_dird = xyes; then
533 DIR_TOOLS="NODIRTOOLS"
538 # -------------------------------------------
539 # stored (default on)
540 # -------------------------------------------
541 AC_ARG_ENABLE(build-stored,
542 [ --enable-build-stored enable building of stored (Storage daemon) [enabled]],
543 [if test x$enableval = xno; then
546 if test x$build_stored = xyes; then
547 STORED_DIR="src/stored"
553 # ---------------------------------------------------
554 # Check for conio (Bacula readline substitute)(
555 # ---------------------------------------------------
556 # this allows you to turn it completely off
558 [ --disable-conio disable conio support [enabled]
560 [if test x$enableval = xno; then
566 # ---------------------------------------------------
567 # Check for IPv6 support
568 # ---------------------------------------------------
569 # this allows you to turn it completely off
572 [ --enable-ipv6 enable ipv6 support [enabled]
574 [if test x$enableval = xno; then
579 if test x$support_ipv6 = xyes; then
580 AC_TRY_LINK([ #include <sys/types.h>
581 #include <sys/socket.h>
582 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
583 [support_ipv6=yes], [support_ipv6=no])
586 if test x$support_ipv6 = xyes; then
587 AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
593 if test x$support_conio = xyes; then
594 AC_CHECK_HEADER(termcap.h,
595 [ AC_CHECK_LIB(termcap, tgetent,
596 [ CONS_LIBS="-ltermcap"
601 AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
603 [ AC_CHECK_LIB(ncurses, tgetent,
604 [ CONS_LIBS="-lncurses"
609 AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
614 AC_CHECK_HEADERS(curses.h)
615 AC_CHECK_HEADER(term.h,
616 [ AC_CHECK_LIB(curses, tgetent,
617 [ CONS_LIBS="-lcurses"
622 AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
625 [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
634 # ---------------------------------------------------
635 # Check for readline support/directory (default off)
636 # ---------------------------------------------------
637 # this allows you to turn it completely off
638 AC_ARG_ENABLE(readline,
639 [ --disable-readline disable readline support [disable]
641 [if test x$enableval = xno; then
647 if test x$support_readline = xyes; then
648 AC_ARG_WITH(readline,
649 [ --with-readline@<:@=DIR@:>@ specify readline library directory],
651 case "$with_readline" in
654 if test -f ${with_readline}/readline.h; then
655 CONS_INC="-I${with_readline}"
656 CONS_LDFLAGS="-L$with_readline"
657 elif test -f ${with_readline}/include/readline/readline.h; then
658 CONS_INC="-I${with_readline}/include/readline"
659 CONS_LDFLAGS="-L${with_readline}/lib"
660 with_readline="${with_readline}/include/readline"
662 with_readline="/usr/include/readline"
664 AC_CHECK_HEADER(${with_readline}/readline.h,
665 [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
666 CONS_LIBS="-lreadline -lhistory -ltermcap"
670 echo "readline.h not found. readline turned off ..."
677 # check for standard readline library
678 AC_CHECK_HEADER(/usr/include/readline/readline.h,
679 [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
681 CONS_INC="-I/usr/include/readline"
682 CONS_LIBS="-lreadline -ltermcap"
684 # Did not find standard library, so try Bacula's default
685 AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h,
686 [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
688 CONS_INC="-I${TOP_DIR}/depkgs/readline"
689 CONS_LIBS="-lreadline -lhistory -ltermcap"
690 CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
691 PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
694 echo "readline.h not found. readline turned off ..."
710 AC_SUBST(CONS_LDFLAGS)
711 AC_SUBST(READLINE_SRC)
713 # Minimal stuff for readline Makefile configuration
718 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
719 AC_CHECK_FUNCS(nanosleep nl_langinfo)
720 AC_CHECK_HEADERS(varargs.h)
722 # End of readline/conio stuff
723 # -----------------------------------------------------------------------
725 # -----------------------------------------------------------------------
726 # Check for Python support
728 AC_MSG_CHECKING(for Python support)
731 --with-python@<:@=DIR@:>@ Include Python support. DIR is the Python base
732 install directory, default is to search through
733 a number of common places for the Python files.],
737 if test "$withval" != "no"; then
738 if test "$withval" = "yes"; then
739 for python_root in /usr /usr/local /usr/sfw; do
740 for ver in python2.2 python2.3 python2.4 python2.5; do
741 if test -f $python_root/include/${ver}/Python.h; then
742 PYTHON_INCDIR=-I$python_root/include/${ver}
743 if test -d $python_root/lib64/${ver}/config; then
744 PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
746 PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
752 if test x$PYTHON_INCDIR = x; then
753 if test -f $prefix/include/Python.h; then
754 PYTHON_INCDIR=-I$prefix/include
755 if test -d $prefix/lib64/config; then
756 PYTHON_LIBS="-L$prefix/lib64/config -lpython"
758 PYTHON_LIBS="-L$prefix/lib/config -lpython"
762 AC_MSG_ERROR(Unable to find Python.h in standard locations)
766 if test -f $withval/Python.h; then
767 PYTHON_INCDIR=-I$withval
768 PYTHON_LIBS="-L$withval/config -lpython"
769 elif test -f $withval/include/Python.h; then
770 PYTHON_INCDIR=-I$withval/include
771 if test -d $withval/lib64/config; then
772 PYTHON_LIBS="-L$withval/lib64/config -lpython"
774 PYTHON_LIBS="-L$withval/lib/config -lpython"
776 elif test -f $withval/include/python/Python.h; then
777 PYTHON_INCDIR=-I$withval/include/python
778 if test -d $withval/lib64/python/config; then
779 PYTHON_LIBS="-L$withval/lib64/python/config -lpython"
781 PYTHON_LIBS="-L$withval/lib/python/config -lpython"
785 AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
788 AC_DEFINE([HAVE_PYTHON], 1)
791 AC_MSG_NOTICE(checking for more Python libs)
792 saved_LIBS="$LIBS"; LIBS=
793 AC_SEARCH_LIBS(shm_open, [rt])
794 AC_CHECK_LIB(util, openpty)
795 PYTHON_LIBS="$PYTHON_LIBS $LIBS"
803 AC_SUBST(PYTHON_LIBS)
804 AC_SUBST(PYTHON_INCDIR)
807 # Find where sockets are (especially for Solaris)
808 # Do this before the TCP Wrappers test since tcp wrappers
809 # uses the socket library and some linkers are stupid.
811 AC_CHECK_FUNC(socket,
812 AC_MSG_RESULT(using libc's socket),
813 AC_CHECK_LIB(xnet,socket)
814 AC_CHECK_LIB(socket,socket)
815 AC_CHECK_LIB(inet,socket))
818 # -----------------------------------------------------------
819 # Check whether user wants TCP wrappers support (default off)
820 # -----------------------------------------------------------
823 AC_ARG_WITH(tcp-wrappers,
824 [ --with-tcp-wrappers@<:@=DIR@:>@ enable tcpwrappers support],
826 if test "x$withval" != "xno" ; then
828 LIBS="$saved_LIBS -lwrap"
829 AC_MSG_CHECKING(for libwrap)
830 AC_SEARCH_LIBS(nanosleep, [rt])
832 [ #include <sys/types.h>
834 int deny_severity = 0;
835 int allow_severity = 0;
836 struct request_info *req; ],
837 [ hosts_access(req); ],
840 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
845 LIBS="$saved_LIBS -lwrap -lnsl"
846 WRAPLIBS="$saved_LIBS -lwrap -lnsl"
848 [ #include <sys/types.h>
850 int deny_severity = 0;
851 int allow_severity = 0;
852 struct request_info *req; ],
853 [ hosts_access(req); ],
856 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
861 [AC_MSG_ERROR([*** libwrap missing]) ] ]
868 # -----------------------------------------------------------
869 # Check whether OpenSSL is available
870 # -----------------------------------------------------------
871 AC_MSG_CHECKING([for OpenSSL])
872 dnl The following uses quadrigraphs:
876 AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
877 [with_openssl_directory=${withval}])
879 if test "x$with_openssl_directory" != "x"; then
880 OPENSSL_LIBS="-lssl -lcrypto"
883 if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
884 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
885 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
889 saved_CFLAGS="${CFLAGS}"
890 LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
891 CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"
893 AC_TRY_LINK([ #include <openssl/ssl.h> ],
894 [ CRYPTO_set_id_callback(NULL); ],
902 AC_TRY_LINK([ #include <openssl/evp.h> ],
904 [ ac_cv_openssl_sha2="yes" ],
905 [ ac_cv_openssl_sha2="no" ]
908 # Solaris disables greater than 128+ bit encryption in their OpenSSL
909 # implementation, presumably for export reasons. If 192bit AES
910 # is available, we assume that we're running with a 'non-export'
912 AC_TRY_LINK([ #include <openssl/evp.h> ],
913 [ EVP_aes_192_cbc(); ],
914 [ ac_cv_openssl_export="no" ],
915 [ ac_cv_openssl_export="yes" ]
919 CFLAGS="${saved_CFLAGS}"
921 if test "$support_tls" = "yes"; then
922 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
923 AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
924 AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
927 if test "$ac_cv_openssl_sha2" = "yes"; then
928 AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
931 if test "$ac_cv_openssl_export" = "yes"; then
932 AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
941 AC_MSG_RESULT([$support_tls])
942 AC_SUBST(OPENSSL_LIBS)
943 AC_SUBST(OPENSSL_INC)
946 # -----------------------------------------------------------
947 # dlopen is needed for plugins
948 # -----------------------------------------------------------
949 AC_SEARCH_LIBS(dlopen, [dl])
951 # ------------------------------------------
952 # Where to place working dir
953 # ------------------------------------------
954 working_dir=`eval echo ${prefix}/var/bacula/working`
955 AC_ARG_WITH(working-dir,
956 [ --with-working-dir=PATH specify path of Bacula working directory],
958 if test "x$withval" != "xno" ; then
964 AC_SUBST(working_dir)
966 # ------------------------------------------------------------------
967 # If the user has not set archivedir, we set our default as /tmp
968 # ------------------------------------------------------------------
970 AC_ARG_WITH(archivedir,
971 [ --with-archivedir=PATH specify path of SD archive directory],
973 if test "x$withval" != "xno" ; then
983 # ------------------------------------------
984 # Where to place scriptdir (script files)
985 # ------------------------------------------
986 scriptdir=`eval echo ${sysconfdir}`
987 AC_ARG_WITH(scriptdir,
988 [ --with-scriptdir=PATH specify path of Bacula scripts directory],
990 if test "x$withval" != "xno" ; then
999 # ------------------------------------------
1000 # Where to send dump email
1001 # ------------------------------------------
1002 dump_email=root@localhost
1003 AC_ARG_WITH(dump-email,
1004 [ --with-dump-email=EMAIL dump email address],
1006 if test "x$withval" != "xno" ; then
1012 AC_SUBST(dump_email)
1014 # ------------------------------------------
1015 # Where to send job email
1016 # ------------------------------------------
1017 job_email=root@localhost
1018 AC_ARG_WITH(job-email,
1019 [ --with-job-email=EMAIL job output email address],
1021 if test "x$withval" != "xno" ; then
1029 # ------------------------------------------
1030 # Where to find smtp host
1031 # ------------------------------------------
1033 AC_ARG_WITH(smtp_host,
1034 [ --with-smtp-host=HOST SMTP mail host address],
1036 if test "x$withval" != "xno" ; then
1045 # ------------------------------------
1046 # Where to place pid files
1047 # ------------------------------------
1049 AC_ARG_WITH(pid-dir,
1050 [ --with-pid-dir=PATH specify location of Bacula pid files],
1052 if test "x$withval" != "xno" ; then
1058 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
1062 # ------------------------------------
1063 # Where to place subsys "lock file"
1064 # ------------------------------------
1065 subsysdir=/var/run/subsys
1066 if test -d /var/run/subsys; then
1067 subsysdir=/var/run/subsys
1068 elif test -d /var/lock/subsys; then
1069 subsysdir=/var/lock/subsys
1071 subsysdir=/var/run/subsys
1073 AC_ARG_WITH(subsys-dir,
1074 [ --with-subsys-dir=PATH specify location of Bacula subsys file],
1076 if test "x$withval" != "xno" ; then
1086 # ------------------------------------
1087 # Where to start assigning ports
1088 # ------------------------------------
1090 AC_ARG_WITH(baseport,
1091 [ --with-baseport=PORT specify base port address for daemons],
1093 if test "x$withval" != "xno" ; then
1100 dir_port=`expr $baseport`
1101 fd_port=`expr $baseport + 1`
1102 sd_port=`expr $fd_port + 1`
1109 # ------------------------------------------
1110 # Generate passwords
1111 # ------------------------------------------
1113 AC_ARG_WITH(dir-password,
1114 [ --with-dir-password=PASSWORD specify Director's password],
1116 if test "x$withval" != "xno" ; then
1117 dir_password=$withval
1122 if test "x$dir_password" = "x" ; then
1123 if test "x$OPENSSL" = "xnone" ; then
1124 key=`autoconf/randpass 33`
1126 key=`openssl rand -base64 33`
1132 AC_ARG_WITH(fd-password,
1133 [ --with-fd-password=PASSWORD specify Client's password],
1135 if test "x$withval" != "xno" ; then
1136 fd_password=$withval
1141 if test "x$fd_password" = "x" ; then
1142 if test "x$OPENSSL" = "xnone" ; then
1143 key=`autoconf/randpass 37`
1145 key=`openssl rand -base64 33`
1151 AC_ARG_WITH(sd-password,
1152 [ --with-sd-password=PASSWORD specify Storage daemon's password],
1154 if test "x$withval" != "xno" ; then
1155 sd_password=$withval
1160 if test "x$sd_password" = "x" ; then
1161 if test "x$OPENSSL" = "xnone" ; then
1162 key=`autoconf/randpass 41`
1164 key=`openssl rand -base64 33`
1170 AC_ARG_WITH(mon-dir-password,
1171 [ --with-mon-dir-password=PASSWORD specify Director's password used by the monitor],
1173 if test "x$withval" != "xno" ; then
1174 mon_dir_password=$withval
1179 if test "x$mon_dir_password" = "x" ; then
1180 if test "x$OPENSSL" = "xnone" ; then
1181 key=`autoconf/randpass 33`
1183 key=`openssl rand -base64 33`
1185 mon_dir_password=$key
1189 AC_ARG_WITH(mon-fd-password,
1190 [ --with-mon-fd-password=PASSWORD specify Client's password used by the monitor],
1192 if test "x$withval" != "xno" ; then
1193 mon_fd_password=$withval
1198 if test "x$mon_fd_password" = "x" ; then
1199 if test "x$OPENSSL" = "xnone" ; then
1200 key=`autoconf/randpass 37`
1202 key=`openssl rand -base64 33`
1204 mon_fd_password=$key
1208 AC_ARG_WITH(mon-sd-password,
1209 [ --with-mon-sd-password=PASSWORD specify Storage daemon's password used by the monitor],
1211 if test "x$withval" != "xno" ; then
1212 mon_sd_password=$withval
1217 if test "x$mon_sd_password" = "x" ; then
1218 if test "x$OPENSSL" = "xnone" ; then
1219 key=`autoconf/randpass 41`
1221 key=`openssl rand -base64 33`
1223 mon_sd_password=$key
1226 AC_SUBST(dir_password)
1227 AC_SUBST(fd_password)
1228 AC_SUBST(sd_password)
1229 AC_SUBST(mon_dir_password)
1230 AC_SUBST(mon_fd_password)
1231 AC_SUBST(mon_sd_password)
1234 # Pickup any database name
1237 AC_ARG_WITH(db_name,
1238 [ --with-db-name=DBNAME specify database name (default bacula)],
1240 if test "x$withval" != "x" ; then
1248 AC_ARG_WITH(db_user,
1249 [ --with-db-user=UNAME specify database user (default bacula)],
1251 if test "x$withval" != "x" ; then
1260 # Handle users and groups for each daemon
1263 AC_ARG_WITH(dir_user,
1264 [ --with-dir-user=USER specify user for Director daemon],
1266 if test "x$withval" != "x" ; then
1273 AC_ARG_WITH(dir_group,
1274 [ --with-dir-group=GROUP specify group for Director daemon],
1276 if test "x$withval" != "x" ; then
1283 AC_ARG_WITH(sd_user,
1284 [ --with-sd-user=USER specify user for Storage daemon],
1286 if test "x$withval" != "x" ; then
1293 AC_ARG_WITH(sd_group,
1294 [ --with-sd-group=GROUP specify group for Storage daemon],
1296 if test "x$withval" != "x" ; then
1303 AC_ARG_WITH(fd_user,
1304 [ --with-fd-user=USER specify user for File daemon],
1306 if test "x$withval" != "x" ; then
1313 AC_ARG_WITH(fd_group,
1314 [ --with-fd-group=GROUP specify group for File daemon],
1316 if test "x$withval" != "x" ; then
1330 # allow setting default executable permissions
1333 AC_ARG_WITH(sbin-perm,
1334 [ --with-sbin-perm=MODE specify permissions for sbin binaries (0754)],
1336 if test "x$withval" != "x" ; then
1344 # ------------------------------------------------
1345 # Bacula check for various SQL database engines
1346 # ------------------------------------------------
1348 BA_CHECK_POSTGRESQL_DB
1363 # -------------------------------------------
1364 # enable batch attribute DB insert (default on)
1365 # -------------------------------------------
1366 support_batch_insert=no
1367 A=`nm $SQL_LIB | grep pthread_mutex_lock`
1369 if test $pkg = 0; then
1370 support_batch_insert=yes
1371 AC_ARG_ENABLE(batch-insert,
1372 [ --enable-batch-insert enable the DB batch insert code [disabled]],
1373 [if test x$enableval = xno; then
1374 support_batch_insert=no
1376 support_batch_insert=yes
1380 # Check if postgresql support batch mode
1381 if test x$DB_TYPE = xpostgresql; then
1382 A=`nm $SQL_LIB | grep PQputCopyData`
1384 if test $pkg != 0; then
1385 support_batch_insert=no
1389 if test x$DB_TYPE = xdbi; then
1393 # Check for batch insert
1394 if test $DB_PROG = postgresql; then
1395 A=`nm $DB_PROG_LIB | grep PQputCopyData`
1399 if test $DB_PROG = mysql; then
1400 A=`nm $DB_PROG_LIB | grep pthread_mutex_lock`
1404 if test $pkg = 0; then
1405 AC_ARG_ENABLE(batch-insert,
1406 [ --enable-batch-insert enable the DB batch insert code [disabled]],
1407 [if test x$enableval = xno; then
1408 support_batch_insert=no
1410 support_batch_insert=yes
1415 if test $support_batch_insert = yes ; then
1416 AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
1420 AC_DEFINE(PROTOTYPES)
1422 dnl# --------------------------------------------------------------------------
1423 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1425 if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1426 if test -z "$CCOPTS"; then
1427 CCOPTS='-g -O2 -Wall'
1436 dnl See if we can use 64 bit file addresses
1437 largefile_support="no"
1443 dnl# --------------------------------------------------------------------------
1444 dnl# CHECKING FOR HEADER FILES
1445 dnl# --------------------------------------------------------------------------
1484 AC_STRUCT_ST_BLKSIZE
1488 dnl# --------------------------------------------------------------------------
1489 dnl# Check for utime.h structure
1490 dnl# --------------------------------------------------------------------------
1491 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1493 #include <sys/types.h>
1494 #include <utime.h>], [struct utimbuf foo],
1495 ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
1496 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])
1498 dnl# --------------------------------------------------------------------------
1499 dnl# Check for socklen_t
1500 dnl# --------------------------------------------------------------------------
1501 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1503 #include <sys/types.h>
1504 #include <sys/socket.h>],
1506 ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
1507 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
1509 dnl# --------------------------------------------------------------------------
1510 dnl# Check for bigendian
1511 dnl# --------------------------------------------------------------------------
1512 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
1514 [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
1515 [ba_cv_bigendian=yes],
1516 [ba_cv_bigendian=no],
1517 [ba_cv_bigendian=no])])
1518 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
1520 dnl# --------------------------------------------------------------------------
1521 dnl# Check for typeof()
1522 dnl# --------------------------------------------------------------------------
1524 AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
1526 [main(){char *a = 0; a = (typeof a)a;}],
1527 [ba_cv_have_typeof=yes],
1528 [ba_cv_have_typeof=no],
1529 [ba_cv_have_typeof=no])])
1530 test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
1536 dnl# --------------------------------------------------------------------------
1537 dnl# CHECKING FOR FILESYSTEM TYPE
1538 dnl# --------------------------------------------------------------------------
1539 AC_MSG_CHECKING(how to get filesystem type)
1541 # The order of these tests is important.
1542 AC_TRY_CPP([#include <sys/statvfs.h>
1543 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
1544 if test $fstype = no; then
1545 AC_TRY_CPP([#include <sys/statfs.h>
1546 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
1548 if test $fstype = no; then
1549 AC_TRY_CPP([#include <sys/statfs.h>
1550 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
1552 if test $fstype = no; then
1553 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
1555 if test $fstype = no; then
1556 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1558 if test $fstype = no; then
1559 AC_TRY_CPP([#include <sys/mount.h>
1560 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
1562 AC_MSG_RESULT($fstype)
1564 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
1566 dnl# --------------------------------------------------------------------------
1567 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
1568 dnl# --------------------------------------------------------------------------
1576 AC_CHECK_TYPE(ino_t, unsigned long)
1577 AC_CHECK_TYPE(dev_t, unsigned long)
1578 AC_CHECK_TYPE(daddr_t, long)
1579 AC_CHECK_TYPE(major_t, int)
1580 AC_CHECK_TYPE(minor_t, int)
1581 AC_CHECK_TYPE(ssize_t, int)
1588 AC_CHECK_SIZEOF(char, 1)
1589 AC_CHECK_SIZEOF(short int, 2)
1590 AC_CHECK_SIZEOF(int, 4)
1591 AC_CHECK_SIZEOF(long int, 4)
1592 AC_CHECK_SIZEOF(long long int, 8)
1593 AC_CHECK_SIZEOF(int *, 4)
1595 # Check for sys/types.h types
1596 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1598 [ #include <sys/types.h> ],
1600 [ ac_cv_have_u_int="yes" ],
1601 [ ac_cv_have_u_int="no" ]
1604 if test "x$ac_cv_have_u_int" = "xyes" ; then
1605 AC_DEFINE(HAVE_U_INT)
1609 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
1611 [ #include <sys/types.h> ],
1612 [ intmax_t a; a = 1;],
1613 [ ac_cv_have_intmax_t="yes" ],
1616 [ #include <stdint.h> ],
1617 [ intmax_t a; a = 1;],
1618 [ ac_cv_have_intmax_t="yes" ],
1619 [ ac_cv_have_intmax_t="no" ]
1625 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
1626 AC_DEFINE(HAVE_INTMAX_T)
1631 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
1633 [ #include <sys/types.h> ],
1634 [ u_intmax_t a; a = 1;],
1635 [ ac_cv_have_u_intmax_t="yes" ],
1638 [ #include <stdint.h> ],
1639 [ u_intmax_t a; a = 1;],
1640 [ ac_cv_have_u_intmax_t="yes" ],
1641 [ ac_cv_have_u_intmax_t="no" ]
1646 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
1647 AC_DEFINE(HAVE_U_INTMAX_T)
1652 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1654 [ #include <sys/types.h> ],
1655 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1656 [ ac_cv_have_intxx_t="yes" ],
1657 [ ac_cv_have_intxx_t="no" ]
1660 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1661 AC_DEFINE(HAVE_INTXX_T)
1665 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1667 [ #include <sys/types.h> ],
1668 [ int64_t a; a = 1;],
1669 [ ac_cv_have_int64_t="yes" ],
1670 [ ac_cv_have_int64_t="no" ]
1673 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1674 AC_DEFINE(HAVE_INT64_T)
1678 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1680 [ #include <sys/types.h> ],
1681 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1682 [ ac_cv_have_u_intxx_t="yes" ],
1683 [ ac_cv_have_u_intxx_t="no" ]
1686 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1687 AC_DEFINE(HAVE_U_INTXX_T)
1691 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1693 [ #include <sys/types.h> ],
1694 [ u_int64_t a; a = 1;],
1695 [ ac_cv_have_u_int64_t="yes" ],
1696 [ ac_cv_have_u_int64_t="no" ]
1699 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1700 AC_DEFINE(HAVE_U_INT64_T)
1704 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1705 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1707 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1709 [ #include <sys/bitypes.h> ],
1710 [ int8_t a; int16_t b; int32_t c;
1711 u_int8_t e; u_int16_t f; u_int32_t g;
1712 a = b = c = e = f = g = 1; ],
1713 [ AC_DEFINE(HAVE_U_INTXX_T)
1714 AC_DEFINE(HAVE_INTXX_T)
1715 AC_DEFINE(HAVE_SYS_BITYPES_H)
1716 AC_MSG_RESULT(yes) ],
1717 [ AC_MSG_RESULT(no)]
1721 if test -z "$have_u_intxx_t" ; then
1722 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1724 [ #include <sys/types.h> ],
1725 [ uint8_t a; uint16_t b;
1726 uint32_t c; a = b = c = 1; ],
1727 [ ac_cv_have_uintxx_t="yes" ],
1728 [ ac_cv_have_uintxx_t="no" ]
1731 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1732 AC_DEFINE(HAVE_UINTXX_T)
1736 if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
1737 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1739 AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
1741 [ #include <sys/bitypes.h> ],
1742 [ int64_t a; u_int64_t b;
1744 [ AC_DEFINE(HAVE_U_INT64_T)
1745 AC_DEFINE(HAVE_INT64_T)
1746 AC_MSG_RESULT(yes) ],
1747 [ AC_MSG_RESULT(no)]
1751 if (test -z "$have_uintxx_t" && \
1752 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1754 AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
1756 [ #include <sys/bitypes.h> ],
1757 [ uint8_t a; uint16_t b;
1758 uint32_t c; a = b = c = 1; ],
1759 [ AC_DEFINE(HAVE_UINTXX_T)
1760 AC_MSG_RESULT(yes) ],
1761 [ AC_MSG_RESULT(no)]
1769 dnl# --------------------------------------------------------------------------
1770 dnl# CHECKING FOR REQUIRED LIBRARY FUNCTIONS
1771 dnl# --------------------------------------------------------------------------
1787 [echo 'configure: cannot find needed function.'; exit 1]
1790 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1791 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1792 AC_CHECK_FUNCS(posix_fadvise)
1793 AC_CHECK_FUNCS(fdatasync)
1795 AC_CHECK_FUNCS(chflags)
1797 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
1799 AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
1802 void use_va_copy(va_list args){va_list args2; va_copy(args2,args); va_end(args2);}
1803 void call_use_va_copy(int junk,...){va_list args; va_start(args,junk); use_va_copy(args); va_end(args);}
1805 [call_use_va_copy(1,2,3)],
1806 ba_cv_va_copy=yes, ba_cv_va_copy=no)])
1807 test $ba_cv_va_copy = yes && AC_DEFINE(HAVE_VA_COPY, 1, [Set if va_copy exists])
1810 dnl# --------------------------------------------------------------------------
1811 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1812 dnl# --------------------------------------------------------------------------
1813 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1815 # If resolver functions are not in libc check for -lnsl or -lresolv.
1816 AC_CHECK_FUNC(gethostbyname_r,
1817 AC_MSG_RESULT(using libc's resolver),
1818 AC_CHECK_LIB(nsl,gethostbyname_r)
1819 AC_CHECK_LIB(resolv,gethostbyname_r))
1823 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1824 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
1825 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
1827 dnl ----------------------------
1828 dnl check sa_len of sockaddr
1829 dnl ----------------------------
1830 AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
1831 [AC_TRY_COMPILE([#include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
1832 ac_cv_struct_sockaddr_sa_len=yes, ac_cv_struct_sockaddr_sa_len=no)])
1834 if test $ac_cv_struct_sockaddr_sa_len = yes; then
1835 AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
1845 AC_FUNC_CLOSEDIR_VOID
1846 AC_FUNC_SETPGRP dnl check for BSD setpgrp.
1847 # AC_FUNC_FNMATCH dnl use local version
1850 AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
1853 AC_CHECK_LIB(sun, getpwnam)
1855 AC_CHECK_HEADERS(zlib.h)
1856 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1858 if test x$FDLIBS = x-lz; then
1859 AC_DEFINE(HAVE_LIBZ)
1864 # Check for ACL libraries
1867 AC_CHECK_HEADER(sys/acl.h)
1868 AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
1869 [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"],
1870 [AC_CHECK_LIB(sec, acltotext, [have_acl=yes; FDLIBS="-lsec $FDLIBS"])]
1873 if test $have_acl = yes; then
1877 dnl Check for pthread libraries
1879 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1880 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1881 [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1882 [AC_CHECK_FUNC(pthread_create)]
1893 if test x$have_gcc = xyes ; then
1894 CPPFLAGS="$CPPFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1895 CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1897 LDFLAGS=${LDFLAGS--O}
1898 DB_LIBS="${SQL_LFLAGS}"
1899 CPPFLAGS="$CPPFLAGS"
1912 AC_SUBST(X_EXTRA_LIBS)
1917 dnl# extra configurable objects
1928 # Finally we set appropriate distribution specific
1929 # variables and defaults
1931 # PFILES are platform specific files
1932 PFILES="platforms/Makefile"
1936 hostname=`uname -n | cut -d '.' -f 1`
1937 if test x${hostname} = x ; then
1938 hostname="localhost"
1943 PSCMD="ps -e -o pid,comm"
1945 platforms/aix/Makefile"
1946 TAPEDRIVE="/dev/rmt0.1"
1950 PTHREAD_LIB="-lpthread -lexc"
1951 if test "${CC}" = "gcc" ; then
1958 TAPEDRIVE="/dev/nrmt0"
1961 DISTVER=`uname -a |awk '{print $3}'`
1962 TAPEDRIVE="/dev/nrmt0"
1963 PTHREAD_LIB="-pthread"
1964 CFLAGS="${CFLAGS} -pthread"
1965 PSCMD="ps -ax -o pid,command"
1969 platforms/bsdi/Makefile \
1970 platforms/bsdi/bacula-fd \
1971 platforms/bsdi/bacula-sd \
1972 platforms/bsdi/bacula-dir"
1973 largefile_support="yes"
1976 DISTVER=`uname -a |awk '{print $3}'`
1977 TAPEDRIVE="/dev/nrst0"
1980 WLDFLAGS="-mwindows"
1984 TAPEDRIVE="/dev/nst0"
1985 PSCMD="ps -e -o pid,command"
1988 platforms/darwin/Makefile"
1991 if `grep -q ubuntu /etc/apt/sources.list`; then
1994 DISTVER=`cat /etc/debian_version`
1995 if test -f /etc/lsb-release ; then
1997 if test "x$DISTRIB_ID" != "x" ; then
1998 DISTNAME=$DISTRIB_ID
2000 if test "x$DISTRIB_RELEASE" != "x" ; then
2001 DISTVER=$DISTRIB_RELEASE
2004 if test "$DISTNAME" = "Ubuntu" ; then
2007 TAPEDRIVE="/dev/nst0"
2008 PSCMD="ps -e -o pid,command"
2009 if test "$DISTNAME" = "ubuntu" ; then
2011 platforms/ubuntu/Makefile \
2012 platforms/ubuntu/bacula-fd \
2013 platforms/ubuntu/bacula-sd \
2014 platforms/ubuntu/bacula-dir"
2017 platforms/debian/Makefile \
2018 platforms/debian/bacula-fd \
2019 platforms/debian/bacula-sd \
2020 platforms/debian/bacula-dir"
2024 DISTVER=`uname -a |awk '{print $3}'`
2025 VER=`echo $DISTVER | cut -c 1`
2026 if test x$VER = x4 ; then
2027 PTHREAD_LIB="${PTHREAD_LIBS:--pthread}"
2028 CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS:--pthread}"
2032 TAPEDRIVE="/dev/nrsa0"
2033 PSCMD="ps -ax -o pid,command"
2035 platforms/freebsd/Makefile \
2036 platforms/freebsd/bacula-fd \
2037 platforms/freebsd/bacula-sd \
2038 platforms/freebsd/bacula-dir"
2039 largefile_support="yes"
2042 PSCMD="UNIX95=1; ps -e -o pid,comm"
2043 CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
2045 TAPEDRIVE="/dev/rmt/0hnb"
2046 PTHREAD_LIB="-lpthread"
2047 AC_DEFINE([_INCLUDE_LONGLONG])
2051 TAPEDRIVE="/dev/rmt/0cbn"
2052 PSCMD="ps -e -o pid,comm"
2054 platforms/irix/Makefile \
2055 platforms/irix/bacula-fd \
2056 platforms/irix/bacula-sd \
2057 platforms/irix/bacula-dir"
2060 DISTVER=`uname -a |awk '{print $3}'`
2063 TAPEDRIVE="/dev/nrst0"
2064 PSCMD="ps -ax -o pid,command"
2065 PTHREAD_LIB="-pthread"
2066 CFLAGS="${CFLAGS} -pthread"
2069 DISTVER=`uname -a |awk '{print $3}'`
2072 TAPEDRIVE="/dev/nrst0"
2073 PSCMD="ps -ax -o pid,command"
2074 PTHREAD_LIB="-pthread"
2075 CFLAGS="${CFLAGS} -pthread"
2077 platforms/openbsd/Makefile \
2078 platforms/openbsd/bacula-fd \
2079 platforms/openbsd/bacula-sd \
2080 platforms/openbsd/bacula-dir"
2083 if test -f /etc/whitebox-release ; then
2084 f=/etc/whitebox-release
2086 f=/etc/redhat-release
2088 if test `cat $f | grep release |\
2089 cut -f 3 -d ' '`x = "Enterprise"x ; then
2090 DISTVER="Enterprise "`cat $f | grep release |\
2093 DISTVER=`cat /etc/redhat-release | grep release |\
2096 TAPEDRIVE="/dev/nst0"
2097 PSCMD="ps -e -o pid,command"
2099 platforms/redhat/Makefile \
2100 platforms/redhat/bacula-fd \
2101 platforms/redhat/bacula-sd \
2102 platforms/redhat/bacula-dir \
2103 platforms/redhat/bacula.spec \
2107 DISTVER=`cat /etc/mandrake-release | grep release |\
2109 TAPEDRIVE="/dev/nst0"
2110 PSCMD="ps -e -o pid,command"
2112 platforms/mandrake/Makefile \
2113 platforms/mandrake/bacula-fd \
2114 platforms/mandrake/bacula-sd \
2115 platforms/mandrake/bacula-dir \
2116 platforms/mandrake/bacula.spec \
2120 DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
2121 TAPEDRIVE="/dev/nst0"
2122 PSCMD="ps -e -o pid,command"
2124 platforms/gentoo/Makefile \
2125 platforms/gentoo/bacula-init \
2126 platforms/gentoo/bacula-fd \
2127 platforms/gentoo/bacula-sd \
2128 platforms/gentoo/bacula-dir"
2131 DISTVER=`cat /etc/slackware-version`
2132 TAPEDRIVE="/dev/nst0"
2133 PSCMD="ps -e -o pid,command"
2135 platforms/slackware/Makefile \
2136 platforms/slackware/rc.bacula-fd \
2137 platforms/slackware/rc.bacula-sd \
2138 platforms/slackware/rc.bacula-dir\
2139 platforms/slackware/functions.bacula"
2143 TAPEDRIVE="/dev/rmt/0cbn"
2144 PSCMD="ps -e -o pid,comm"
2146 platforms/solaris/Makefile \
2147 platforms/solaris/bacula-fd \
2148 platforms/solaris/bacula-sd \
2149 platforms/solaris/bacula-dir"
2150 if test x$DISTVER = x5.6 ; then
2151 AC_DEFINE(HAVE_OLD_SOCKOPT)
2153 LIBS="$LIBS -lresolv"
2156 DISTVER=`cat /etc/SuSE-release |grep VERSION|\
2158 TAPEDRIVE="/dev/nst0"
2159 PSCMD="ps -e -o pid,command"
2161 platforms/suse/Makefile \
2162 platforms/suse/bacula-fd \
2163 platforms/suse/bacula-sd \
2164 platforms/suse/bacula-dir \
2165 platforms/suse/bacula \
2166 platforms/suse/bacula.spec"
2171 TAPEDRIVE="/dev/nst0"
2172 PSCMD="ps -e -o pid,command"
2174 platforms/suse/Makefile \
2175 platforms/suse/bacula-fd \
2176 platforms/suse/bacula-sd \
2177 platforms/suse/bacula-dir"
2181 TAPEDRIVE="/dev/nst0"
2184 echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
2190 LIBS="$PTHREAD_LIB $LIBS"
2192 AC_DEFINE_UNQUOTED(lld, "$lld")
2193 AC_DEFINE_UNQUOTED(llu, "$llu")
2201 dnl# common parts of the Makefile
2202 MCOMMON=./autoconf/Make.common
2203 AC_SUBST_FILE(MCOMMON)
2206 if test "x${subsysdir}" = "x${sbindir}" ; then
2209 echo "You have set both --sbindir and --with-subsys-dir"
2210 echo " equal to: ${subsysdir} "
2211 echo "This is not permitted. Please reconfigure."
2213 echo "Aborting configuration ..."
2219 AC_OUTPUT([autoconf/Make.common \
2222 scripts/startmysql \
2224 scripts/btraceback \
2230 scripts/bacula-ctl-dir \
2231 scripts/bacula-ctl-fd \
2232 scripts/bacula-ctl-sd \
2233 scripts/devel_bacula \
2236 scripts/bacula.desktop.gnome1 \
2237 scripts/bacula.desktop.gnome2 \
2238 scripts/bacula.desktop.gnome1.consolehelper \
2239 scripts/bacula.desktop.gnome2.consolehelper \
2240 scripts/bacula.desktop.gnome1.xsu \
2241 scripts/bacula.desktop.gnome2.xsu \
2242 scripts/bgnome-console.console_apps \
2243 scripts/mtx-changer \
2244 scripts/disk-changer \
2245 scripts/dvd-handler \
2246 scripts/dvd-simulator \
2247 scripts/bacula-tray-monitor.desktop \
2248 scripts/logwatch/Makefile \
2249 scripts/logwatch/logfile.bacula.conf \
2250 scripts/wxconsole.console_apps \
2251 scripts/wxconsole.desktop.consolehelper \
2252 scripts/wxconsole.desktop.xsu \
2253 scripts/bat.desktop \
2254 scripts/bat.desktop.xsu \
2255 scripts/bat.desktop.consolehelper \
2256 scripts/bat.console_apps \
2259 src/console/Makefile \
2260 src/console/bconsole.conf \
2261 src/gnome2-console/Makefile \
2262 src/gnome2-console/bgnome-console.conf \
2263 src/qt-console/bat.conf \
2264 src/qt-console/bat.pro \
2265 src/qt-console/install_conf_file \
2266 src/wx-console/Makefile \
2267 src/wx-console/bwx-console.conf \
2268 src/tray-monitor/Makefile \
2269 src/tray-monitor/tray-monitor.conf \
2271 src/dird/bacula-dir.conf \
2273 src/stored/Makefile \
2274 src/stored/bacula-sd.conf \
2275 src/filed/Makefile \
2276 src/filed/bacula-fd.conf \
2278 src/cats/make_catalog_backup \
2279 src/cats/delete_catalog_backup \
2280 src/cats/create_postgresql_database \
2281 src/cats/update_postgresql_tables \
2282 src/cats/make_postgresql_tables \
2283 src/cats/grant_postgresql_privileges \
2284 src/cats/drop_postgresql_tables \
2285 src/cats/drop_postgresql_database \
2286 src/cats/create_mysql_database \
2287 src/cats/update_mysql_tables \
2288 src/cats/make_mysql_tables \
2289 src/cats/grant_mysql_privileges \
2290 src/cats/drop_mysql_tables \
2291 src/cats/drop_mysql_database \
2292 src/cats/create_sqlite_database \
2293 src/cats/update_sqlite_tables \
2294 src/cats/make_sqlite_tables \
2295 src/cats/grant_sqlite_privileges \
2296 src/cats/drop_sqlite_tables \
2297 src/cats/drop_sqlite_database \
2298 src/cats/create_sqlite3_database \
2299 src/cats/update_sqlite3_tables \
2300 src/cats/make_sqlite3_tables \
2301 src/cats/grant_sqlite3_privileges \
2302 src/cats/drop_sqlite3_tables \
2303 src/cats/drop_sqlite3_database \
2306 src/cats/create_bdb_database \
2307 src/cats/update_bdb_tables \
2308 src/cats/make_bdb_tables \
2309 src/cats/grant_bdb_privileges \
2310 src/cats/drop_bdb_tables \
2311 src/cats/drop_bdb_database \
2312 src/cats/create_bacula_database \
2313 src/cats/update_bacula_tables \
2314 src/cats/grant_bacula_privileges \
2315 src/cats/make_bacula_tables \
2316 src/cats/drop_bacula_tables \
2317 src/cats/drop_bacula_database \
2318 src/findlib/Makefile \
2319 src/tools/Makefile \
2321 updatedb/update_mysql_tables_10_to_11 \
2322 updatedb/update_sqlite3_tables_10_to_11 \
2323 updatedb/update_postgresql_tables_10_to_11 \
2324 updatedb/update_sqlite_tables_10_to_11 \
2329 if test "${support_bat}" = "yes" ; then
2330 if test "x$QMAKE" = "xnone" && test "x$QMAKEQT4" = "xnone"; then
2331 echo "Could not find qmake or qmake-qt4 in $PATH. Check your Qt installation"
2337 if test "x$QMAKEQT4" != "xnone"; then
2342 chmod 755 install_conf_file build-depkgs-qt-console
2343 echo "Creating bat Makefile"
2349 # configure and prepare libtokyodbm for bacula
2350 pushd src/lib/tokyocabinet > /dev/null
2352 if test x$largefile_support = xyes; then
2353 tcdbm_opt=--enable-off64
2355 ./configure $tcdbm_opt
2357 # need tokyo header files for "make depend"
2358 cp src/lib/tokyocabinet/t*.h src/lib
2360 echo "Doing make of dependencies"
2361 ${MAKE:-make} depend
2364 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
2365 chmod 755 dvd-handler dvd-simulator
2366 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
2370 chmod 755 $c/update_mysql_tables_10_to_11 $c/update_sqlite3_tables_10_to_11
2371 chmod 755 $c/update_postgresql_tables_10_to_11 $c/update_sqlite_tables_10_to_11
2375 chmod 755 $c/create_bacula_database $c/update_bacula_tables $c/make_bacula_tables
2376 chmod 755 $c/grant_bacula_privileges $c/drop_bacula_tables $c/drop_bacula_database
2378 chmod 755 $c/create_bdb_database $c/update_bdb_tables $c/make_bdb_tables
2379 chmod 755 $c/grant_bdb_privileges $c/drop_bdb_tables $c/drop_bdb_database
2381 chmod 755 $c/create_mysql_database $c/update_mysql_tables $c/make_mysql_tables
2382 chmod 755 $c/grant_mysql_privileges $c/drop_mysql_tables $c/drop_mysql_database
2384 chmod 755 $c/create_sqlite_database $c/update_sqlite_tables $c/make_sqlite_tables
2385 chmod 755 $c/grant_sqlite_privileges $c/drop_sqlite_tables $c/drop_sqlite_database
2387 chmod 755 $c/create_sqlite3_database $c/update_sqlite3_tables $c/make_sqlite3_tables
2388 chmod 755 $c/grant_sqlite3_privileges $c/drop_sqlite3_tables $c/drop_sqlite3_database
2390 chmod 755 $c/create_postgresql_database $c/update_postgresql_tables $c/make_postgresql_tables
2391 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables $c/drop_postgresql_database
2393 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup
2397 chmod 755 src/win32/build-depkgs-mingw32
2401 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
2402 largefile_support="yes"
2406 # A whole lot of hand springs to get the compiler version.
2407 # This is because gcc changed the output in version 3.0
2409 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2410 if test "x${CCVERSION}" = "x" ; then
2411 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2413 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2414 if test x"${CXXVERSION}" = x ; then
2415 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2418 if test "x${subsysdir}" = "x${sbindir}" ; then
2421 echo "You have set --sbindir and --with-subsys-dir"
2422 echo " both equal to: ${subsysdir} "
2423 echo " This is not permitted. Please reconfigure."
2425 echo "Aborting configuration ..."
2431 if test "x${db_type}" = "xInternal" ; then
2434 echo "You have not specified either --enable-client-only or one of the"
2435 echo " supported databases: MySQL, PostgreSQL, SQLite3, SQLite or DBI."
2436 echo " This is not permitted. Please reconfigure."
2438 echo "Aborting the configuration ..."
2445 Configuration on `date`:
2447 Host: $host -- ${DISTNAME} ${DISTVER}
2448 Bacula version: ${VERSION} (${DATE})
2449 Source code location: ${srcdir}
2450 Install binaries: ${sbindir}
2451 Install config files: ${sysconfdir}
2452 Scripts directory: ${scriptdir}
2453 Archive directory: ${archivedir}
2454 Working directory: ${working_dir}
2455 PID directory: ${piddir}
2456 Subsys directory: ${subsysdir}
2457 Man directory: ${mandir}
2458 Data directory: ${datadir}
2459 C Compiler: ${CC} ${CCVERSION}
2460 C++ Compiler: ${CXX} ${CXXVERSION}
2461 Compiler flags: ${WCFLAGS} ${CFLAGS}
2462 Linker flags: ${WLDFLAGS} ${LDFLAGS}
2464 Statically Linked Tools: ${support_static_tools}
2465 Statically Linked FD: ${support_static_fd}
2466 Statically Linked SD: ${support_static_sd}
2467 Statically Linked DIR: ${support_static_dir}
2468 Statically Linked CONS: ${support_static_cons}
2469 Database type: ${db_type}
2470 Database lib: ${DB_LIBS}
2471 Database name: ${db_name}
2472 Database user: ${db_user}
2474 Job Output Email: ${job_email}
2475 Traceback Email: ${dump_email}
2476 SMTP Host Address: ${smtp_host}
2478 Director Port: ${dir_port}
2479 File daemon Port: ${fd_port}
2480 Storage daemon Port: ${sd_port}
2482 Director User: ${dir_user}
2483 Director Group: ${dir_group}
2484 Storage Daemon User: ${sd_user}
2485 Storage DaemonGroup: ${sd_group}
2486 File Daemon User: ${fd_user}
2487 File Daemon Group: ${fd_group}
2489 SQL binaries Directory ${SQL_BINDIR}
2491 Large file support: $largefile_support
2492 Bacula conio support: ${got_conio} ${CONS_LIBS}
2493 readline support: ${got_readline} ${PRTREADLINE_SRC}
2494 TCP Wrappers support: ${TCPW_MSG} ${WRAPLIBS}
2495 TLS support: ${support_tls}
2496 Encryption support: ${support_crypto}
2497 ZLIB support: ${have_zlib}
2498 enable-smartalloc: ${support_smartalloc}
2499 enable-faketape: ${support_faketape}
2500 bat support: ${support_bat} ${QWT_LDFLAGS}
2501 enable-gnome: ${support_gnome} ${gnome_version}
2502 enable-bwx-console: ${support_wx_console} ${wx_version}
2503 enable-tray-monitor: ${support_tray_monitor}
2504 client-only: ${build_client_only}
2505 build-dird: ${build_dird}
2506 build-stored: ${build_stored}
2507 ACL support: ${have_acl}
2508 Python support: ${support_python} ${PYTHON_LIBS}
2509 Batch insert enabled: ${support_batch_insert}