]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
This commit was manufactured by cvs2svn to create tag
[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
455 AC_HEADER_STAT
456 AC_HEADER_DIRENT
457
458 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat lchown)
459 AC_CHECK_FUNCS(nanosleep nl_langinfo)
460
461 AC_CHECK_HEADERS(varargs.h)
462
463 # End of readline/conio stuff
464 # -----------------------------------------------------------------------
465
466
467 # ---------------------------------------------------
468 # Check for GMP support/directory
469 # ---------------------------------------------------
470 #GMP_SRC=
471 #local_gmp="no"
472 #AC_ARG_WITH(gmp,
473 #  [  --with-gmp[=DIR]   Specify gmp library directory],
474 #  [
475 #     case "$with_gmp" in
476 #     no) : ;;
477 #     yes|*)
478 #       if test "$with_gmp" != "yes"; then
479 #         GMP_INC="-I$with_gmp"
480 #         GMP_LIBS="-lgmp"
481 #         GMP_LDFLAGS="-L$with_gmp"
482 #       else
483 #          with_gmp="/usr/include" 
484 #       fi
485 #       AC_CHECK_HEADER($with_gmp/gmp.h, 
486 #          [ AC_MSG_RESULT(yes)
487 #            AC_DEFINE(HAVE_GMP) 
488 #            GMP_LIBS="-lgmp"
489 #            got_gmp="yes"   
490 #          ],
491 #          [ AC_MSG_ERROR([*** gmp library missing]) 
492 #          ]
493 #       )
494 #       ;;
495 #     esac
496 #  ],[
497 #    # check for standard gmp library
498 #    AC_CHECK_HEADER(/usr/include/gmp.h,
499 #    [ AC_MSG_RESULT(yes)
500 #      AC_DEFINE(HAVE_GMP)
501 #      got_gmp="yes"
502 #      GMP_INC=
503 #      GMP_LIBS="-lgmp"
504 #    ], [
505 #      # Did not find standard library, so use our own
506 #      AC_MSG_RESULT(yes)
507 #      AC_DEFINE(HAVE_GMP)
508 #      got_gmp="yes"
509 #      local_gmp="yes"
510 #      GMP_INC="-I${TOP_DIR}/depkgs/gmp"
511 #      GMP_LIBS="-lgmp"
512 #      GMP_LDFLAGS="-L${TOP_DIR}/depkgs/gmp"
513 #      GMP_SRC="${TOP_DIR}/depkgs/gmp"
514 #    ])
515 #  ]   
516 #)
517 #AC_SUBST(GMP_INC)
518 #AC_SUBST(GMP_LIBS)
519 #AC_SUBST(GMP_LDFLAGS)
520 #AC_SUBST(GMP_SRC)
521
522 # End of GMP stuff
523 # -----------------------------------------------------------------------
524
525
526 # ---------------------------------------------------
527 # Check for CWEB support/directory
528 # ---------------------------------------------------
529 #CWEB_SRC=
530 #CWEB=/bin
531 #local_cweb="no"
532 #AC_ARG_WITH(cweb,
533 #  [  --with-cweb[=DIR]   Specify cweb library directory],
534 #  [
535 #     case "$with_cweb" in
536 #     no) : ;;
537 #     yes|*)
538 #       if test "$with_cweb" != "yes"; then
539 #         CWEB_INC="-I$with_cweb"
540 #         CWEB_LIBS="-lcweb"
541 #         CWEB_LDFLAGS="-L$with_cweb"
542 #       else
543 #          with_cweb="/usr/include" 
544 #       fi
545 #       AC_CHECK_HEADER($with_cweb/cweb.h, 
546 #          [ AC_MSG_RESULT(yes)
547 #            AC_DEFINE(HAVE_CWEB) 
548 #            CWEB_LIBS="-lcweb"
549 #            got_cweb="yes"   
550 #          ],
551 #          [ AC_MSG_ERROR([*** cweb library missing]) 
552 #          ]
553 #       )
554 #       ;;
555 #     esac
556 #  ],[
557 #    # check for standard cweb library
558 #    AC_CHECK_HEADER(/usr/include/cweb.h,
559 #    [ AC_MSG_RESULT(yes)
560 #      AC_DEFINE(HAVE_CWEB)
561 #      got_cweb="yes"
562 #      CWEB_INC=
563 #      CWEB_LIBS="-lcweb"
564 #    ], [
565 #      # Did not find starndard library, so use our own
566 #      AC_MSG_RESULT(yes)
567 #      AC_DEFINE(HAVE_CWEB)
568 #      got_cweb="yes"
569 #      local_cweb="yes"
570 #      CWEB=${TOP_DIR}/depkgs/cweb
571 #      CWEB_INC="-I${TOP_DIR}/depkgs/cweb"
572 #      CWEB_LIBS="-lcweb"
573 #      CWEB_LDFLAGS="-L${TOP_DIR}/depkgs/cweb"
574 #      CWEB_SRC="${TOP_DIR}/depkgs/cweb"
575 #    ])
576 #  ]   
577 #)
578 #AC_SUBST(CWEB)
579 #AC_SUBST(CWEB_INC)
580 #AC_SUBST(CWEB_LIBS)
581 #AC_SUBST(CWEB_LDFLAGS)
582 #AC_SUBST(CWEB_SRC)
583
584 # End of CWEB stuff
585 # -----------------------------------------------------------------------
586
587
588
589 # -----------------------------------------------------------
590 # Check whether user wants TCP wrappers support (default off)
591 # -----------------------------------------------------------
592 TCPW_MSG="no" 
593 AC_ARG_WITH(tcp-wrappers,
594   [  --with-tcp-wrappers=DIR     enable tcpwrappers support],
595   [
596     if test "x$withval" != "xno" ; then
597        saved_LIBS="$LIBS"
598        LIBS="$saved_LIBS -lwrap"
599        AC_MSG_CHECKING(for libwrap)
600        AC_TRY_LINK(
601           [ #include <tcpd.h>
602              int deny_severity = 0;
603              int allow_severity = 0;
604              struct request_info *req; ],
605           [ hosts_access(req); ],
606           [
607             AC_MSG_RESULT(yes)
608             AC_DEFINE(HAVE_LIBWRAP)
609             TCPW_MSG="yes" 
610           ], [
611             LIBS="$saved_LIBS -lwrap -lnsl"
612             AC_TRY_LINK(
613               [ #include <tcpd.h>
614                  int deny_severity = 0;
615                  int allow_severity = 0;
616                  struct request_info *req; ],
617               [ hosts_access(req); ],
618               [
619                  AC_MSG_RESULT(yes)
620                  AC_DEFINE(HAVE_LIBWRAP)
621                  TCPW_MSG="yes" 
622               ],
623               [AC_MSG_ERROR([*** libwrap missing]) ] ]
624             )
625        )
626     fi
627   ]
628 )
629
630 # ------------------------------------------
631 # Where to place working dir
632 # ------------------------------------------
633 working_dir=`eval echo ${prefix}/var/bacula/working`
634 AC_ARG_WITH(working-dir,
635    [  --with-working-dir=PATH    specify path of Bacula working directory],
636    [
637        if test "x$withval" != "xno" ; then     
638               working_dir=$withval
639        fi
640    ]
641 )
642
643 AC_SUBST(working_dir)
644
645
646 # ------------------------------------------
647 # Where to place scriptdir (script files)
648 # ------------------------------------------
649 scriptdir=`eval echo ${sysconfdir}`
650 AC_ARG_WITH(scriptdir,
651    [  --with-scriptdir=PATH    specify path of Bacula scripts directory],
652    [
653        if test "x$withval" != "xno" ; then     
654               scriptdir=$withval
655        fi
656    ]
657 )
658
659 AC_SUBST(scriptdir)
660
661
662 # ------------------------------------------
663 # Where to send dump email
664 # ------------------------------------------
665 dump_email=root@localhost
666 AC_ARG_WITH(dump-email,
667    [  --with-dump-email=EMAIL    dump email address],
668    [
669        if test "x$withval" != "xno" ; then     
670               dump_email=$withval
671        fi
672    ]
673 )
674
675 AC_SUBST(dump_email)
676
677 # ------------------------------------------
678 # Where to send job email
679 # ------------------------------------------
680 job_email=root@localhost
681 AC_ARG_WITH(job-email,
682    [  --with-job-email=EMAIL     job output email address],
683    [
684        if test "x$withval" != "xno" ; then     
685               job_email=$withval
686        fi
687    ]
688 )
689
690 AC_SUBST(job_email)
691
692 # ------------------------------------------
693 # Where to find smtp host
694 # ------------------------------------------
695 smtp_host=localhost
696 AC_ARG_WITH(smtp_host,
697    [  --with-smtp-host=HOST              SMTP mail host address],
698    [
699        if test "x$withval" != "xno" ; then     
700               smtp_host=$withval
701        fi
702    ]
703 )
704
705 AC_SUBST(smtp_host)
706
707
708 # ------------------------------------
709 # Where to place pid files
710 # ------------------------------------
711 piddir=/var/run
712 AC_ARG_WITH(pid-dir,
713     [  --with-pid-dir=PATH               specify location of Bacula pid files],
714     [
715         if test "x$withval" != "xno" ; then     
716             piddir=$withval
717         fi
718     ]
719 )
720
721 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
722 AC_SUBST(piddir)
723
724
725 # ------------------------------------
726 # Where to place subsys "lock file"
727 # ------------------------------------
728 subsysdir=/var/run/subsys
729 AC_ARG_WITH(subsys-dir,
730     [  --with-subsys-dir=PATH    specify location of Bacula subsys file],
731     [
732         if test "x$withval" != "xno" ; then     
733             subsysdir=$withval
734         fi
735     ]
736 )
737
738 AC_SUBST(subsysdir)
739
740
741
742 # ------------------------------------
743 # Where to start assigning ports
744 # ------------------------------------
745 baseport=9101
746 AC_ARG_WITH(baseport,
747     [  --with-baseport=PORT              specify base port address for daemons],
748     [
749         if test "x$withval" != "xno" ; then     
750              baseport=$withval
751         fi
752     ]
753 )
754
755 AC_SUBST(baseport)
756 dir_port=`expr $baseport`
757 fd_port=`expr $baseport + 1`
758 sd_port=`expr $fd_port + 1`
759
760 AC_SUBST(dir_port)
761 AC_SUBST(fd_port)
762 AC_SUBST(sd_port)
763
764
765 # ------------------------------------------
766 # Generate passwords
767 # ------------------------------------------
768 dir_password=
769 AC_ARG_WITH(dir-password,
770    [  --with-dir-password=PASSWORD   specify Director's password],
771    [
772        if test "x$withval" != "xno" ; then     
773            dir_password=$withval
774        fi
775    ]
776 )
777
778 if test "x$dir_password" = "x" ; then
779    if test "x$OPENSSL" = "xnone" ; then
780 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'`
781       key=`autoconf/randpass 33`
782    else
783       key=`openssl rand -base64 33`
784    fi
785    dir_password=$key
786 fi
787
788 fd_password=
789 AC_ARG_WITH(fd-password,
790    [  --with-fd-password=PASSWORD    specify Client's password],
791    [
792        if test "x$withval" != "xno" ; then     
793            fd_password=$withval
794        fi
795    ]
796 )
797
798 if test "x$fd_password" = "x" ; then
799    if test "x$OPENSSL" = "xnone" ; then
800 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'`
801       key=`autoconf/randpass 37`
802    else
803       key=`openssl rand -base64 33`
804    fi
805    fd_password=$key
806 fi
807
808 sd_password=
809 AC_ARG_WITH(sd-password,
810    [  --with-sd-password=PASSWORD    specify Storage daemon's password],
811    [
812        if test "x$withval" != "xno" ; then     
813            sd_password=$withval
814        fi
815    ]
816 )
817
818 if test "x$sd_password" = "x" ; then
819    if test "x$OPENSSL" = "xnone" ; then
820 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'`
821       key=`autoconf/randpass 41`
822    else
823       key=`openssl rand -base64 33`
824    fi
825    sd_password=$key
826 fi
827
828
829 AC_SUBST(dir_password)
830 AC_SUBST(fd_password)
831 AC_SUBST(sd_password)
832
833
834 #
835 # Handle users and groups for each daemon
836 #
837 dir_user=
838 AC_ARG_WITH(dir_user,
839     [  --with-dir-user=USER              specify user for Director daemon],
840     [
841         if test "x$withval" != "x" ; then       
842              dir_user=$withval
843         fi
844     ]
845 )
846
847 dir_group=
848 AC_ARG_WITH(dir_group,
849     [  --with-dir-group=GROUP            specify group for Director daemon],
850     [
851         if test "x$withval" != "x" ; then       
852              dir_group=$withval
853         fi
854     ]
855 )
856
857 sd_user=
858 AC_ARG_WITH(sd_user,
859     [  --with-sd-user=USER               specify user for Storage daemon],
860     [
861         if test "x$withval" != "x" ; then       
862              sd_user=$withval
863         fi
864     ]
865 )
866
867 sd_group=
868 AC_ARG_WITH(sd_group,
869     [  --with-sd-group=GROUP             specify group for Storage daemon],
870     [
871         if test "x$withval" != "x" ; then       
872              sd_group=$withval
873         fi
874     ]
875 )
876
877 fd_user=
878 AC_ARG_WITH(fd_user,
879     [  --with-fd-user=USER               specify user for File daemon],
880     [
881         if test "x$withval" != "x" ; then       
882              fd_user=$withval
883         fi
884     ]
885 )
886
887 fd_group=
888 AC_ARG_WITH(fd_group,
889     [  --with-fd-group=GROUP             specify group for File daemon],
890     [
891         if test "x$withval" != "x" ; then       
892              fd_group=$withval
893         fi
894     ]
895 )
896
897
898
899
900 AC_SUBST(dir_user)
901 AC_SUBST(dir_group)
902 AC_SUBST(sd_user)
903 AC_SUBST(sd_group)
904 AC_SUBST(fd_user)
905 AC_SUBST(fd_group)
906
907 #
908 # allow setting default executable permissions
909 #
910 SBINPERM=0754
911 AC_ARG_WITH(sbin-perm,
912     [  --with-sbin-perm=MODE             specify permissions for sbin binaries (0754)],
913     [
914         if test "x$withval" != "x" ; then       
915             SBINPERM=$withval
916         fi
917     ]
918 )
919
920 AC_SUBST(SBINPERM)
921
922 # ------------------------------------------------
923 # Bacula check for various SQL database engines
924 # ------------------------------------------------
925 BA_CHECK_POSTGRESQL_DB
926
927 BA_CHECK_MYSQL_DB
928
929 BA_CHECK_SQLITE_DB
930
931 AC_SUBST(cats)
932 AC_SUBST(DB_NAME)
933
934 AC_DEFINE(PROTOTYPES)
935
936 dnl# --------------------------------------------------------------------------
937 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
938 dnl#
939 if test -z "$CFLAGS"; then
940     if test -z "$CCOPTS"; then
941         CCOPTS='-g -O2'
942 dnl>    if test "x$GCC" = xyes; then
943 dnl>        if test x$system = xLinux; then
944 dnl>            CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
945 dnl>        fi
946 dnl>    fi
947     fi
948     CFLAGS="$CCOPTS"
949 fi
950
951
952 dnl A few others 
953 AC_EXEEXT
954
955 dnl See if we can use 64 bit file addresses
956 largefile_support="no"
957 AC_BAC_LARGEFILE
958
959
960 AC_PATH_XTRA
961
962 dnl# --------------------------------------------------------------------------
963 dnl# CHECKING FOR HEADER FILES
964 dnl# --------------------------------------------------------------------------
965 AC_CHECK_HEADERS( \
966         assert.h \
967         fcntl.h \
968         grp.h \
969         pwd.h \
970         libc.h \
971         limits.h \
972         stdarg.h \
973         stdlib.h \
974         stdint.h \
975         string.h \
976         termios.h \
977         unistd.h \
978         sys/byteorder.h \
979         sys/ioctl.h \
980         sys/select.h \
981         sys/sockio.h \
982         sys/time.h \
983         sys/socket.h \
984         arpa/nameser.h \
985         resolv.h \
986         mtio.h \
987         sys/mtio.h \
988 )
989 AC_HEADER_STDC
990 AC_HEADER_MAJOR
991 AC_HEADER_DIRENT
992 AC_HEADER_STAT
993 AC_HEADER_SYS_WAIT
994 AC_HEADER_TIME
995 AC_STRUCT_ST_BLKSIZE
996 AC_STRUCT_ST_BLOCKS
997 AC_STRUCT_TIMEZONE
998
999 dnl# --------------------------------------------------------------------------
1000 dnl# Check for utime.h structure 
1001 dnl# --------------------------------------------------------------------------
1002 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1003   [AC_TRY_COMPILE([
1004 #include <sys/types.h>
1005 #include <utime.h>], [struct utimbuf foo],
1006   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
1007 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
1008
1009 dnl# --------------------------------------------------------------------------
1010 dnl# Check for socklen_t
1011 dnl# --------------------------------------------------------------------------
1012 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1013   [AC_TRY_COMPILE([
1014 #include <sys/types.h>
1015 #include <sys/socket.h>],
1016   [socklen_t x],
1017   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
1018 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
1019
1020 dnl# --------------------------------------------------------------------------
1021 dnl# Check for bigendian
1022 dnl# --------------------------------------------------------------------------
1023 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
1024   [AC_TRY_RUN(
1025     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
1026     [ba_cv_bigendian=yes], 
1027     [ba_cv_bigendian=no], 
1028     [ba_cv_bigendian=no])])
1029 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
1030
1031
1032 AC_C_CONST
1033
1034
1035 dnl# --------------------------------------------------------------------------
1036 dnl# CHECKING FOR FILESYSTEM TYPE
1037 dnl# --------------------------------------------------------------------------
1038 AC_MSG_CHECKING(how to get filesystem type)
1039 fstype=no
1040 # The order of these tests is important.
1041 AC_TRY_CPP([#include <sys/statvfs.h>
1042 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
1043 if test $fstype = no; then
1044 AC_TRY_CPP([#include <sys/statfs.h>
1045 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
1046 fi
1047 if test $fstype = no; then
1048 AC_TRY_CPP([#include <sys/statfs.h>
1049 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
1050 fi
1051 if test $fstype = no; then  
1052 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
1053 fi
1054 if test $fstype = no; then  
1055 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1056 fi
1057 if test $fstype = no; then  
1058 AC_TRY_CPP([#include <sys/mount.h>
1059 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
1060 fi
1061 AC_MSG_RESULT($fstype)
1062
1063 dnl# --------------------------------------------------------------------------
1064 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
1065 dnl# --------------------------------------------------------------------------
1066 AC_TYPE_SIGNAL
1067 SIGNAL_CHECK
1068 AC_TYPE_MODE_T
1069 AC_TYPE_UID_T
1070 AC_TYPE_SIZE_T
1071 AC_TYPE_PID_T
1072 AC_TYPE_OFF_T
1073 AC_CHECK_TYPE(ino_t, unsigned long)
1074 AC_CHECK_TYPE(dev_t, unsigned long)
1075 AC_CHECK_TYPE(daddr_t, long)
1076 AC_CHECK_TYPE(major_t, int)
1077 AC_CHECK_TYPE(minor_t, int)
1078 AC_CHECK_TYPE(ssize_t, int)
1079 AC_STRUCT_ST_BLOCKS
1080 AC_STRUCT_ST_RDEV
1081 AC_STRUCT_TM
1082 AC_C_CONST
1083
1084
1085 AC_CHECK_SIZEOF(char, 1)
1086 AC_CHECK_SIZEOF(short int, 2)
1087 AC_CHECK_SIZEOF(int, 4)
1088 AC_CHECK_SIZEOF(long int, 4)
1089 AC_CHECK_SIZEOF(long long int, 8)
1090 AC_CHECK_SIZEOF(int *, 4)
1091
1092 # Check for sys/types.h types
1093 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1094     AC_TRY_COMPILE(
1095         [ #include <sys/types.h> ], 
1096         [ u_int a; a = 1;], 
1097         [ ac_cv_have_u_int="yes" ],
1098         [ ac_cv_have_u_int="no" ]
1099     )
1100 ])
1101 if test "x$ac_cv_have_u_int" = "xyes" ; then
1102    AC_DEFINE(HAVE_U_INT)
1103    have_u_int=1
1104 fi
1105
1106 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
1107    AC_TRY_COMPILE(
1108       [ #include <sys/types.h> ], 
1109       [ intmax_t a; a = 1;], 
1110       [ ac_cv_have_intmax_t="yes" ],
1111       [ 
1112          AC_TRY_COMPILE(
1113             [ #include <stdint.h> ], 
1114             [ intmax_t a; a = 1;], 
1115             [ ac_cv_have_intmax_t="yes" ],
1116             [ ac_cv_have_intmax_t="no" ]
1117          )
1118       ]
1119    )        
1120
1121 ])
1122 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
1123    AC_DEFINE(HAVE_INTMAX_T)
1124    have_intmax_t=1
1125 fi
1126
1127
1128 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
1129    AC_TRY_COMPILE(
1130       [ #include <sys/types.h> ], 
1131       [ u_intmax_t a; a = 1;], 
1132       [ ac_cv_have_u_intmax_t="yes" ],
1133       [ 
1134          AC_TRY_COMPILE(
1135             [ #include <stdint.h> ], 
1136             [ u_intmax_t a; a = 1;], 
1137             [ ac_cv_have_u_intmax_t="yes" ],
1138             [ ac_cv_have_u_intmax_t="no" ]
1139          )
1140       ]
1141    )
1142 ])
1143 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
1144    AC_DEFINE(HAVE_U_INTMAX_T)
1145    have_u_intmax_t=1
1146 fi
1147
1148
1149 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1150    AC_TRY_COMPILE(
1151       [ #include <sys/types.h> ], 
1152       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
1153       [ ac_cv_have_intxx_t="yes" ],
1154       [ ac_cv_have_intxx_t="no" ]
1155    )
1156 ])
1157 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1158    AC_DEFINE(HAVE_INTXX_T)
1159    have_intxx_t=1
1160 fi
1161         
1162 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1163    AC_TRY_COMPILE(
1164       [ #include <sys/types.h> ], 
1165       [ int64_t a; a = 1;], 
1166       [ ac_cv_have_int64_t="yes" ],
1167       [ ac_cv_have_int64_t="no" ]
1168    )
1169 ])
1170 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1171    AC_DEFINE(HAVE_INT64_T)
1172    have_int64_t=1
1173 fi
1174         
1175 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1176    AC_TRY_COMPILE(
1177       [ #include <sys/types.h> ], 
1178       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
1179       [ ac_cv_have_u_intxx_t="yes" ],
1180       [ ac_cv_have_u_intxx_t="no" ]
1181    )
1182 ])
1183 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1184    AC_DEFINE(HAVE_U_INTXX_T)
1185    have_u_intxx_t=1
1186 fi
1187
1188 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1189    AC_TRY_COMPILE(
1190       [ #include <sys/types.h> ], 
1191       [ u_int64_t a; a = 1;], 
1192       [ ac_cv_have_u_int64_t="yes" ],
1193       [ ac_cv_have_u_int64_t="no" ]
1194    )
1195 ])
1196 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1197    AC_DEFINE(HAVE_U_INT64_T)
1198    have_u_int64_t=1
1199 fi
1200
1201 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1202            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1203 then
1204    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1205    AC_TRY_COMPILE(
1206       [ #include <sys/bitypes.h>  ], 
1207       [ int8_t a; int16_t b; int32_t c;
1208         u_int8_t e; u_int16_t f; u_int32_t g;
1209         a = b = c = e = f = g = 1;  ], 
1210       [ AC_DEFINE(HAVE_U_INTXX_T)
1211         AC_DEFINE(HAVE_INTXX_T)
1212         AC_DEFINE(HAVE_SYS_BITYPES_H)
1213         AC_MSG_RESULT(yes) ],
1214       [ AC_MSG_RESULT(no)]
1215    ) 
1216 fi
1217
1218 if test -z "$have_u_intxx_t" ; then
1219    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1220       AC_TRY_COMPILE(
1221          [ #include <sys/types.h> ], 
1222          [ uint8_t a; uint16_t b; 
1223            uint32_t c; a = b = c = 1; ], 
1224          [ ac_cv_have_uintxx_t="yes" ],
1225          [ ac_cv_have_uintxx_t="no" ]
1226       )
1227    ])
1228    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1229       AC_DEFINE(HAVE_UINTXX_T)
1230    fi
1231 fi
1232
1233
1234 dnl# --------------------------------------------------------------------------
1235 dnl# CHECKING FOR LIBRARY FUNCTIONS
1236 dnl# --------------------------------------------------------------------------
1237 AC_CHECK_FUNCS( \
1238         fork \
1239         getcwd \
1240         gethostname \
1241         getpid \
1242         gettimeofday \
1243         setpgid \
1244         setpgrp \
1245         setsid \
1246         signal \
1247         strerror \
1248         strncmp \
1249         strncpy \
1250         vfprintf \
1251         ,,
1252         [echo 'configure: cannot find needed function.'; exit 1]
1253 )
1254
1255 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1256 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1257
1258 AC_CHECK_FUNCS(chflags) 
1259
1260 AC_CHECK_FUNCS(snprintf vsnprintf gethostid getdomainname)
1261
1262 dnl# --------------------------------------------------------------------------
1263 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1264 dnl# --------------------------------------------------------------------------
1265 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1266
1267 # If resolver functions are not in libc check for -lnsl or -lresolv.
1268 AC_CHECK_FUNC(gethostbyname_r,
1269     AC_MSG_RESULT(using libc's resolver),
1270     AC_CHECK_LIB(nsl,gethostbyname_r)
1271     AC_CHECK_LIB(resolv,gethostbyname_r))
1272
1273
1274 # Find where sockets are (especially for Solaris)
1275 AC_CHECK_FUNC(socket,
1276     AC_MSG_RESULT(using libc's socket),
1277     AC_CHECK_LIB(xnet,socket)
1278     AC_CHECK_LIB(socket,socket)
1279     AC_CHECK_LIB(inet,socket))
1280
1281 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1282
1283 AC_FUNC_STRFTIME
1284 AC_FUNC_VPRINTF
1285 AC_FUNC_ALLOCA
1286 AC_FUNC_GETMNTENT
1287 AC_FUNC_CLOSEDIR_VOID
1288 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
1289 AC_FUNC_FNMATCH
1290
1291
1292 dnl# FreeBSD needs to link libxpg4
1293 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
1294
1295
1296 AC_CHECK_LIB(sun, getpwnam)
1297
1298 AC_CHECK_HEADERS(zlib.h)
1299 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1300 have_zlib=no
1301 if test x$FDLIBS = x-lz; then
1302   AC_DEFINE(HAVE_LIBZ)
1303   have_zlib=yes
1304 fi
1305
1306 AC_CHECK_HEADER(sys/acl.h)
1307 AC_CHECK_LIB(acl, acl_get_file, [FDLIBS="-lacl $FDLIBS"])
1308 have_acl=no
1309 if test $ac_cv_lib_acl_acl_get_file = yes; then
1310    AC_DEFINE(HAVE_ACL)
1311    have_acl=yes
1312 fi
1313
1314 dnl Check for pthread libraries
1315 PTHREAD_LIB=""
1316 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1317         [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1318             [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1319                 [AC_CHECK_FUNC(pthread_create)]
1320             )]
1321         )]
1322 )
1323
1324 AC_SUBST(FDLIBS)
1325 AC_DEFINE(FDLIBS)
1326
1327
1328 CFLAGS=${CFLAGS--O}
1329 LDFLAGS=${LDFLAGS--O}
1330 DB_LIBS="${SQL_LFLAGS}"
1331
1332 CPPFLAGS="$CPPFLAGS"
1333 AC_SUBST(DEBUG)
1334 AC_SUBST(DINCLUDE)
1335 AC_SUBST(CFLAGS)
1336 AC_SUBST(CPPFLAGS)
1337 AC_SUBST(LDFLAGS)
1338 AC_SUBST(X_CFLAGS)
1339 AC_SUBST(LIBS)
1340 AC_SUBST(DLIB)
1341 AC_SUBST(DB_LIBS)
1342 AC_SUBST(X_LIBS)
1343 AC_SUBST(X_EXTRA_LIBS)
1344 AC_SUBST(WCFLAGS)
1345 AC_SUBST(WLDFLAGS)
1346
1347 dnl# extra configurable objects
1348 OBJLIST=
1349 AC_SUBST(OBJLIST)
1350
1351 lld="lld"
1352 llu="llu"
1353
1354 WCFLAGS=
1355 WLDFLAGS=
1356
1357 #
1358 # Finally we set appropriate distribution specific
1359 #  variables and defaults
1360 #
1361 # PFILES are platform specific files
1362 PFILES="platforms/Makefile"
1363 PSCMD="ps -e"
1364 WIN32=
1365 MACOSX=
1366 hostname=`uname -n | cut -d '.' -f 1`
1367 case "$DISTNAME" in
1368 aix)
1369         DISTVER=`uname -r`
1370         PSCMD="ps -e -o pid,comm"
1371         PFILES="${PFILES} \
1372            platforms/aix/Makefile"
1373         TAPEDRIVE="/dev/rmt0.1" 
1374   ;;      
1375 alpha)
1376         DISTVER=`uname -r`
1377         PTHREAD_LIB="-lpthread -lexc"
1378         if test "${CC}" = "gcc" ; then
1379            lld="lld"
1380            llu="llu"
1381         else
1382            lld="ld"
1383            llu="lu"
1384         fi
1385         TAPEDRIVE="/dev/nrmt0"
1386   ;;
1387 bsdi)
1388         DISTVER=`uname -a |awk '{print $3}'`
1389         TAPEDRIVE="/dev/nrmt0"
1390         PTHREAD_LIB="-pthread"
1391         CFLAGS="${CFLAGS} -pthread"
1392         PSCMD="ps -x -o pid,command"
1393         lld="qd"
1394         llu="qu"
1395         PFILES="${PFILES} \
1396             platforms/bsdi/Makefile \
1397             platforms/bsdi/bacula-fd \
1398             platforms/bsdi/bacula-sd \
1399             platforms/bsdi/bacula-dir"
1400         largefile_support="yes"
1401   ;;
1402 cygwin)
1403         DISTVER=`uname -a |awk '{print $3}'`
1404         TAPEDRIVE="/dev/nrst0"
1405         WIN32=win32
1406         WCFLAGS="-mwindows"
1407         WLDFLAGS="-mwindows"
1408   ;;
1409 darwin)
1410         DISTVER=`uname -r`
1411         TAPEDRIVE="/dev/nst0"
1412         PSCMD="ps -e -o pid,command"
1413         MACOSX=macosx
1414         PFILES="${PFILES} \
1415            platforms/darwin/Makefile"
1416   ;;
1417 debian)
1418         DISTVER=`cat /etc/debian_version`
1419         TAPEDRIVE="/dev/nrst0"
1420         PSCMD="ps -e -o pid,command"
1421   ;;
1422 freebsd)
1423         DISTVER=`uname -a |awk '{print $3}'`
1424         VER=`echo $DISTVER | cut -c 1`
1425         if test x$VER = x4 ; then
1426            PTHREAD_LIB="-pthread"
1427            CFLAGS="${CFLAGS} -pthread"
1428         fi
1429         lld="qd"
1430         llu="qu"
1431         TAPEDRIVE="/dev/nrsa0"
1432         PSCMD="ps -x -o pid,command"
1433         PFILES="${PFILES} \
1434             platforms/freebsd/Makefile \
1435             platforms/freebsd/bacula-fd \
1436             platforms/freebsd/bacula-sd \
1437             platforms/freebsd/bacula-dir"
1438         largefile_support="yes"
1439   ;;
1440 hpux)
1441         PSCMD="UNIX95=1 ps -e -o pid,comm"
1442         CFLAGS="$(CFLAGS) -D_XOPEN_SOURCE_EXTENDED=1"
1443         DISTVER=`uname -r`
1444         TAPEDRIVE="/dev/rmt/0hnb"
1445   ;;
1446 irix)
1447         DISTVER=`uname -r`
1448         TAPEDRIVE="/dev/rmt/0cbn"
1449         PSCMD="ps -e -o pid,comm"
1450         PFILES="${PFILES} \
1451             platforms/irix/Makefile \
1452             platforms/irix/bacula-fd \
1453             platforms/irix/bacula-sd \
1454             platforms/irix/bacula-dir"
1455   ;;
1456 netbsd)
1457         DISTVER=`uname -a |awk '{print $3}'`
1458         lld="qd"
1459         llu="qu"
1460         TAPEDRIVE="/dev/nrst0"
1461         PSCMD="ps -a -o pid,command"
1462         PTHREAD_LIB="-pthread"
1463         CFLAGS="${CFLAGS} -pthread"
1464   ;;
1465 openbsd)
1466         DISTVER=`uname -a |awk '{print $3}'`
1467         lld="qd"
1468         llu="qu"
1469         TAPEDRIVE="/dev/nrst0"
1470         PSCMD="ps -a -o pid,command"
1471         PTHREAD_LIB="-pthread"
1472         CFLAGS="${CFLAGS} -pthread"
1473         PFILES="${PFILES} \
1474             platforms/openbsd/Makefile \
1475             platforms/openbsd/bacula-fd \
1476             platforms/openbsd/bacula-sd \
1477             platforms/openbsd/bacula-dir"
1478   ;;
1479 redhat)
1480         if test `cat /etc/redhat-release | grep release |\
1481                    cut -f 3 -d ' '`x = "Enterprise"x ; then
1482            DISTVER="Enterprise "`cat /etc/redhat-release | grep release |\
1483                     cut -f 6 -d ' '`
1484         else
1485             DISTVER=`cat /etc/redhat-release | grep release |\
1486                      cut -f 5 -d ' '`
1487         fi
1488         TAPEDRIVE="/dev/nst0"
1489         PSCMD="ps -e -o pid,command"
1490         PFILES="${PFILES} \
1491             platforms/redhat/Makefile \
1492             platforms/redhat/bacula-fd \
1493             platforms/redhat/bacula-sd \
1494             platforms/redhat/bacula-dir \
1495             platforms/redhat/bacula.spec \
1496             "
1497         hostname=`hostname -s`
1498   ;;
1499 mandrake)
1500         DISTVER=`cat /etc/mandrake-release | grep release |\
1501            cut -f 5 -d ' '`
1502         TAPEDRIVE="/dev/nst0"
1503         PSCMD="ps -e -o pid,command"
1504         PFILES="${PFILES} \
1505             platforms/mandrake/Makefile \
1506             platforms/mandrake/bacula-fd \
1507             platforms/mandrake/bacula-sd \
1508             platforms/mandrake/bacula-dir \
1509             platforms/mandrake/bacula.spec \
1510             "
1511   ;;
1512 gentoo)
1513         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
1514         TAPEDRIVE="/dev/nst0"
1515         PSCMD="ps -e -o pid,command"
1516         PFILES="${PFILES} \
1517             platforms/gentoo/Makefile \
1518             platforms/gentoo/bacula-fd \
1519             platforms/gentoo/bacula-sd \
1520             platforms/gentoo/bacula-dir"
1521   ;;
1522 slackware)
1523         DISTVER=`cat /etc/slackware-version`
1524         TAPEDRIVE="/dev/nst0"
1525         PSCMD="ps -e -o pid,command"
1526         PFILES="${PFILES} \
1527             platforms/slackware/Makefile \
1528             platforms/slackware/rc.bacula-fd \
1529             platforms/slackware/rc.bacula-sd \
1530             platforms/slackware/rc.bacula-dir\
1531             platforms/slackware/functions.bacula"
1532   ;;
1533 solaris)
1534         DISTVER=`uname -r`
1535         TAPEDRIVE="/dev/rmt/0cbn"
1536         PSCMD="ps -e -o pid,comm"
1537         PFILES="${PFILES} \
1538             platforms/solaris/Makefile \
1539             platforms/solaris/bacula-fd \
1540             platforms/solaris/bacula-sd \
1541             platforms/solaris/bacula-dir"
1542         if test x$DISTVER = x5.6 ; then
1543             AC_DEFINE(HAVE_OLD_SOCKOPT)
1544         fi
1545   ;;
1546 suse)
1547         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1548             cut -f 3 -d ' '`
1549         TAPEDRIVE="/dev/nst0"
1550         PSCMD="ps -e -o pid,command"
1551         PFILES="${PFILES} \
1552             platforms/suse/Makefile \
1553             platforms/suse/bacula-fd \
1554             platforms/suse/bacula-sd \
1555             platforms/suse/bacula-dir \
1556             platforms/suse/bacula \
1557             platforms/suse/bacula.spec"
1558   ;;
1559 suse5)
1560         DISTNAME=suse
1561         DISTVER=5.x
1562         TAPEDRIVE="/dev/nst0"
1563         PSCMD="ps -e -o pid,command"
1564         PFILES="${PFILES} \
1565             platforms/suse/Makefile \
1566             platforms/suse/bacula-fd \
1567             platforms/suse/bacula-sd \
1568             platforms/suse/bacula-dir"
1569   ;;
1570 unknown)
1571         DISTVER=unknown
1572         TAPEDRIVE="/dev/nst0"
1573   ;;
1574 *)
1575   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1576   ;;
1577 esac  
1578
1579 AC_SUBST(hostname)
1580
1581 LIBS="$PTHREAD_LIB $LIBS"
1582
1583 AC_DEFINE_UNQUOTED(lld, "$lld")
1584 AC_DEFINE_UNQUOTED(llu, "$llu")
1585 AC_SUBST(TAPEDRIVE)
1586 AC_SUBST(PSCMD)
1587 AC_SUBST(WIN32)
1588 AC_SUBST(MACOSX)
1589 AC_SUBST(DISTNAME)
1590 AC_SUBST(DISTVER)
1591
1592 dnl# common parts of the Makefile
1593 MCOMMON=./autoconf/Make.common
1594 AC_SUBST_FILE(MCOMMON)
1595
1596 dnl# Insanity check
1597 if test "x${subsysdir}" = "x${sbindir}" ; then
1598    echo " "
1599    echo " "
1600    echo "You have set both --sbindir and --with-subsys-dir"
1601    echo "  equal to: ${subsysdir} "
1602    echo "This is not permitted. Please reconfigure."
1603    echo " "
1604    echo "Aborting configuration ..."
1605    echo " "
1606    echo " "
1607    exit 1
1608 fi 
1609
1610 AC_OUTPUT([autoconf/Make.common \
1611            Makefile \
1612            rescue/Makefile \
1613            rescue/linux/Makefile \
1614            rescue/freebsd/Makefile \
1615            rescue/solaris/Makefile \
1616            scripts/startmysql \
1617            scripts/stopmysql \
1618            scripts/btraceback \
1619            scripts/startit \
1620            scripts/stopit \
1621            scripts/bconsole \
1622            scripts/gconsole \
1623            scripts/bacula \
1624            scripts/devel_bacula \
1625            scripts/fd \
1626            scripts/Makefile \
1627            scripts/logrotate \
1628            scripts/bacula.desktop.gnome1 \
1629            scripts/bacula.desktop.gnome2 \
1630            scripts/bacula.desktop.gnome1.consolehelper \
1631            scripts/bacula.desktop.gnome2.consolehelper \
1632            scripts/bacula.desktop.gnome1.xsu \
1633            scripts/bacula.desktop.gnome2.xsu \
1634            scripts/gnome-console.console_apps \
1635            scripts/mtx-changer \
1636            doc/Makefile \
1637            src/Makefile \
1638            src/host.h \
1639            src/console/Makefile \
1640            src/console/bconsole.conf \
1641            src/gnome-console/Makefile \
1642            src/gnome-console/gnome-console.conf \
1643            src/gnome2-console/Makefile \
1644            src/gnome2-console/gnome-console.conf \
1645            src/wx-console/Makefile \
1646            src/wx-console/wx-console.conf \
1647            src/dird/Makefile \
1648            src/dird/bacula-dir.conf \
1649            src/lib/Makefile \
1650            src/stored/Makefile \
1651            src/stored/bacula-sd.conf \
1652            src/filed/Makefile \
1653            src/filed/bacula-fd.conf \
1654            src/filed/win32/Makefile \
1655            src/cats/Makefile \
1656            src/cats/make_catalog_backup \
1657            src/cats/delete_catalog_backup \
1658            src/cats/create_postgresql_database \
1659            src/cats/update_postgresql_tables \
1660            src/cats/make_postgresql_tables \
1661            src/cats/grant_postgresql_privileges \
1662            src/cats/drop_postgresql_tables \
1663            src/cats/drop_postgresql_database \
1664            src/cats/create_mysql_database \
1665            src/cats/update_mysql_tables \
1666            src/cats/make_mysql_tables \
1667            src/cats/grant_mysql_privileges \
1668            src/cats/drop_mysql_tables \
1669            src/cats/drop_mysql_database \
1670            src/cats/create_sqlite_database \
1671            src/cats/update_sqlite_tables \
1672            src/cats/make_sqlite_tables \
1673            src/cats/grant_sqlite_privileges \
1674            src/cats/drop_sqlite_tables \
1675            src/cats/drop_sqlite_database \
1676            src/cats/sqlite \
1677            src/cats/mysql \
1678            src/cats/create_bdb_database \
1679            src/cats/update_bdb_tables \
1680            src/cats/make_bdb_tables \
1681            src/cats/grant_bdb_privileges \
1682            src/cats/drop_bdb_tables \
1683            src/cats/drop_bdb_database \
1684            src/cats/create_bacula_database \
1685            src/cats/update_bacula_tables \
1686            src/cats/grant_bacula_privileges \
1687            src/cats/make_bacula_tables \
1688            src/cats/drop_bacula_tables \
1689            src/cats/drop_bacula_database \
1690            src/findlib/Makefile \
1691            src/tools/Makefile \
1692            src/win32/winbacula.nsi \
1693            src/win32/baculafd/bacula-fd.conf \
1694            src/win32/Makefile \
1695            src/win32/console/bconsole.conf \
1696            src/win32/wx-console/wx-console.conf \
1697            $PFILES ],  
1698           [(echo "Doing make of dependencies"; make depend;) ]
1699 )
1700
1701 cd scripts
1702 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
1703 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
1704 cd ..
1705
1706 c=src/cats
1707
1708 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
1709 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
1710
1711 chmod 755 $c/create_bdb_database      $c/update_bdb_tables     $c/make_bdb_tables
1712 chmod 755 $c/grant_bdb_privileges     $c/drop_bdb_tables       $c/drop_bdb_database
1713
1714 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
1715 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
1716
1717 chmod 755 $c/create_sqlite_database   $c/update_sqlite_tables  $c/make_sqlite_tables
1718 chmod 755 $c/grant_sqlite_privileges  $c/drop_sqlite_tables    $c/drop_sqlite_database
1719
1720 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
1721 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
1722
1723 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup
1724 chmod 755 $c/sqlite
1725 chmod 755 $c/mysql
1726
1727 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
1728    largefile_support="yes"
1729 fi
1730
1731 #
1732 # A whole lot of hand springs to get the compiler version.
1733 #  This is because gcc changed the output in version 3.0
1734 #
1735 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
1736 if test "x${CCVERSION}" = "x" ; then
1737   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
1738 fi
1739 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
1740 if test x"${CXXVERSION}" = x ; then
1741   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
1742 fi
1743
1744 if test "x${subsysdir}" = "x${sbindir}" ; then
1745    echo " "
1746    echo " "
1747    echo "You have set --sbindir and --with-subsys-dir"
1748    echo "  both equal to: ${subsysdir} "
1749    echo "  This is not permitted. Please reconfigure."
1750    echo " "
1751    echo "Aborting configuration ..."
1752    echo " "
1753    echo " "
1754    exit 1
1755 fi 
1756
1757 if test "x${db_name}" = "xInternal" ; then
1758    echo " "
1759    echo " "
1760    echo "You have not specified either --enable-client-only or one of the"
1761    echo "  supported databases: MySQL, PostgreSQL, or SQLite".
1762    echo "  This is not permitted. Please reconfigure."
1763    echo " "
1764    echo "Aborting the configuration ..."
1765    echo " "
1766    echo " "
1767    exit 1
1768 fi
1769
1770 echo "
1771 Configuration on `date`:
1772
1773   Host:                       $host -- ${DISTNAME} ${DISTVER}
1774   Bacula version:             ${VERSION} (${DATE})
1775   Source code location:       ${srcdir}
1776   Install binaries:           ${sbindir}
1777   Install config files:       ${sysconfdir}
1778   Scripts directory:          ${scriptdir}
1779   Working directory:          ${working_dir}
1780   PID directory:              ${piddir}
1781   Subsys directory:           ${subsysdir}
1782   C Compiler:                 ${CC} ${CCVERSION}
1783   C++ Compiler:               ${CXX} ${CXXVERSION}
1784   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
1785   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
1786   Libraries:                  ${LIBS}
1787   Statically Linked Tools:    ${support_static_tools}
1788   Statically Linked FD:       ${support_static_fd}
1789   Statically Linked SD:       ${support_static_sd}
1790   Statically Linked DIR:      ${support_static_dir}
1791   Statically Linked CONS:     ${support_static_cons}
1792   Database type:              ${db_name}
1793   Database lib:               ${DB_LIBS}
1794
1795   Job Output Email:           ${job_email}
1796   Traceback Email:            ${dump_email}
1797   SMTP Host Address:          ${smtp_host}
1798
1799   Director Port:              ${dir_port}
1800   File daemon Port:           ${fd_port}
1801   Storage daemon Port:        ${sd_port}
1802
1803   Director User:              ${dir_user}
1804   Director Group:             ${dir_group}
1805   Storage Daemon User:        ${sd_user}
1806   Storage DaemonGroup:        ${sd_group}
1807   File Daemon User:           ${fd_user}
1808   File Daemon Group:          ${fd_group}
1809
1810   SQL binaries Directory      ${SQL_BINDIR}
1811
1812   Large file support:         $largefile_support
1813   Bacula conio support:       ${got_conio} ${CONS_LIBS}
1814   readline support:           ${got_readline} ${PRTREADLINE_SRC}
1815   TCP Wrappers support:       ${TCPW_MSG}
1816   ZLIB support:               ${have_zlib}
1817   enable-smartalloc:          ${support_smartalloc} 
1818   enable-gnome:               ${support_gnome} ${gnome_version}
1819   enable-wx-console:          ${support_wx_console}
1820   client-only:                ${build_client_only}
1821   ACL support:                ${have_acl}
1822
1823   " > config.out
1824
1825 cat config.out
1826
1827 # old stuff
1828 # cweb support:               ${got_cweb} ${CWEB_SRC}
1829 # gmp support:                ${got_gmp} ${GMP_SRC}