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