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