]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
Complete port to Windows
[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
150 # -------------------------------------------------------------------------
151 #  If the user has not set --exec-prefix, we default to ${prefix}
152 # -------------------------------------------------------------------------
153 if test x${exec_prefix} = xNONE ; then
154     exec_prefix=${prefix}
155 fi
156
157 # ------------------------------------------------------------------
158 # If the user has not set --sbindir, we set our default as /sbin
159 # ------------------------------------------------------------------
160 if test x$sbindir = x'${exec_prefix}/sbin' ; then
161     sbindir=${exec_prefix}/sbin
162 fi
163 sbindir=`eval echo ${sbindir}`
164
165 # -------------------------------------------------------------------------
166 #  If the user has not set --mandir, we default to /usr/share/man
167 # -------------------------------------------------------------------------
168 if test x$mandir = x'${prefix}/man' ; then
169    mandir=/usr/share/man
170 fi
171
172                       
173 # ------------------------------------------------------------------
174 # All list of languages for which a translation exist. Each
175 #  language is separated by a space.
176 # ------------------------------------------------------------------
177 ALL_LINGUAS=""
178
179 AC_PATH_PROGS(MSGFMT, msgfmt, no)
180 if test "$MSGFMT" = "no"
181 then
182    echo 'msgfmt program not found, disabling NLS !'
183    USE_NLS=no
184    USE_INCLUDED_LIBINTL=no
185 #else
186     AM_GNU_GETTEXT
187 fi
188
189
190 support_mysql=no
191 support_sqlite=no
192 support_sqlite3=no
193 support_postgresql=no
194 support_smartalloc=yes
195 support_readline=yes
196 support_conio=yes
197 support_gnome=no
198 support_wx_console=no
199 support_tls=no
200 support_crypto=no
201 gnome_version=
202 wx_version=
203 support_static_tools=no
204 support_static_fd=no
205 support_static_sd=no
206 support_static_dir=no
207 support_static_cons=no
208 support_python=no
209 build_client_only=no
210 build_dird=yes
211 build_stored=yes
212 cats=
213 db_name=Internal
214 DB_NAME=bdb
215
216 dnl# --------------------------------------------------------------------------
217 dnl# CHECKING COMMAND LINE OPTIONS
218 dnl# --------------------------------------------------------------------------
219
220 # -------------------------------------------
221 # gnome (default off)
222 # -------------------------------------------
223 AC_ARG_ENABLE(gnome,
224   [  --enable-gnome       enable build of gnome-console GUI [disabled]],
225   [if test x$enableval = xyes; then
226     support_gnome=yes
227   fi])
228
229 GNOME_DIR=
230 if test x$support_gnome = xyes; then
231   abc=`$PKGCONFIG --exists libgnomeui-2.0`
232   pkg=$?
233   if test $pkg = 0; then
234      GNOME_INCLUDEDIR=`$PKGCONFIG --cflags-only-I libgnomeui-2.0`
235      GNOMEUI_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
236      GNOME_LIBDIR=`$PKGCONFIG --libs libgnomeui-2.0`
237      GNOME_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
238      AC_SUBST(GNOME_INCLUDEDIR)
239      AC_SUBST(GNOMEUI_LIBS)
240      AC_SUBST(GNOME_LIBDIR)
241      AC_SUBST(GNOME_LIBS)
242      GNOME_DIR=src/gnome2-console
243      gnome_version="Version 2.x"
244   else
245      AC_MSG_ERROR(Unable to find Gnome 2 installation)
246   fi
247 fi
248 AC_SUBST(GNOME_DIR)
249
250
251 # -------------------------------------------
252 # wx-console (default off)
253 # -------------------------------------------
254 AC_ARG_ENABLE(wx-console,
255   [  --enable-wx-console     enable build of wxWidgets console [disabled]],
256   [if test x$enableval = xyes; then
257     support_wx_console=yes
258   fi])
259
260 WX_DIR=
261 if test x$support_wx_console = xyes; then
262   abc=`$WXCONFIG $WXFLAGS --cppflags`
263   pkg=$?
264   if test $pkg = 0; then
265      wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
266      WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
267      WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
268
269      AC_SUBST(WXCONS_CPPFLAGS)
270      AC_SUBST(WXCONS_LDFLAGS)
271      WX_DIR=src/wx-console
272   else
273      echo " "
274      echo "wx-config program not found. wx-console disabled."
275      echo " "
276      support_wx_console=no
277   fi
278 fi
279 AC_SUBST(WX_DIR)
280
281
282 # -------------------------------------------
283 # tray-monitor (default off)
284 # -------------------------------------------
285 AC_ARG_ENABLE(tray-monitor,
286   [  --enable-tray-monitor   enable build of Gnome tray monitor (compatible with KDE) [disabled]],
287   [if test x$enableval = xyes; then
288     support_tray_monitor=yes
289   fi])
290
291 TRAY_MONITOR_DIR=
292 if test x$support_tray_monitor = xyes; then
293   abc=`$PKGCONFIG --exists gtk+-2.0`
294   pkg=$?
295   if test $pkg = 0; then
296      TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
297      TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
298      AC_SUBST(TRAY_MONITOR_CPPFLAGS)
299      AC_SUBST(TRAY_MONITOR_LDFLAGS)
300      TRAY_MONITOR_DIR=src/tray-monitor
301      abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
302      pkg=$?
303      if test $pkg = 0; then
304         AC_DEFINE(HAVE_GTK_2_4)
305      fi
306   fi
307 fi
308 AC_SUBST(TRAY_MONITOR_DIR)
309
310 # -------------------------------------------
311 # smartalloc (default off)
312 # -------------------------------------------
313 AC_ARG_ENABLE(smartalloc,
314   [  --enable-smartalloc     enable smartalloc debugging support [disabled]],
315   [if test x$enableval = xno; then
316     support_smartalloc=no
317   fi])
318
319 if test x$support_smartalloc = xyes; then
320    AC_DEFINE(SMARTALLOC)
321 fi
322
323 # -------------------------------------------
324 # static-tools (default off)
325 # -------------------------------------------
326 AC_ARG_ENABLE(static-tools,
327    [  --enable-static-tools   enable static tape tools [disabled]],
328    [if test x$enableval = xyes; then
329      support_static_tools=yes
330    fi])
331
332 TTOOL_LDFLAGS=
333 if test x$support_static_tools = xyes; then
334    TTOOL_LDFLAGS="-static"
335 fi
336 AC_SUBST(TTOOL_LDFLAGS)
337
338 # -------------------------------------------
339 # static-fd    (default off)
340 # -------------------------------------------
341 AC_ARG_ENABLE(static-fd,
342    [  --enable-static-fd      enable static File daemon [disabled]],
343    [if test x$enableval = xyes; then
344      support_static_fd=yes
345    fi])
346
347 STATIC_FD=
348 if test x$support_static_fd = xyes; then
349    STATIC_FD="static-bacula-fd"
350 fi
351 AC_SUBST(STATIC_FD)
352
353 # -------------------------------------------
354 # static-sd    (default off)
355 # -------------------------------------------
356 AC_ARG_ENABLE(static-sd,
357    [  --enable-static-sd      enable static Storage daemon [disabled]],
358    [if test x$enableval = xyes; then
359      support_static_sd=yes
360    fi])
361
362 STATIC_SD=
363 if test x$support_static_sd = xyes; then
364    STATIC_SD="static-bacula-sd"
365 fi
366 AC_SUBST(STATIC_SD)
367
368 # -------------------------------------------
369 # static-dir   (default off)
370 # -------------------------------------------
371 AC_ARG_ENABLE(static-dir,
372    [  --enable-static-dir     enable static Director [disabled]],
373    [if test x$enableval = xyes; then
374      support_static_dir=yes
375    fi])
376
377 STATIC_DIR=
378 if test x$support_static_dir = xyes; then
379    STATIC_DIR="static-bacula-dir"
380 fi
381 AC_SUBST(STATIC_DIR)
382
383 # -------------------------------------------
384 # static-cons  (default off)
385 # -------------------------------------------
386 AC_ARG_ENABLE(static-cons,
387    [  --enable-static-cons    enable static Console [disabled]],
388    [if test x$enableval = xyes; then
389      support_static_cons=yes
390    fi])
391
392 STATIC_CONS=
393 STATIC_GNOME_CONS=
394 STATIC_WX_CONS=
395 if test x$support_static_cons = xyes; then
396    STATIC_CONS="static-bconsole"
397    STATIC_GNOME_CONS="static-gnome-console"
398    STATIC_WX_CONS="static-wx-console"
399 fi
400 AC_SUBST(STATIC_CONS)
401 AC_SUBST(STATIC_GNOME_CONS)
402 AC_SUBST(STATIC_WX_CONS)
403
404 # -------------------------------------------
405 # client_only  (default off)
406 # -------------------------------------------
407 AC_ARG_ENABLE(client-only,
408    [  --enable-client-only    build client (File daemon) only [disabled]],
409    [if test x$enableval = xyes; then
410       build_client_only=yes
411       db_name=None
412       DB_NAME=none
413    fi])
414 if test x$build_client_only = xno; then
415    ALL_DIRS="subdirs"
416 else
417    ALL_DIRS=""
418 fi
419 AC_SUBST(ALL_DIRS)
420
421 # -------------------------------------------
422 # director  (default on)
423 # -------------------------------------------
424 AC_ARG_ENABLE(build-dird,
425    [  --enable-build-dird     enable building of dird (Director) [enabled]],
426    [if test x$enableval = xno; then
427       build_dird=no
428    fi])
429 if test x$build_dird = xyes; then
430    DIRD_DIR="src/dird"
431    DIR_TOOLS="DIRTOOLS"
432 else
433    DIRD_DIR=""
434    DIR_TOOLS="NODIRTOOLS"
435 fi
436 AC_SUBST(DIRD_DIR)
437 AC_SUBST(DIR_TOOLS)
438
439 # -------------------------------------------
440 # stored  (default on)
441 # -------------------------------------------
442 AC_ARG_ENABLE(build-stored,
443    [  --enable-build-stored   enable building of stored (Storage daemon) [enabled]],
444    [if test x$enableval = xno; then
445       build_stored=no
446    fi])
447 if test x$build_stored = xyes; then
448    STORED_DIR="src/stored"
449 else
450    STORED_DIR=""
451 fi
452 AC_SUBST(STORED_DIR)
453
454 # ---------------------------------------------------
455 # Check for conio (Bacula readline substitute)(
456 # ---------------------------------------------------
457 # this allows you to turn it completely off
458 AC_ARG_ENABLE(conio,   
459   [  --disable-conio         disable conio support [enabled]
460                                                       ],
461   [if test x$enableval = xno; then
462     support_conio=no
463   fi])
464
465 got_conio="no"
466 if test x$support_conio = xyes; then
467    AC_CHECK_HEADER(termcap.h, 
468      [ AC_CHECK_LIB(termcap, tgetent, 
469        [ CONS_LIBS="-ltermcap"
470          CONS_OBJ="conio.o"
471          CONS_SRC="conio.c"
472          got_conio="yes"
473          support_readline=no
474          AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
475        ],   
476        [ AC_CHECK_LIB(ncurses, tgetent,
477          [ CONS_LIBS="-lncurses"
478            CONS_OBJ="conio.o"
479            CONS_SRC="conio.c"
480            got_conio="yes"
481            support_readline=no
482            AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
483          ])
484        ])
485      ],
486      [
487          AC_CHECK_HEADERS(curses.h)
488          AC_CHECK_HEADER(term.h,
489                [ AC_CHECK_LIB(curses, tgetent, 
490                  [ CONS_LIBS="-lcurses"
491                    CONS_OBJ="conio.o"
492                    CONS_SRC="conio.c"
493                    got_conio="yes"
494                    support_readline=no
495                    AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
496                  ])
497                ],
498                [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
499 [#if HAVE_CURSES_H
500 #include <curses.h>
501 #endif
502 ])
503      ])
504 fi
505
506
507 # ---------------------------------------------------
508 # Check for readline support/directory (default off)
509 # ---------------------------------------------------
510 # this allows you to turn it completely off
511 AC_ARG_ENABLE(readline,
512   [  --disable-readline      disable readline support [disable]
513                                                       ],
514   [if test x$enableval = xno; then
515     support_readline=no
516   fi])
517
518 got_readline="no"
519 READLINE_SRC=
520 if test x$support_readline = xyes; then
521    AC_ARG_WITH(readline,
522      [ --with-readline=DIR               specify readline library directory],
523      [
524         case "$with_readline" in
525         no) : ;;
526         yes|*)
527           if test -f ${with_readline}/readline.h; then
528              CONS_INC="-I${with_readline}"
529              CONS_LDFLAGS="-L$with_readline"
530           elif test -f ${with_readline}/include/readline/readline.h; then
531              CONS_INC="-I${with_readline}/include/readline"
532              CONS_LDFLAGS="-L${with_readline}/lib"
533              with_readline="${with_readline}/include/readline"
534           else
535              with_readline="/usr/include/readline" 
536           fi
537           AC_CHECK_HEADER(${with_readline}/readline.h, 
538              [ AC_DEFINE(HAVE_READLINE) 
539                CONS_LIBS="-lreadline -lhistory -ltermcap"
540                got_readline="yes"   
541              ],
542              [ echo " "
543                echo "readline.h not found. readline turned off ..."
544                echo " "
545              ]
546           )
547           ;;
548         esac
549      ],[
550        # check for standard readline library
551        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
552          [ AC_DEFINE(HAVE_READLINE)
553            got_readline="yes"
554            CONS_INC="-I/usr/include/readline"
555            CONS_LIBS="-lreadline -ltermcap"
556          ], [
557            # Did not find standard library, so try Bacula's default
558             AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
559               [ AC_DEFINE(HAVE_READLINE) 
560                  got_readline="yes"   
561                  CONS_INC="-I${TOP_DIR}/depkgs/readline"
562                  CONS_LIBS="-lreadline -lhistory -ltermcap"
563                  CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
564                  PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
565               ],
566               [ echo " "
567                 echo "readline.h not found. readline turned off ..."
568                 echo " "
569               ]
570             )
571          ]
572        )
573      ]   
574    )
575 fi
576
577
578
579 AC_SUBST(CONS_INC)
580 AC_SUBST(CONS_OBJ)
581 AC_SUBST(CONS_SRC)
582 AC_SUBST(CONS_LIBS)
583 AC_SUBST(CONS_LDFLAGS)
584 AC_SUBST(READLINE_SRC)
585
586 # Minimal stuff for readline Makefile configuration
587 MAKE_SHELL=/bin/sh
588 AC_SUBST(MAKE_SHELL)
589 AC_HEADER_STAT
590 AC_HEADER_DIRENT
591 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
592 AC_CHECK_FUNCS(nanosleep nl_langinfo)
593 AC_CHECK_HEADERS(varargs.h)
594
595 # End of readline/conio stuff
596 # -----------------------------------------------------------------------
597
598 # -----------------------------------------------------------------------
599 #  Check for Python support
600 #
601 AC_MSG_CHECKING(for Python support)
602 AC_ARG_WITH(python,
603 [
604   --with-python[=DIR]     Include Python support.  DIR is the Python base
605                           install directory, default is to search through
606                           a number of common places for the Python files.],
607 [
608   PYTHON_INCDIR= 
609   PYTHON_LIBS=
610   if test "$withval" != "no"; then
611      if test "$withval" = "yes"; then
612         for python_root in /usr /usr/local /usr/sfw; do
613           if test -f $python_root/include/python2.2/Python.h; then
614              PYTHON_INCDIR=-I$python_root/include/python2.2
615              if test -d $python_root/lib64/python2.2/config; then
616                 PYTHON_LIBS="-L$python_root/lib64/python2.2/config -lpython2.2"
617              else
618                 PYTHON_LIBS="-L$python_root/lib/python2.2/config -lpython2.2"
619              fi
620              break
621           elif test -f $python_root/include/python2.3/Python.h; then
622              PYTHON_INCDIR=-I$python_root/include/python2.3
623              if test -d $python_root/lib64/python2.3/config; then
624                 PYTHON_LIBS="-L$python_root/lib64/python2.3/config -lpython2.3"
625              else
626                 PYTHON_LIBS="-L$python_root/lib/python2.3/config -lpython2.3"
627              fi
628              break
629           elif test -f $python_root/include/python2.4/Python.h; then
630              PYTHON_INCDIR=-I$python_root/include/python2.4
631              if test -d $python_root/lib64/python2.4/config; then
632                 PYTHON_LIBS="-L$python_root/lib64/python2.4/config -lpython2.4"
633              else
634                 PYTHON_LIBS="-L$python_root/lib/python2.4/config -lpython2.4"
635              fi
636              break
637           fi
638         done
639         if test x$PYTHON_INCDIR = x; then
640           if test -f $prefix/include/Python.h; then
641              PYTHON_INCDIR=-I$prefix/include
642              if test -d $prefix/lib64/config; then
643                 PYTHON_LIBS="-L$prefix/lib64/config -lpython"
644              else
645                 PYTHON_LIBS="-L$prefix/lib/config -lpython"
646              fi
647           else
648            AC_MSG_RESULT(no)
649            AC_MSG_ERROR(Unable to find Python.h in standard locations)
650           fi
651         fi
652      else
653         if test -f $withval/Python.h; then
654            PYTHON_INCDIR=-I$withval
655            PYTHON_LIBS="-L$withval/config -lpython"
656         elif test -f $withval/include/Python.h; then
657            PYTHON_INCDIR=-I$withval/include
658            if test -d $withval/lib64/config; then
659               PYTHON_LIBS="-L$withval/lib64/config -lpython"
660            else
661               PYTHON_LIBS="-L$withval/lib/config -lpython"
662            fi
663         elif test -f $withval/include/python/Python.h; then
664            PYTHON_INCDIR=-I$withval/include/python
665            if test -d $withval/lib64/python/config; then
666               PYTHON_LIBS="-L$withval/lib64/python/config -lpython"
667            else
668               PYTHON_LIBS="-L$withval/lib/python/config -lpython"
669            fi
670         else
671            AC_MSG_RESULT(no)
672            AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
673         fi
674      fi
675      AC_DEFINE([HAVE_PYTHON], 1)
676      AC_MSG_RESULT(yes)
677      support_python=yes
678      AC_MSG_NOTICE(checking for more Python libs)
679      saved_LIBS="$LIBS"; LIBS=
680      AC_SEARCH_LIBS(shm_open, [rt])
681      AC_CHECK_LIB(util, openpty)
682      PYTHON_LIBS="$PYTHON_LIBS $LIBS"
683      LIBS="$saved_LIBS"
684   else
685      AC_MSG_RESULT(no)
686   fi
687 ],[
688   AC_MSG_RESULT(no)
689 ])
690 AC_SUBST(PYTHON_LIBS)
691 AC_SUBST(PYTHON_INCDIR)
692   
693
694 #
695 # Find where sockets are (especially for Solaris)
696 # Do this before the TCP Wrappers test since tcp wrappers
697 # uses the socket library and some linkers are stupid.
698 #
699 AC_CHECK_FUNC(socket,
700     AC_MSG_RESULT(using libc's socket),
701     AC_CHECK_LIB(xnet,socket)
702     AC_CHECK_LIB(socket,socket)
703     AC_CHECK_LIB(inet,socket))
704
705
706 # -----------------------------------------------------------
707 # Check whether user wants TCP wrappers support (default off)
708 # -----------------------------------------------------------
709 TCPW_MSG="no" 
710 WRAPLIBS=""
711 AC_ARG_WITH(tcp-wrappers,
712   [  --with-tcp-wrappers=DIR     enable tcpwrappers support],
713   [
714     if test "x$withval" != "xno" ; then
715        saved_LIBS="$LIBS"
716        LIBS="$saved_LIBS -lwrap"
717        AC_MSG_CHECKING(for libwrap)
718        AC_SEARCH_LIBS(nanosleep, [rt])
719        AC_TRY_LINK(
720           [ #include <sys/types.h>
721             #include <tcpd.h>
722              int deny_severity = 0;
723              int allow_severity = 0;
724              struct request_info *req; ],
725           [ hosts_access(req); ],
726           [
727             AC_MSG_RESULT(yes)
728             AC_DEFINE(HAVE_LIBWRAP)
729             TCPW_MSG="yes" 
730             LIBS="$saved_LIBS"
731             WRAPLIBS="-lwrap"
732           ], [
733             LIBS="$saved_LIBS -lwrap -lnsl"
734             WRAPLIBS="$saved_LIBS -lwrap -lnsl"
735             AC_TRY_LINK(
736               [ #include <sys/types.h>
737                  #include <tcpd.h>
738                  int deny_severity = 0;
739                  int allow_severity = 0;
740                  struct request_info *req; ],
741               [ hosts_access(req); ],
742               [
743                  AC_MSG_RESULT(yes)
744                  AC_DEFINE(HAVE_LIBWRAP)
745                  TCPW_MSG="yes" 
746                  LIBS="$saved_LIBS"
747                  WRAPLIBS="-lwrap"
748               ],
749               [AC_MSG_ERROR([*** libwrap missing]) ] ]
750             )
751        )
752     fi
753   ]
754 )
755
756 # -----------------------------------------------------------
757 # Check whether OpenSSL is available
758 # -----------------------------------------------------------
759 AC_MSG_CHECKING([for OpenSSL])
760 dnl The following uses quadrigraphs:
761 dnl '@<:@' = '['
762 dnl '@:>@' = ']'
763 AC_ARG_WITH(openssl,
764         AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
765         [with_openssl_directory=${withval}])
766
767 if test "x$with_openssl_directory" != "x"; then
768         OPENSSL_LIBS="-lssl -lcrypto"
769         OPENSSL_INC=""
770
771         if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
772                 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
773                 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
774         fi
775
776         saved_LIBS="$LIBS"
777         saved_CFLAGS="$CFLAGS"
778         LIBS="$saved_LIBS $OPENSSL_LIBS"
779         CFLAGS="$saved_CFLAGS $OPENSSL_INC"
780
781         AC_TRY_LINK([ #include <openssl/ssl.h> ],
782                 [ CRYPTO_set_id_callback(NULL); ],
783                 [
784                         support_tls="yes"
785                         support_crypto="yes"
786                 ],
787                 [ support_tls="no" ]
788         )
789
790         AC_TRY_LINK([ #include <openssl/evp.h> ],
791                 [ EVP_sha512(); ],
792                 [ ac_cv_openssl_sha2="yes" ],
793                 [ ac_cv_openssl_sha2="no" ]
794         )
795
796         LIBS="$saved_LIBS"
797         CFLAGS="$saved_CFLAGS"
798
799         if test "$support_tls" = "yes"; then
800                 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
801                 AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
802                 AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
803         fi
804
805         if test "$ac_cv_openssl_sha2" = "yes"; then
806                 AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
807         fi
808 else
809         support_tls="no"
810         support_crypto="no"
811         OPENSSL_LIBS=""
812         OPENSSL_INC=""
813 fi
814
815 AC_MSG_RESULT([$support_tls])
816 AC_SUBST(OPENSSL_LIBS)
817 AC_SUBST(OPENSSL_INC)
818
819
820 # -----------------------------------------------------------
821 # Python and OpenSSL are using dlopen
822 # -----------------------------------------------------------
823
824 if test "$support_python" = "yes" -o "$support_tls" = "yes"; then
825    AC_SEARCH_LIBS(dlopen, [dl])
826 fi
827
828 # ------------------------------------------
829 # Where to place working dir
830 # ------------------------------------------
831 working_dir=`eval echo ${prefix}/var/bacula/working`
832 AC_ARG_WITH(working-dir,
833    [  --with-working-dir=PATH    specify path of Bacula working directory],
834    [
835        if test "x$withval" != "xno" ; then     
836               working_dir=$withval
837        fi
838    ]
839 )
840
841 AC_SUBST(working_dir)
842
843
844 # ------------------------------------------
845 # Where to place scriptdir (script files)
846 # ------------------------------------------
847 scriptdir=`eval echo ${sysconfdir}`
848 AC_ARG_WITH(scriptdir,
849    [  --with-scriptdir=PATH    specify path of Bacula scripts directory],
850    [
851        if test "x$withval" != "xno" ; then     
852               scriptdir=$withval
853        fi
854    ]
855 )
856
857 AC_SUBST(scriptdir)
858
859
860 # ------------------------------------------
861 # Where to send dump email
862 # ------------------------------------------
863 dump_email=root@localhost
864 AC_ARG_WITH(dump-email,
865    [  --with-dump-email=EMAIL    dump email address],
866    [
867        if test "x$withval" != "xno" ; then     
868               dump_email=$withval
869        fi
870    ]
871 )
872
873 AC_SUBST(dump_email)
874
875 # ------------------------------------------
876 # Where to send job email
877 # ------------------------------------------
878 job_email=root@localhost
879 AC_ARG_WITH(job-email,
880    [  --with-job-email=EMAIL     job output email address],
881    [
882        if test "x$withval" != "xno" ; then     
883               job_email=$withval
884        fi
885    ]
886 )
887
888 AC_SUBST(job_email)
889
890 # ------------------------------------------
891 # Where to find smtp host
892 # ------------------------------------------
893 smtp_host=localhost
894 AC_ARG_WITH(smtp_host,
895    [  --with-smtp-host=HOST              SMTP mail host address],
896    [
897        if test "x$withval" != "xno" ; then     
898               smtp_host=$withval
899        fi
900    ]
901 )
902
903 AC_SUBST(smtp_host)
904
905
906 # ------------------------------------
907 # Where to place pid files
908 # ------------------------------------
909 piddir=/var/run
910 AC_ARG_WITH(pid-dir,
911     [  --with-pid-dir=PATH               specify location of Bacula pid files],
912     [
913         if test "x$withval" != "xno" ; then     
914             piddir=$withval
915         fi
916     ]
917 )
918
919 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
920 AC_SUBST(piddir)
921
922
923 # ------------------------------------
924 # Where to place subsys "lock file"
925 # ------------------------------------
926 subsysdir=/var/run/subsys
927 AC_ARG_WITH(subsys-dir,
928     [  --with-subsys-dir=PATH    specify location of Bacula subsys file],
929     [
930         if test "x$withval" != "xno" ; then     
931             subsysdir=$withval
932         fi
933     ]
934 )
935
936 AC_SUBST(subsysdir)
937
938
939
940 # ------------------------------------
941 # Where to start assigning ports
942 # ------------------------------------
943 baseport=9101
944 AC_ARG_WITH(baseport,
945     [  --with-baseport=PORT              specify base port address for daemons],
946     [
947         if test "x$withval" != "xno" ; then     
948              baseport=$withval
949         fi
950     ]
951 )
952
953 AC_SUBST(baseport)
954 dir_port=`expr $baseport`
955 fd_port=`expr $baseport + 1`
956 sd_port=`expr $fd_port + 1`
957
958 AC_SUBST(dir_port)
959 AC_SUBST(fd_port)
960 AC_SUBST(sd_port)
961
962
963 # ------------------------------------------
964 # Generate passwords
965 # ------------------------------------------
966 dir_password=
967 AC_ARG_WITH(dir-password,
968    [  --with-dir-password=PASSWORD   specify Director's password],
969    [
970        if test "x$withval" != "xno" ; then     
971            dir_password=$withval
972        fi
973    ]
974 )
975
976 if test "x$dir_password" = "x" ; then
977    if test "x$OPENSSL" = "xnone" ; then
978       key=`autoconf/randpass 33`
979    else
980       key=`openssl rand -base64 33`
981    fi
982    dir_password=$key
983 fi
984
985 fd_password=
986 AC_ARG_WITH(fd-password,
987    [  --with-fd-password=PASSWORD    specify Client's password],
988    [
989        if test "x$withval" != "xno" ; then     
990            fd_password=$withval
991        fi
992    ]
993 )
994
995 if test "x$fd_password" = "x" ; then
996    if test "x$OPENSSL" = "xnone" ; then
997       key=`autoconf/randpass 37`
998    else
999       key=`openssl rand -base64 33`
1000    fi
1001    fd_password=$key
1002 fi
1003
1004 sd_password=
1005 AC_ARG_WITH(sd-password,
1006    [  --with-sd-password=PASSWORD    specify Storage daemon's password],
1007    [
1008        if test "x$withval" != "xno" ; then     
1009            sd_password=$withval
1010        fi
1011    ]
1012 )
1013
1014 if test "x$sd_password" = "x" ; then
1015    if test "x$OPENSSL" = "xnone" ; then
1016       key=`autoconf/randpass 41`
1017    else
1018       key=`openssl rand -base64 33`
1019    fi
1020    sd_password=$key
1021 fi
1022
1023 mon_dir_password=
1024 AC_ARG_WITH(mon-dir-password,
1025    [  --with-mon-dir-password=PASSWORD   specify Director's password used by the monitor],
1026    [
1027        if test "x$withval" != "xno" ; then     
1028            mon_dir_password=$withval
1029        fi
1030    ]
1031 )
1032
1033 if test "x$mon_dir_password" = "x" ; then
1034    if test "x$OPENSSL" = "xnone" ; then
1035       key=`autoconf/randpass 33`
1036    else
1037       key=`openssl rand -base64 33`
1038    fi
1039    mon_dir_password=$key
1040 fi
1041
1042 mon_fd_password=
1043 AC_ARG_WITH(mon-fd-password,
1044    [  --with-mon-fd-password=PASSWORD    specify Client's password used by the monitor],
1045    [
1046        if test "x$withval" != "xno" ; then     
1047            mon_fd_password=$withval
1048        fi
1049    ]
1050 )
1051
1052 if test "x$mon_fd_password" = "x" ; then
1053    if test "x$OPENSSL" = "xnone" ; then
1054       key=`autoconf/randpass 37`
1055    else
1056       key=`openssl rand -base64 33`
1057    fi
1058    mon_fd_password=$key
1059 fi
1060
1061 mon_sd_password=
1062 AC_ARG_WITH(mon-sd-password,
1063    [  --with-mon-sd-password=PASSWORD    specify Storage daemon's password used by the monitor],
1064    [
1065        if test "x$withval" != "xno" ; then     
1066            mon_sd_password=$withval
1067        fi
1068    ]
1069 )
1070
1071 if test "x$mon_sd_password" = "x" ; then
1072    if test "x$OPENSSL" = "xnone" ; then
1073       key=`autoconf/randpass 41`
1074    else
1075       key=`openssl rand -base64 33`
1076    fi
1077    mon_sd_password=$key
1078 fi
1079
1080 AC_SUBST(dir_password)
1081 AC_SUBST(fd_password)
1082 AC_SUBST(sd_password)
1083 AC_SUBST(mon_dir_password)
1084 AC_SUBST(mon_fd_password)
1085 AC_SUBST(mon_sd_password)
1086
1087
1088 #
1089 # Handle users and groups for each daemon
1090 #
1091 dir_user=
1092 AC_ARG_WITH(dir_user,
1093     [  --with-dir-user=USER              specify user for Director daemon],
1094     [
1095         if test "x$withval" != "x" ; then       
1096              dir_user=$withval
1097         fi
1098     ]
1099 )
1100
1101 dir_group=
1102 AC_ARG_WITH(dir_group,
1103     [  --with-dir-group=GROUP            specify group for Director daemon],
1104     [
1105         if test "x$withval" != "x" ; then       
1106              dir_group=$withval
1107         fi
1108     ]
1109 )
1110
1111 sd_user=
1112 AC_ARG_WITH(sd_user,
1113     [  --with-sd-user=USER               specify user for Storage daemon],
1114     [
1115         if test "x$withval" != "x" ; then       
1116              sd_user=$withval
1117         fi
1118     ]
1119 )
1120
1121 sd_group=
1122 AC_ARG_WITH(sd_group,
1123     [  --with-sd-group=GROUP             specify group for Storage daemon],
1124     [
1125         if test "x$withval" != "x" ; then       
1126              sd_group=$withval
1127         fi
1128     ]
1129 )
1130
1131 fd_user=
1132 AC_ARG_WITH(fd_user,
1133     [  --with-fd-user=USER               specify user for File daemon],
1134     [
1135         if test "x$withval" != "x" ; then       
1136              fd_user=$withval
1137         fi
1138     ]
1139 )
1140
1141 fd_group=
1142 AC_ARG_WITH(fd_group,
1143     [  --with-fd-group=GROUP             specify group for File daemon],
1144     [
1145         if test "x$withval" != "x" ; then       
1146              fd_group=$withval
1147         fi
1148     ]
1149 )
1150
1151
1152
1153
1154 AC_SUBST(dir_user)
1155 AC_SUBST(dir_group)
1156 AC_SUBST(sd_user)
1157 AC_SUBST(sd_group)
1158 AC_SUBST(fd_user)
1159 AC_SUBST(fd_group)
1160
1161 #
1162 # allow setting default executable permissions
1163 #
1164 SBINPERM=0754
1165 AC_ARG_WITH(sbin-perm,
1166     [  --with-sbin-perm=MODE             specify permissions for sbin binaries (0754)],
1167     [
1168         if test "x$withval" != "x" ; then       
1169             SBINPERM=$withval
1170         fi
1171     ]
1172 )
1173
1174 AC_SUBST(SBINPERM)
1175
1176 # ------------------------------------------------
1177 # Bacula check for various SQL database engines
1178 # ------------------------------------------------
1179 BA_CHECK_POSTGRESQL_DB
1180
1181 BA_CHECK_MYSQL_DB
1182
1183 BA_CHECK_SQLITE3_DB
1184
1185 BA_CHECK_SQLITE_DB
1186
1187 AC_SUBST(cats)
1188 AC_SUBST(DB_NAME)
1189
1190 AC_DEFINE(PROTOTYPES)
1191
1192 dnl# --------------------------------------------------------------------------
1193 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1194 dnl#
1195 if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1196     if test -z "$CCOPTS"; then
1197         CCOPTS='-g -O2 -Wall'
1198     fi
1199     CFLAGS="$CCOPTS"
1200 fi
1201
1202
1203 dnl A few others 
1204 AC_EXEEXT
1205
1206 dnl See if we can use 64 bit file addresses
1207 largefile_support="no"
1208 AC_BAC_LARGEFILE
1209
1210
1211 AC_PATH_XTRA
1212
1213 dnl# --------------------------------------------------------------------------
1214 dnl# CHECKING FOR HEADER FILES
1215 dnl# --------------------------------------------------------------------------
1216 AC_CHECK_HEADERS( \
1217         assert.h \
1218         fcntl.h \
1219         grp.h \
1220         pwd.h \
1221         libc.h \
1222         limits.h \
1223         stdarg.h \
1224         stdlib.h \
1225         stdint.h \
1226         string.h \
1227         termios.h \
1228         termcap.h \
1229         term.h \
1230         unistd.h \
1231         sys/bitypes.h \
1232         sys/byteorder.h \
1233         sys/ioctl.h \
1234         sys/select.h \
1235         sys/sockio.h \
1236         sys/time.h \
1237         sys/socket.h \
1238         arpa/nameser.h \
1239         resolv.h \
1240         mtio.h \
1241         sys/mtio.h \
1242         sys/tape.h \
1243         regex.h \
1244 )
1245 AC_HEADER_STDC
1246 AC_HEADER_MAJOR
1247 AC_HEADER_DIRENT
1248 AC_HEADER_STAT
1249 AC_HEADER_SYS_WAIT
1250 AC_HEADER_TIME
1251 AC_STRUCT_ST_BLKSIZE
1252 AC_STRUCT_ST_BLOCKS
1253 AC_STRUCT_TIMEZONE
1254
1255 dnl# --------------------------------------------------------------------------
1256 dnl# Check for utime.h structure 
1257 dnl# --------------------------------------------------------------------------
1258 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1259   [AC_TRY_COMPILE([
1260 #include <sys/types.h>
1261 #include <utime.h>], [struct utimbuf foo],
1262   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
1263 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
1264
1265 dnl# --------------------------------------------------------------------------
1266 dnl# Check for socklen_t
1267 dnl# --------------------------------------------------------------------------
1268 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1269   [AC_TRY_COMPILE([
1270 #include <sys/types.h>
1271 #include <sys/socket.h>],
1272   [socklen_t x],
1273   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
1274 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
1275
1276 dnl# --------------------------------------------------------------------------
1277 dnl# Check for bigendian
1278 dnl# --------------------------------------------------------------------------
1279 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
1280   [AC_TRY_RUN(
1281     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
1282     [ba_cv_bigendian=yes], 
1283     [ba_cv_bigendian=no], 
1284     [ba_cv_bigendian=no])])
1285 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
1286
1287 dnl# --------------------------------------------------------------------------
1288 dnl# Check for typeof()
1289 dnl# --------------------------------------------------------------------------
1290 AC_LANG_PUSH(C++)
1291 AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
1292   [AC_TRY_RUN(
1293     [main(){char *a = 0; a = (typeof a)a;}],
1294     [ba_cv_have_typeof=yes],
1295     [ba_cv_have_typeof=no],
1296     [ba_cv_have_typeof=no])])
1297 test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
1298 AC_LANG_POP(C++)
1299
1300 AC_C_CONST
1301
1302
1303 dnl# --------------------------------------------------------------------------
1304 dnl# CHECKING FOR FILESYSTEM TYPE
1305 dnl# --------------------------------------------------------------------------
1306 AC_MSG_CHECKING(how to get filesystem type)
1307 fstype=no
1308 # The order of these tests is important.
1309 AC_TRY_CPP([#include <sys/statvfs.h>
1310 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
1311 if test $fstype = no; then
1312 AC_TRY_CPP([#include <sys/statfs.h>
1313 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
1314 fi
1315 if test $fstype = no; then
1316 AC_TRY_CPP([#include <sys/statfs.h>
1317 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
1318 fi
1319 if test $fstype = no; then  
1320 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
1321 fi
1322 if test $fstype = no; then  
1323 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1324 fi
1325 if test $fstype = no; then  
1326 AC_TRY_CPP([#include <sys/mount.h>
1327 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
1328 fi
1329 AC_MSG_RESULT($fstype)
1330
1331 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
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 fseeko)
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 AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
1617
1618
1619 AC_CHECK_LIB(sun, getpwnam)
1620
1621 AC_CHECK_HEADERS(zlib.h)
1622 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1623 have_zlib=no
1624 if test x$FDLIBS = x-lz; then
1625   AC_DEFINE(HAVE_LIBZ)
1626   have_zlib=yes
1627 fi
1628
1629 #
1630 # Check for ACL libraries
1631 #
1632 have_acl=no
1633 AC_CHECK_HEADER(sys/acl.h)
1634 AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
1635    [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"], 
1636       [AC_CHECK_LIB(sec, acltotext, [have_acl=yes; FDLIBS="-lsec $FDLIBS"])]
1637     )]
1638 )
1639 if test $have_acl = yes; then
1640    AC_DEFINE(HAVE_ACL)
1641 fi
1642
1643 dnl Check for pthread libraries
1644 PTHREAD_LIB=""
1645 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1646    [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1647       [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1648             [AC_CHECK_FUNC(pthread_create)]
1649        )]
1650     )]
1651 )
1652
1653 AC_SUBST(FDLIBS)
1654 AC_DEFINE(FDLIBS)
1655
1656
1657 CFLAGS=${CFLAGS--O}
1658
1659 if test x$have_gcc = xyes ; then
1660    CPPFLAGS="$CPPFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1661    CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
1662 fi
1663 LDFLAGS=${LDFLAGS--O}
1664 DB_LIBS="${SQL_LFLAGS}"
1665 CPPFLAGS="$CPPFLAGS"
1666 CFLAGS="$CFLAGS"
1667 AC_SUBST(DEBUG)
1668 AC_SUBST(DINCLUDE)
1669 AC_SUBST(CFLAGS)
1670 AC_SUBST(CPPFLAGS)
1671 AC_SUBST(LDFLAGS)
1672 AC_SUBST(X_CFLAGS)
1673 AC_SUBST(DEFS)
1674 AC_SUBST(LIBS)
1675 AC_SUBST(DLIB)
1676 AC_SUBST(DB_LIBS)
1677 AC_SUBST(X_LIBS)
1678 AC_SUBST(X_EXTRA_LIBS)
1679 AC_SUBST(WCFLAGS)
1680 AC_SUBST(WLDFLAGS)
1681 AC_SUBST(WRAPLIBS)
1682
1683 dnl# extra configurable objects
1684 OBJLIST=
1685 AC_SUBST(OBJLIST)
1686
1687 lld="lld"
1688 llu="llu"
1689
1690 WCFLAGS=
1691 WLDFLAGS=
1692
1693 #
1694 # Finally we set appropriate distribution specific
1695 #  variables and defaults
1696 #
1697 # PFILES are platform specific files
1698 PFILES="platforms/Makefile"
1699 PSCMD="ps -e"
1700 WIN32=
1701 MACOSX=
1702 hostname=`uname -n | cut -d '.' -f 1`
1703 if test x${hostname} = x ; then
1704   hostname="localhost"
1705 fi
1706 case "$DISTNAME" in
1707 aix)
1708         DISTVER=`uname -r`
1709         PSCMD="ps -e -o pid,comm"
1710         PFILES="${PFILES} \
1711            platforms/aix/Makefile"
1712         TAPEDRIVE="/dev/rmt0.1" 
1713   ;;      
1714 alpha)
1715         DISTVER=`uname -r`
1716         PTHREAD_LIB="-lpthread -lexc"
1717         if test "${CC}" = "gcc" ; then
1718            lld="lld"
1719            llu="llu"
1720         else
1721            lld="ld"
1722            llu="lu"
1723         fi
1724         TAPEDRIVE="/dev/nrmt0"
1725   ;;
1726 bsdi)
1727         DISTVER=`uname -a |awk '{print $3}'`
1728         TAPEDRIVE="/dev/nrmt0"
1729         PTHREAD_LIB="-pthread"
1730         CFLAGS="${CFLAGS} -pthread"
1731         PSCMD="ps -ax -o pid,command"
1732         lld="qd"
1733         llu="qu"
1734         PFILES="${PFILES} \
1735             platforms/bsdi/Makefile \
1736             platforms/bsdi/bacula-fd \
1737             platforms/bsdi/bacula-sd \
1738             platforms/bsdi/bacula-dir"
1739         largefile_support="yes"
1740   ;;
1741 cygwin)
1742         DISTVER=`uname -a |awk '{print $3}'`
1743         TAPEDRIVE="/dev/nrst0"
1744         WIN32=win32
1745         WCFLAGS="-mwindows"
1746         WLDFLAGS="-mwindows"
1747   ;;
1748 darwin)
1749         DISTVER=`uname -r`
1750         TAPEDRIVE="/dev/nst0"
1751         PSCMD="ps -e -o pid,command"
1752         MACOSX=macosx
1753         PFILES="${PFILES} \
1754            platforms/darwin/Makefile"
1755   ;;
1756 debian)
1757         DISTVER=`cat /etc/debian_version`
1758         TAPEDRIVE="/dev/nrst0"
1759         PSCMD="ps -e -o pid,command"
1760   ;;
1761 freebsd)
1762         DISTVER=`uname -a |awk '{print $3}'`
1763         VER=`echo $DISTVER | cut -c 1`
1764         if test x$VER = x4 ; then
1765            PTHREAD_LIB="${PTHREAD_LIBS}"
1766            CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
1767         fi
1768         lld="qd"
1769         llu="qu"
1770         TAPEDRIVE="/dev/nrsa0"
1771         PSCMD="ps -ax -o pid,command"
1772         PFILES="${PFILES} \
1773             platforms/freebsd/Makefile \
1774             platforms/freebsd/bacula-fd \
1775             platforms/freebsd/bacula-sd \
1776             platforms/freebsd/bacula-dir"
1777         largefile_support="yes"
1778   ;;
1779 hpux)
1780         PSCMD="UNIX95=1 ps -e -o pid,comm"
1781         CFLAGS="$(CFLAGS) -D_XOPEN_SOURCE_EXTENDED=1"
1782         DISTVER=`uname -r`
1783         TAPEDRIVE="/dev/rmt/0hnb"
1784         PTHREAD_LIB="-lpthread"
1785         AC_DEFINE([_INCLUDE_LONGLONG])
1786   ;;
1787 irix)
1788         DISTVER=`uname -r`
1789         TAPEDRIVE="/dev/rmt/0cbn"
1790         PSCMD="ps -e -o pid,comm"
1791         PFILES="${PFILES} \
1792             platforms/irix/Makefile \
1793             platforms/irix/bacula-fd \
1794             platforms/irix/bacula-sd \
1795             platforms/irix/bacula-dir"
1796   ;;
1797 netbsd)
1798         DISTVER=`uname -a |awk '{print $3}'`
1799         lld="qd"
1800         llu="qu"
1801         TAPEDRIVE="/dev/nrst0"
1802         PSCMD="ps -ax -o pid,command"
1803         PTHREAD_LIB="-pthread"
1804         CFLAGS="${CFLAGS} -pthread"
1805   ;;
1806 openbsd)
1807         DISTVER=`uname -a |awk '{print $3}'`
1808         lld="qd"
1809         llu="qu"
1810         TAPEDRIVE="/dev/nrst0"
1811         PSCMD="ps -ax -o pid,command"
1812         PTHREAD_LIB="-pthread"
1813         CFLAGS="${CFLAGS} -pthread"
1814         PFILES="${PFILES} \
1815             platforms/openbsd/Makefile \
1816             platforms/openbsd/bacula-fd \
1817             platforms/openbsd/bacula-sd \
1818             platforms/openbsd/bacula-dir"
1819   ;;
1820 redhat)
1821         if test -f /etc/whitebox-release ; then
1822            f=/etc/whitebox-release
1823         else
1824            f=/etc/redhat-release
1825         fi
1826         if test `cat $f | grep release |\
1827                    cut -f 3 -d ' '`x = "Enterprise"x ; then
1828            DISTVER="Enterprise "`cat $f | grep release |\
1829                     cut -f 6 -d ' '`
1830         else
1831             DISTVER=`cat /etc/redhat-release | grep release |\
1832                      cut -f 5 -d ' '`
1833         fi
1834         TAPEDRIVE="/dev/nst0"
1835         PSCMD="ps -e -o pid,command"
1836         PFILES="${PFILES} \
1837             platforms/redhat/Makefile \
1838             platforms/redhat/bacula-fd \
1839             platforms/redhat/bacula-sd \
1840             platforms/redhat/bacula-dir \
1841             platforms/redhat/bacula.spec \
1842             "
1843   ;;
1844 mandrake)
1845         DISTVER=`cat /etc/mandrake-release | grep release |\
1846            cut -f 5 -d ' '`
1847         TAPEDRIVE="/dev/nst0"
1848         PSCMD="ps -e -o pid,command"
1849         PFILES="${PFILES} \
1850             platforms/mandrake/Makefile \
1851             platforms/mandrake/bacula-fd \
1852             platforms/mandrake/bacula-sd \
1853             platforms/mandrake/bacula-dir \
1854             platforms/mandrake/bacula.spec \
1855             "
1856   ;;
1857 gentoo)
1858         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
1859         TAPEDRIVE="/dev/nst0"
1860         PSCMD="ps -e -o pid,command"
1861         PFILES="${PFILES} \
1862             platforms/gentoo/Makefile \
1863          platforms/gentoo/bacula-init \
1864             platforms/gentoo/bacula-fd \
1865             platforms/gentoo/bacula-sd \
1866             platforms/gentoo/bacula-dir"
1867   ;;
1868 slackware)
1869         DISTVER=`cat /etc/slackware-version`
1870         TAPEDRIVE="/dev/nst0"
1871         PSCMD="ps -e -o pid,command"
1872         PFILES="${PFILES} \
1873             platforms/slackware/Makefile \
1874             platforms/slackware/rc.bacula-fd \
1875             platforms/slackware/rc.bacula-sd \
1876             platforms/slackware/rc.bacula-dir\
1877             platforms/slackware/functions.bacula"
1878   ;;
1879 solaris)
1880         DISTVER=`uname -r`
1881         TAPEDRIVE="/dev/rmt/0cbn"
1882         PSCMD="ps -e -o pid,comm"
1883         PFILES="${PFILES} \
1884             platforms/solaris/Makefile \
1885             platforms/solaris/bacula-fd \
1886             platforms/solaris/bacula-sd \
1887             platforms/solaris/bacula-dir"
1888         if test x$DISTVER = x5.6 ; then
1889             AC_DEFINE(HAVE_OLD_SOCKOPT)
1890         fi
1891         LIBS="$LIBS -lresolv"
1892   ;;
1893 suse)
1894         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1895             cut -f 3 -d ' '`
1896         TAPEDRIVE="/dev/nst0"
1897         PSCMD="ps -e -o pid,command"
1898         PFILES="${PFILES} \
1899             platforms/suse/Makefile \
1900             platforms/suse/bacula-fd \
1901             platforms/suse/bacula-sd \
1902             platforms/suse/bacula-dir \
1903             platforms/suse/bacula \
1904             platforms/suse/bacula.spec"
1905   ;;
1906 suse5)
1907         DISTNAME=suse
1908         DISTVER=5.x
1909         TAPEDRIVE="/dev/nst0"
1910         PSCMD="ps -e -o pid,command"
1911         PFILES="${PFILES} \
1912             platforms/suse/Makefile \
1913             platforms/suse/bacula-fd \
1914             platforms/suse/bacula-sd \
1915             platforms/suse/bacula-dir"
1916   ;;
1917 unknown)
1918         DISTVER=unknown
1919         TAPEDRIVE="/dev/nst0"
1920   ;;
1921 *)
1922   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1923   ;;
1924 esac  
1925
1926 AC_SUBST(hostname)
1927
1928 LIBS="$PTHREAD_LIB $LIBS"
1929
1930 AC_DEFINE_UNQUOTED(lld, "$lld")
1931 AC_DEFINE_UNQUOTED(llu, "$llu")
1932 AC_SUBST(TAPEDRIVE)
1933 AC_SUBST(PSCMD)
1934 AC_SUBST(WIN32)
1935 AC_SUBST(MACOSX)
1936 AC_SUBST(DISTNAME)
1937 AC_SUBST(DISTVER)
1938
1939 dnl# common parts of the Makefile
1940 MCOMMON=./autoconf/Make.common
1941 AC_SUBST_FILE(MCOMMON)
1942
1943 dnl# Insanity check
1944 if test "x${subsysdir}" = "x${sbindir}" ; then
1945    echo " "
1946    echo " "
1947    echo "You have set both --sbindir and --with-subsys-dir"
1948    echo "  equal to: ${subsysdir} "
1949    echo "This is not permitted. Please reconfigure."
1950    echo " "
1951    echo "Aborting configuration ..."
1952    echo " "
1953    echo " "
1954    exit 1
1955 fi 
1956
1957 AC_OUTPUT([autoconf/Make.common \
1958            Makefile \
1959            manpages/Makefile \
1960            scripts/startmysql \
1961            scripts/stopmysql \
1962            scripts/btraceback \
1963            scripts/startit \
1964            scripts/stopit \
1965            scripts/bconsole \
1966            scripts/gconsole \
1967            scripts/bacula \
1968            scripts/bacula-ctl-dir \
1969            scripts/bacula-ctl-fd \
1970            scripts/bacula-ctl-sd \
1971            scripts/devel_bacula \
1972            scripts/Makefile \
1973            scripts/logrotate \
1974            scripts/bacula.desktop.gnome1 \
1975            scripts/bacula.desktop.gnome2 \
1976            scripts/bacula.desktop.gnome1.consolehelper \
1977            scripts/bacula.desktop.gnome2.consolehelper \
1978            scripts/bacula.desktop.gnome1.xsu \
1979            scripts/bacula.desktop.gnome2.xsu \
1980            scripts/gnome-console.console_apps \
1981            scripts/mtx-changer \
1982            scripts/disk-changer \
1983            scripts/dvd-handler \
1984            scripts/bacula-tray-monitor.desktop \
1985            scripts/logwatch/Makefile \
1986            scripts/logwatch/logfile.bacula.conf \
1987            scripts/wxconsole.console_apps \
1988            scripts/wxconsole.desktop.consolehelper \
1989            scripts/wxconsole.desktop.xsu \
1990            src/Makefile \
1991            src/host.h \
1992            src/console/Makefile \
1993            src/console/bconsole.conf \
1994            src/gnome2-console/Makefile \
1995            src/gnome2-console/gnome-console.conf \
1996            src/wx-console/Makefile \
1997            src/wx-console/wx-console.conf \
1998            src/tray-monitor/Makefile \
1999            src/tray-monitor/tray-monitor.conf \
2000            src/dird/Makefile \
2001            src/dird/bacula-dir.conf \
2002            src/lib/Makefile \
2003            src/stored/Makefile \
2004            src/stored/bacula-sd.conf \
2005            src/filed/Makefile \
2006            src/filed/bacula-fd.conf \
2007            src/cats/Makefile \
2008            src/cats/make_catalog_backup \
2009            src/cats/delete_catalog_backup \
2010            src/cats/create_postgresql_database \
2011            src/cats/update_postgresql_tables \
2012            src/cats/make_postgresql_tables \
2013            src/cats/grant_postgresql_privileges \
2014            src/cats/drop_postgresql_tables \
2015            src/cats/drop_postgresql_database \
2016            src/cats/create_mysql_database \
2017            src/cats/update_mysql_tables \
2018            src/cats/make_mysql_tables \
2019            src/cats/grant_mysql_privileges \
2020            src/cats/drop_mysql_tables \
2021            src/cats/drop_mysql_database \
2022            src/cats/create_sqlite_database \
2023            src/cats/update_sqlite_tables \
2024            src/cats/make_sqlite_tables \
2025            src/cats/grant_sqlite_privileges \
2026            src/cats/drop_sqlite_tables \
2027            src/cats/drop_sqlite_database \
2028            src/cats/create_sqlite3_database \
2029            src/cats/update_sqlite3_tables \
2030            src/cats/make_sqlite3_tables \
2031            src/cats/grant_sqlite3_privileges \
2032            src/cats/drop_sqlite3_tables \
2033            src/cats/drop_sqlite3_database \
2034            src/cats/sqlite \
2035            src/cats/mysql \
2036            src/cats/create_bdb_database \
2037            src/cats/update_bdb_tables \
2038            src/cats/make_bdb_tables \
2039            src/cats/grant_bdb_privileges \
2040            src/cats/drop_bdb_tables \
2041            src/cats/drop_bdb_database \
2042            src/cats/create_bacula_database \
2043            src/cats/update_bacula_tables \
2044            src/cats/grant_bacula_privileges \
2045            src/cats/make_bacula_tables \
2046            src/cats/drop_bacula_tables \
2047            src/cats/drop_bacula_database \
2048            src/findlib/Makefile \
2049            src/pygtk-console/Makefile \
2050            src/tools/Makefile \
2051            po/Makefile.in \
2052            $PFILES ],  
2053           [(echo "Doing make of dependencies"; ${MAKE:-make} depend;) ]
2054 )
2055
2056 cd scripts
2057 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
2058 chmod 755 dvd-handler
2059 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
2060 cd ..
2061
2062 c=src/cats
2063
2064 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
2065 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
2066
2067 chmod 755 $c/create_bdb_database      $c/update_bdb_tables     $c/make_bdb_tables
2068 chmod 755 $c/grant_bdb_privileges     $c/drop_bdb_tables       $c/drop_bdb_database
2069
2070 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
2071 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
2072
2073 chmod 755 $c/create_sqlite_database   $c/update_sqlite_tables  $c/make_sqlite_tables
2074 chmod 755 $c/grant_sqlite_privileges  $c/drop_sqlite_tables    $c/drop_sqlite_database
2075
2076 chmod 755 $c/create_sqlite3_database   $c/update_sqlite3_tables  $c/make_sqlite3_tables
2077 chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables    $c/drop_sqlite3_database
2078
2079 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
2080 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
2081
2082 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup
2083 chmod 755 $c/sqlite
2084 chmod 755 $c/mysql
2085
2086 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
2087    largefile_support="yes"
2088 fi
2089
2090 #
2091 # A whole lot of hand springs to get the compiler version.
2092 #  This is because gcc changed the output in version 3.0
2093 #
2094 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2095 if test "x${CCVERSION}" = "x" ; then
2096   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2097 fi
2098 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2099 if test x"${CXXVERSION}" = x ; then
2100   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2101 fi
2102
2103 if test "x${subsysdir}" = "x${sbindir}" ; then
2104    echo " "
2105    echo " "
2106    echo "You have set --sbindir and --with-subsys-dir"
2107    echo "  both equal to: ${subsysdir} "
2108    echo "  This is not permitted. Please reconfigure."
2109    echo " "
2110    echo "Aborting configuration ..."
2111    echo " "
2112    echo " "
2113    exit 1
2114 fi 
2115
2116 if test "x${db_name}" = "xInternal" ; then
2117    echo " "
2118    echo " "
2119    echo "You have not specified either --enable-client-only or one of the"
2120    echo "  supported databases: MySQL, PostgreSQL, SQLite3 or SQLite."
2121    echo "  This is not permitted. Please reconfigure."
2122    echo " "
2123    echo "Aborting the configuration ..."
2124    echo " "
2125    echo " "
2126    exit 1
2127 fi
2128
2129 echo "
2130 Configuration on `date`:
2131
2132   Host:                       $host -- ${DISTNAME} ${DISTVER}
2133   Bacula version:             ${VERSION} (${DATE})
2134   Source code location:       ${srcdir}
2135   Install binaries:           ${sbindir}
2136   Install config files:       ${sysconfdir}
2137   Scripts directory:          ${scriptdir}
2138   Working directory:          ${working_dir}
2139   PID directory:              ${piddir}
2140   Subsys directory:           ${subsysdir}
2141   Man directory:              ${mandir}
2142   Data directory:             ${datadir}
2143   C Compiler:                 ${CC} ${CCVERSION}
2144   C++ Compiler:               ${CXX} ${CXXVERSION}
2145   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
2146   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
2147   Libraries:                  ${LIBS}
2148   Statically Linked Tools:    ${support_static_tools}
2149   Statically Linked FD:       ${support_static_fd}
2150   Statically Linked SD:       ${support_static_sd}
2151   Statically Linked DIR:      ${support_static_dir}
2152   Statically Linked CONS:     ${support_static_cons}
2153   Database type:              ${db_name}
2154   Database lib:               ${DB_LIBS}
2155
2156   Job Output Email:           ${job_email}
2157   Traceback Email:            ${dump_email}
2158   SMTP Host Address:          ${smtp_host}
2159
2160   Director Port:              ${dir_port}
2161   File daemon Port:           ${fd_port}
2162   Storage daemon Port:        ${sd_port}
2163
2164   Director User:              ${dir_user}
2165   Director Group:             ${dir_group}
2166   Storage Daemon User:        ${sd_user}
2167   Storage DaemonGroup:        ${sd_group}
2168   File Daemon User:           ${fd_user}
2169   File Daemon Group:          ${fd_group}
2170
2171   SQL binaries Directory      ${SQL_BINDIR}
2172
2173   Large file support:         $largefile_support
2174   Bacula conio support:       ${got_conio} ${CONS_LIBS}
2175   readline support:           ${got_readline} ${PRTREADLINE_SRC}
2176   TCP Wrappers support:       ${TCPW_MSG} ${WRAPLIBS}
2177   TLS support:                ${support_tls}
2178   Encryption support:         ${support_crypto} 
2179   ZLIB support:               ${have_zlib}
2180   enable-smartalloc:          ${support_smartalloc} 
2181   enable-gnome:               ${support_gnome} ${gnome_version}
2182   enable-wx-console:          ${support_wx_console} ${wx_version}
2183   enable-tray-monitor:        ${support_tray_monitor}
2184   client-only:                ${build_client_only}
2185   build-dird:                 ${build_dird}
2186   build-stored:               ${build_stored}
2187   ACL support:                ${have_acl}
2188   Python support:             ${support_python} ${PYTHON_LIBS}
2189
2190   " > config.out
2191
2192 cat config.out