]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
Move host.h from filed to src + add Project to home page
[bacula/bacula] / bacula / autoconf / configure.in
1 dnl#
2 dnl#
3 dnl# Process this file with autoconf to produce a configure script.
4 dnl#
5 AC_INIT(src/version.h)
6 BUILD_DIR=`pwd`
7 cd ..
8 TOP_DIR=`pwd`
9 cd ${BUILD_DIR}
10 AC_SUBST(BUILD_DIR)
11 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
12 AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in)
13
14 dnl require a recent autoconf
15 AC_PREREQ(2.13)
16
17
18 dnl search for true and false programs.
19 AC_PATH_PROGS(TRUEPRG, true, :)
20 AC_PATH_PROGS(FALSEPRG, false, :)
21
22 AC_CANONICAL_HOST
23
24 dnl bacula version
25 VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
26 DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
27 LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
28 AC_SUBST(VERSION)dnl 
29 AC_SUBST(DATE)dnl 
30 AC_SUBST(LSMDATE)dnl 
31 echo "configuring for bacula $VERSION ($DATE)"
32
33
34 dnl -------------------------------------------------------
35 dnl# Check for compiler.
36 dnl ------------------------------------------------------
37
38 AC_PROG_CC
39 AC_PROG_CXX
40 AC_PROG_CC_C_O                  dnl Determine if C compiler support -c -o.
41 AC_PROG_GCC_TRADITIONAL         dnl Determine if ioctl() need -traditional.
42
43 if test x$CC = xgcc
44 then
45    AC_DEFINE(HAVE_GCC)
46 fi
47
48 dnl -------------------------------------------------------
49 dnl# Check for programs.
50 dnl ------------------------------------------------------
51 AC_PROG_INSTALL
52 AC_PROG_RANLIB
53 AC_PATH_PROG(MV, mv, mv)
54 AC_PATH_PROG(RM, rm, rm)
55 AC_PATH_PROG(CP, cp, cp)
56 AC_PATH_PROG(SED, sed, sed)
57 AC_PATH_PROG(AWK, awk, awk)
58 AC_PATH_PROG(ECHO, echo, echo)
59 AC_PATH_PROG(CMP, cmp, cmp)
60 AC_PATH_PROG(TBL, tbl, tbl)
61 AC_PATH_PROG(AR, ar, ar)
62 AC_PATH_PROG(RANLIB, ranlib, ranlib)
63 AC_PATH_PROG(OPENSSL, openssl, none)
64 AC_PATH_PROG(MTX, mtx, mtx)
65 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
66
67 test -n "$ARFLAG" || ARFLAGS="cr"
68 AC_SUBST(ARFLAGS)
69
70 MAKE_SHELL=/bin/sh
71 AC_SUBST(MAKE_SHELL)
72
73 AC_SUBST(LOCAL_LIBS)
74 AC_SUBST(LOCAL_CFLAGS)
75 AC_SUBST(LOCAL_LDFLAGS)
76 AC_SUBST(LOCAL_DEFS)
77
78
79
80 dnl --------------------------------------------------
81 dnl Bacula OP Sys determination (see aclocal.m4)
82 dnl --------------------------------------------------
83 BA_CHECK_OPSYS
84
85 # -----------------------------------------------------------
86 dnl Bacula OPSys Distribution determination (see aclocal.m4)
87 # ----------------------------------------------------------
88 BA_CHECK_OPSYS_DISTNAME
89
90 # -----------------------------------------------------------
91 dnl Check for gnome stuff for gnome-console
92 # ----------------------------------------------------------
93 AM_ACLOCAL_INCLUDE(gnome-macros)
94
95 # ------------------------------------------------------------------
96 #  If the user has not set --prefix, we set our default to nothing.
97 #  In this case, if the user has not set --sysconfdir, we set it
98 #  to the package default of /etc/bacula.  If either --prefix or
99 #  --sysconfdir is set, we leave sysconfdir alone except to eval it.
100 # ------------------------------------------------------------------
101 if test x${prefix} = xNONE ; then
102     if test `eval echo ${sysconfdir}` = NONE/etc ; then
103         sysconfdir=/etc/bacula
104     fi
105     prefix=
106 fi
107 sysconfdir=`eval echo ${sysconfdir}`
108
109 # -------------------------------------------------------------------------
110 #  If the user has not set --exec-prefix, we default to ${prefix}
111 # -------------------------------------------------------------------------
112 if test x${exec_prefix} = xNONE ; then
113     exec_prefix=${prefix}
114 fi
115
116 # ------------------------------------------------------------------
117 # If the user has not set --sbindir, we set our default as /sbin
118 # ------------------------------------------------------------------
119 if test x$sbindir = x'${exec_prefix}/sbin' ; then
120     sbindir=${exec_prefix}/sbin
121 fi
122 sbindir=`eval echo ${sbindir}`
123                       
124 # ------------------------------------------------------------------
125 # All list of languages for which a translation exist. Each
126 #  language is separated by a space.
127 # ------------------------------------------------------------------
128 ALL_LINGUAS=""
129
130 AC_PATH_PROGS(MSGFMT, msgfmt, no)
131 if test "$MSGFMT" = "no"
132 then
133    echo 'msgfmt program not found, disabling NLS !'
134    USE_NLS=no
135    USE_INCLUDED_LIBINTL=no
136 #else
137 #   AM_GNU_GETTEXT
138 fi
139
140
141 support_mysql=no
142 support_sqlite=no
143 support_smartalloc=yes
144 support_readline=yes
145 support_gnome=no
146 support_static_tools=no
147 support_static_fd=no
148 support_static_sd=no
149 support_static_dir=no
150 support_static_cons=no
151 build_client_only=no
152 cats=
153 db_name=Internal
154 DB_NAME=bdb
155
156 dnl# --------------------------------------------------------------------------
157 dnl# CHECKING COMMAND LINE OPTIONS
158 dnl# --------------------------------------------------------------------------
159
160 # -------------------------------------------
161 # gnome (default off)
162 # -------------------------------------------
163 AC_ARG_ENABLE(gnome,
164   [  --enable-gnome       enable build of gnome-console GUI [disabled]],
165   [if test x$enableval = xyes; then
166     support_gnome=yes
167   fi])
168
169 GNOME_DIR=
170 if test x$support_gnome = xyes; then
171   abc=`$PKGCONFIG --exists libgnomeui-2.0`
172   pkg=$?
173   if test $pkg = 0; then
174      GNOME_INCLUDEDIR=`pkg-config --cflags-only-I libgnomeui-2.0`
175      GNOMEUI_LIBS=`pkg-config --libs-only-other libgnomeui-2.0`
176      GNOME_LIBDIR=`pkg-config --libs libgnomeui-2.0`
177      GNOME_LIBS=`pkg-config --libs-only-l libgnomeui-2.0`
178      AC_SUBST(GNOME_INCLUDEDIR)
179      AC_SUBST(GNOMEUI_LIBS)
180      AC_SUBST(GNOME_LIBDIR)
181      AC_SUBST(GNOME_LIBS)
182      GNOME_DIR=src/gnome2-console
183   else
184 dnl 1.4 stuff
185     GNOME_INIT
186     GNOME_DIR=src/gnome-console
187   fi
188 fi
189 AC_SUBST(GNOME_DIR)
190
191
192 # -------------------------------------------
193 # smartalloc (default off)
194 # -------------------------------------------
195 AC_ARG_ENABLE(smartalloc,
196   [  --enable-smartalloc     enable smartalloc debugging support [disabled]],
197   [if test x$enableval = xno; then
198     support_smartalloc=no
199   fi])
200
201 if test x$support_smartalloc = xyes; then
202    AC_DEFINE(SMARTALLOC)
203 fi
204
205 # -------------------------------------------
206 # static-tools (default off)
207 # -------------------------------------------
208 AC_ARG_ENABLE(static-tools,
209    [  --enable-static-tools   enable static tape tools [disabled]],
210    [if test x$enableval = xyes; then
211      support_static_tools=yes
212    fi])
213
214 TTOOL_LDFLAGS=
215 if test x$support_static_tools = xyes; then
216    TTOOL_LDFLAGS="-static"
217 fi
218 AC_SUBST(TTOOL_LDFLAGS)
219
220 # -------------------------------------------
221 # static-fd    (default off)
222 # -------------------------------------------
223 AC_ARG_ENABLE(static-fd,
224    [  --enable-static-fd      enable static File daemon [disabled]],
225    [if test x$enableval = xyes; then
226      support_static_fd=yes
227    fi])
228
229 STATIC_FD=
230 if test x$support_static_fd = xyes; then
231    STATIC_FD="static-bacula-fd"
232 fi
233 AC_SUBST(STATIC_FD)
234
235 # -------------------------------------------
236 # static-sd    (default off)
237 # -------------------------------------------
238 AC_ARG_ENABLE(static-sd,
239    [  --enable-static-sd      enable static Storage daemon [disabled]],
240    [if test x$enableval = xyes; then
241      support_static_sd=yes
242    fi])
243
244 STATIC_SD=
245 if test x$support_static_sd = xyes; then
246    STATIC_SD="static-bacula-sd"
247 fi
248 AC_SUBST(STATIC_SD)
249
250 # -------------------------------------------
251 # static-dir   (default off)
252 # -------------------------------------------
253 AC_ARG_ENABLE(static-dir,
254    [  --enable-static-dir     enable static Director [disabled]],
255    [if test x$enableval = xyes; then
256      support_static_dir=yes
257    fi])
258
259 STATIC_DIR=
260 if test x$support_static_dir = xyes; then
261    STATIC_DIR="static-bacula-dir"
262 fi
263 AC_SUBST(STATIC_DIR)
264
265 # -------------------------------------------
266 # static-cons  (default off)
267 # -------------------------------------------
268 AC_ARG_ENABLE(static-cons,
269    [  --enable-static-cons    enable static Console [disabled]],
270    [if test x$enableval = xyes; then
271      support_static_cons=yes
272    fi])
273
274 STATIC_CONS=
275 if test x$support_static_cons = xyes; then
276    STATIC_CONS="static-console"
277 fi
278 AC_SUBST(STATIC_CONS)
279
280 # -------------------------------------------
281 # client_only  (default off)
282 # -------------------------------------------
283 AC_ARG_ENABLE(client-only,
284    [  --enable-client-only    build client (File daemon) only [disabled]],
285    [if test x$enableval = xyes; then
286      build_client_only=yes
287    fi])
288 if test x$build_client_only = xno; then
289    ALL_DIRS="subdirs"
290 else
291    ALL_DIRS=""
292 fi
293 AC_SUBST(ALL_DIRS)
294
295 # ---------------------------------------------------
296 # Check for readline support/directory (default on)
297 # ---------------------------------------------------
298 # this allows you to turn it completely off
299 AC_ARG_ENABLE(readline,
300   [  --disable-readline      disable readline support [enabled]
301                                                       ],
302   [if test x$enableval = xno; then
303     support_readline=no
304   fi])
305
306 got_readline="no"
307 READLINE_SRC=
308 if test x$support_readline = xyes; then
309    AC_ARG_WITH(readline,
310      [ --with-readline=DIR               specify readline library directory],
311      [
312         case "$with_readline" in
313         no) : ;;
314         yes|*)
315           if test "$with_readline" != "yes"; then
316             CONS_INC="-I${with_readline}"
317             CONS_LDFLAGS="-L$with_readline"
318           else
319              with_readline="/usr/include/readline" 
320           fi
321           AC_CHECK_HEADER(${with_readline}/readline.h, 
322              [ AC_DEFINE(HAVE_READLINE) 
323                CONS_LIBS="-lreadline -ltermcap"
324                got_readline="yes"   
325              ],
326              [ AC_MSG_ERROR([*** readline library missing]) 
327              ]
328           )
329           ;;
330         esac
331      ],[
332        # check for standard readline library
333        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
334          [ AC_DEFINE(HAVE_READLINE)
335            got_readline="yes"
336            CONS_INC="-I/usr/include/readline"
337            CONS_LIBS="-lreadline -ltermcap"
338          ], [
339            # Did not find standard library, so try Bacula's default
340             AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
341               [ AC_DEFINE(HAVE_READLINE) 
342                  got_readline="yes"   
343                  CONS_INC="-I${TOP_DIR}/depkgs/readline"
344                  CONS_LIBS="-lreadline -lhistory -ltermcap"
345                  CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
346                  PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
347               ],
348               [ AC_MSG_ERROR([*** readline library missing]) 
349               ]
350             )
351          ]
352        )
353      ]   
354    )
355 fi
356 AC_SUBST(CONS_INC)
357 AC_SUBST(CONS_LIBS)
358 AC_SUBST(CONS_LDFLAGS)
359 AC_SUBST(READLINE_SRC)
360
361 # Minimal stuff for readline Makefile configuration
362 MAKE_SHELL=/bin/sh
363 AC_SUBST(MAKE_SHELL)
364
365 AC_HEADER_STAT
366 AC_HEADER_DIRENT
367
368 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat lchown)
369 AC_CHECK_FUNCS(nanosleep)
370
371 #AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG),
372 #   [LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o"
373 #    EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"])
374
375 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG))
376
377
378 AC_FUNC_STRCOLL
379
380 AC_CHECK_HEADERS(varargs.h \
381                 sys/ptem.h sys/pte.h sys/stream.h)      
382
383 # End of readline stuff
384 # -----------------------------------------------------------------------
385
386
387 # ---------------------------------------------------
388 # Check for GMP support/directory
389 # ---------------------------------------------------
390 #GMP_SRC=
391 #local_gmp="no"
392 #AC_ARG_WITH(gmp,
393 #  [  --with-gmp[=DIR]   Specify gmp library directory],
394 #  [
395 #     case "$with_gmp" in
396 #     no) : ;;
397 #     yes|*)
398 #       if test "$with_gmp" != "yes"; then
399 #         GMP_INC="-I$with_gmp"
400 #         GMP_LIBS="-lgmp"
401 #         GMP_LDFLAGS="-L$with_gmp"
402 #       else
403 #          with_gmp="/usr/include" 
404 #       fi
405 #       AC_CHECK_HEADER($with_gmp/gmp.h, 
406 #          [ AC_MSG_RESULT(yes)
407 #            AC_DEFINE(HAVE_GMP) 
408 #            GMP_LIBS="-lgmp"
409 #            got_gmp="yes"   
410 #          ],
411 #          [ AC_MSG_ERROR([*** gmp library missing]) 
412 #          ]
413 #       )
414 #       ;;
415 #     esac
416 #  ],[
417 #    # check for standard gmp library
418 #    AC_CHECK_HEADER(/usr/include/gmp.h,
419 #    [ AC_MSG_RESULT(yes)
420 #      AC_DEFINE(HAVE_GMP)
421 #      got_gmp="yes"
422 #      GMP_INC=
423 #      GMP_LIBS="-lgmp"
424 #    ], [
425 #      # Did not find standard library, so use our own
426 #      AC_MSG_RESULT(yes)
427 #      AC_DEFINE(HAVE_GMP)
428 #      got_gmp="yes"
429 #      local_gmp="yes"
430 #      GMP_INC="-I${TOP_DIR}/depkgs/gmp"
431 #      GMP_LIBS="-lgmp"
432 #      GMP_LDFLAGS="-L${TOP_DIR}/depkgs/gmp"
433 #      GMP_SRC="${TOP_DIR}/depkgs/gmp"
434 #    ])
435 #  ]   
436 #)
437 #AC_SUBST(GMP_INC)
438 #AC_SUBST(GMP_LIBS)
439 #AC_SUBST(GMP_LDFLAGS)
440 #AC_SUBST(GMP_SRC)
441
442 # End of GMP stuff
443 # -----------------------------------------------------------------------
444
445
446 # ---------------------------------------------------
447 # Check for CWEB support/directory
448 # ---------------------------------------------------
449 #CWEB_SRC=
450 #CWEB=/bin
451 #local_cweb="no"
452 #AC_ARG_WITH(cweb,
453 #  [  --with-cweb[=DIR]   Specify cweb library directory],
454 #  [
455 #     case "$with_cweb" in
456 #     no) : ;;
457 #     yes|*)
458 #       if test "$with_cweb" != "yes"; then
459 #         CWEB_INC="-I$with_cweb"
460 #         CWEB_LIBS="-lcweb"
461 #         CWEB_LDFLAGS="-L$with_cweb"
462 #       else
463 #          with_cweb="/usr/include" 
464 #       fi
465 #       AC_CHECK_HEADER($with_cweb/cweb.h, 
466 #          [ AC_MSG_RESULT(yes)
467 #            AC_DEFINE(HAVE_CWEB) 
468 #            CWEB_LIBS="-lcweb"
469 #            got_cweb="yes"   
470 #          ],
471 #          [ AC_MSG_ERROR([*** cweb library missing]) 
472 #          ]
473 #       )
474 #       ;;
475 #     esac
476 #  ],[
477 #    # check for standard cweb library
478 #    AC_CHECK_HEADER(/usr/include/cweb.h,
479 #    [ AC_MSG_RESULT(yes)
480 #      AC_DEFINE(HAVE_CWEB)
481 #      got_cweb="yes"
482 #      CWEB_INC=
483 #      CWEB_LIBS="-lcweb"
484 #    ], [
485 #      # Did not find starndard library, so use our own
486 #      AC_MSG_RESULT(yes)
487 #      AC_DEFINE(HAVE_CWEB)
488 #      got_cweb="yes"
489 #      local_cweb="yes"
490 #      CWEB=${TOP_DIR}/depkgs/cweb
491 #      CWEB_INC="-I${TOP_DIR}/depkgs/cweb"
492 #      CWEB_LIBS="-lcweb"
493 #      CWEB_LDFLAGS="-L${TOP_DIR}/depkgs/cweb"
494 #      CWEB_SRC="${TOP_DIR}/depkgs/cweb"
495 #    ])
496 #  ]   
497 #)
498 #AC_SUBST(CWEB)
499 #AC_SUBST(CWEB_INC)
500 #AC_SUBST(CWEB_LIBS)
501 #AC_SUBST(CWEB_LDFLAGS)
502 #AC_SUBST(CWEB_SRC)
503
504 # End of CWEB stuff
505 # -----------------------------------------------------------------------
506
507
508
509 # -----------------------------------------------------------
510 # Check whether user wants TCP wrappers support (default off)
511 # -----------------------------------------------------------
512 TCPW_MSG="no" 
513 AC_ARG_WITH(tcp-wrappers,
514   [  --with-tcp-wrappers=DIR     enable tcpwrappers support],
515   [
516     if test "x$withval" != "xno" ; then
517        saved_LIBS="$LIBS"
518        LIBS="$LIBS -lwrap -lnsl"
519        AC_MSG_CHECKING(for libwrap)
520        AC_TRY_LINK(
521           [ #include <tcpd.h>
522              int deny_severity = 0;
523              int allow_severity = 0;
524              struct request_info *req; ],
525           [ hosts_access(req); ],
526           [
527             AC_MSG_RESULT(yes)
528             AC_DEFINE(HAVE_LIBWRAP)
529             TCPW_MSG="yes" 
530           ],
531           [AC_MSG_ERROR([*** libwrap missing]) ]
532        )
533     fi
534   ]
535 )
536
537 # ------------------------------------------
538 # Where to place working dir
539 # ------------------------------------------
540 working_dir=`eval echo ${sysconfdir}/working`
541 AC_ARG_WITH(working-dir,
542    [  --with-working-dir=PATH    specify path of Bacula working directory],
543    [
544        if test "x$withval" != "xno" ; then     
545               working_dir=$withval
546        fi
547    ]
548 )
549
550 AC_SUBST(working_dir)
551
552
553 # ------------------------------------------
554 # Where to place scriptdir (script files)
555 # ------------------------------------------
556 scriptdir=`eval echo ${sysconfdir}`
557 AC_ARG_WITH(scriptdir,
558    [  --with-scriptdir=PATH    specify path of Bacula scripts directory],
559    [
560        if test "x$withval" != "xno" ; then     
561               scriptdir=$withval
562        fi
563    ]
564 )
565
566 AC_SUBST(scriptdir)
567
568
569 # ------------------------------------------
570 # Where to send dump email
571 # ------------------------------------------
572 dump_email=root@localhost
573 AC_ARG_WITH(dump-email,
574    [  --with-dump-email=EMAIL    dump email address],
575    [
576        if test "x$withval" != "xno" ; then     
577               dump_email=$withval
578        fi
579    ]
580 )
581
582 AC_SUBST(dump_email)
583
584 # ------------------------------------------
585 # Where to send job email
586 # ------------------------------------------
587 job_email=root@localhost
588 AC_ARG_WITH(job-email,
589    [  --with-job-email=EMAIL     job output email address],
590    [
591        if test "x$withval" != "xno" ; then     
592               job_email=$withval
593        fi
594    ]
595 )
596
597 AC_SUBST(job_email)
598
599 # ------------------------------------------
600 # Where to find smtp host
601 # ------------------------------------------
602 smtp_host=localhost
603 AC_ARG_WITH(smtp_host,
604    [  --with-smtp-host=HOST              SMTP mail host address],
605    [
606        if test "x$withval" != "xno" ; then     
607               smtp_host=$withval
608        fi
609    ]
610 )
611
612 AC_SUBST(smtp_host)
613
614
615 # ------------------------------------
616 # Where to place pid files
617 # ------------------------------------
618 piddir=/var/run
619 AC_ARG_WITH(pid-dir,
620     [  --with-pid-dir=PATH               specify location of Bacula pid files],
621     [
622         if test "x$withval" != "xno" ; then     
623             piddir=$withval
624         fi
625     ]
626 )
627
628 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
629 AC_SUBST(piddir)
630
631
632 # ------------------------------------
633 # Where to place subsys "lock file"
634 # ------------------------------------
635 subsysdir=/var/run/subsys
636 AC_ARG_WITH(subsys-dir,
637     [  --with-subsys-dir=PATH    specify location of Bacula subsys file],
638     [
639         if test "x$withval" != "xno" ; then     
640             subsysdir=$withval
641         fi
642     ]
643 )
644
645 AC_SUBST(subsysdir)
646
647
648
649 # ------------------------------------
650 # Where to start assigning ports
651 # ------------------------------------
652 baseport=9101
653 AC_ARG_WITH(baseport,
654     [  --with-baseport=PORT              specify base port address for daemons],
655     [
656         if test "x$withval" != "xno" ; then     
657              baseport=$withval
658         fi
659     ]
660 )
661
662 AC_SUBST(baseport)
663 dir_port=`expr $baseport`
664 fd_port=`expr $baseport + 1`
665 sd_port=`expr $fd_port + 1`
666
667 AC_SUBST(dir_port)
668 AC_SUBST(fd_port)
669 AC_SUBST(sd_port)
670
671
672 # ------------------------------------------
673 # Generate passwords
674 # ------------------------------------------
675 dir_password=
676 AC_ARG_WITH(dir-password,
677    [  --with-dir-password=PASSWORD   specify Director's password],
678    [
679        if test "x$withval" != "xno" ; then     
680            dir_password=$withval
681        fi
682    ]
683 )
684
685 if test "x$dir_password" = "x" ; then
686    if test "x$OPENSSL" = "xnone" ; then
687 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'`
688       key=`autoconf/randpass 33`
689    else
690       key=`openssl rand -base64 33`
691    fi
692    dir_password=$key
693 fi
694
695 fd_password=
696 AC_ARG_WITH(fd-password,
697    [  --with-fd-password=PASSWORD    specify Client's password],
698    [
699        if test "x$withval" != "xno" ; then     
700            fd_password=$withval
701        fi
702    ]
703 )
704
705 if test "x$fd_password" = "x" ; then
706    if test "x$OPENSSL" = "xnone" ; then
707 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'`
708       key=`autoconf/randpass 37`
709    else
710       key=`openssl rand -base64 33`
711    fi
712    fd_password=$key
713 fi
714
715 sd_password=
716 AC_ARG_WITH(sd-password,
717    [  --with-sd-password=PASSWORD    specify Storage daemon's password],
718    [
719        if test "x$withval" != "xno" ; then     
720            sd_password=$withval
721        fi
722    ]
723 )
724
725 if test "x$sd_password" = "x" ; then
726    if test "x$OPENSSL" = "xnone" ; then
727 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'`
728       key=`autoconf/randpass 41`
729    else
730       key=`openssl rand -base64 33`
731    fi
732    sd_password=$key
733 fi
734
735
736 AC_SUBST(dir_password)
737 AC_SUBST(fd_password)
738 AC_SUBST(sd_password)
739
740
741
742
743 # ------------------------------------------------
744 # Bacula check for various SQL database engines
745 # ------------------------------------------------
746 BA_CHECK_MYSQL_DB
747
748
749 # ------------------------------------------------
750 # Bacula check for various SQL database engines
751 # ------------------------------------------------
752 BA_CHECK_SQLITE_DB
753
754 AC_SUBST(cats)
755 AC_SUBST(DB_NAME)
756
757 AC_DEFINE(PROTOTYPES)
758
759 dnl# --------------------------------------------------------------------------
760 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
761 dnl#
762 if test -z "$CFLAGS"; then
763     if test -z "$CCOPTS"; then
764         CCOPTS='-g -O2'
765 dnl>    if test "x$GCC" = xyes; then
766 dnl>        if test x$system = xLinux; then
767 dnl>            CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
768 dnl>        fi
769 dnl>    fi
770     fi
771     CFLAGS="$CCOPTS"
772 fi
773
774
775 dnl A few others 
776 AC_EXEEXT
777
778 dnl See if we can use 64 bit file addresses
779 largefile_support="no"
780 AC_BAC_LARGEFILE
781
782
783 AC_PATH_XTRA
784
785 dnl# --------------------------------------------------------------------------
786 dnl# CHECKING FOR HEADER FILES
787 dnl# --------------------------------------------------------------------------
788 AC_CHECK_HEADERS( \
789         assert.h \
790         fcntl.h \
791         grp.h \
792         pwd.h \
793         libc.h \
794         limits.h \
795         stdarg.h \
796         stdlib.h \
797         stdint.h \
798         string.h \
799         termios.h \
800         unistd.h \
801         sys/byteorder.h \
802         sys/ioctl.h \
803         sys/select.h \
804         sys/sockio.h \
805         sys/time.h \
806         sys/socket.h \
807         arpa/nameser.h \
808         resolv.h \
809         mtio.h \
810         sys/mtio.h \
811 )
812 AC_HEADER_STDC
813 AC_HEADER_MAJOR
814 AC_HEADER_DIRENT
815 AC_HEADER_STAT
816 AC_HEADER_SYS_WAIT
817 AC_HEADER_TIME
818 AC_STRUCT_ST_BLKSIZE
819 AC_STRUCT_ST_BLOCKS
820 AC_STRUCT_TIMEZONE
821
822 dnl# --------------------------------------------------------------------------
823 dnl# Check for utime.h structure 
824 dnl# --------------------------------------------------------------------------
825 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
826   [AC_TRY_COMPILE([
827 #include <sys/types.h>
828 #include <utime.h>], [struct utimbuf foo],
829   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
830 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
831
832 dnl# --------------------------------------------------------------------------
833 dnl# Check for socklen_t
834 dnl# --------------------------------------------------------------------------
835 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
836   [AC_TRY_COMPILE([
837 #include <sys/types.h>
838 #include <sys/socket.h>],
839   [socklen_t x],
840   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
841 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
842
843 dnl# --------------------------------------------------------------------------
844 dnl# Check for bigendian
845 dnl# --------------------------------------------------------------------------
846 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
847   [AC_TRY_RUN(
848     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
849     [ba_cv_bigendian=yes], 
850     [ba_cv_bigendian=no], 
851     [ba_cv_bigendian=no])])
852 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
853
854
855 AC_C_CONST
856
857
858 dnl# --------------------------------------------------------------------------
859 dnl# CHECKING FOR FILESYSTEM TYPE
860 dnl# --------------------------------------------------------------------------
861 AC_MSG_CHECKING(how to get filesystem type)
862 fstype=no
863 # The order of these tests is important.
864 AC_TRY_CPP([#include <sys/statvfs.h>
865 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
866 if test $fstype = no; then
867 AC_TRY_CPP([#include <sys/statfs.h>
868 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
869 fi
870 if test $fstype = no; then
871 AC_TRY_CPP([#include <sys/statfs.h>
872 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
873 fi
874 if test $fstype = no; then  
875 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
876 fi
877 if test $fstype = no; then  
878 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
879 fi
880 if test $fstype = no; then  
881 AC_TRY_CPP([#include <sys/mount.h>
882 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
883 fi
884 AC_MSG_RESULT($fstype)
885
886 dnl# --------------------------------------------------------------------------
887 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
888 dnl# --------------------------------------------------------------------------
889 AC_TYPE_SIGNAL
890 SIGNAL_CHECK
891 AC_TYPE_MODE_T
892 AC_TYPE_UID_T
893 AC_TYPE_SIZE_T
894 AC_TYPE_PID_T
895 AC_TYPE_OFF_T
896 AC_CHECK_TYPE(ino_t, unsigned long)
897 AC_CHECK_TYPE(dev_t, unsigned long)
898 AC_CHECK_TYPE(daddr_t, long)
899 AC_CHECK_TYPE(major_t, int)
900 AC_CHECK_TYPE(minor_t, int)
901 AC_CHECK_TYPE(ssize_t, int)
902 AC_STRUCT_ST_BLOCKS
903 AC_STRUCT_ST_RDEV
904 AC_STRUCT_TM
905 AC_C_CONST
906
907
908 AC_CHECK_SIZEOF(char, 1)
909 AC_CHECK_SIZEOF(short int, 2)
910 AC_CHECK_SIZEOF(int, 4)
911 AC_CHECK_SIZEOF(long int, 4)
912 AC_CHECK_SIZEOF(long long int, 8)
913 AC_CHECK_SIZEOF(int *, 4)
914
915 # Check for sys/types.h types
916 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
917     AC_TRY_COMPILE(
918         [ #include <sys/types.h> ], 
919         [ u_int a; a = 1;], 
920         [ ac_cv_have_u_int="yes" ],
921         [ ac_cv_have_u_int="no" ]
922     )
923 ])
924 if test "x$ac_cv_have_u_int" = "xyes" ; then
925    AC_DEFINE(HAVE_U_INT)
926    have_u_int=1
927 fi
928
929 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
930    AC_TRY_COMPILE(
931       [ #include <sys/types.h> ], 
932       [ intmax_t a; a = 1;], 
933       [ ac_cv_have_intmax_t="yes" ],
934       [ 
935          AC_TRY_COMPILE(
936             [ #include <stdint.h> ], 
937             [ intmax_t a; a = 1;], 
938             [ ac_cv_have_intmax_t="yes" ],
939             [ ac_cv_have_intmax_t="no" ]
940          )
941       ]
942    )        
943
944 ])
945 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
946    AC_DEFINE(HAVE_INTMAX_T)
947    have_intmax_t=1
948 fi
949
950
951 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
952    AC_TRY_COMPILE(
953       [ #include <sys/types.h> ], 
954       [ u_intmax_t a; a = 1;], 
955       [ ac_cv_have_u_intmax_t="yes" ],
956       [ 
957          AC_TRY_COMPILE(
958             [ #include <stdint.h> ], 
959             [ u_intmax_t a; a = 1;], 
960             [ ac_cv_have_u_intmax_t="yes" ],
961             [ ac_cv_have_u_intmax_t="no" ]
962          )
963       ]
964    )
965 ])
966 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
967    AC_DEFINE(HAVE_U_INTMAX_T)
968    have_u_intmax_t=1
969 fi
970
971
972 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
973    AC_TRY_COMPILE(
974       [ #include <sys/types.h> ], 
975       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
976       [ ac_cv_have_intxx_t="yes" ],
977       [ ac_cv_have_intxx_t="no" ]
978    )
979 ])
980 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
981    AC_DEFINE(HAVE_INTXX_T)
982    have_intxx_t=1
983 fi
984         
985 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
986    AC_TRY_COMPILE(
987       [ #include <sys/types.h> ], 
988       [ int64_t a; a = 1;], 
989       [ ac_cv_have_int64_t="yes" ],
990       [ ac_cv_have_int64_t="no" ]
991    )
992 ])
993 if test "x$ac_cv_have_int64_t" = "xyes" ; then
994    AC_DEFINE(HAVE_INT64_T)
995    have_int64_t=1
996 fi
997         
998 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
999    AC_TRY_COMPILE(
1000       [ #include <sys/types.h> ], 
1001       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
1002       [ ac_cv_have_u_intxx_t="yes" ],
1003       [ ac_cv_have_u_intxx_t="no" ]
1004    )
1005 ])
1006 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1007    AC_DEFINE(HAVE_U_INTXX_T)
1008    have_u_intxx_t=1
1009 fi
1010
1011 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1012    AC_TRY_COMPILE(
1013       [ #include <sys/types.h> ], 
1014       [ u_int64_t a; a = 1;], 
1015       [ ac_cv_have_u_int64_t="yes" ],
1016       [ ac_cv_have_u_int64_t="no" ]
1017    )
1018 ])
1019 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1020    AC_DEFINE(HAVE_U_INT64_T)
1021    have_u_int64_t=1
1022 fi
1023
1024 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1025            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1026 then
1027    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1028    AC_TRY_COMPILE(
1029       [ #include <sys/bitypes.h>  ], 
1030       [ int8_t a; int16_t b; int32_t c;
1031         u_int8_t e; u_int16_t f; u_int32_t g;
1032         a = b = c = e = f = g = 1;  ], 
1033       [ AC_DEFINE(HAVE_U_INTXX_T)
1034         AC_DEFINE(HAVE_INTXX_T)
1035         AC_DEFINE(HAVE_SYS_BITYPES_H)
1036         AC_MSG_RESULT(yes) ],
1037       [ AC_MSG_RESULT(no)]
1038    ) 
1039 fi
1040
1041 if test -z "$have_u_intxx_t" ; then
1042    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1043       AC_TRY_COMPILE(
1044          [ #include <sys/types.h> ], 
1045          [ uint8_t a; uint16_t b; 
1046            uint32_t c; a = b = c = 1; ], 
1047          [ ac_cv_have_uintxx_t="yes" ],
1048          [ ac_cv_have_uintxx_t="no" ]
1049       )
1050    ])
1051    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1052       AC_DEFINE(HAVE_UINTXX_T)
1053    fi
1054 fi
1055
1056
1057 dnl# --------------------------------------------------------------------------
1058 dnl# CHECKING FOR LIBRARY FUNCTIONS
1059 dnl# --------------------------------------------------------------------------
1060 AC_CHECK_FUNCS( \
1061         fork \
1062         getcwd \
1063         gethostname \
1064         getpid \
1065         gettimeofday \
1066         setpgid \
1067         setpgrp \
1068         setsid \
1069         signal \
1070         strerror \
1071         strncmp \
1072         strncpy \
1073         vfprintf \
1074         ,,
1075         [echo 'configure: cannot find needed function.'; exit 1]
1076 )
1077
1078 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1079 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1080
1081 AC_CHECK_FUNCS(chflags) 
1082
1083 AC_CHECK_FUNCS(snprintf vsnprintf gethostid getdomainname)
1084
1085 dnl# --------------------------------------------------------------------------
1086 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1087 dnl# --------------------------------------------------------------------------
1088 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1089
1090 # If resolver functions are not in libc check for -lnsl or -lresolv.
1091 AC_CHECK_FUNC(gethostbyname_r,
1092     AC_MSG_RESULT(using libc's resolver),
1093     AC_CHECK_LIB(nsl,gethostbyname_r)
1094     AC_CHECK_LIB(resolv,gethostbyname_r))
1095
1096
1097 # Find where sockets are (especially for Solaris)
1098 AC_CHECK_FUNC(socket,
1099     AC_MSG_RESULT(using libc's socket),
1100     AC_CHECK_LIB(xnet,socket)
1101     AC_CHECK_LIB(socket,socket)
1102     AC_CHECK_LIB(inet,socket))
1103
1104 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1105
1106 AC_FUNC_STRFTIME
1107 AC_FUNC_VPRINTF
1108 AC_FUNC_ALLOCA
1109 AC_FUNC_GETMNTENT
1110 AC_FUNC_CLOSEDIR_VOID
1111 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
1112 AC_FUNC_FNMATCH
1113
1114
1115 dnl# FreeBSD needs to link libxpg4
1116 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
1117
1118
1119 AC_CHECK_LIB(sun, getpwnam)
1120
1121 AC_CHECK_HEADERS(zlib.h)
1122 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1123 have_zlib=no
1124 if test x$FDLIBS = x-lz; then
1125   AC_DEFINE(HAVE_LIBZ)
1126   have_zlib=yes
1127 fi
1128
1129 dnl Check for pthread libraries
1130 PTHREAD_LIB=""
1131 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1132         [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1133             [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1134                 [AC_CHECK_FUNC(pthread_create)]
1135             )]
1136         )]
1137 )
1138
1139 AC_SUBST(FDLIBS)
1140 AC_DEFINE(FDLIBS)
1141
1142
1143 CFLAGS=${CFLAGS--O}
1144 LDFLAGS=${LDFLAGS--O}
1145 DB_LIBS="${SQL_LFLAGS}"
1146
1147 CPPFLAGS="$CPPFLAGS"
1148 AC_SUBST(DEBUG)
1149 AC_SUBST(DINCLUDE)
1150 AC_SUBST(CFLAGS)
1151 AC_SUBST(CPPFLAGS)
1152 AC_SUBST(LDFLAGS)
1153 AC_SUBST(X_CFLAGS)
1154 AC_SUBST(LIBS)
1155 AC_SUBST(DLIB)
1156 AC_SUBST(DB_LIBS)
1157 AC_SUBST(X_LIBS)
1158 AC_SUBST(X_EXTRA_LIBS)
1159 AC_SUBST(WCFLAGS)
1160 AC_SUBST(WLDFLAGS)
1161
1162 dnl# extra configurable objects
1163 OBJLIST=
1164 AC_SUBST(OBJLIST)
1165
1166 lld="lld"
1167 llu="llu"
1168
1169 WCFLAGS=
1170 WLDFLAGS=
1171
1172 #
1173 # Finally we set appropriate distribution specific
1174 #  variables and defaults
1175 #
1176 # PFILES are platform specific files
1177 PFILES="platforms/Makefile"
1178 PSCMD="ps -e"
1179 WIN32=
1180 hostname=`uname -n`
1181 case "$DISTNAME" in
1182 aix)
1183         DISTVER=`uname -r`
1184         PSCMD="ps -e -o pid,comm"
1185         PFILES="${PFILES} \
1186            platforms/aix/Makefile"
1187         TAPEDRIVE="/dev/rmt0.1" 
1188   ;;      
1189 alpha)
1190         DISTVER=`uname -r`
1191         PTHREAD_LIB="-lpthread -lexc"
1192         if test "${CC}" = "gcc" ; then
1193            lld="lld"
1194            llu="llu"
1195         else
1196            lld="ld"
1197            llu="lu"
1198         fi
1199         TAPEDRIVE="/dev/nrmt0"
1200   ;;
1201 bsdi)
1202         DISTVER=`uname -a |awk '{print $3}'`
1203         TAPEDRIVE="/dev/nrmt0"
1204         PTHREAD_LIB="-pthread"
1205         CFLAGS="${CFLAGS} -pthread"
1206         PSCMD="ps -x -o pid,command"
1207         lld="qd"
1208         llu="qu"
1209         PFILES="${PFILES} \
1210             platforms/bsdi/Makefile \
1211             platforms/bsdi/bacula-fd \
1212             platforms/bsdi/bacula-sd \
1213             platforms/bsdi/bacula-dir"
1214         hostname=`hostname -s`
1215         largefile_support="yes"
1216   ;;
1217 cygwin)
1218         DISTVER=`uname -a |awk '{print $3}'`
1219         TAPEDRIVE="/dev/nrst0"
1220         WIN32=win32
1221         WCFLAGS="-mwindows"
1222         WLDFLAGS="-mwindows"
1223   ;;
1224 darwin)
1225         DISTVER=`uname -r`
1226         TAPEDRIVE="/dev/nst0"
1227         PSCMD="ps -e -o pid,command"
1228         hostname=`hostname -s`
1229         PFILES="${PFILES} \
1230            platforms/darwin/Makefile"
1231   ;;
1232 debian)
1233         DISTVER=`cat /etc/debian_version`
1234         TAPEDRIVE="/dev/nrst0"
1235         PSCMD="ps -e -o pid,command"
1236         hostname=`hostname -s`
1237   ;;
1238 freebsd)
1239         DISTVER=`uname -a |awk '{print $3}'`
1240         PTHREAD_LIB="-pthread"
1241         CFLAGS="${CFLAGS} -pthread"
1242         lld="qd"
1243         llu="qu"
1244         TAPEDRIVE="/dev/nrsa0"
1245         PSCMD="ps -x -o pid,command"
1246         PFILES="${PFILES} \
1247             platforms/freebsd/Makefile \
1248             platforms/freebsd/bacula-fd \
1249             platforms/freebsd/bacula-sd \
1250             platforms/freebsd/bacula-dir"
1251         hostname=`hostname -s`
1252         largefile_support="yes"
1253   ;;
1254 hpux)
1255         DISTVER=`uname -r`
1256         TAPEDRIVE="/dev/rmt/0hnb"
1257   ;;
1258 irix)
1259         DISTVER=`uname -r`
1260         TAPEDRIVE="/dev/rmt/0cbn"
1261         PSCMD="ps -e -o pid,comm"
1262         PFILES="${PFILES} \
1263             platforms/irix/Makefile \
1264             platforms/irix/bacula-fd \
1265             platforms/irix/bacula-sd \
1266             platforms/irix/bacula-dir"
1267   ;;
1268 netbsd)
1269         DISTVER=`uname -a |awk '{print $3}'`
1270         lld="qd"
1271         llu="qu"
1272         TAPEDRIVE="/dev/nrst0"
1273         PSCMD="ps -a -o pid,command"
1274         PTHREAD_LIB="-pthread"
1275         CFLAGS="${CFLAGS} -pthread"
1276   ;;
1277 openbsd)
1278         DISTVER=`uname -a |awk '{print $3}'`
1279         lld="qd"
1280         llu="qu"
1281         TAPEDRIVE="/dev/nrst0"
1282         PSCMD="ps -a -o pid,command"
1283         PTHREAD_LIB="-pthread"
1284         CFLAGS="${CFLAGS} -pthread"
1285         PFILES="${PFILES} \
1286             platforms/openbsd/Makefile \
1287             platforms/openbsd/bacula-fd \
1288             platforms/openbsd/bacula-sd \
1289             platforms/openbsd/bacula-dir"
1290   ;;
1291 redhat)
1292         DISTVER=`cat /etc/redhat-release | grep release |\
1293            cut -f 5 -d ' '`
1294         TAPEDRIVE="/dev/nst0"
1295         PSCMD="ps -e -o pid,command"
1296         PFILES="${PFILES} \
1297             platforms/redhat/Makefile \
1298             platforms/redhat/bacula-fd \
1299             platforms/redhat/bacula-sd \
1300             platforms/redhat/bacula-dir \
1301             platforms/redhat/bacula.spec \
1302             "
1303         hostname=`hostname -s`
1304   ;;
1305 mandrake)
1306         DISTVER=`cat /etc/mandrake-release | grep release |\
1307            cut -f 5 -d ' '`
1308         TAPEDRIVE="/dev/nst0"
1309         PSCMD="ps -e -o pid,command"
1310         PFILES="${PFILES} \
1311             platforms/mandrake/Makefile \
1312             platforms/mandrake/bacula-fd \
1313             platforms/mandrake/bacula-sd \
1314             platforms/mandrake/bacula-dir \
1315             platforms/mandrake/bacula.spec \
1316             "
1317         hostname=`hostname -s`
1318   ;;
1319 gentoo)
1320         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
1321         TAPEDRIVE="/dev/nst0"
1322         PSCMD="ps -e -o pid,command"
1323         PFILES="${PFILES} \
1324             platforms/gentoo/Makefile \
1325             platforms/gentoo/bacula-fd \
1326             platforms/gentoo/bacula-sd \
1327             platforms/gentoo/bacula-dir"
1328         hostname=`hostname -s`
1329   ;;
1330
1331 slackware)
1332         DISTVER=`cat /etc/slackware-version`
1333         TAPEDRIVE="/dev/nst0"
1334         PSCMD="ps -e -o pid,command"
1335         hostname=`hostname -s`
1336   ;;
1337 solaris)
1338         DISTVER=`uname -r`
1339         TAPEDRIVE="/dev/rmt/0cbn"
1340         PSCMD="ps -e -o pid,comm"
1341         PFILES="${PFILES} \
1342             platforms/solaris/Makefile \
1343             platforms/solaris/bacula-fd \
1344             platforms/solaris/bacula-sd \
1345             platforms/solaris/bacula-dir"
1346         if test x$DISTVER = x5.6 ; then
1347             AC_DEFINE(HAVE_OLD_SOCKOPT)
1348         fi
1349   ;;
1350 suse)
1351         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1352             cut -f 3 -d ' '`
1353         TAPEDRIVE="/dev/nst0"
1354         PSCMD="ps -e -o pid,command"
1355         hostname=`hostname -s`
1356   ;;
1357 suse5)
1358         DISTNAME=suse
1359         DISTVER=5.x
1360         TAPEDRIVE="/dev/nst0"
1361         PSCMD="ps -e -o pid,command"
1362         hostname=`hostname -s`
1363   ;;
1364 unknown)
1365         DISTVER=unknown
1366         TAPEDRIVE="/dev/nst0"
1367   ;;
1368 *)
1369   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1370   ;;
1371 esac  
1372
1373 AC_SUBST(hostname)
1374
1375 LIBS="$PTHREAD_LIB $LIBS"
1376
1377 AC_DEFINE_UNQUOTED(lld, "$lld")
1378 AC_DEFINE_UNQUOTED(llu, "$llu")
1379 AC_SUBST(TAPEDRIVE)
1380 AC_SUBST(PSCMD)
1381 AC_SUBST(WIN32)
1382 AC_SUBST(DISTNAME)
1383 AC_SUBST(DISTVER)
1384
1385 dnl# common parts of the Makefile
1386 MCOMMON=./autoconf/Make.common
1387 AC_SUBST_FILE(MCOMMON)
1388
1389 dnl# Insanity check
1390 if test "x${subsysdir}" = "x${sbindir}" ; then
1391    echo " "
1392    echo " "
1393    echo "You have set both --sbindir and --with-subsys-dir"
1394    echo "  equal to: ${subsysdir} "
1395    echo "This is not permitted. Please reconfigure."
1396    echo " "
1397    echo "Aborting configuration ..."
1398    echo " "
1399    echo " "
1400    exit 1
1401 fi 
1402
1403 AC_OUTPUT([autoconf/Make.common \
1404            Makefile \
1405            rescue/Makefile \
1406            rescue/linux/Makefile \
1407            rescue/freebsd/Makefile \
1408            rescue/solaris/Makefile \
1409            scripts/startmysql \
1410            scripts/stopmysql \
1411            scripts/btraceback \
1412            scripts/startit \
1413            scripts/stopit \
1414            scripts/console \
1415            scripts/gconsole \
1416            scripts/bacula \
1417            scripts/fd \
1418            scripts/Makefile \
1419            scripts/logrotate \
1420            scripts/bacula.desktop.gnome1 \
1421            scripts/bacula.desktop.gnome2 \
1422            scripts/mtx-changer \
1423            doc/Makefile \
1424            src/Makefile \
1425            src/host.h \
1426            src/console/Makefile \
1427            src/console/console.conf \
1428            src/gnome-console/Makefile \
1429            src/gnome-console/gnome-console.conf \
1430            src/gnome2-console/Makefile \
1431            src/gnome2-console/gnome-console.conf \
1432            src/tconsole/Makefile \
1433            src/dird/Makefile \
1434            src/dird/bacula-dir.conf \
1435            src/lib/Makefile \
1436            src/stored/Makefile \
1437            src/stored/bacula-sd.conf \
1438            src/filed/Makefile \
1439            src/filed/bacula-fd.conf \
1440            src/filed/win32/Makefile \
1441            src/cats/Makefile \
1442            src/cats/make_catalog_backup \
1443            src/cats/delete_catalog_backup \
1444            src/cats/alter_mysql_tables \
1445            src/cats/make_mysql_tables \
1446            src/cats/drop_mysql_tables \
1447            src/cats/create_mysql_database \
1448            src/cats/grant_mysql_privileges \
1449            src/cats/alter_sqlite_tables \
1450            src/cats/make_sqlite_tables \
1451            src/cats/drop_sqlite_tables \
1452            src/cats/create_sqlite_database \
1453            src/cats/sqlite \
1454            src/cats/mysql \
1455            src/cats/create_bdb_database \
1456            src/cats/make_bdb_tables \
1457            src/cats/drop_bdb_tables \
1458            src/cats/make_bacula_tables \
1459            src/cats/drop_bacula_tables \
1460            src/findlib/Makefile \
1461            src/tools/Makefile \
1462            $PFILES ],  
1463           [(echo "Doing make of dependencies"; make depend;) ]
1464 )
1465
1466 cd scripts
1467 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
1468 chmod 755 console gconsole mtx-changer
1469 cd ..
1470 chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables
1471 chmod 755 src/cats/make_test_tables src/cats/drop_test_tables
1472 chmod 755 src/cats/create_mysql_database 
1473 chmod 755 src/cats/make_catalog_backup src/cats/delete_catalog_backup
1474 chmod 755 src/cats/alter_mysql_tables
1475 chmod 755 src/cats/grant_mysql_privileges
1476 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
1477 chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
1478 chmod 755 src/cats/create_sqlite_database
1479 chmod 755 src/cats/alter_sqlite_tables
1480 chmod 755 src/cats/sqlite
1481 chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables 
1482 chmod 755 src/cats/create_bdb_database
1483
1484 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
1485    largefile_support="yes"
1486 fi
1487
1488 #
1489 # A whole lot of hand springs to get the compiler version.
1490 #  This is because gcc changed the output in version 3.0
1491 #
1492 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
1493 if test "x${CCVERSION}" = "x" ; then
1494   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
1495 fi
1496 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
1497 if test x"${CXXVERSION}" = x ; then
1498   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
1499 fi
1500
1501 if test "x${subsysdir}" = "x${sbindir}" ; then
1502    echo " "
1503    echo " "
1504    echo "You have set --sbindir and --with-subsys-dir"
1505    echo "  both equal to: ${subsysdir} "
1506    echo "  This is not permitted. Please reconfigure."
1507    echo "Aborting configuration ..."
1508    echo " "
1509    echo " "
1510    exit 1
1511 fi 
1512
1513 echo "
1514 Configuration on `date`:
1515
1516   Host:                       $host -- ${DISTNAME} ${DISTVER}
1517   Bacula version:             ${VERSION} (${DATE})
1518   Source code location:       ${srcdir}
1519   Install binaries:           ${sbindir}
1520   Install config files:       ${sysconfdir}
1521   Scripts directory:          ${scriptdir}
1522   Working directory:          ${working_dir}
1523   PID directory:              ${piddir}
1524   Subsys directory:           ${subsysdir}
1525   C Compiler:                 ${CC} ${CCVERSION}
1526   C++ Compiler:               ${CXX} ${CXXVERSION}
1527   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
1528   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
1529   Libraries:                  ${LIBS}
1530   Statically Linked Tools:    ${support_static_tools}
1531   Statically Linked FD:       ${support_static_fd}
1532   Statically Linked SD:       ${support_static_sd}
1533   Statically Linked DIR:      ${support_static_dir}
1534   Statically Linked CONS:     ${support_static_cons}
1535   Database type:              ${db_name}
1536   Database lib:               ${DB_LIBS}
1537
1538   Job Output Email:           ${job_email}
1539   Traceback Email:            ${dump_email}
1540   SMTP Host Address:          ${smtp_host}
1541   Director Port               ${dir_port}
1542   File daemon Port            ${fd_port}
1543   Storage daemon Port         ${sd_port}
1544   SQL binaries Directory      ${SQL_BINDIR}
1545
1546   Large file support:         $largefile_support
1547   readline support:           ${got_readline} ${PRTREADLINE_SRC}
1548   TCP Wrappers support:       ${TCPW_MSG}
1549   ZLIB support:               ${have_zlib}
1550   enable-smartalloc:          ${support_smartalloc} 
1551   enable-gnome:               ${support_gnome}
1552   client-only:                ${build_client_only}
1553
1554   " > config.out
1555
1556 cat config.out
1557
1558 # old stuff
1559 # cweb support:               ${got_cweb} ${CWEB_SRC}
1560 # gmp support:                ${got_gmp} ${GMP_SRC}