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