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