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