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