]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
6a3f7cdcde19c88c1a606b902c13b036e4b3dc78
[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]*DATE.*"\(.*\)"$/\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
65 test -n "$ARFLAG" || ARFLAGS="cr"
66 AC_SUBST(ARFLAGS)
67
68 MAKE_SHELL=/bin/sh
69 AC_SUBST(MAKE_SHELL)
70
71 AC_SUBST(LOCAL_LIBS)
72 AC_SUBST(LOCAL_CFLAGS)
73 AC_SUBST(LOCAL_LDFLAGS)
74 AC_SUBST(LOCAL_DEFS)
75
76
77
78 dnl --------------------------------------------------
79 dnl Bacula OP Sys determination (see aclocal.m4)
80 dnl --------------------------------------------------
81 BA_CHECK_OPSYS
82
83 # -----------------------------------------------------------
84 dnl Bacula OPSys Distribution determination (see aclocal.m4)
85 # ----------------------------------------------------------
86 BA_CHECK_OPSYS_DISTNAME
87
88 # -----------------------------------------------------------
89 dnl Check for gnome stuff for gnome-console
90 # ----------------------------------------------------------
91 AM_ACLOCAL_INCLUDE(gnome-macros)
92
93 # ------------------------------------------------------------------
94 #  If the user has not set --prefix, we set our default to nothing.
95 #  In this case, if the user has not set --sysconfdir, we set it
96 #  to the package default of /etc/bacula.  If either --prefix or
97 #  --sysconfdir is set, we leave sysconfdir alone except to eval it.
98 # ------------------------------------------------------------------
99 if test x${prefix} = xNONE ; then
100     if test `eval echo ${sysconfdir}` = NONE/etc ; then
101         sysconfdir=/etc/bacula
102     fi
103     prefix=
104 fi
105 sysconfdir=`eval echo ${sysconfdir}`
106
107 # -------------------------------------------------------------------------
108 #  If the user has not set --exec-prefix, we default to ${prefix}
109 # -------------------------------------------------------------------------
110 if test x${exec_prefix} = xNONE ; then
111     exec_prefix=${prefix}
112 fi
113
114 # ------------------------------------------------------------------
115 # If the user has not set --sbindir, we set our default as /sbin
116 # ------------------------------------------------------------------
117 if test x$sbindir = x'${exec_prefix}/sbin' ; then
118     sbindir=${exec_prefix}/sbin
119 fi
120 sbindir=`eval echo ${sbindir}`
121                       
122 # ------------------------------------------------------------------
123 # All list of languages for which a translation exist. Each
124 #  language is separated by a space.
125 # ------------------------------------------------------------------
126 ALL_LINGUAS=""
127
128 AC_PATH_PROGS(MSGFMT, msgfmt, no)
129 if test "$MSGFMT" = "no"
130 then
131    echo 'msgfmt program not found, disabling NLS !'
132    USE_NLS=no
133    USE_INCLUDED_LIBINTL=no
134 #else
135 #   AM_GNU_GETTEXT
136 fi
137
138
139 support_mysql=no
140 support_sqlite=no
141 support_smartalloc=yes
142 support_readline=yes
143 support_gnome=no
144 support_static_tools=no
145 cats=
146 db_name=Internal
147 DB_NAME=bdb
148
149 dnl# --------------------------------------------------------------------------
150 dnl# CHECKING COMMAND LINE OPTIONS
151 dnl# --------------------------------------------------------------------------
152 AC_ARG_ENABLE(everything,
153   [  --enable-everything     enable standard non-multichoice features: marked *],
154   [if test x$enableval = xyes; then
155     support_smartalloc=yes
156   fi])
157
158 # -------------------------------------------
159 # gnome (default off)
160 # -------------------------------------------
161 AC_ARG_ENABLE(gnome,
162   [  --enable-gnome     enable build of gnome-console GUI                     *],
163   [if test x$enableval = xyes; then
164     support_gnome=yes
165   fi])
166
167 GNOME_DIR=
168 if test x$support_gnome = xyes; then
169     GNOME_INIT
170     GNOME_DIR=src/gnome-console
171 fi
172 AC_SUBST(GNOME_DIR)
173
174
175 # -------------------------------------------
176 # smartalloc (default off)
177 # -------------------------------------------
178 AC_ARG_ENABLE(smartalloc,
179   [  --enable-smartalloc     enable smartalloc debugging support                   *],
180   [if test x$enableval = xno; then
181     support_smartalloc=no
182   fi])
183
184 if test x$support_smartalloc = xyes; then
185    AC_DEFINE(SMARTALLOC)
186 fi
187
188 # -------------------------------------------
189 # static-tools (default off)
190 # -------------------------------------------
191 AC_ARG_ENABLE(static-tools,
192    [  --enable-static-tools    enable static tape tools                            *],
193    [if test x$enableval = xyes; then
194      support_static_tools=yes
195    fi])
196
197 TTOOL_LDFLAGS=
198 if test x$support_static_tools = xyes; then
199    TTOOL_LDFLAGS="-static"
200 fi
201 AC_SUBST(TTOOL_LDFLAGS)
202
203
204
205
206 # ---------------------------------------------------
207 # Check for readline support/directory (default on)
208 # ---------------------------------------------------
209 # this allows you to turn it completely off
210 AC_ARG_ENABLE(readline,
211   [  --disable-readline      disable readline support ],
212   [if test x$enableval = xno; then
213     support_readline=no
214   fi])
215
216 got_readline="no"
217 READLINE_SRC=
218 if test x$support_readline = xyes; then
219    AC_ARG_WITH(readline,
220      [  --with-readline[=DIR]   Specify readline library directory],
221      [
222         case "$with_readline" in
223         no) : ;;
224         yes|*)
225           if test "$with_readline" != "yes"; then
226             CONS_INC="-I$with_readline"
227             CONS_LDFLAGS="-L$with_readline"
228           else
229              with_readline="/usr/include/readline" 
230           fi
231           AC_CHECK_HEADER($with_readline/readline.h, 
232              [ AC_MSG_RESULT(yes)
233                AC_DEFINE(HAVE_READLINE) 
234                CONS_LIBS="-lreadline -ltermcap"
235                got_readline="yes"   
236              ],
237              [ AC_MSG_ERROR([*** readline library missing]) 
238              ]
239           )
240           ;;
241         esac
242      ],[
243        # check for standard readline library
244        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
245        [ AC_MSG_RESULT(yes)
246          AC_DEFINE(HAVE_READLINE)
247          got_readline="yes"
248          CONS_INC="-I/usr/include/readline"
249          CONS_LIBS="-lreadline -ltermcap"
250        ], [
251          # Did not find starndard library, so user our own
252          AC_MSG_RESULT(yes)
253          AC_DEFINE(HAVE_READLINE)
254          got_readline="yes"
255          CONS_INC="-I${TOP_DIR}/depkgs"
256          CONS_LIBS="-lreadline -lhistory -ltermcap"
257          CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
258          PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
259        ])
260      ]   
261    )
262 fi
263 AC_SUBST(CONS_INC)
264 AC_SUBST(CONS_LIBS)
265 AC_SUBST(CONS_LDFLAGS)
266 AC_SUBST(READLINE_SRC)
267
268 # Minimal stuff for readline Makefile configuration
269 MAKE_SHELL=/bin/sh
270 AC_SUBST(MAKE_SHELL)
271
272 AC_HEADER_STAT
273 AC_HEADER_DIRENT
274
275 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat lchown)
276
277 #AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG),
278 #   [LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o"
279 #    EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"])
280
281 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG))
282
283
284 AC_FUNC_STRCOLL
285
286 AC_CHECK_HEADERS(varargs.h \
287                 sys/ptem.h sys/pte.h sys/stream.h)      
288
289 # End of readline stuff
290 # -----------------------------------------------------------------------
291
292
293 # ---------------------------------------------------
294 # Check for GMP support/directory
295 # ---------------------------------------------------
296 GMP_SRC=
297 local_gmp="no"
298 AC_ARG_WITH(gmp,
299   [  --with-gmp[=DIR]   Specify gmp library directory],
300   [
301      case "$with_gmp" in
302      no) : ;;
303      yes|*)
304        if test "$with_gmp" != "yes"; then
305          GMP_INC="-I$with_gmp"
306          GMP_LIBS="-lgmp"
307          GMP_LDFLAGS="-L$with_gmp"
308        else
309           with_gmp="/usr/include" 
310        fi
311        AC_CHECK_HEADER($with_gmp/gmp.h, 
312           [ AC_MSG_RESULT(yes)
313             AC_DEFINE(HAVE_GMP) 
314             GMP_LIBS="-lgmp"
315             got_gmp="yes"   
316           ],
317           [ AC_MSG_ERROR([*** gmp library missing]) 
318           ]
319        )
320        ;;
321      esac
322   ],[
323     # check for standard gmp library
324     AC_CHECK_HEADER(/usr/include/gmp.h,
325     [ AC_MSG_RESULT(yes)
326       AC_DEFINE(HAVE_GMP)
327       got_gmp="yes"
328       GMP_INC=
329       GMP_LIBS="-lgmp"
330     ], [
331       # Did not find standard library, so use our own
332       AC_MSG_RESULT(yes)
333       AC_DEFINE(HAVE_GMP)
334       got_gmp="yes"
335       local_gmp="yes"
336       GMP_INC="-I${TOP_DIR}/depkgs/gmp"
337       GMP_LIBS="-lgmp"
338       GMP_LDFLAGS="-L${TOP_DIR}/depkgs/gmp"
339       GMP_SRC="${TOP_DIR}/depkgs/gmp"
340     ])
341   ]   
342 )
343 AC_SUBST(GMP_INC)
344 AC_SUBST(GMP_LIBS)
345 AC_SUBST(GMP_LDFLAGS)
346 AC_SUBST(GMP_SRC)
347
348 # End of GMP stuff
349 # -----------------------------------------------------------------------
350
351
352 # ---------------------------------------------------
353 # Check for CWEB support/directory
354 # ---------------------------------------------------
355 CWEB_SRC=
356 CWEB=/bin
357 local_cweb="no"
358 AC_ARG_WITH(cweb,
359   [  --with-cweb[=DIR]   Specify cweb library directory],
360   [
361      case "$with_cweb" in
362      no) : ;;
363      yes|*)
364        if test "$with_cweb" != "yes"; then
365          CWEB_INC="-I$with_cweb"
366          CWEB_LIBS="-lcweb"
367          CWEB_LDFLAGS="-L$with_cweb"
368        else
369           with_cweb="/usr/include" 
370        fi
371        AC_CHECK_HEADER($with_cweb/cweb.h, 
372           [ AC_MSG_RESULT(yes)
373             AC_DEFINE(HAVE_CWEB) 
374             CWEB_LIBS="-lcweb"
375             got_cweb="yes"   
376           ],
377           [ AC_MSG_ERROR([*** cweb library missing]) 
378           ]
379        )
380        ;;
381      esac
382   ],[
383     # check for standard cweb library
384     AC_CHECK_HEADER(/usr/include/cweb.h,
385     [ AC_MSG_RESULT(yes)
386       AC_DEFINE(HAVE_CWEB)
387       got_cweb="yes"
388       CWEB_INC=
389       CWEB_LIBS="-lcweb"
390     ], [
391       # Did not find starndard library, so use our own
392       AC_MSG_RESULT(yes)
393       AC_DEFINE(HAVE_CWEB)
394       got_cweb="yes"
395       local_cweb="yes"
396       CWEB=${TOP_DIR}/depkgs/cweb
397       CWEB_INC="-I${TOP_DIR}/depkgs/cweb"
398       CWEB_LIBS="-lcweb"
399       CWEB_LDFLAGS="-L${TOP_DIR}/depkgs/cweb"
400       CWEB_SRC="${TOP_DIR}/depkgs/cweb"
401     ])
402   ]   
403 )
404 AC_SUBST(CWEB)
405 AC_SUBST(CWEB_INC)
406 AC_SUBST(CWEB_LIBS)
407 AC_SUBST(CWEB_LDFLAGS)
408 AC_SUBST(CWEB_SRC)
409
410 # End of CWEB stuff
411 # -----------------------------------------------------------------------
412
413
414
415 # -----------------------------------------------------------
416 # Check whether user wants TCP wrappers support (default off)
417 # -----------------------------------------------------------
418 TCPW_MSG="no" 
419 AC_ARG_WITH(tcp-wrappers,
420   [  --with-tcp-wrappers=DIR Enable tcpwrappers support],
421   [
422     if test "x$withval" != "xno" ; then
423        saved_LIBS="$LIBS"
424        LIBS="$LIBS -lwrap -lnsl"
425        AC_MSG_CHECKING(for libwrap)
426        AC_TRY_LINK(
427           [ #include <tcpd.h>
428              int deny_severity = 0;
429              int allow_severity = 0;
430              struct request_info *req; ],
431           [ hosts_access(req); ],
432           [
433             AC_MSG_RESULT(yes)
434             AC_DEFINE(HAVE_LIBWRAP)
435             TCPW_MSG="yes" 
436           ],
437           [AC_MSG_ERROR([*** libwrap missing]) ]
438        )
439     fi
440   ]
441 )
442
443 # ------------------------------------------
444 # Where to place working dir
445 # ------------------------------------------
446 working_dir=`eval echo ${sysconfdir}/working`
447 AC_ARG_WITH(working-dir,
448    [  --with-working-dir=PATH Specify location of Bacula working files],
449    [
450        if test "x$withval" != "xno" ; then     
451               working_dir=$withval
452        fi
453    ]
454 )
455
456 AC_SUBST(working_dir)
457
458 # ------------------------------------------
459 # Where to send dump email
460 # ------------------------------------------
461 dump_email=root@localhost
462 AC_ARG_WITH(dump-email,
463    [  --with-dump-email=Dump email address],
464    [
465        if test "x$withval" != "xno" ; then     
466               dump_email=$withval
467        fi
468    ]
469 )
470
471 AC_SUBST(dump_email)
472
473 # ------------------------------------------
474 # Where to send job email
475 # ------------------------------------------
476 job_email=root@localhost
477 AC_ARG_WITH(job-email,
478    [  --with-job-email=Job output email address],
479    [
480        if test "x$withval" != "xno" ; then     
481               job_email=$withval
482        fi
483    ]
484 )
485
486 AC_SUBST(job_email)
487
488 # ------------------------------------------
489 # Where to find smtp host
490 # ------------------------------------------
491 smtp_host=localhost
492 AC_ARG_WITH(smtp_host,
493    [  --with-smtp-host=SMTP mail host address],
494    [
495        if test "x$withval" != "xno" ; then     
496               smtp_host=$withval
497        fi
498    ]
499 )
500
501 AC_SUBST(smtp_host)
502
503
504 # ------------------------------------
505 # Where to place pid files
506 # ------------------------------------
507 piddir=/var/run
508 AC_ARG_WITH(pid-dir,
509     [  --with-pid-dir=PATH    Specify location of Bacula pid files],
510     [
511         if test "x$withval" != "xno" ; then     
512             piddir=$withval
513         fi
514     ]
515 )
516
517 # make sure the pid directory exists
518 if test ! -d $piddir ; then     
519     piddir=`eval echo ${sysconfdir}`
520     case $piddir in
521           NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
522     esac
523 fi
524
525 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
526 AC_SUBST(piddir)
527
528
529 # ------------------------------------
530 # Where to place subsys "lock file"
531 # ------------------------------------
532 subsysdir=/var/run/subsys
533 AC_ARG_WITH(subsys-dir,
534     [  --with-subsys-dir=PATH    Specify location of Bacula subsys file],
535     [
536         if test "x$withval" != "xno" ; then     
537             subsysdir=$withval
538         fi
539     ]
540 )
541
542 # make sure the pid directory exists
543 if test ! -d $subsysdir ; then     
544     subsysdir=`eval echo ${sysconfdir}`
545     case $subsysdir in
546         NONE/*) subsysdir=`echo $subsysdir | sed "s~NONE~$ac_default_prefix~"` ;;
547     esac
548 fi
549
550 AC_SUBST(subsysdir)
551
552
553
554 # ------------------------------------
555 # Where to start assigning ports
556 # ------------------------------------
557 baseport=9101
558 AC_ARG_WITH(baseport,
559     [  --with-baseport=PORT    Specify base port address for daemons],
560     [
561         if test "x$withval" != "xno" ; then     
562              baseport=$withval
563         fi
564     ]
565 )
566
567 AC_SUBST(baseport)
568 dir_port=`expr $baseport`
569 fd_port=`expr $baseport + 1`
570 sd_port=`expr $fd_port + 1`
571
572 AC_SUBST(dir_port)
573 AC_SUBST(fd_port)
574 AC_SUBST(sd_port)
575
576
577 # ------------------------------------------
578 # Generate passwords
579 # ------------------------------------------
580 dir_password=
581 AC_ARG_WITH(dir-password,
582    [  --with-dir-password=PASSWORD Specify Director's password],
583    [
584        if test "x$withval" != "xno" ; then     
585            dir_password=$withval
586        fi
587    ]
588 )
589
590 if test "x$dir_password" = "x" ; then
591    if test "x$OPENSSL" = "xnone" ; then
592 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'`
593       key=`./randpass 33`
594    else
595       key=`openssl rand -base64 33`
596    fi
597    dir_password=$key
598 fi
599
600 fd_password=
601 AC_ARG_WITH(fd-password,
602    [  --with-fd-password=PASSWORD Specify Client's password],
603    [
604        if test "x$withval" != "xno" ; then     
605            fd_password=$withval
606        fi
607    ]
608 )
609
610 if test "x$fd_password" = "x" ; then
611    if test "x$OPENSSL" = "xnone" ; then
612 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'`
613       key=`./randpass 37`
614    else
615       key=`openssl rand -base64 33`
616    fi
617    fd_password=$key
618 fi
619
620 sd_password=
621 AC_ARG_WITH(sd-password,
622    [  --with-sd-password=PASSWORD Specify Storage daemon's password],
623    [
624        if test "x$withval" != "xno" ; then     
625            sd_password=$withval
626        fi
627    ]
628 )
629
630 if test "x$sd_password" = "x" ; then
631    if test "x$OPENSSL" = "xnone" ; then
632 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'`
633       key=`./randpass 41`
634    else
635       key=`openssl rand -base64 33`
636    fi
637    sd_password=$key
638 fi
639
640
641 AC_SUBST(dir_password)
642 AC_SUBST(fd_password)
643 AC_SUBST(sd_password)
644
645
646
647
648 # ------------------------------------------------
649 # Bacula check for various SQL database engines
650 # ------------------------------------------------
651 BA_CHECK_MYSQL_DB
652
653
654 # ------------------------------------------------
655 # Bacula check for various SQL database engines
656 # ------------------------------------------------
657 BA_CHECK_SQLITE_DB
658
659 AC_SUBST(cats)
660 AC_SUBST(DB_NAME)
661
662 AC_DEFINE(PROTOTYPES)
663
664 dnl# --------------------------------------------------------------------------
665 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
666 dnl#
667 if test -z "$CFLAGS"; then
668     if test -z "$CCOPTS"; then
669         CCOPTS='-g -O2'
670 dnl>    if test "x$GCC" = xyes; then
671 dnl>        if test x$system = xLinux; then
672 dnl>            CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
673 dnl>        fi
674 dnl>    fi
675     fi
676     CFLAGS="$CCOPTS"
677 fi
678
679
680 dnl A few others 
681 AC_EXEEXT
682
683 dnl See if we can use 64 bit file addresses
684 largefile_support="no"
685 AC_SYS_LARGEFILE
686
687
688 AC_PATH_XTRA
689
690 dnl# --------------------------------------------------------------------------
691 dnl# CHECKING FOR HEADER FILES
692 dnl# --------------------------------------------------------------------------
693 AC_CHECK_HEADERS( \
694         assert.h \
695         fcntl.h \
696         grp.h \
697         libc.h \
698         limits.h \
699         stdarg.h \
700         stdlib.h \
701         string.h \
702         termios.h \
703         unistd.h \
704         sys/byteorder.h \
705         sys/ioctl.h \
706         sys/select.h \
707         sys/sockio.h \
708         sys/time.h \
709 )
710 AC_HEADER_STDC
711 AC_HEADER_MAJOR
712 AC_HEADER_DIRENT
713 AC_HEADER_STAT
714 AC_HEADER_SYS_WAIT
715 AC_HEADER_TIME
716 AC_STRUCT_ST_BLKSIZE
717 AC_STRUCT_ST_BLOCKS
718 AC_STRUCT_TIMEZONE
719
720 # It seems that that many machines where <utime.h> seems to be
721 # broken just require something like -D_XXX_SOURCE, where XXX might
722 # be POSIX, POSIX_C, ALL, HPUX or whatever, depending on the machine.
723
724 AC_CACHE_CHECK(for utime.h, tar_cv_header_utime_h,
725   [AC_TRY_COMPILE([
726 #include <sys/types.h>
727 #include <utime.h>], [struct utimbuf foo],
728   tar_cv_header_utime_h=yes, tar_cv_header_utime_h=no)])
729 test $tar_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
730
731 AC_C_CONST
732
733
734 dnl# --------------------------------------------------------------------------
735 dnl# CHECKING FOR FILESYSTEM TYPE
736 dnl# --------------------------------------------------------------------------
737 AC_MSG_CHECKING(how to get filesystem type)
738 fstype=no
739 # The order of these tests is important.
740 AC_TRY_CPP([#include <sys/statvfs.h>
741 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
742 if test $fstype = no; then
743 AC_TRY_CPP([#include <sys/statfs.h>
744 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
745 fi
746 if test $fstype = no; then
747 AC_TRY_CPP([#include <sys/statfs.h>
748 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
749 fi
750 if test $fstype = no; then  
751 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
752 fi
753 if test $fstype = no; then  
754 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
755 fi
756 if test $fstype = no; then  
757 AC_TRY_CPP([#include <sys/mount.h>
758 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
759 fi
760 AC_MSG_RESULT($fstype)
761
762 dnl# --------------------------------------------------------------------------
763 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
764 dnl# --------------------------------------------------------------------------
765 AC_TYPE_SIGNAL
766 SIGNAL_CHECK
767 AC_TYPE_MODE_T
768 AC_TYPE_UID_T
769 AC_TYPE_SIZE_T
770 AC_TYPE_PID_T
771 AC_TYPE_OFF_T
772 AC_CHECK_TYPE(ino_t, unsigned long)
773 AC_CHECK_TYPE(dev_t, unsigned long)
774 AC_CHECK_TYPE(daddr_t, long)
775 AC_CHECK_TYPE(major_t, int)
776 AC_CHECK_TYPE(minor_t, int)
777 AC_CHECK_TYPE(ssize_t, int)
778 AC_STRUCT_ST_BLOCKS
779 AC_STRUCT_ST_RDEV
780 AC_STRUCT_TM
781 AC_C_CONST
782
783
784 AC_CHECK_SIZEOF(char, 1)
785 AC_CHECK_SIZEOF(short int, 2)
786 AC_CHECK_SIZEOF(int, 4)
787 AC_CHECK_SIZEOF(long int, 4)
788 AC_CHECK_SIZEOF(long long int, 8)
789 AC_CHECK_SIZEOF(int *, 4)
790
791 # Check for sys/types.h types
792 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
793     AC_TRY_COMPILE(
794         [ #include <sys/types.h> ], 
795         [ u_int a; a = 1;], 
796         [ ac_cv_have_u_int="yes" ],
797         [ ac_cv_have_u_int="no" ]
798     )
799 ])
800 if test "x$ac_cv_have_u_int" = "xyes" ; then
801    AC_DEFINE(HAVE_U_INT)
802    have_u_int=1
803 fi
804
805 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
806    AC_TRY_COMPILE(
807       [ #include <sys/types.h> ], 
808       [ intmax_t a; a = 1;], 
809       [ ac_cv_have_intmax_t="yes" ],
810       [ 
811          AC_TRY_COMPILE(
812             [ #include <stdint.h> ], 
813             [ intmax_t a; a = 1;], 
814             [ ac_cv_have_intmax_t="yes" ],
815             [ ac_cv_have_intmax_t="no" ]
816          )
817       ]
818    )        
819
820 ])
821 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
822    AC_DEFINE(HAVE_INTMAX_T)
823    have_intmax_t=1
824 fi
825
826
827 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
828    AC_TRY_COMPILE(
829       [ #include <sys/types.h> ], 
830       [ u_intmax_t a; a = 1;], 
831       [ ac_cv_have_u_intmax_t="yes" ],
832       [ 
833          AC_TRY_COMPILE(
834             [ #include <stdint.h> ], 
835             [ u_intmax_t a; a = 1;], 
836             [ ac_cv_have_u_intmax_t="yes" ],
837             [ ac_cv_have_u_intmax_t="no" ]
838          )
839       ]
840    )
841 ])
842 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
843    AC_DEFINE(HAVE_U_INTMAX_T)
844    have_u_intmax_t=1
845 fi
846
847
848 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
849    AC_TRY_COMPILE(
850       [ #include <sys/types.h> ], 
851       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
852       [ ac_cv_have_intxx_t="yes" ],
853       [ ac_cv_have_intxx_t="no" ]
854    )
855 ])
856 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
857    AC_DEFINE(HAVE_INTXX_T)
858    have_intxx_t=1
859 fi
860         
861 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
862    AC_TRY_COMPILE(
863       [ #include <sys/types.h> ], 
864       [ int64_t a; a = 1;], 
865       [ ac_cv_have_int64_t="yes" ],
866       [ ac_cv_have_int64_t="no" ]
867    )
868 ])
869 if test "x$ac_cv_have_int64_t" = "xyes" ; then
870    AC_DEFINE(HAVE_INT64_T)
871    have_int64_t=1
872 fi
873         
874 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
875    AC_TRY_COMPILE(
876       [ #include <sys/types.h> ], 
877       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
878       [ ac_cv_have_u_intxx_t="yes" ],
879       [ ac_cv_have_u_intxx_t="no" ]
880    )
881 ])
882 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
883    AC_DEFINE(HAVE_U_INTXX_T)
884    have_u_intxx_t=1
885 fi
886
887 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
888    AC_TRY_COMPILE(
889       [ #include <sys/types.h> ], 
890       [ u_int64_t a; a = 1;], 
891       [ ac_cv_have_u_int64_t="yes" ],
892       [ ac_cv_have_u_int64_t="no" ]
893    )
894 ])
895 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
896    AC_DEFINE(HAVE_U_INT64_T)
897    have_u_int64_t=1
898 fi
899
900 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
901            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
902 then
903    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
904    AC_TRY_COMPILE(
905       [ #include <sys/bitypes.h>  ], 
906       [ int8_t a; int16_t b; int32_t c;
907         u_int8_t e; u_int16_t f; u_int32_t g;
908         a = b = c = e = f = g = 1;  ], 
909       [ AC_DEFINE(HAVE_U_INTXX_T)
910         AC_DEFINE(HAVE_INTXX_T)
911         AC_DEFINE(HAVE_SYS_BITYPES_H)
912         AC_MSG_RESULT(yes) ],
913       [ AC_MSG_RESULT(no)]
914    ) 
915 fi
916
917 if test -z "$have_u_intxx_t" ; then
918    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
919       AC_TRY_COMPILE(
920          [ #include <sys/types.h> ], 
921          [ uint8_t a; uint16_t b; 
922            uint32_t c; a = b = c = 1; ], 
923          [ ac_cv_have_uintxx_t="yes" ],
924          [ ac_cv_have_uintxx_t="no" ]
925       )
926    ])
927    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
928       AC_DEFINE(HAVE_UINTXX_T)
929    fi
930 fi
931
932
933 dnl# --------------------------------------------------------------------------
934 dnl# CHECKING FOR LIBRARY FUNCTIONS
935 dnl# --------------------------------------------------------------------------
936 AC_CHECK_FUNCS( \
937         fork \
938         getcwd \
939         gethostname \
940         getpid \
941         setpgid \
942         setpgrp \
943         setsid \
944         signal \
945         strerror \
946         strncmp \
947         strncpy \
948         vfprintf \
949         ,,
950         [echo 'configure: cannot find needed function.'; exit 1]
951 )
952
953 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
954
955 AC_CHECK_FUNCS(snprintf vsnprintf gethostid getdomainname)
956
957 dnl# --------------------------------------------------------------------------
958 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
959 dnl# --------------------------------------------------------------------------
960 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
961
962 # If resolver functions are not in libc check for -lnsl or -lresolv.
963 AC_CHECK_FUNC(gethostbyname_r,
964     AC_MSG_RESULT(using libc's resolver),
965     AC_CHECK_LIB(nsl,gethostbyname_r)
966     AC_CHECK_LIB(resolv,gethostbyname_r))
967
968
969 # Find where sockets are (especially for Solaris)
970 AC_CHECK_FUNC(socket,
971     AC_MSG_RESULT(using libc's socket),
972     AC_CHECK_LIB(xnet,socket)
973     AC_CHECK_LIB(socket,socket)
974     AC_CHECK_LIB(inet,socket))
975
976 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
977
978 AC_FUNC_STRFTIME
979 AC_FUNC_VPRINTF
980 AC_FUNC_ALLOCA
981 AC_FUNC_GETMNTENT
982 AC_FUNC_CLOSEDIR_VOID
983 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
984 AC_FUNC_FNMATCH
985
986
987 dnl# FreeBSD needs to link libxpg4
988 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
989
990
991 AC_CHECK_LIB(sun, getpwnam)
992
993 AC_CHECK_HEADERS(zlib.h)
994 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
995 have_zlib=no
996 if test x$FDLIBS = x-lz; then
997   AC_DEFINE(HAVE_LIBZ)
998   have_zlib=yes
999 fi
1000
1001 dnl Check for pthread libraries
1002 PTHREAD_LIB=""
1003 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1004         [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1005             [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1006                 [AC_CHECK_FUNC(pthread_create)]
1007             )]
1008         )]
1009 )
1010
1011 AC_SUBST(FDLIBS)
1012 AC_DEFINE(FDLIBS)
1013
1014
1015 CFLAGS=${CFLAGS--O}
1016 LDFLAGS=${LDFLAGS--O}
1017 DB_LIBS="${SQL_LFLAGS}"
1018
1019 CPPFLAGS="$CPPFLAGS"
1020 AC_SUBST(DEBUG)
1021 AC_SUBST(DINCLUDE)
1022 AC_SUBST(CFLAGS)
1023 AC_SUBST(CPPFLAGS)
1024 AC_SUBST(LDFLAGS)
1025 AC_SUBST(X_CFLAGS)
1026 AC_SUBST(LIBS)
1027 AC_SUBST(DLIB)
1028 AC_SUBST(DB_LIBS)
1029 AC_SUBST(X_LIBS)
1030 AC_SUBST(X_EXTRA_LIBS)
1031
1032 dnl# extra configurable objects
1033 OBJLIST=
1034 AC_SUBST(OBJLIST)
1035
1036 lld="lld"
1037 llu="llu"
1038
1039 #
1040 # Finally we set appropriate distribution specific
1041 #  variables and defaults
1042 #
1043 # PFILES are platform specific files
1044 PFILES="platforms/Makefile"
1045 PSCMD="ps -e"
1046 WIN32=
1047 hostname=`hostname`
1048 case "$DISTNAME" in
1049 alpha)
1050         DISTVER=`uname -r`
1051         PTHREAD_LIB="-lpthread -lexc"
1052         if test "${CC}" = "gcc" ; then
1053            lld="lld"
1054            llu="llu"
1055         else
1056            lld="ld"
1057            llu="lu"
1058         fi
1059         TAPEDRIVE="/dev/nrmt0"
1060   ;;
1061 bsdi)
1062         DISTVER=`uname -a |awk '{print $3}'`
1063         TAPEDRIVE="/dev/nrst0"
1064   ;;
1065 caldera)
1066         DISTVER=`cat /etc/.issue | grep Version | cut -f 2 -d ' '`
1067         TAPEDRIVE="/dev/nrst0"
1068         PSCMD="ps -e -o pid,command"
1069         hostname=`hostname -s`
1070   ;;
1071 cygwin)
1072         DISTVER=`uname -a |awk '{print $3}'`
1073         TAPEDRIVE="/dev/nrst0"
1074         WIN32=win32
1075         CFLAGS="${CFLAGS} -mwindows"
1076         LDFLAGS="${LDFLAGS} -mwindows"
1077   ;;
1078 debian)
1079         DISTVER=`cat /etc/debian_version`
1080         TAPEDRIVE="/dev/nrst0"
1081         PSCMD="ps -e -o pid,command"
1082         hostname=`hostname -s`
1083   ;;
1084 freebsd)
1085         DISTVER=`uname -a |awk '{print $3}'`
1086         PTHREAD_LIB="-pthread"
1087         CFLAGS="${CFLAGS} -pthread"
1088         lld="qd"
1089         llu="qu"
1090         TAPEDRIVE="/dev/nrst0"
1091         PSCMD="ps -x -o pid,command"
1092         PFILES="${PFILES} \
1093             platforms/freebsd/Makefile \
1094             platforms/freebsd/bacula-fd \
1095             platforms/freebsd/bacula-sd \
1096             platforms/freebsd/bacula-dir"
1097         hostname=`hostname -s`
1098         largefile_support="yes"
1099   ;;
1100 hpux)
1101         DISTVER=`uname -r`
1102         TAPEDRIVE="/dev/rmt/0hnb"
1103   ;;
1104 irix)
1105         DISTVER=`uname -r`
1106         TAPEDRIVE="/dev/rmt/0cbn"
1107         PSCMD="ps -e -o pid,comm"
1108         hostname=`/usr/bsd/hostname -s`
1109         PFILES="${PFILES} \
1110             platforms/irix/Makefile \
1111             platforms/irix/bacula-fd \
1112             platforms/irix/bacula-sd \
1113             platforms/irix/bacula-dir"
1114   ;;
1115 netbsd)
1116         DISTVER=`uname -a |awk '{print $3}'`
1117         lld="qd"
1118         llu="qu"
1119         TAPEDRIVE="/dev/nrst0"
1120         PSCMD="ps -a -o pid,command"
1121   ;;
1122 openbsd)
1123         DISTVER=`uname -a |awk '{print $3}'`
1124         lld="qd"
1125         llu="qu"
1126         TAPEDRIVE="/dev/nrst0"
1127         PSCMD="ps -a -o pid,command"
1128   ;;
1129 redhat)
1130         DISTVER=`cat /etc/redhat-release | grep release |\
1131                                 cut -f 5 -d ' '`
1132         TAPEDRIVE="/dev/nst0"
1133         PSCMD="ps -e -o pid,command"
1134         PFILES="${PFILES} \
1135             platforms/redhat/Makefile \
1136             platforms/redhat/bacula-fd \
1137             platforms/redhat/bacula-sd \
1138             platforms/redhat/bacula-dir"
1139         hostname=`hostname -s`
1140   ;;
1141 slackware)
1142         DISTVER=`cat /etc/slackware-version`
1143         TAPEDRIVE="/dev/nst0"
1144         PSCMD="ps -e -o pid,command"
1145         hostname=`hostname -s`
1146   ;;
1147 solaris)
1148         DISTVER=Solaris
1149         TAPEDRIVE="/dev/rmt/0cbn"
1150         PSCMD="ps -e -o pid,comm"
1151         PFILES="${PFILES} \
1152             platforms/solaris/Makefile \
1153             platforms/solaris/bacula-fd \
1154             platforms/solaris/bacula-sd \
1155             platforms/solaris/bacula-dir"
1156   ;;
1157 suse)
1158         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1159                                 cut -f 3 -d ' '`
1160         TAPEDRIVE="/dev/nst0"
1161         PSCMD="ps -e -o pid,command"
1162         hostname=`hostname -s`
1163   ;;
1164 suse5)
1165         DISTNAME=suse
1166         DISTVER=5.x
1167         TAPEDRIVE="/dev/nst0"
1168         PSCMD="ps -e -o pid,command"
1169         hostname=`hostname -s`
1170   ;;
1171 unknown)
1172         DISTVER=unknown
1173         TAPEDRIVE="/dev/nst0"
1174   ;;
1175 *)
1176   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1177   ;;
1178 esac  
1179
1180 AC_SUBST(hostname)
1181
1182
1183 LIBS="$PTHREAD_LIB $LIBS"
1184
1185 AC_DEFINE_UNQUOTED(lld, "$lld")
1186 AC_DEFINE_UNQUOTED(llu, "$llu")
1187 AC_SUBST(TAPEDRIVE)
1188 AC_SUBST(PSCMD)
1189 AC_SUBST(WIN32)
1190 AC_SUBST(DISTNAME)
1191 AC_SUBST(DISTVER)
1192
1193
1194 dnl# common parts of the Makefile
1195 MCOMMON=./autoconf/Make.common
1196 AC_SUBST_FILE(MCOMMON)
1197
1198 AC_OUTPUT([autoconf/Make.common \
1199            Makefile \
1200            startmysql \
1201            stopmysql \
1202            btraceback \
1203            startit \
1204            stopit \
1205            console \
1206            gconsole \
1207            bacula \
1208            fd \
1209            doc/Makefile \
1210            src/Makefile \
1211            src/console/Makefile \
1212            src/console/console.conf \
1213            src/gnome-console/Makefile \
1214            src/gnome-console/gnome-console.conf \
1215            src/dird/Makefile \
1216            src/dird/bacula-dir.conf \
1217            src/lib/Makefile \
1218            src/stored/Makefile \
1219            src/stored/bacula-sd.conf \
1220            src/filed/Makefile \
1221            src/filed/bacula-fd.conf \
1222            src/filed/win32/Makefile \
1223            src/cats/Makefile \
1224            src/cats/alter_mysql_tables \
1225            src/cats/make_mysql_tables \
1226            src/cats/drop_mysql_tables \
1227            src/cats/create_mysql_database \
1228            src/cats/grant_mysql_privileges \
1229            src/cats/alter_sqlite_tables \
1230            src/cats/make_sqlite_tables \
1231            src/cats/drop_sqlite_tables \
1232            src/cats/create_sqlite_database \
1233            src/cats/sqlite \
1234            src/cats/mysql \
1235            src/cats/create_bdb_database \
1236            src/cats/make_bdb_tables \
1237            src/cats/drop_bdb_tables \
1238            src/cats/make_bacula_tables \
1239            src/cats/drop_bacula_tables \
1240            src/findlib/Makefile \
1241            src/tools/Makefile \
1242            $PFILES ],  
1243           [(echo "Doing make of dependencies"; make depend;) ]
1244 )
1245
1246 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
1247 chmod 755 console gconsole
1248 cp -f startit stopit btraceback btraceback.gdb src/console
1249 cp -f startit stopit btraceback btraceback.gdb src/dird
1250 cp -f startit stopit btraceback btraceback.gdb src/filed
1251 cp -f startit stopit btraceback btraceback.gdb src/lib
1252 cp -f startit stopit btraceback btraceback.gdb src/stored
1253 chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables
1254 chmod 755 src/cats/make_test_tables src/cats/drop_test_tables
1255 chmod 755 src/cats/create_mysql_database 
1256 chmod 755 src/cats/alter_mysql_tables
1257 chmod 755 src/cats/grant_mysql_privileges
1258 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
1259 chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
1260 chmod 755 src/cats/create_sqlite_database
1261 chmod 755 src/cats/alter_sqlite_tables
1262 chmod 755 src/cats/sqlite
1263 chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables 
1264 chmod 755 src/cats/create_bdb_database
1265
1266 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
1267    largefile_support="yes"
1268 fi
1269
1270
1271 echo "
1272 Configuration on `date`:
1273
1274   Host:                       ${DISTNAME} ${DISTVER}
1275   Bacula version:             ${VERSION} (${DATE})
1276   Source code location:       ${srcdir}
1277   Install binaries:           ${sbindir}
1278   Install config files:       ${sysconfdir}
1279   C Compiler:                 ${CC}
1280   C++ Compiler:               ${CXX}
1281   Compiler flags:             ${CFLAGS} 
1282   Linker flags:               ${LDFLAGS}
1283   Libraries:                  ${LIBS}
1284   Statically Linked Tools:    ${support_static_tools}
1285   Database found:             ${have_db}
1286   Database type:              ${db_name}
1287   Database lib:               ${DB_LIBS}
1288
1289   Job Output Email:           ${job_email}
1290   Traceback Email:            ${dump_email}
1291   SMTP Host Address:          ${smtp_host}
1292   Director Port               ${dir_port}
1293   File daemon Port            ${fd_port}
1294   Storage daemon Port         ${sd_port}
1295   Working directory           ${working_dir}
1296   SQL binaries Directory      ${SQL_BINDIR}
1297
1298   Large file support:         $largefile_support
1299   readline support:           ${got_readline} ${PRTREADLINE_SRC}
1300   cweb support:               ${got_cweb} ${CWEB_SRC}
1301   TCP Wrappers support:       ${TCPW_MSG}
1302   ZLIB support:               ${have_zlib}
1303   enable-smartalloc:          ${support_smartalloc} 
1304   enable-gnome:               ${support_gnome}
1305   gmp support:                ${got_gmp} ${GMP_SRC}
1306
1307   " > config.out
1308
1309 cat config.out