]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
c1a29bfd99c0ec434dc57782bbfb0740916baf1e
[bacula/bacula] / bacula / autoconf / configure.in
1 lal#
2 dnl#
3 dnl# Process this file with autoconf to produce a configure script.
4 dnl#
5 AC_INIT(src/version.h)
6 BUILD_DIR=`pwd`
7 cd ..
8 TOP_DIR=`pwd`
9 cd ${BUILD_DIR}
10 AC_SUBST(BUILD_DIR)
11 AC_SUBST(TOP_DIR)
12 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
13 AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in)
14
15 dnl require a recent autoconf
16 AC_PREREQ(2.59)
17
18
19 dnl search for true and false programs.
20 AC_PATH_PROGS(TRUEPRG, true, :)
21 AC_PATH_PROGS(FALSEPRG, false, :)
22
23
24 dnl bacula version
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`
28 AC_SUBST(VERSION)dnl 
29 AC_SUBST(DATE)dnl 
30 AC_SUBST(LSMDATE)dnl 
31 echo "configuring for bacula $VERSION ($DATE)"
32
33
34 dnl -------------------------------------------------------
35 dnl# Check for compiler.
36 dnl ------------------------------------------------------
37
38 AC_PROG_CC
39 AC_PROG_CXX
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.
42
43 BASECC=`basename $CC`
44 have_gcc=no
45 if test "x$BASECC" = xgcc; then
46    AC_DEFINE(HAVE_GCC)
47    have_gcc=yes
48 fi
49 AC_PATH_PROG(CXX, $CXX, $CXX)
50 if test ! -e $CXX; then
51    AC_MSG_ERROR(Unable to find C++ compiler)
52 fi
53
54 dnl -------------------------------------------------------
55 dnl# Check for programs.
56 dnl ------------------------------------------------------
57 AC_PROG_INSTALL
58 AC_PROG_RANLIB
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_ARG_VAR(WXCONFIG, [wx-config command. On some systems, you must set it to wx-config-2.6 to use wxWidgets 2.6.])
78 if test "x$WXCONFIG" = x; then
79   WXCONFIG=wx-config
80 fi
81 AC_PATH_PROG(WXCONFIG, ${WXCONFIG}, ${WXCONFIG})
82 AC_ARG_VAR(WXFLAGS, [Parameters to pass to wx-config (e.g. --unicode=no).])
83 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
84 AC_PATH_PROG(PIDOF, pidof, pidof)
85 AC_PROG_AWK
86 # Some AWK programs fail, so test it and warn the user
87 if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 } 
88       { if ((prog == $2) || (("(" prog ")") == $2) ||
89            (("[" prog "]") == $2) ||
90            ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
91 else
92   AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
93    The regex engine of $AWK is too broken to be used you 
94    might want to install GNU AWK.
95    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
96 fi
97 THE_AWK=$AWK
98 AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
99
100
101 test -n "$ARFLAG" || ARFLAGS="cr"
102 AC_SUBST(ARFLAGS)
103
104 MAKE_SHELL=/bin/sh
105 AC_SUBST(MAKE_SHELL)
106
107 AC_SUBST(LOCAL_LIBS)
108 AC_SUBST(LOCAL_CFLAGS)
109 AC_SUBST(LOCAL_LDFLAGS)
110 AC_SUBST(LOCAL_DEFS)
111
112 dnl --------------------------------------------------
113 dnl Bacula OP Sys determination (see aclocal.m4)
114 dnl --------------------------------------------------
115 BA_CHECK_OPSYS
116
117 # -----------------------------------------------------------
118 dnl Bacula OPSys Distribution determination (see aclocal.m4)
119 # ----------------------------------------------------------
120 BA_CHECK_OPSYS_DISTNAME
121
122 # --------------------------------------------------
123 # Suppport for gettext (translations)
124 # By default, $datadir is ${prefix}/share
125 # --------------------------------------------------
126 AM_GNU_GETTEXT([external])
127 if test x${prefix} = xNONE ; then
128    if test `eval echo ${datadir}` = NONE/share ; then
129       datadir=/usr/share
130    fi
131 fi
132
133 # ------------------------------------------------------------------
134 #  If the user has not set --prefix, we set our default to nothing.
135 #  In this case, if the user has not set --sysconfdir, we set it
136 #  to the package default of /etc/bacula.  If either --prefix or
137 #  --sysconfdir is set, we leave sysconfdir alone except to eval it.
138 # ------------------------------------------------------------------
139 if test x${prefix} = xNONE ; then
140     if test `eval echo ${sysconfdir}` = NONE/etc ; then
141         sysconfdir=/etc/bacula
142     fi
143     prefix=
144 fi
145 sysconfdir=`eval echo ${sysconfdir}`
146 datadir=`eval echo ${datadir}`
147 localedir=`eval echo ${datadir}/locale`
148 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir") 
149 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
150
151 # -------------------------------------------------------------------------
152 #  If the user has not set --exec-prefix, we default to ${prefix}
153 # -------------------------------------------------------------------------
154 if test x${exec_prefix} = xNONE ; then
155     exec_prefix=${prefix}
156 fi
157
158 # ------------------------------------------------------------------
159 # If the user has not set --sbindir, we set our default as /sbin
160 # ------------------------------------------------------------------
161 if test x$sbindir = x'${exec_prefix}/sbin' ; then
162     sbindir=${exec_prefix}/sbin
163 fi
164 sbindir=`eval echo ${sbindir}`
165
166 # -------------------------------------------------------------------------
167 #  If the user has not set --mandir, we default to /usr/share/man
168 # -------------------------------------------------------------------------
169 if test x$mandir = x'${prefix}/man' ; then
170    mandir=/usr/share/man
171 fi
172
173                       
174 AC_PATH_PROGS(MSGFMT, msgfmt, no)
175 if test "$MSGFMT" = "no"
176 then
177    echo 'msgfmt program not found, disabling NLS !'
178    USE_NLS=no
179    USE_INCLUDED_LIBINTL=no
180 #else
181     AM_GNU_GETTEXT
182 fi
183
184
185 support_mysql=no
186 support_sqlite=no
187 support_sqlite3=no
188 support_postgresql=no
189 support_smartalloc=yes
190 support_readline=yes
191 support_conio=yes
192 support_gnome=no
193 support_bat=no
194 support_wx_console=no
195 support_tls=no
196 support_crypto=no
197 gnome_version=
198 wx_version=
199 support_static_tools=no
200 support_static_fd=no
201 support_static_sd=no
202 support_static_dir=no
203 support_static_cons=no
204 support_python=no
205 build_client_only=no
206 build_dird=yes
207 build_stored=yes
208 cats=
209 db_type=Internal
210 DB_TYPE=bdb
211
212 dnl# --------------------------------------------------------------------------
213 dnl# CHECKING COMMAND LINE OPTIONS
214 dnl# --------------------------------------------------------------------------
215
216 # -------------------------------------------
217 # gnome (default off)
218 # -------------------------------------------
219 AC_ARG_ENABLE(gnome,
220   [  --enable-gnome       enable build of bgnome-console GUI [disabled]],
221   [if test x$enableval = xyes; then
222     support_gnome=yes
223   fi])
224
225 GNOME_DIR=
226 if test x$support_gnome = xyes; then
227   abc=`$PKGCONFIG --exists libgnomeui-2.0`
228   pkg=$?
229   if test $pkg = 0; then
230      GNOME_INCLUDEDIR=`$PKGCONFIG --cflags-only-I libgnomeui-2.0`
231      GNOMEUI_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
232      GNOME_LIBDIR=`$PKGCONFIG --libs libgnomeui-2.0`
233      GNOME_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
234      AC_SUBST(GNOME_INCLUDEDIR)
235      AC_SUBST(GNOMEUI_LIBS)
236      AC_SUBST(GNOME_LIBDIR)
237      AC_SUBST(GNOME_LIBS)
238      GNOME_DIR=src/gnome2-console
239      gnome_version="Version 2.x"
240   else
241      AC_MSG_ERROR(Unable to find Gnome 2 installation)
242   fi
243 fi
244 AC_SUBST(GNOME_DIR)
245
246 # -------------------------------------------
247 # bat (default off)
248 # -------------------------------------------
249 AC_ARG_ENABLE(bat,
250   [  --enable-bat       enable build of bat Qt4 GUI [disabled]],
251   [if test x$enableval = xyes; then
252     AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4 GUI support enabled]) 
253     support_bat=yes
254   fi])
255
256 BAT_DIR=
257 if test x$support_bat = xyes; then
258   abc=`$PKGCONFIG --atleast-version=4.2 QtGui`
259   pkg=$?
260   if test $pkg = 0; then
261      BAT_DIR=src/qt-console
262   else
263      AC_MSG_ERROR(Unable to find Qt4 installation needed by bat)
264   fi
265 fi
266
267
268 #  If bat is enabled, we need the qwt library
269 got_qwt=no
270 QWT_INC=
271 QWT_LDFLAGS=
272 if test x$support_bat = xyes; then
273    AC_MSG_CHECKING(for qwt support)
274    AC_ARG_WITH(qwt,
275      [ --with-qwt@<:@=DIR@:>@             specify qwt library directory],
276      [
277         case "$with_qwt" in
278         no)
279           ;;
280         yes|*)
281           if test -f ${with_qwt}/include/qwt.h; then
282              QWT_INC="${with_qwt}/include"
283              QWT_LDFLAGS="-L${with_qwt}/lib"
284           fi
285           ;;
286         esac
287      ]   
288    )
289 #
290 # Search in standard places, or --with-qwt not specified
291 #
292    if test x$QWT_INC = x; then
293       for root in /usr /usr/local; do
294          for ver in qwt qwt5; do
295             if test -f ${root}/include/${ver}/qwt.h; then
296                QWT_INC="${root}/include/${ver}"
297                if test -d ${root}/lib64/; then
298                   QWT_LDFLAGS="-L${root}/lib64"
299                else
300                   QWT_LDFLAGS="-L${root}/lib"
301                fi
302                got_qwt=yes
303                break;
304             fi
305          done
306       done
307    fi
308    if test x$QWT_INC = x; then
309       AC_MSG_RESULT(no)
310       AC_MSG_ERROR(Unable to find qwt package needed by bat)
311       BAT_DIR=
312       support_bat=no
313    else
314       AC_MSG_RESULT(yes)
315    fi
316 fi
317
318 AC_SUBST(BAT_DIR)
319 AC_SUBST(QWT_INC)
320 AC_SUBST(QWT_LDFLAGS)
321
322
323 # -------------------------------------------
324 # bwx-console (default off)
325 # -------------------------------------------
326 AC_ARG_ENABLE(bwx-console,
327   [  --enable-bwx-console     enable build of wxWidgets console [disabled]],
328   [if test x$enableval = xyes; then
329     support_wx_console=yes
330   fi])
331
332 WX_DIR=
333 if test x$support_wx_console = xyes; then
334   abc=`$WXCONFIG $WXFLAGS --cppflags`
335   pkg=$?
336   if test $pkg = 0; then
337      wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
338      WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
339      WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
340
341      AC_SUBST(WXCONS_CPPFLAGS)
342      AC_SUBST(WXCONS_LDFLAGS)
343      WX_DIR=src/wx-console
344   else
345      echo " "
346      echo "wx-config program not found. bwx-console disabled."
347      echo " "
348      support_wx_console=no
349   fi
350 fi
351 AC_SUBST(WX_DIR)
352
353
354 # -------------------------------------------
355 # tray-monitor (default off)
356 # -------------------------------------------
357 AC_ARG_ENABLE(tray-monitor,
358   [  --enable-tray-monitor   enable build of Gnome tray monitor (compatible with KDE) [disabled]],
359   [if test x$enableval = xyes; then
360     support_tray_monitor=yes
361   fi])
362
363 TRAY_MONITOR_DIR=
364 if test x$support_tray_monitor = xyes; then
365   abc=`$PKGCONFIG --exists gtk+-2.0`
366   pkg=$?
367   if test $pkg = 0; then
368      TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
369      TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
370      AC_SUBST(TRAY_MONITOR_CPPFLAGS)
371      AC_SUBST(TRAY_MONITOR_LDFLAGS)
372      TRAY_MONITOR_DIR=src/tray-monitor
373      abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
374      pkg=$?
375      if test $pkg = 0; then
376         AC_DEFINE(HAVE_GTK_2_4, 1, [Set if you have GTK 4.2 or greater loaded])
377      fi
378   fi
379 fi
380 AC_SUBST(TRAY_MONITOR_DIR)
381
382 # -------------------------------------------
383 # smartalloc (default off)
384 # -------------------------------------------
385 AC_ARG_ENABLE(smartalloc,
386   [  --enable-smartalloc     enable smartalloc debugging support [disabled]],
387   [if test x$enableval = xno; then
388     support_smartalloc=no
389   fi])
390
391 if test x$support_smartalloc = xyes; then
392    AC_DEFINE(SMARTALLOC, 1, [Set if you want Smartalloc enabled])
393 fi
394
395 # -------------------------------------------
396 # static-tools (default off)
397 # -------------------------------------------
398 AC_ARG_ENABLE(static-tools,
399    [  --enable-static-tools   enable static tape tools [disabled]],
400    [if test x$enableval = xyes; then
401      support_static_tools=yes
402    fi])
403
404 TTOOL_LDFLAGS=
405 if test x$support_static_tools = xyes; then
406    TTOOL_LDFLAGS="-static"
407 fi
408 AC_SUBST(TTOOL_LDFLAGS)
409
410 # -------------------------------------------
411 # static-fd    (default off)
412 # -------------------------------------------
413 AC_ARG_ENABLE(static-fd,
414    [  --enable-static-fd      enable static File daemon [disabled]],
415    [if test x$enableval = xyes; then
416      support_static_fd=yes
417    fi])
418
419 STATIC_FD=
420 if test x$support_static_fd = xyes; then
421    STATIC_FD="static-bacula-fd"
422 fi
423 AC_SUBST(STATIC_FD)
424
425 # -------------------------------------------
426 # static-sd    (default off)
427 # -------------------------------------------
428 AC_ARG_ENABLE(static-sd,
429    [  --enable-static-sd      enable static Storage daemon [disabled]],
430    [if test x$enableval = xyes; then
431      support_static_sd=yes
432    fi])
433
434 STATIC_SD=
435 if test x$support_static_sd = xyes; then
436    STATIC_SD="static-bacula-sd"
437 fi
438 AC_SUBST(STATIC_SD)
439
440 # -------------------------------------------
441 # static-dir   (default off)
442 # -------------------------------------------
443 AC_ARG_ENABLE(static-dir,
444    [  --enable-static-dir     enable static Director [disabled]],
445    [if test x$enableval = xyes; then
446      support_static_dir=yes
447    fi])
448
449 STATIC_DIR=
450 if test x$support_static_dir = xyes; then
451    STATIC_DIR="static-bacula-dir"
452 fi
453 AC_SUBST(STATIC_DIR)
454
455 # -------------------------------------------
456 # static-cons  (default off)
457 # -------------------------------------------
458 AC_ARG_ENABLE(static-cons,
459    [  --enable-static-cons    enable static Console [disabled]],
460    [if test x$enableval = xyes; then
461      support_static_cons=yes
462    fi])
463
464 STATIC_CONS=
465 STATIC_GNOME_CONS=
466 STATIC_WX_CONS=
467 if test x$support_static_cons = xyes; then
468    STATIC_CONS="static-bconsole"
469    STATIC_GNOME_CONS="static-bgnome-console"
470    STATIC_WX_CONS="static-bwx-console"
471 fi
472 AC_SUBST(STATIC_CONS)
473 AC_SUBST(STATIC_GNOME_CONS)
474 AC_SUBST(STATIC_WX_CONS)
475
476 # -------------------------------------------
477 # client_only  (default off)
478 # -------------------------------------------
479 AC_ARG_ENABLE(client-only,
480    [  --enable-client-only    build client (File daemon) only [disabled]],
481    [if test x$enableval = xyes; then
482       build_client_only=yes
483       db_type=None
484       DB_TYPE=none
485    fi])
486 if test x$build_client_only = xno; then
487    ALL_DIRS="subdirs"
488 else
489    ALL_DIRS=""
490 fi
491 AC_SUBST(ALL_DIRS)
492
493 # -------------------------------------------
494 # director  (default on)
495 # -------------------------------------------
496 AC_ARG_ENABLE(build-dird,
497    [  --enable-build-dird     enable building of dird (Director) [enabled]],
498    [if test x$enableval = xno; then
499       build_dird=no
500    fi])
501 if test x$build_dird = xyes; then
502    DIRD_DIR="src/dird"
503    DIR_TOOLS="DIRTOOLS"
504 else
505    DIRD_DIR=""
506    DIR_TOOLS="NODIRTOOLS"
507 fi
508 AC_SUBST(DIRD_DIR)
509 AC_SUBST(DIR_TOOLS)
510
511 # -------------------------------------------
512 # stored  (default on)
513 # -------------------------------------------
514 AC_ARG_ENABLE(build-stored,
515    [  --enable-build-stored   enable building of stored (Storage daemon) [enabled]],
516    [if test x$enableval = xno; then
517       build_stored=no
518    fi])
519 if test x$build_stored = xyes; then
520    STORED_DIR="src/stored"
521 else
522    STORED_DIR=""
523 fi
524 AC_SUBST(STORED_DIR)
525
526 # ---------------------------------------------------
527 # Check for conio (Bacula readline substitute)(
528 # ---------------------------------------------------
529 # this allows you to turn it completely off
530 AC_ARG_ENABLE(conio,
531   [ --disable-conio disable conio support [enabled]
532                                               ],
533   [if test x$enableval = xno; then
534      support_conio=no
535   fi]
536 )
537   
538
539 # ---------------------------------------------------
540 # Check for IPv6 support
541 # ---------------------------------------------------
542 # this allows you to turn it completely off
543 support_ipv6=yes
544 AC_ARG_ENABLE(ipv6,   
545   [  --enable-ipv6                  enable ipv6 support [enabled]
546                                                       ],
547   [if test x$enableval = xno; then
548      support_ipv6=no  
549   fi]
550 )
551
552 if test x$support_ipv6 = xyes; then
553     AC_TRY_LINK([ #include <sys/types.h>
554 #include <sys/socket.h>
555 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
556       [support_ipv6=yes], [support_ipv6=no])
557 fi
558
559 if test x$support_ipv6 = xyes; then
560    AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
561 fi
562
563
564
565 got_conio="no"
566 if test x$support_conio = xyes; then
567    AC_CHECK_HEADER(termcap.h, 
568      [ AC_CHECK_LIB(termcap, tgetent, 
569        [ CONS_LIBS="-ltermcap"
570          CONS_OBJ="conio.o"
571          CONS_SRC="conio.c"
572          got_conio="yes"
573          support_readline=no
574          AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
575        ],   
576        [ AC_CHECK_LIB(ncurses, tgetent,
577          [ CONS_LIBS="-lncurses"
578            CONS_OBJ="conio.o"
579            CONS_SRC="conio.c"
580            got_conio="yes"
581            support_readline=no
582            AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
583          ])
584        ])
585      ],
586      [
587          AC_CHECK_HEADERS(curses.h)
588          AC_CHECK_HEADER(term.h,
589                [ AC_CHECK_LIB(curses, tgetent, 
590                  [ CONS_LIBS="-lcurses"
591                    CONS_OBJ="conio.o"
592                    CONS_SRC="conio.c"
593                    got_conio="yes"
594                    support_readline=no
595                    AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
596                  ])
597                ],
598                [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
599 [#if HAVE_CURSES_H
600 #include <curses.h>
601 #endif
602 ])
603      ])
604 fi
605
606
607 # ---------------------------------------------------
608 # Check for readline support/directory (default off)
609 # ---------------------------------------------------
610 # this allows you to turn it completely off
611 AC_ARG_ENABLE(readline,
612   [  --disable-readline      disable readline support [disable]
613                                                       ],
614   [if test x$enableval = xno; then
615     support_readline=no
616   fi])
617
618 got_readline="no"
619 READLINE_SRC=
620 if test x$support_readline = xyes; then
621    AC_ARG_WITH(readline,
622      [ --with-readline@<:@=DIR@:>@             specify readline library directory],
623      [
624         case "$with_readline" in
625         no) : ;;
626         yes|*)
627           if test -f ${with_readline}/readline.h; then
628              CONS_INC="-I${with_readline}"
629              CONS_LDFLAGS="-L$with_readline"
630           elif test -f ${with_readline}/include/readline/readline.h; then
631              CONS_INC="-I${with_readline}/include/readline"
632              CONS_LDFLAGS="-L${with_readline}/lib"
633              with_readline="${with_readline}/include/readline"
634           else
635              with_readline="/usr/include/readline" 
636           fi
637           AC_CHECK_HEADER(${with_readline}/readline.h, 
638              [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
639                CONS_LIBS="-lreadline -lhistory -ltermcap"
640                got_readline="yes"   
641              ],
642              [ echo " "
643                echo "readline.h not found. readline turned off ..."
644                echo " "
645              ]
646           )
647           ;;
648         esac
649      ],[
650        # check for standard readline library
651        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
652          [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
653            got_readline="yes"
654            CONS_INC="-I/usr/include/readline"
655            CONS_LIBS="-lreadline -ltermcap"
656          ], [
657            # Did not find standard library, so try Bacula's default
658             AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
659               [ AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
660                  got_readline="yes"   
661                  CONS_INC="-I${TOP_DIR}/depkgs/readline"
662                  CONS_LIBS="-lreadline -lhistory -ltermcap"
663                  CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
664                  PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
665               ],
666               [ echo " "
667                 echo "readline.h not found. readline turned off ..."
668                 echo " "
669               ]
670             )
671          ]
672        )
673      ]   
674    )
675 fi
676
677
678
679 AC_SUBST(CONS_INC)
680 AC_SUBST(CONS_OBJ)
681 AC_SUBST(CONS_SRC)
682 AC_SUBST(CONS_LIBS)
683 AC_SUBST(CONS_LDFLAGS)
684 AC_SUBST(READLINE_SRC)
685
686 # Minimal stuff for readline Makefile configuration
687 MAKE_SHELL=/bin/sh
688 AC_SUBST(MAKE_SHELL)
689 AC_HEADER_STAT
690 AC_HEADER_DIRENT
691 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
692 AC_CHECK_FUNCS(nanosleep nl_langinfo)
693 AC_CHECK_HEADERS(varargs.h)
694
695 # End of readline/conio stuff
696 # -----------------------------------------------------------------------
697
698 # -----------------------------------------------------------------------
699 #  Check for Python support
700 #
701 AC_MSG_CHECKING(for Python support)
702 AC_ARG_WITH(python,
703 [
704   --with-python@<:@=DIR@:>@     Include Python support.  DIR is the Python base
705                           install directory, default is to search through
706                           a number of common places for the Python files.],
707 [
708   PYTHON_INCDIR= 
709   PYTHON_LIBS=
710   if test "$withval" != "no"; then
711      if test "$withval" = "yes"; then
712         for python_root in /usr /usr/local /usr/sfw; do
713           for ver in python2.2 python2.3 python2.4 python2.5; do
714              if test -f $python_root/include/${ver}/Python.h; then
715                 PYTHON_INCDIR=-I$python_root/include/${ver}
716                 if test -d $python_root/lib64/${ver}/config; then
717                    PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
718                 else
719                    PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
720                 fi
721                 break 
722              fi
723           done
724         done
725         if test x$PYTHON_INCDIR = x; then
726           if test -f $prefix/include/Python.h; then
727              PYTHON_INCDIR=-I$prefix/include
728              if test -d $prefix/lib64/config; then
729                 PYTHON_LIBS="-L$prefix/lib64/config -lpython"
730              else
731                 PYTHON_LIBS="-L$prefix/lib/config -lpython"
732              fi
733           else
734            AC_MSG_RESULT(no)
735            AC_MSG_ERROR(Unable to find Python.h in standard locations)
736           fi
737         fi
738      else
739         if test -f $withval/Python.h; then
740            PYTHON_INCDIR=-I$withval
741            PYTHON_LIBS="-L$withval/config -lpython"
742         elif test -f $withval/include/Python.h; then
743            PYTHON_INCDIR=-I$withval/include
744            if test -d $withval/lib64/config; then
745               PYTHON_LIBS="-L$withval/lib64/config -lpython"
746            else
747               PYTHON_LIBS="-L$withval/lib/config -lpython"
748            fi
749         elif test -f $withval/include/python/Python.h; then
750            PYTHON_INCDIR=-I$withval/include/python
751            if test -d $withval/lib64/python/config; then
752               PYTHON_LIBS="-L$withval/lib64/python/config -lpython"
753            else
754               PYTHON_LIBS="-L$withval/lib/python/config -lpython"
755            fi
756         else
757            AC_MSG_RESULT(no)
758            AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
759         fi
760      fi
761      AC_DEFINE([HAVE_PYTHON], 1)
762      AC_MSG_RESULT(yes)
763      support_python=yes
764      AC_MSG_NOTICE(checking for more Python libs)
765      saved_LIBS="$LIBS"; LIBS=
766      AC_SEARCH_LIBS(shm_open, [rt])
767      AC_CHECK_LIB(util, openpty)
768      PYTHON_LIBS="$PYTHON_LIBS $LIBS"
769      LIBS="$saved_LIBS"
770   else
771      AC_MSG_RESULT(no)
772   fi
773 ],[
774   AC_MSG_RESULT(no)
775 ])
776 AC_SUBST(PYTHON_LIBS)
777 AC_SUBST(PYTHON_INCDIR)
778
779 #
780 # Find where sockets are (especially for Solaris)
781 # Do this before the TCP Wrappers test since tcp wrappers
782 # uses the socket library and some linkers are stupid.
783 #
784 AC_CHECK_FUNC(socket,
785     AC_MSG_RESULT(using libc's socket),
786     AC_CHECK_LIB(xnet,socket)
787     AC_CHECK_LIB(socket,socket)
788     AC_CHECK_LIB(inet,socket))
789
790
791 # -----------------------------------------------------------
792 # Check whether user wants TCP wrappers support (default off)
793 # -----------------------------------------------------------
794 TCPW_MSG="no" 
795 WRAPLIBS=""
796 AC_ARG_WITH(tcp-wrappers,
797   [  --with-tcp-wrappers@<:@=DIR@:>@   enable tcpwrappers support],
798   [
799     if test "x$withval" != "xno" ; then
800        saved_LIBS="$LIBS"
801        LIBS="$saved_LIBS -lwrap"
802        AC_MSG_CHECKING(for libwrap)
803        AC_SEARCH_LIBS(nanosleep, [rt])
804        AC_TRY_LINK(
805           [ #include <sys/types.h>
806             #include <tcpd.h>
807              int deny_severity = 0;
808              int allow_severity = 0;
809              struct request_info *req; ],
810           [ hosts_access(req); ],
811           [
812             AC_MSG_RESULT(yes)
813             AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
814             TCPW_MSG="yes" 
815             LIBS="$saved_LIBS"
816             WRAPLIBS="-lwrap"
817           ], [
818             LIBS="$saved_LIBS -lwrap -lnsl"
819             WRAPLIBS="$saved_LIBS -lwrap -lnsl"
820             AC_TRY_LINK(
821               [ #include <sys/types.h>
822                  #include <tcpd.h>
823                  int deny_severity = 0;
824                  int allow_severity = 0;
825                  struct request_info *req; ],
826               [ hosts_access(req); ],
827               [
828                  AC_MSG_RESULT(yes)
829                  AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
830                  TCPW_MSG="yes" 
831                  LIBS="$saved_LIBS"
832                  WRAPLIBS="-lwrap"
833               ],
834               [AC_MSG_ERROR([*** libwrap missing]) ] ]
835             )
836        )
837     fi
838   ]
839 )
840
841 # -----------------------------------------------------------
842 # Check whether OpenSSL is available
843 # -----------------------------------------------------------
844 AC_MSG_CHECKING([for OpenSSL])
845 dnl The following uses quadrigraphs:
846 dnl '@<:@' = '['
847 dnl '@:>@' = ']'
848 AC_ARG_WITH(openssl,
849         AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
850         [with_openssl_directory=${withval}])
851
852 if test "x$with_openssl_directory" != "x"; then
853         OPENSSL_LIBS="-lssl -lcrypto"
854         OPENSSL_INC=""
855
856         if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
857                 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
858                 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
859         fi
860
861         saved_LIBS="${LIBS}"
862         saved_CFLAGS="${CFLAGS}"
863         LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
864         CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"
865
866         AC_TRY_LINK([ #include <openssl/ssl.h> ],
867                 [ CRYPTO_set_id_callback(NULL); ],
868                 [
869                         support_tls="yes"
870                         support_crypto="yes"
871                 ],
872                 [ support_tls="no" ]
873         )
874
875         AC_TRY_LINK([ #include <openssl/evp.h> ],
876                 [ EVP_sha512(); ],
877                 [ ac_cv_openssl_sha2="yes" ],
878                 [ ac_cv_openssl_sha2="no" ]
879         )
880
881         # Solaris disables greater than 128+ bit encryption in their OpenSSL
882         # implementation, presumably for export reasons. If 192bit AES
883         # is available, we assume that we're running with a 'non-export'
884         # openssl library.
885         AC_TRY_LINK([ #include <openssl/evp.h> ],
886                 [ EVP_aes_192_cbc(); ],
887                 [ ac_cv_openssl_export="no" ],
888                 [ ac_cv_openssl_export="yes" ]
889         )
890
891         LIBS="${saved_LIBS}"
892         CFLAGS="${saved_CFLAGS}"
893
894         if test "$support_tls" = "yes"; then
895                 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
896                 AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
897                 AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
898         fi
899
900         if test "$ac_cv_openssl_sha2" = "yes"; then
901                 AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
902         fi
903
904         if test "$ac_cv_openssl_export" = "yes"; then
905                 AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
906         fi
907 else
908         support_tls="no"
909         support_crypto="no"
910         OPENSSL_LIBS=""
911         OPENSSL_INC=""
912 fi
913
914 AC_MSG_RESULT([$support_tls])
915 AC_SUBST(OPENSSL_LIBS)
916 AC_SUBST(OPENSSL_INC)
917
918
919 # -----------------------------------------------------------
920 # Python and OpenSSL are using dlopen
921 # -----------------------------------------------------------
922
923 if test "$support_python" = "yes" -o "$support_tls" = "yes"; then
924    AC_SEARCH_LIBS(dlopen, [dl])
925 fi
926
927 # ------------------------------------------
928 # Where to place working dir
929 # ------------------------------------------
930 working_dir=`eval echo ${prefix}/var/bacula/working`
931 AC_ARG_WITH(working-dir,
932    [  --with-working-dir=PATH    specify path of Bacula working directory],
933    [
934        if test "x$withval" != "xno" ; then     
935               working_dir=$withval
936        fi
937    ]
938 )
939
940 AC_SUBST(working_dir)
941
942
943 # ------------------------------------------
944 # Where to place scriptdir (script files)
945 # ------------------------------------------
946 scriptdir=`eval echo ${sysconfdir}`
947 AC_ARG_WITH(scriptdir,
948    [  --with-scriptdir=PATH    specify path of Bacula scripts directory],
949    [
950        if test "x$withval" != "xno" ; then     
951               scriptdir=$withval
952        fi
953    ]
954 )
955
956 AC_SUBST(scriptdir)
957
958
959 # ------------------------------------------
960 # Where to send dump email
961 # ------------------------------------------
962 dump_email=root@localhost
963 AC_ARG_WITH(dump-email,
964    [  --with-dump-email=EMAIL    dump email address],
965    [
966        if test "x$withval" != "xno" ; then     
967               dump_email=$withval
968        fi
969    ]
970 )
971
972 AC_SUBST(dump_email)
973
974 # ------------------------------------------
975 # Where to send job email
976 # ------------------------------------------
977 job_email=root@localhost
978 AC_ARG_WITH(job-email,
979    [  --with-job-email=EMAIL     job output email address],
980    [
981        if test "x$withval" != "xno" ; then     
982               job_email=$withval
983        fi
984    ]
985 )
986
987 AC_SUBST(job_email)
988
989 # ------------------------------------------
990 # Where to find smtp host
991 # ------------------------------------------
992 smtp_host=localhost
993 AC_ARG_WITH(smtp_host,
994    [  --with-smtp-host=HOST              SMTP mail host address],
995    [
996        if test "x$withval" != "xno" ; then     
997               smtp_host=$withval
998        fi
999    ]
1000 )
1001
1002 AC_SUBST(smtp_host)
1003
1004
1005 # ------------------------------------
1006 # Where to place pid files
1007 # ------------------------------------
1008 piddir=/var/run
1009 AC_ARG_WITH(pid-dir,
1010     [  --with-pid-dir=PATH               specify location of Bacula pid files],
1011     [
1012         if test "x$withval" != "xno" ; then     
1013             piddir=$withval
1014         fi
1015     ]
1016 )
1017
1018 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
1019 AC_SUBST(piddir)
1020
1021
1022 # ------------------------------------
1023 # Where to place subsys "lock file"
1024 # ------------------------------------
1025 subsysdir=/var/run/subsys
1026 if test -d /var/run/subsys; then
1027    subsysdir=/var/run/subsys
1028 elif test -d /var/lock/subsys; then
1029    subsysdir=/var/lock/subsys
1030 else
1031    subsysdir=/var/run/subsys
1032 fi
1033 AC_ARG_WITH(subsys-dir,
1034     [  --with-subsys-dir=PATH    specify location of Bacula subsys file],
1035     [
1036         if test "x$withval" != "xno" ; then     
1037             subsysdir=$withval
1038         fi
1039     ]
1040 )
1041
1042 AC_SUBST(subsysdir)
1043
1044
1045
1046 # ------------------------------------
1047 # Where to start assigning ports
1048 # ------------------------------------
1049 baseport=9101
1050 AC_ARG_WITH(baseport,
1051     [  --with-baseport=PORT              specify base port address for daemons],
1052     [
1053         if test "x$withval" != "xno" ; then     
1054              baseport=$withval
1055         fi
1056     ]
1057 )
1058
1059 AC_SUBST(baseport)
1060 dir_port=`expr $baseport`
1061 fd_port=`expr $baseport + 1`
1062 sd_port=`expr $fd_port + 1`
1063
1064 AC_SUBST(dir_port)
1065 AC_SUBST(fd_port)
1066 AC_SUBST(sd_port)
1067
1068
1069 # ------------------------------------------
1070 # Generate passwords
1071 # ------------------------------------------
1072 dir_password=
1073 AC_ARG_WITH(dir-password,
1074    [  --with-dir-password=PASSWORD   specify Director's password],
1075    [
1076        if test "x$withval" != "xno" ; then     
1077            dir_password=$withval
1078        fi
1079    ]
1080 )
1081
1082 if test "x$dir_password" = "x" ; then
1083    if test "x$OPENSSL" = "xnone" ; then
1084       key=`autoconf/randpass 33`
1085    else
1086       key=`openssl rand -base64 33`
1087    fi
1088    dir_password=$key
1089 fi
1090
1091 fd_password=
1092 AC_ARG_WITH(fd-password,
1093    [  --with-fd-password=PASSWORD    specify Client's password],
1094    [
1095        if test "x$withval" != "xno" ; then     
1096            fd_password=$withval
1097        fi
1098    ]
1099 )
1100
1101 if test "x$fd_password" = "x" ; then
1102    if test "x$OPENSSL" = "xnone" ; then
1103       key=`autoconf/randpass 37`
1104    else
1105       key=`openssl rand -base64 33`
1106    fi
1107    fd_password=$key
1108 fi
1109
1110 sd_password=
1111 AC_ARG_WITH(sd-password,
1112    [  --with-sd-password=PASSWORD    specify Storage daemon's password],
1113    [
1114        if test "x$withval" != "xno" ; then     
1115            sd_password=$withval
1116        fi
1117    ]
1118 )
1119
1120 if test "x$sd_password" = "x" ; then
1121    if test "x$OPENSSL" = "xnone" ; then
1122       key=`autoconf/randpass 41`
1123    else
1124       key=`openssl rand -base64 33`
1125    fi
1126    sd_password=$key
1127 fi
1128
1129 mon_dir_password=
1130 AC_ARG_WITH(mon-dir-password,
1131    [  --with-mon-dir-password=PASSWORD   specify Director's password used by the monitor],
1132    [
1133        if test "x$withval" != "xno" ; then     
1134            mon_dir_password=$withval
1135        fi
1136    ]
1137 )
1138
1139 if test "x$mon_dir_password" = "x" ; then
1140    if test "x$OPENSSL" = "xnone" ; then
1141       key=`autoconf/randpass 33`
1142    else
1143       key=`openssl rand -base64 33`
1144    fi
1145    mon_dir_password=$key
1146 fi
1147
1148 mon_fd_password=
1149 AC_ARG_WITH(mon-fd-password,
1150    [  --with-mon-fd-password=PASSWORD    specify Client's password used by the monitor],
1151    [
1152        if test "x$withval" != "xno" ; then     
1153            mon_fd_password=$withval
1154        fi
1155    ]
1156 )
1157
1158 if test "x$mon_fd_password" = "x" ; then
1159    if test "x$OPENSSL" = "xnone" ; then
1160       key=`autoconf/randpass 37`
1161    else
1162       key=`openssl rand -base64 33`
1163    fi
1164    mon_fd_password=$key
1165 fi
1166
1167 mon_sd_password=
1168 AC_ARG_WITH(mon-sd-password,
1169    [  --with-mon-sd-password=PASSWORD    specify Storage daemon's password used by the monitor],
1170    [
1171        if test "x$withval" != "xno" ; then     
1172            mon_sd_password=$withval
1173        fi
1174    ]
1175 )
1176
1177 if test "x$mon_sd_password" = "x" ; then
1178    if test "x$OPENSSL" = "xnone" ; then
1179       key=`autoconf/randpass 41`
1180    else
1181       key=`openssl rand -base64 33`
1182    fi
1183    mon_sd_password=$key
1184 fi
1185
1186 AC_SUBST(dir_password)
1187 AC_SUBST(fd_password)
1188 AC_SUBST(sd_password)
1189 AC_SUBST(mon_dir_password)
1190 AC_SUBST(mon_fd_password)
1191 AC_SUBST(mon_sd_password)
1192
1193 #
1194 # Pickup any database name
1195 #
1196 db_name=bacula
1197 AC_ARG_WITH(db_name,
1198     [  --with-db-name=DBNAME           specify database name (default bacula)],
1199     [
1200         if test "x$withval" != "x" ; then       
1201              db_name=$withval
1202         fi
1203     ]
1204 )
1205 AC_SUBST(db_name)
1206
1207 db_user=bacula
1208 AC_ARG_WITH(db_user,
1209     [  --with-db-user=UNAME            specify database user (default bacula)],
1210     [
1211         if test "x$withval" != "x" ; then       
1212              db_user=$withval
1213         fi
1214     ]
1215 )
1216 AC_SUBST(db_user)
1217
1218
1219 #
1220 # Handle users and groups for each daemon
1221 #
1222 dir_user=
1223 AC_ARG_WITH(dir_user,
1224     [  --with-dir-user=USER              specify user for Director daemon],
1225     [
1226         if test "x$withval" != "x" ; then       
1227              dir_user=$withval
1228         fi
1229     ]
1230 )
1231
1232 dir_group=
1233 AC_ARG_WITH(dir_group,
1234     [  --with-dir-group=GROUP            specify group for Director daemon],
1235     [
1236         if test "x$withval" != "x" ; then       
1237              dir_group=$withval
1238         fi
1239     ]
1240 )
1241
1242 sd_user=
1243 AC_ARG_WITH(sd_user,
1244     [  --with-sd-user=USER               specify user for Storage daemon],
1245     [
1246         if test "x$withval" != "x" ; then       
1247              sd_user=$withval
1248         fi
1249     ]
1250 )
1251
1252 sd_group=
1253 AC_ARG_WITH(sd_group,
1254     [  --with-sd-group=GROUP             specify group for Storage daemon],
1255     [
1256         if test "x$withval" != "x" ; then       
1257              sd_group=$withval
1258         fi
1259     ]
1260 )
1261
1262 fd_user=
1263 AC_ARG_WITH(fd_user,
1264     [  --with-fd-user=USER               specify user for File daemon],
1265     [
1266         if test "x$withval" != "x" ; then       
1267              fd_user=$withval
1268         fi
1269     ]
1270 )
1271
1272 fd_group=
1273 AC_ARG_WITH(fd_group,
1274     [  --with-fd-group=GROUP             specify group for File daemon],
1275     [
1276         if test "x$withval" != "x" ; then       
1277              fd_group=$withval
1278         fi
1279     ]
1280 )
1281
1282 AC_SUBST(dir_user)
1283 AC_SUBST(dir_group)
1284 AC_SUBST(sd_user)
1285 AC_SUBST(sd_group)
1286 AC_SUBST(fd_user)
1287 AC_SUBST(fd_group)
1288
1289 #
1290 # allow setting default executable permissions
1291 #
1292 SBINPERM=0754
1293 AC_ARG_WITH(sbin-perm,
1294     [  --with-sbin-perm=MODE             specify permissions for sbin binaries (0754)],
1295     [
1296         if test "x$withval" != "x" ; then       
1297             SBINPERM=$withval
1298         fi
1299     ]
1300 )
1301
1302 AC_SUBST(SBINPERM)
1303
1304 # ------------------------------------------------
1305 # Bacula check for various SQL database engines
1306 # ------------------------------------------------
1307 SQL_LIB=
1308 BA_CHECK_POSTGRESQL_DB
1309
1310 BA_CHECK_MYSQL_DB
1311
1312 BA_CHECK_SQLITE3_DB
1313
1314 BA_CHECK_SQLITE_DB
1315
1316 AC_SUBST(cats)
1317 AC_SUBST(DB_TYPE)
1318
1319 # -------------------------------------------
1320 # enable batch attribute DB insert (default on)
1321 # -------------------------------------------
1322 support_batch_insert=no
1323 A=`nm $SQL_LIB | grep pthread_mutex_lock`
1324 pkg=$?
1325 if test $pkg = 0; then
1326    support_batch_insert=yes
1327    AC_ARG_ENABLE(batch-insert,
1328      [  --enable-batch-insert       enable the DB batch insert code [disabled]],
1329      [if test x$enableval = xno; then
1330        support_batch_insert=no
1331       else
1332        support_batch_insert=yes
1333      fi])
1334 fi
1335                                                           
1336 if test $support_batch_insert = yes ; then
1337    AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
1338 fi
1339
1340
1341 AC_DEFINE(PROTOTYPES)
1342
1343 dnl# --------------------------------------------------------------------------
1344 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1345 dnl#
1346 if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1347     if test -z "$CCOPTS"; then
1348         CCOPTS='-g -O2 -Wall'
1349     fi
1350     CFLAGS="$CCOPTS"
1351 fi
1352
1353
1354 dnl A few others 
1355 AC_EXEEXT
1356
1357 dnl See if we can use 64 bit file addresses
1358 largefile_support="no"
1359 AC_BAC_LARGEFILE
1360
1361
1362 AC_PATH_XTRA
1363
1364 dnl# --------------------------------------------------------------------------
1365 dnl# CHECKING FOR HEADER FILES
1366 dnl# --------------------------------------------------------------------------
1367 AC_CHECK_HEADERS( \
1368         assert.h \
1369         fcntl.h \
1370         grp.h \
1371         pwd.h \
1372         libc.h \
1373         limits.h \
1374         stdarg.h \
1375         stdlib.h \
1376         stdint.h \
1377         string.h \
1378         termios.h \
1379         termcap.h \
1380         term.h \
1381         unistd.h \
1382         sys/bitypes.h \
1383         sys/byteorder.h \
1384         sys/ioctl.h \
1385         sys/select.h \
1386         sys/sockio.h \
1387         sys/time.h \
1388         sys/socket.h \
1389         arpa/nameser.h \
1390         resolv.h \
1391         mtio.h \
1392         sys/mtio.h \
1393         sys/tape.h \
1394         regex.h \
1395 )
1396 AC_HEADER_STDC
1397 AC_HEADER_MAJOR
1398 AC_HEADER_DIRENT
1399 AC_HEADER_STAT
1400 AC_HEADER_SYS_WAIT
1401 AC_HEADER_TIME
1402 AC_STRUCT_ST_BLKSIZE
1403 AC_STRUCT_ST_BLOCKS
1404 AC_STRUCT_TIMEZONE
1405
1406 dnl# --------------------------------------------------------------------------
1407 dnl# Check for utime.h structure 
1408 dnl# --------------------------------------------------------------------------
1409 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1410   [AC_TRY_COMPILE([
1411 #include <sys/types.h>
1412 #include <utime.h>], [struct utimbuf foo],
1413   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
1414 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])
1415
1416 dnl# --------------------------------------------------------------------------
1417 dnl# Check for socklen_t
1418 dnl# --------------------------------------------------------------------------
1419 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1420   [AC_TRY_COMPILE([
1421 #include <sys/types.h>
1422 #include <sys/socket.h>],
1423   [socklen_t x],
1424   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
1425 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
1426
1427 dnl# --------------------------------------------------------------------------
1428 dnl# Check for bigendian
1429 dnl# --------------------------------------------------------------------------
1430 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
1431   [AC_TRY_RUN(
1432     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
1433     [ba_cv_bigendian=yes], 
1434     [ba_cv_bigendian=no], 
1435     [ba_cv_bigendian=no])])
1436 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
1437
1438 dnl# --------------------------------------------------------------------------
1439 dnl# Check for typeof()
1440 dnl# --------------------------------------------------------------------------
1441 AC_LANG_PUSH(C++)
1442 AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
1443   [AC_TRY_RUN(
1444     [main(){char *a = 0; a = (typeof a)a;}],
1445     [ba_cv_have_typeof=yes],
1446     [ba_cv_have_typeof=no],
1447     [ba_cv_have_typeof=no])])
1448 test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
1449 AC_LANG_POP(C++)
1450
1451 AC_C_CONST
1452
1453
1454 dnl# --------------------------------------------------------------------------
1455 dnl# CHECKING FOR FILESYSTEM TYPE
1456 dnl# --------------------------------------------------------------------------
1457 AC_MSG_CHECKING(how to get filesystem type)
1458 fstype=no
1459 # The order of these tests is important.
1460 AC_TRY_CPP([#include <sys/statvfs.h>
1461 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
1462 if test $fstype = no; then
1463 AC_TRY_CPP([#include <sys/statfs.h>
1464 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
1465 fi
1466 if test $fstype = no; then
1467 AC_TRY_CPP([#include <sys/statfs.h>
1468 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
1469 fi
1470 if test $fstype = no; then  
1471 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
1472 fi
1473 if test $fstype = no; then  
1474 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1475 fi
1476 if test $fstype = no; then  
1477 AC_TRY_CPP([#include <sys/mount.h>
1478 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
1479 fi
1480 AC_MSG_RESULT($fstype)
1481
1482 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
1483
1484 dnl# --------------------------------------------------------------------------
1485 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
1486 dnl# --------------------------------------------------------------------------
1487 AC_TYPE_SIGNAL
1488 SIGNAL_CHECK
1489 AC_TYPE_MODE_T
1490 AC_TYPE_UID_T
1491 AC_TYPE_SIZE_T
1492 AC_TYPE_PID_T
1493 AC_TYPE_OFF_T
1494 AC_CHECK_TYPE(ino_t, unsigned long)
1495 AC_CHECK_TYPE(dev_t, unsigned long)
1496 AC_CHECK_TYPE(daddr_t, long)
1497 AC_CHECK_TYPE(major_t, int)
1498 AC_CHECK_TYPE(minor_t, int)
1499 AC_CHECK_TYPE(ssize_t, int)
1500 AC_STRUCT_ST_BLOCKS
1501 AC_STRUCT_ST_RDEV
1502 AC_STRUCT_TM
1503 AC_C_CONST
1504
1505
1506 AC_CHECK_SIZEOF(char, 1)
1507 AC_CHECK_SIZEOF(short int, 2)
1508 AC_CHECK_SIZEOF(int, 4)
1509 AC_CHECK_SIZEOF(long int, 4)
1510 AC_CHECK_SIZEOF(long long int, 8)
1511 AC_CHECK_SIZEOF(int *, 4)
1512
1513 # Check for sys/types.h types
1514 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1515     AC_TRY_COMPILE(
1516         [ #include <sys/types.h> ], 
1517         [ u_int a; a = 1;], 
1518         [ ac_cv_have_u_int="yes" ],
1519         [ ac_cv_have_u_int="no" ]
1520     )
1521 ])
1522 if test "x$ac_cv_have_u_int" = "xyes" ; then
1523    AC_DEFINE(HAVE_U_INT)
1524    have_u_int=1
1525 fi
1526
1527 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
1528    AC_TRY_COMPILE(
1529       [ #include <sys/types.h> ], 
1530       [ intmax_t a; a = 1;], 
1531       [ ac_cv_have_intmax_t="yes" ],
1532       [ 
1533          AC_TRY_COMPILE(
1534             [ #include <stdint.h> ], 
1535             [ intmax_t a; a = 1;], 
1536             [ ac_cv_have_intmax_t="yes" ],
1537             [ ac_cv_have_intmax_t="no" ]
1538          )
1539       ]
1540    )        
1541
1542 ])
1543 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
1544    AC_DEFINE(HAVE_INTMAX_T)
1545    have_intmax_t=1
1546 fi
1547
1548
1549 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
1550    AC_TRY_COMPILE(
1551       [ #include <sys/types.h> ], 
1552       [ u_intmax_t a; a = 1;], 
1553       [ ac_cv_have_u_intmax_t="yes" ],
1554       [ 
1555          AC_TRY_COMPILE(
1556             [ #include <stdint.h> ], 
1557             [ u_intmax_t a; a = 1;], 
1558             [ ac_cv_have_u_intmax_t="yes" ],
1559             [ ac_cv_have_u_intmax_t="no" ]
1560          )
1561       ]
1562    )
1563 ])
1564 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
1565    AC_DEFINE(HAVE_U_INTMAX_T)
1566    have_u_intmax_t=1
1567 fi
1568
1569
1570 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1571    AC_TRY_COMPILE(
1572       [ #include <sys/types.h> ], 
1573       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
1574       [ ac_cv_have_intxx_t="yes" ],
1575       [ ac_cv_have_intxx_t="no" ]
1576    )
1577 ])
1578 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1579    AC_DEFINE(HAVE_INTXX_T)
1580    have_intxx_t=1
1581 fi
1582         
1583 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1584    AC_TRY_COMPILE(
1585       [ #include <sys/types.h> ], 
1586       [ int64_t a; a = 1;], 
1587       [ ac_cv_have_int64_t="yes" ],
1588       [ ac_cv_have_int64_t="no" ]
1589    )
1590 ])
1591 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1592    AC_DEFINE(HAVE_INT64_T)
1593    have_int64_t=1
1594 fi
1595         
1596 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1597    AC_TRY_COMPILE(
1598       [ #include <sys/types.h> ], 
1599       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
1600       [ ac_cv_have_u_intxx_t="yes" ],
1601       [ ac_cv_have_u_intxx_t="no" ]
1602    )
1603 ])
1604 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1605    AC_DEFINE(HAVE_U_INTXX_T)
1606    have_u_intxx_t=1
1607 fi
1608
1609 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1610    AC_TRY_COMPILE(
1611       [ #include <sys/types.h> ], 
1612       [ u_int64_t a; a = 1;], 
1613       [ ac_cv_have_u_int64_t="yes" ],
1614       [ ac_cv_have_u_int64_t="no" ]
1615    )
1616 ])
1617 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1618    AC_DEFINE(HAVE_U_INT64_T)
1619    have_u_int64_t=1
1620 fi
1621
1622 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1623            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1624 then
1625    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1626    AC_TRY_COMPILE(
1627       [ #include <sys/bitypes.h>  ], 
1628       [ int8_t a; int16_t b; int32_t c;
1629         u_int8_t e; u_int16_t f; u_int32_t g;
1630         a = b = c = e = f = g = 1;  ], 
1631       [ AC_DEFINE(HAVE_U_INTXX_T)
1632         AC_DEFINE(HAVE_INTXX_T)
1633         AC_DEFINE(HAVE_SYS_BITYPES_H)
1634         AC_MSG_RESULT(yes) ],
1635       [ AC_MSG_RESULT(no)]
1636    ) 
1637 fi
1638
1639 if test -z "$have_u_intxx_t" ; then
1640    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1641       AC_TRY_COMPILE(
1642          [ #include <sys/types.h> ], 
1643          [ uint8_t a; uint16_t b; 
1644            uint32_t c; a = b = c = 1; ], 
1645          [ ac_cv_have_uintxx_t="yes" ],
1646          [ ac_cv_have_uintxx_t="no" ]
1647       )
1648    ])
1649    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1650       AC_DEFINE(HAVE_UINTXX_T)
1651    fi
1652 fi
1653
1654 if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
1655           test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1656 then
1657    AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
1658    AC_TRY_COMPILE(
1659       [ #include <sys/bitypes.h>  ], 
1660       [ int64_t a; u_int64_t b; 
1661        a = b = 1;  ], 
1662       [ AC_DEFINE(HAVE_U_INT64_T)
1663        AC_DEFINE(HAVE_INT64_T)
1664        AC_MSG_RESULT(yes) ],
1665       [ AC_MSG_RESULT(no)]
1666    ) 
1667 fi
1668
1669 if (test -z "$have_uintxx_t" && \
1670           test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1671 then
1672    AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
1673    AC_TRY_COMPILE(
1674       [ #include <sys/bitypes.h>  ], 
1675         [ uint8_t a; uint16_t b; 
1676           uint32_t c; a = b = c = 1; ], 
1677       [ AC_DEFINE(HAVE_UINTXX_T)
1678        AC_MSG_RESULT(yes) ],
1679       [ AC_MSG_RESULT(no)]
1680    ) 
1681
1682 fi
1683
1684
1685
1686
1687 dnl# --------------------------------------------------------------------------
1688 dnl# CHECKING FOR REQUIRED LIBRARY FUNCTIONS
1689 dnl# --------------------------------------------------------------------------
1690 AC_CHECK_FUNCS( \
1691         fork \
1692         getcwd \
1693         gethostname \
1694         getpid \
1695         gettimeofday \
1696         setpgid \
1697         setpgrp \
1698         setsid \
1699         signal \
1700         strerror \
1701         strncmp \
1702         strncpy \
1703         vfprintf \
1704         ,,
1705         [echo 'configure: cannot find needed function.'; exit 1]
1706 )
1707
1708 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1709 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1710 AC_CHECK_FUNCS(posix_fadvise)
1711 AC_CHECK_FUNCS(fdatasync)
1712
1713 AC_CHECK_FUNCS(chflags) 
1714
1715 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
1716
1717 AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
1718   [AC_TRY_LINK([
1719 #include <stdarg.h>
1720 void use_va_copy(va_list args){va_list args2; va_copy(args2,args); va_end(args2);}
1721 void call_use_va_copy(int junk,...){va_list args; va_start(args,junk); use_va_copy(args); va_end(args);}
1722 ],
1723   [call_use_va_copy(1,2,3)],
1724   ba_cv_va_copy=yes, ba_cv_va_copy=no)])
1725 test $ba_cv_va_copy = yes && AC_DEFINE(HAVE_VA_COPY, 1, [Set if va_copy exists])
1726
1727
1728 dnl# --------------------------------------------------------------------------
1729 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1730 dnl# --------------------------------------------------------------------------
1731 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1732
1733 # If resolver functions are not in libc check for -lnsl or -lresolv.
1734 AC_CHECK_FUNC(gethostbyname_r,
1735     AC_MSG_RESULT(using libc's resolver),
1736     AC_CHECK_LIB(nsl,gethostbyname_r)
1737     AC_CHECK_LIB(resolv,gethostbyname_r))
1738
1739
1740
1741 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1742 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
1743 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
1744
1745 dnl ----------------------------
1746 dnl check sa_len of sockaddr
1747 dnl ----------------------------
1748 AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
1749   [AC_TRY_COMPILE([#include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
1750   ac_cv_struct_sockaddr_sa_len=yes, ac_cv_struct_sockaddr_sa_len=no)])
1751
1752  if test $ac_cv_struct_sockaddr_sa_len = yes; then
1753   AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
1754  fi
1755
1756
1757
1758
1759 AC_FUNC_STRFTIME
1760 AC_FUNC_VPRINTF
1761 AC_FUNC_ALLOCA
1762 AC_FUNC_GETMNTENT
1763 AC_FUNC_CLOSEDIR_VOID
1764 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
1765 # AC_FUNC_FNMATCH    dnl use local version
1766
1767
1768 AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
1769
1770
1771 AC_CHECK_LIB(sun, getpwnam)
1772
1773 AC_CHECK_HEADERS(zlib.h)
1774 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1775 have_zlib=no
1776 if test x$FDLIBS = x-lz; then
1777   AC_DEFINE(HAVE_LIBZ)
1778   have_zlib=yes
1779 fi
1780
1781 #
1782 # Check for ACL libraries
1783 #
1784 have_acl=no
1785 AC_CHECK_HEADER(sys/acl.h)
1786 AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
1787    [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"], 
1788       [AC_CHECK_LIB(sec, acltotext, [have_acl=yes; FDLIBS="-lsec $FDLIBS"])]
1789     )]
1790 )
1791 if test $have_acl = yes; then
1792    AC_DEFINE(HAVE_ACL)
1793 fi
1794
1795 dnl Check for pthread libraries
1796 PTHREAD_LIB=""
1797 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1798    [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1799       [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1800             [AC_CHECK_FUNC(pthread_create)]
1801        )]
1802     )]
1803 )
1804
1805 AC_SUBST(FDLIBS)
1806 AC_DEFINE(FDLIBS)
1807
1808
1809 CFLAGS=${CFLAGS--O}
1810
1811 if test x$have_gcc = xyes ; then
1812    CPPFLAGS="$CPPFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1813    CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1814 fi
1815 LDFLAGS=${LDFLAGS--O}
1816 DB_LIBS="${SQL_LFLAGS}"
1817 CPPFLAGS="$CPPFLAGS"
1818 CFLAGS="$CFLAGS"
1819 AC_SUBST(DEBUG)
1820 AC_SUBST(DINCLUDE)
1821 AC_SUBST(CFLAGS)
1822 AC_SUBST(CPPFLAGS)
1823 AC_SUBST(LDFLAGS)
1824 AC_SUBST(X_CFLAGS)
1825 AC_SUBST(DEFS)
1826 AC_SUBST(LIBS)
1827 AC_SUBST(DLIB)
1828 AC_SUBST(DB_LIBS)
1829 AC_SUBST(X_LIBS)
1830 AC_SUBST(X_EXTRA_LIBS)
1831 AC_SUBST(WCFLAGS)
1832 AC_SUBST(WLDFLAGS)
1833 AC_SUBST(WRAPLIBS)
1834
1835 dnl# extra configurable objects
1836 OBJLIST=
1837 AC_SUBST(OBJLIST)
1838
1839 lld="lld"
1840 llu="llu"
1841
1842 WCFLAGS=
1843 WLDFLAGS=
1844
1845 #
1846 # Finally we set appropriate distribution specific
1847 #  variables and defaults
1848 #
1849 # PFILES are platform specific files
1850 PFILES="platforms/Makefile"
1851 PSCMD="ps -e"
1852 WIN32=
1853 MACOSX=
1854 hostname=`uname -n | cut -d '.' -f 1`
1855 if test x${hostname} = x ; then
1856   hostname="localhost"
1857 fi
1858 case "$DISTNAME" in
1859 aix)
1860         DISTVER=`uname -r`
1861         PSCMD="ps -e -o pid,comm"
1862         PFILES="${PFILES} \
1863            platforms/aix/Makefile"
1864         TAPEDRIVE="/dev/rmt0.1" 
1865   ;;      
1866 alpha)
1867         DISTVER=`uname -r`
1868         PTHREAD_LIB="-lpthread -lexc"
1869         if test "${CC}" = "gcc" ; then
1870            lld="lld"
1871            llu="llu"
1872         else
1873            lld="ld"
1874            llu="lu"
1875         fi
1876         TAPEDRIVE="/dev/nrmt0"
1877   ;;
1878 bsdi)
1879         DISTVER=`uname -a |awk '{print $3}'`
1880         TAPEDRIVE="/dev/nrmt0"
1881         PTHREAD_LIB="-pthread"
1882         CFLAGS="${CFLAGS} -pthread"
1883         PSCMD="ps -ax -o pid,command"
1884         lld="qd"
1885         llu="qu"
1886         PFILES="${PFILES} \
1887             platforms/bsdi/Makefile \
1888             platforms/bsdi/bacula-fd \
1889             platforms/bsdi/bacula-sd \
1890             platforms/bsdi/bacula-dir"
1891         largefile_support="yes"
1892   ;;
1893 cygwin)
1894         DISTVER=`uname -a |awk '{print $3}'`
1895         TAPEDRIVE="/dev/nrst0"
1896         WIN32=win32
1897         WCFLAGS="-mwindows"
1898         WLDFLAGS="-mwindows"
1899   ;;
1900 darwin)
1901         DISTVER=`uname -r`
1902         TAPEDRIVE="/dev/nst0"
1903         PSCMD="ps -e -o pid,command"
1904         MACOSX=macosx
1905         PFILES="${PFILES} \
1906            platforms/darwin/Makefile"
1907   ;;
1908 debian)
1909         DISTVER=`cat /etc/debian_version`
1910         TAPEDRIVE="/dev/nrst0"
1911         PSCMD="ps -e -o pid,command"
1912   ;;
1913 freebsd)
1914         DISTVER=`uname -a |awk '{print $3}'`
1915         VER=`echo $DISTVER | cut -c 1`
1916         if test x$VER = x4 ; then
1917            PTHREAD_LIB="${PTHREAD_LIBS:--pthread}"
1918            CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS:--pthread}"
1919         fi
1920         lld="qd"
1921         llu="qu"
1922         TAPEDRIVE="/dev/nrsa0"
1923         PSCMD="ps -ax -o pid,command"
1924         PFILES="${PFILES} \
1925             platforms/freebsd/Makefile \
1926             platforms/freebsd/bacula-fd \
1927             platforms/freebsd/bacula-sd \
1928             platforms/freebsd/bacula-dir"
1929         largefile_support="yes"
1930   ;;
1931 hpux)
1932         PSCMD="UNIX95=1; ps -e -o pid,comm"
1933         CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
1934         DISTVER=`uname -r`
1935         TAPEDRIVE="/dev/rmt/0hnb"
1936         PTHREAD_LIB="-lpthread"
1937         AC_DEFINE([_INCLUDE_LONGLONG])
1938   ;;
1939 irix)
1940         DISTVER=`uname -r`
1941         TAPEDRIVE="/dev/rmt/0cbn"
1942         PSCMD="ps -e -o pid,comm"
1943         PFILES="${PFILES} \
1944             platforms/irix/Makefile \
1945             platforms/irix/bacula-fd \
1946             platforms/irix/bacula-sd \
1947             platforms/irix/bacula-dir"
1948   ;;
1949 netbsd)
1950         DISTVER=`uname -a |awk '{print $3}'`
1951         lld="qd"
1952         llu="qu"
1953         TAPEDRIVE="/dev/nrst0"
1954         PSCMD="ps -ax -o pid,command"
1955         PTHREAD_LIB="-pthread"
1956         CFLAGS="${CFLAGS} -pthread"
1957   ;;
1958 openbsd)
1959         DISTVER=`uname -a |awk '{print $3}'`
1960         lld="qd"
1961         llu="qu"
1962         TAPEDRIVE="/dev/nrst0"
1963         PSCMD="ps -ax -o pid,command"
1964         PTHREAD_LIB="-pthread"
1965         CFLAGS="${CFLAGS} -pthread"
1966         PFILES="${PFILES} \
1967             platforms/openbsd/Makefile \
1968             platforms/openbsd/bacula-fd \
1969             platforms/openbsd/bacula-sd \
1970             platforms/openbsd/bacula-dir"
1971   ;;
1972 redhat)
1973         if test -f /etc/whitebox-release ; then
1974            f=/etc/whitebox-release
1975         else
1976            f=/etc/redhat-release
1977         fi
1978         if test `cat $f | grep release |\
1979                    cut -f 3 -d ' '`x = "Enterprise"x ; then
1980            DISTVER="Enterprise "`cat $f | grep release |\
1981                     cut -f 6 -d ' '`
1982         else
1983             DISTVER=`cat /etc/redhat-release | grep release |\
1984                      cut -f 5 -d ' '`
1985         fi
1986         TAPEDRIVE="/dev/nst0"
1987         PSCMD="ps -e -o pid,command"
1988         PFILES="${PFILES} \
1989             platforms/redhat/Makefile \
1990             platforms/redhat/bacula-fd \
1991             platforms/redhat/bacula-sd \
1992             platforms/redhat/bacula-dir \
1993             platforms/redhat/bacula.spec \
1994             "
1995   ;;
1996 mandrake)
1997         DISTVER=`cat /etc/mandrake-release | grep release |\
1998            cut -f 5 -d ' '`
1999         TAPEDRIVE="/dev/nst0"
2000         PSCMD="ps -e -o pid,command"
2001         PFILES="${PFILES} \
2002             platforms/mandrake/Makefile \
2003             platforms/mandrake/bacula-fd \
2004             platforms/mandrake/bacula-sd \
2005             platforms/mandrake/bacula-dir \
2006             platforms/mandrake/bacula.spec \
2007             "
2008   ;;
2009 gentoo)
2010         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
2011         TAPEDRIVE="/dev/nst0"
2012         PSCMD="ps -e -o pid,command"
2013         PFILES="${PFILES} \
2014             platforms/gentoo/Makefile \
2015          platforms/gentoo/bacula-init \
2016             platforms/gentoo/bacula-fd \
2017             platforms/gentoo/bacula-sd \
2018             platforms/gentoo/bacula-dir"
2019   ;;
2020 slackware)
2021         DISTVER=`cat /etc/slackware-version`
2022         TAPEDRIVE="/dev/nst0"
2023         PSCMD="ps -e -o pid,command"
2024         PFILES="${PFILES} \
2025             platforms/slackware/Makefile \
2026             platforms/slackware/rc.bacula-fd \
2027             platforms/slackware/rc.bacula-sd \
2028             platforms/slackware/rc.bacula-dir\
2029             platforms/slackware/functions.bacula"
2030   ;;
2031 solaris)
2032         DISTVER=`uname -r`
2033         TAPEDRIVE="/dev/rmt/0cbn"
2034         PSCMD="ps -e -o pid,comm"
2035         PFILES="${PFILES} \
2036             platforms/solaris/Makefile \
2037             platforms/solaris/bacula-fd \
2038             platforms/solaris/bacula-sd \
2039             platforms/solaris/bacula-dir"
2040         if test x$DISTVER = x5.6 ; then
2041             AC_DEFINE(HAVE_OLD_SOCKOPT)
2042         fi
2043         LIBS="$LIBS -lresolv"
2044   ;;
2045 suse)
2046         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
2047             cut -f 3 -d ' '`
2048         TAPEDRIVE="/dev/nst0"
2049         PSCMD="ps -e -o pid,command"
2050         PFILES="${PFILES} \
2051             platforms/suse/Makefile \
2052             platforms/suse/bacula-fd \
2053             platforms/suse/bacula-sd \
2054             platforms/suse/bacula-dir \
2055             platforms/suse/bacula \
2056             platforms/suse/bacula.spec"
2057   ;;
2058 suse5)
2059         DISTNAME=suse
2060         DISTVER=5.x
2061         TAPEDRIVE="/dev/nst0"
2062         PSCMD="ps -e -o pid,command"
2063         PFILES="${PFILES} \
2064             platforms/suse/Makefile \
2065             platforms/suse/bacula-fd \
2066             platforms/suse/bacula-sd \
2067             platforms/suse/bacula-dir"
2068   ;;
2069 unknown)
2070         DISTVER=unknown
2071         TAPEDRIVE="/dev/nst0"
2072   ;;
2073 *)
2074   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
2075   ;;
2076 esac  
2077
2078 AC_SUBST(hostname)
2079
2080 LIBS="$PTHREAD_LIB $LIBS"
2081
2082 AC_DEFINE_UNQUOTED(lld, "$lld")
2083 AC_DEFINE_UNQUOTED(llu, "$llu")
2084 AC_SUBST(TAPEDRIVE)
2085 AC_SUBST(PSCMD)
2086 AC_SUBST(WIN32)
2087 AC_SUBST(MACOSX)
2088 AC_SUBST(DISTNAME)
2089 AC_SUBST(DISTVER)
2090
2091 dnl# common parts of the Makefile
2092 MCOMMON=./autoconf/Make.common
2093 AC_SUBST_FILE(MCOMMON)
2094
2095 dnl# Insanity check
2096 if test "x${subsysdir}" = "x${sbindir}" ; then
2097    echo " "
2098    echo " "
2099    echo "You have set both --sbindir and --with-subsys-dir"
2100    echo "  equal to: ${subsysdir} "
2101    echo "This is not permitted. Please reconfigure."
2102    echo " "
2103    echo "Aborting configuration ..."
2104    echo " "
2105    echo " "
2106    exit 1
2107 fi 
2108
2109 AC_OUTPUT([autoconf/Make.common \
2110            Makefile \
2111            manpages/Makefile \
2112            scripts/startmysql \
2113            scripts/stopmysql \
2114            scripts/btraceback \
2115            scripts/startit \
2116            scripts/stopit \
2117            scripts/bconsole \
2118            scripts/gconsole \
2119            scripts/bacula \
2120            scripts/bacula-ctl-dir \
2121            scripts/bacula-ctl-fd \
2122            scripts/bacula-ctl-sd \
2123            scripts/devel_bacula \
2124            scripts/Makefile \
2125            scripts/logrotate \
2126            scripts/bacula.desktop.gnome1 \
2127            scripts/bacula.desktop.gnome2 \
2128            scripts/bacula.desktop.gnome1.consolehelper \
2129            scripts/bacula.desktop.gnome2.consolehelper \
2130            scripts/bacula.desktop.gnome1.xsu \
2131            scripts/bacula.desktop.gnome2.xsu \
2132            scripts/bgnome-console.console_apps \
2133            scripts/mtx-changer \
2134            scripts/disk-changer \
2135            scripts/dvd-handler \
2136            scripts/dvd-simulator \
2137            scripts/bacula-tray-monitor.desktop \
2138            scripts/logwatch/Makefile \
2139            scripts/logwatch/logfile.bacula.conf \
2140            scripts/wxconsole.console_apps \
2141            scripts/wxconsole.desktop.consolehelper \
2142            scripts/wxconsole.desktop.xsu \
2143            scripts/bat.desktop \
2144            scripts/bat.desktop.xsu \
2145            scripts/bat.desktop.consolehelper \
2146            scripts/bat.console_apps \
2147            src/Makefile \
2148            src/host.h \
2149            src/console/Makefile \
2150            src/console/bconsole.conf \
2151            src/gnome2-console/Makefile \
2152            src/gnome2-console/bgnome-console.conf \
2153            src/qt-console/bat.conf \
2154            src/qt-console/bat.pro \
2155            src/qt-console/install_conf_file \
2156            src/wx-console/Makefile \
2157            src/wx-console/bwx-console.conf \
2158            src/tray-monitor/Makefile \
2159            src/tray-monitor/tray-monitor.conf \
2160            src/dird/Makefile \
2161            src/dird/bacula-dir.conf \
2162            src/lib/Makefile \
2163            src/stored/Makefile \
2164            src/stored/bacula-sd.conf \
2165            src/filed/Makefile \
2166            src/filed/bacula-fd.conf \
2167            src/cats/Makefile \
2168            src/cats/make_catalog_backup \
2169            src/cats/delete_catalog_backup \
2170            src/cats/create_postgresql_database \
2171            src/cats/update_postgresql_tables \
2172            src/cats/make_postgresql_tables \
2173            src/cats/grant_postgresql_privileges \
2174            src/cats/drop_postgresql_tables \
2175            src/cats/drop_postgresql_database \
2176            src/cats/create_mysql_database \
2177            src/cats/update_mysql_tables \
2178            src/cats/make_mysql_tables \
2179            src/cats/grant_mysql_privileges \
2180            src/cats/drop_mysql_tables \
2181            src/cats/drop_mysql_database \
2182            src/cats/create_sqlite_database \
2183            src/cats/update_sqlite_tables \
2184            src/cats/make_sqlite_tables \
2185            src/cats/grant_sqlite_privileges \
2186            src/cats/drop_sqlite_tables \
2187            src/cats/drop_sqlite_database \
2188            src/cats/create_sqlite3_database \
2189            src/cats/update_sqlite3_tables \
2190            src/cats/make_sqlite3_tables \
2191            src/cats/grant_sqlite3_privileges \
2192            src/cats/drop_sqlite3_tables \
2193            src/cats/drop_sqlite3_database \
2194            src/cats/sqlite \
2195            src/cats/mysql \
2196            src/cats/create_bdb_database \
2197            src/cats/update_bdb_tables \
2198            src/cats/make_bdb_tables \
2199            src/cats/grant_bdb_privileges \
2200            src/cats/drop_bdb_tables \
2201            src/cats/drop_bdb_database \
2202            src/cats/create_bacula_database \
2203            src/cats/update_bacula_tables \
2204            src/cats/grant_bacula_privileges \
2205            src/cats/make_bacula_tables \
2206            src/cats/drop_bacula_tables \
2207            src/cats/drop_bacula_database \
2208            src/findlib/Makefile \
2209            src/tools/Makefile \
2210            po/Makefile.in \
2211            $PFILES ],  
2212           [ ]
2213 )
2214
2215 if test "${support_bat}" = "yes" ; then
2216   cd src/qt-console
2217   chmod 755 install_conf_file build-depkgs-qt-console
2218   echo "Creating bat Makefile"  
2219   qmake
2220   cd ${BUILD_DIR}
2221 fi
2222
2223 echo "Doing make of dependencies"
2224 ${MAKE:-make} depend
2225
2226 cd scripts
2227 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
2228 chmod 755 dvd-handler dvd-simulator
2229 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
2230 cd ..
2231
2232 c=src/cats
2233
2234 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
2235 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
2236
2237 chmod 755 $c/create_bdb_database      $c/update_bdb_tables     $c/make_bdb_tables
2238 chmod 755 $c/grant_bdb_privileges     $c/drop_bdb_tables       $c/drop_bdb_database
2239
2240 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
2241 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
2242
2243 chmod 755 $c/create_sqlite_database   $c/update_sqlite_tables  $c/make_sqlite_tables
2244 chmod 755 $c/grant_sqlite_privileges  $c/drop_sqlite_tables    $c/drop_sqlite_database
2245
2246 chmod 755 $c/create_sqlite3_database   $c/update_sqlite3_tables  $c/make_sqlite3_tables
2247 chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables    $c/drop_sqlite3_database
2248
2249 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
2250 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
2251
2252 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup
2253 chmod 755 $c/sqlite
2254 chmod 755 $c/mysql
2255
2256 chmod 755 src/win32/build-depkgs-mingw32
2257
2258
2259
2260 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
2261    largefile_support="yes"
2262 fi
2263
2264 #
2265 # A whole lot of hand springs to get the compiler version.
2266 #  This is because gcc changed the output in version 3.0
2267 #
2268 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2269 if test "x${CCVERSION}" = "x" ; then
2270   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2271 fi
2272 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2273 if test x"${CXXVERSION}" = x ; then
2274   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2275 fi
2276
2277 if test "x${subsysdir}" = "x${sbindir}" ; then
2278    echo " "
2279    echo " "
2280    echo "You have set --sbindir and --with-subsys-dir"
2281    echo "  both equal to: ${subsysdir} "
2282    echo "  This is not permitted. Please reconfigure."
2283    echo " "
2284    echo "Aborting configuration ..."
2285    echo " "
2286    echo " "
2287    exit 1
2288 fi 
2289
2290 if test "x${db_type}" = "xInternal" ; then
2291    echo " "
2292    echo " "
2293    echo "You have not specified either --enable-client-only or one of the"
2294    echo "  supported databases: MySQL, PostgreSQL, SQLite3 or SQLite."
2295    echo "  This is not permitted. Please reconfigure."
2296    echo " "
2297    echo "Aborting the configuration ..."
2298    echo " "
2299    echo " "
2300    exit 1
2301 fi
2302
2303 echo "
2304 Configuration on `date`:
2305
2306   Host:                       $host -- ${DISTNAME} ${DISTVER}
2307   Bacula version:             ${VERSION} (${DATE})
2308   Source code location:       ${srcdir}
2309   Install binaries:           ${sbindir}
2310   Install config files:       ${sysconfdir}
2311   Scripts directory:          ${scriptdir}
2312   Working directory:          ${working_dir}
2313   PID directory:              ${piddir}
2314   Subsys directory:           ${subsysdir}
2315   Man directory:              ${mandir}
2316   Data directory:             ${datadir}
2317   C Compiler:                 ${CC} ${CCVERSION}
2318   C++ Compiler:               ${CXX} ${CXXVERSION}
2319   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
2320   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
2321   Libraries:                  ${LIBS}
2322   Statically Linked Tools:    ${support_static_tools}
2323   Statically Linked FD:       ${support_static_fd}
2324   Statically Linked SD:       ${support_static_sd}
2325   Statically Linked DIR:      ${support_static_dir}
2326   Statically Linked CONS:     ${support_static_cons}
2327   Database type:              ${db_type}
2328   Database lib:               ${DB_LIBS}
2329   Database name:              ${db_name}
2330   Database user:              ${db_user}
2331
2332   Job Output Email:           ${job_email}
2333   Traceback Email:            ${dump_email}
2334   SMTP Host Address:          ${smtp_host}
2335
2336   Director Port:              ${dir_port}
2337   File daemon Port:           ${fd_port}
2338   Storage daemon Port:        ${sd_port}
2339
2340   Director User:              ${dir_user}
2341   Director Group:             ${dir_group}
2342   Storage Daemon User:        ${sd_user}
2343   Storage DaemonGroup:        ${sd_group}
2344   File Daemon User:           ${fd_user}
2345   File Daemon Group:          ${fd_group}
2346
2347   SQL binaries Directory      ${SQL_BINDIR}
2348
2349   Large file support:         $largefile_support
2350   Bacula conio support:       ${got_conio} ${CONS_LIBS}
2351   readline support:           ${got_readline} ${PRTREADLINE_SRC}
2352   TCP Wrappers support:       ${TCPW_MSG} ${WRAPLIBS}
2353   TLS support:                ${support_tls}
2354   Encryption support:         ${support_crypto} 
2355   ZLIB support:               ${have_zlib}
2356   enable-smartalloc:          ${support_smartalloc} 
2357   bat support:                ${support_bat} ${QWT_LDFLAGS}
2358   enable-gnome:               ${support_gnome} ${gnome_version}
2359   enable-bwx-console:         ${support_wx_console} ${wx_version}
2360   enable-tray-monitor:        ${support_tray_monitor}
2361   client-only:                ${build_client_only}
2362   build-dird:                 ${build_dird}
2363   build-stored:               ${build_stored}
2364   ACL support:                ${have_acl}
2365   Python support:             ${support_python} ${PYTHON_LIBS}
2366   Batch insert enabled:       ${support_batch_insert}
2367
2368   " > config.out
2369
2370 cat config.out