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