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