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