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