From: Kern Sibbald Date: Tue, 23 Apr 2002 19:48:51 +0000 (+0000) Subject: Initial revision X-Git-Tag: Release-1.19a~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1ef84681d13d0c355d6ae78579d2afe1c8d8d0e2;p=bacula%2Fbacula Initial revision git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/ABOUT-NLS b/bacula/ABOUT-NLS new file mode 100644 index 0000000000..28d38c76fd --- /dev/null +++ b/bacula/ABOUT-NLS @@ -0,0 +1,226 @@ +Notes on the Free Translation Project +************************************* + + Free software is going international! The Free Translation Project +is a way to get maintainers of free software, translators, and users all +together, so that will gradually become able to speak many languages. +A few packages already provide translations for their messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do *not* +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work at translations should contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +One advise in advance +===================== + + If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias or message inheritance) as the +implementation here. It is also not possible to offer this additional +functionality on top of a `catgets' implementation. Future versions of +GNU `gettext' will very likely convey even more functionality. So it +might be a good idea to change to GNU `gettext' as soon as possible. + + So you need not provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +INSTALL Matters +=============== + + Some packages are "localizable" when properly installed; the +programs they contain can be made to speak your own native language. +Most such packages use GNU `gettext'. Other packages have their own +ways to internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system provides +usable `catgets' (if using this is selected by the installer) or +`gettext' functions. If neither is available, the GNU `gettext' own +library will be used. This library is wholly contained within this +package, usually in the `intl/' subdirectory, so prior installation of +the GNU `gettext' package is *not* required. Installers may use +special options at configuration time for changing the default +behaviour. The commands: + + ./configure --with-included-gettext + ./configure --with-catgets + ./configure --disable-nls + +will respectively bypass any pre-existing `catgets' or `gettext' to use +the internationalizing routines provided within this package, enable +the use of the `catgets' functions (if found on the locale system), or +else, *totally* disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might be not what is desirable. You +should use the more recent version of the GNU `gettext' library. I.e. +if the file `intl/VERSION' shows that the library which comes with this +package is more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + By default the configuration process will not test for the `catgets' +function and therefore they will not be used. The reasons are already +given above: the emulation on top of `catgets' cannot provide all the +extensions provided by the GNU `gettext' library. If you nevertheless +want to use the `catgets' functions use + + ./configure --with-catgets + +to enable the test for `catgets' (this causes no harm if `catgets' is +not available on your system). If you really select this option we +would like to hear about the reasons because we cannot think of any +good one ourself. + + Internationalized packages have usually many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +Using This Package +================== + + As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +ISO 639 `LL' two-letter code prior to using the programs in the +package. For example, let's suppose that you speak German. At the +shell prompt, merely execute `setenv LANG de' (in `csh'), +`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This +can be done from your `.login' or `.profile' file, once and for all. + + An operating system might already offer message localization for +many of its programs, while other programs have been installed locally +with the full capabilities of GNU `gettext'. Just using `gettext' +extended syntax for `LANG' would break proper localization of already +available operating system programs. In this case, users should set +both `LANGUAGE' and `LANG' variables in their environment, as programs +using GNU `gettext' give preference to `LANGUAGE'. For example, some +Swedish users would rather read translations in German than English for +when Swedish is not available. This is easily accomplished by setting +`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'. + +Translating Teams +================= + + For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list, courtesy of Linux +International. You may reach your translation team at the address +`LL@li.org', replacing LL by the two-letter ISO 639 code for your +language. Language codes are *not* the same as the country codes given +in ISO 3166. The following translation teams exist, as of December +1997: + + Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en', + Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian + `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja', + Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish + `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es', + Swedish `sv', and Turkish `tr'. + +For example, you may reach the Chinese translation team by writing to +`zh@li.org'. + + If you'd like to volunteer to *work* at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is *not* the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +*actively* in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +Available Packages +================== + + Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of December +1997. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination. + + Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv + .----------------------------------------------------. + bash | [] [] [] | 3 + bison | [] [] [] | 3 + clisp | [] [] [] [] | 4 + cpio | [] [] [] [] [] [] | 6 + diffutils | [] [] [] [] [] | 5 + enscript | [] [] [] [] [] [] | 6 + fileutils | [] [] [] [] [] [] [] [] [] [] | 10 + findutils | [] [] [] [] [] [] [] [] [] | 9 + flex | [] [] [] [] | 4 + gcal | [] [] [] [] [] | 5 + gettext | [] [] [] [] [] [] [] [] [] [] [] | 12 + grep | [] [] [] [] [] [] [] [] [] [] | 10 + hello | [] [] [] [] [] [] [] [] [] [] [] | 11 + id-utils | [] [] [] | 3 + indent | [] [] [] [] [] | 5 + libc | [] [] [] [] [] [] [] | 7 + m4 | [] [] [] [] [] [] | 6 + make | [] [] [] [] [] [] | 6 + music | [] [] | 2 + ptx | [] [] [] [] [] [] [] [] | 8 + recode | [] [] [] [] [] [] [] [] [] | 9 + sh-utils | [] [] [] [] [] [] [] [] | 8 + sharutils | [] [] [] [] [] [] | 6 + tar | [] [] [] [] [] [] [] [] [] [] [] | 11 + texinfo | [] [] [] | 3 + textutils | [] [] [] [] [] [] [] [] [] | 9 + wdiff | [] [] [] [] [] [] [] [] | 8 + `----------------------------------------------------' + 17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv + 27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If December 1997 seems to be old, you may fetch a more recent copy +of this `ABOUT-NLS' file on most GNU archive sites. + diff --git a/bacula/COPYING b/bacula/COPYING new file mode 100644 index 0000000000..5087530b0f --- /dev/null +++ b/bacula/COPYING @@ -0,0 +1,17 @@ +/* + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ diff --git a/bacula/ChangeLog b/bacula/ChangeLog new file mode 100644 index 0000000000..09d01728ac --- /dev/null +++ b/bacula/ChangeLog @@ -0,0 +1,164 @@ + +2002-04-22 Release 1.18 +- Applied Phil's configure.in fix for --prefix, ... +- Fixed bug found by Phil (patch supplied) in updating + MD5 signatures (revert to 32 bit FileId, move "static" + variables into JCR) (catreq.c fd-cmds.c). +- Reverted to using INTEGER for FileId in make_sql_tables + due to a bug in MySQL. +- Change editing code to %d for FileId. +- Remove sqlite in make distclean in cats directory. +- Remove console.conf in console during make distclean +- Remove gnome-console.conf during make distclean +- Remove bacula-dir.conf during make distclean +- Set default level when using Console if none specified. + Bug reported by Phil. +- A simple . command from Console is ignored. +- Change program named from filed to bacual-fd in winmain.cpp +- Change default config file for Win32 in winmain.cpp +- Free namebuf on early return from find_one.c. Bug reported by + Phil. +- Modify testfind.c to dump orphaned buffers. +- Removed terabytes from parse_conf.c because of problems with + older gcc compilers. +- Turn off gnome options in gnome-console by constructing empty + argv. + +2002-04-18 Release 1.17 Kern Sibbald +- Ensure that platforms Makefiles are called for clean + and distclean. +- Hide a lot of Makefile messages with @ +- Applied Phil's configure.in patch. Thanks. +- Doc updates, many to clarify points brought up by Phil. +- Applied Phil's make_mysql_tables.in patch. Thanks. +- Made authenticate.c in dird test bnet_send status. +- Make label a bit more friendly with extra info message. +- Add level 200 to debug info in run command. +- Remove old code from findlib/testfind.c so that it compiles. +- Add two minute max wait to cram-md5 authentication. Hopefully, + this will catch non-responding WinNT daemons. +- Allow time and size modifiers to be upper or lower case. +- Turn off old CYGWIN patch for pthread_cond_timedwait() bug that + now causes File daemon hangs on WinNT. +- Fix mount messages for restore. Previous updates to save + broke the restore code. +- By default write fixed block sizes rather than variable block + sizes. My Sony DAT simply does not work (reread failures) with + variable block sizes. +- Data split across tapes was not being correctly restored + (at least on DAT tapes). +- Implement MaximumBlockSize and MinumBlockSize statements in + Storage daemon so user can specify variable block sizes if + desired. +- Return error if block checksum error on read (previously + ignored). +- Fixed some error messages in bls, and in some cases exit(1) + rather than ABORT. There remain ABORTs to be examined. +- Made a local copy of tcpd.h and corrected the function + prototype problem for C++. + +2002-04-14 First public release 1.16 Kern Sibbald + - Many intervening changes/updates. + +2001-09-29 Release 1.0 Kern Sibbald + - Fixes to problems found at John's + installation. + - See techlogs/kes25Sep01 for details + +2001-09-25 Release 1.0 Kern Sibbald + - Helped John install at his site. + He is backing up one Linux machine and + one Win2000 machine. + +2001-mm-dd Many releases + - Released internally. + +2000-04-09 Release 0.4 Kern Sibbald + - Added a lot of Director configuration code. In + part (a small part), the Director now uses the + bacula.conf file to know what to do. There still + remains a lot to do. + - The file search code is now integrated into the + MySQL database routines, and Bacula is now hooked + into the MySQL database (if so configured). Thus + all the database records are being created, though + there still remains some work in getting all the + details into the records (such as the Storage + coordinates). + - I've defined how Volume pools work (see manual). + - I've defined error message handling though no code + is yet written. + - The following resources and records are implemented + in the Director configuration file (bacula.conf): + + Director + Name (passed to Storage daemon) + Client + Name, Address, Port + Password (not yet used) + Storage + Name, Address, Port, Password, MediaType + Job + Name + Type (not yet used) + Backup (only one permitted) + Client, FileSet + Storage + Schedule, Messages, Pool (not used) + FileSet + Name + Include (options ignored) + Exclude (no options) + Schedule (not used) + Name + Messages (not used) + Name + Debug, syslog, mail, append (not used) + Catalog + Name + Address, Port, Password (not used) + Pool (not used) + Name + PoolType, MediaType (not used) + + - Added Storage configuration routines. + Director + Name, password (verified against those sent by Director) + Storage + Name, Address, Port (address, port must correspond to Director's values) + Password, MediaType + Device + Name, MediaType (must correspond to those sent by Director) + Archive Device (defines device name) + + + +2000-03-10 Release 0.3 Kern Sibbald + - Implemented new base64 encoding for attributes. + This eliminates some of the error messages in the + sprintfs on the Solaris due to different stat() sizes. + - Implemented the first cut of the file search routines for + the File daemon. The exclusion lists work including wild + cards. There is a lot of work to be done, but the basic + structure is now in place (wild cards do not yet work for + the include). + - Completed writing the memory pool code. Now I must + implement it in the daemons. + - Modified the bacula start/stop script so that it has a + better chance of working on SGI and Solaris. + - The catalog code has not been converted to the new file + search code. + +2000-03-06 Release 0.2 Kern Sibbald + - Integrated John's fixes. + - Made Makefiles self configuring when Makefile.in is changed. + - Added a runit script in the top level that runs bacula + - Added a "bacula" script in the top level directory that + starts and stops the File daemon and the Storage daemon. + +2000-03-03 Release 0.1 Kern Sibbald + - Basic Director, File, and Storage daemons. + Standalone Catalog services using MySQL + +2000-01-22 Kern Sibbald + * Setup basic file structure with ./configure diff --git a/bacula/INSTALL b/bacula/INSTALL new file mode 100644 index 0000000000..2998b61ecb --- /dev/null +++ b/bacula/INSTALL @@ -0,0 +1,35 @@ +-------------------------------------------------------------------------- +Using GNU autoconfig +-------------------------------------------------------------------------- + 1. Read the Compiling and Installing section of the HTML manual + in the "doc" directory. + + 2. Run ./configure to generate config.h and the various Makefiles. + ./configure --help gives a list of possible options with slightly + longer descriptions in README.configure + + You might look at the "defaultconfig" file in the top directory. + It is an example of what is probably reasonable for defaults. + + Some systems require unusual options for compilation or linking that + the `configure' script does not know about. You can give `configure' + initial values for variables by setting them in the environment. Using + a Bourne-compatible shell, you can do that on the command line like + this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + Or if you're using a non Bourne-compatible shell, you can do: + sh -c 'CFLAGS="-O2 -g" ./configure + + A typical Bacula development configuration for Linux is: + + CFLAGS="-g -Wall" ./configure --enable-smartalloc --enable-mysql + + + 3. set any other main preferences (normally, you don't do this): + Edit "config.h" if you didn't use ./configure options + If you're cross-compiling, edit the following in "config.h" + + 4. Build it (repeat step 2 as desired): + make diff --git a/bacula/Makefile.in b/bacula/Makefile.in new file mode 100755 index 0000000000..2796af378c --- /dev/null +++ b/bacula/Makefile.in @@ -0,0 +1,172 @@ +# +# +@MCOMMON@ + +working_dir=@working_dir@ + +srcdir = @srcdir@ +VPATH = @srcdir@ +.PATH: @srcdir@ +topdir = . +thisdir = . + + +first_rule: all +dummy: + +subdirs = src doc src/lib src/findlib src/cats \ + @READLINE_SRC@ src/console src/dird src/filed \ + src/stored @GNOME_DIR@ + +FDsubdirs = src/lib src/findlib src/filed + +DIST = INSTALL README.configure configure Makefile Makefile.in ChangeLog + +DIST_CFG = autoconf/aclocal.m4 autoconf/configure.in \ + autoconf/config.h.in autoconf/acconfig.h autoconf/Make.common.in \ + autoconf/install-sh autoconf/mkinstalldirs + +MKDIR = $(srcdir)/autoconf/mkinstalldirs + +#------------------------------------------------------------------------- + +all: Makefile + @for I in ${subdirs}; \ + do (cd $$I; echo "==>Entering directory `pwd`"; $(MAKE) $@ || exit 1); done + +depend: + @for I in ${subdirs}; \ + do (cd $$I; echo "==>Entering directory `pwd`"; $(MAKE) $@ || exit 1); done + +bacula-fd: Makefile + @for I in ${FDsubdirs}; \ + do (cd $$I; echo "==>Entering directory `pwd`"; $(MAKE) all || exit 1); done + +#------------------------------------------------------------------------- +configure: autoconf/configure.in autoconf/aclocal.m4 autoconf/acconfig.h autoconf/config.h.in + cd $(srcdir); + autoconf --localdir=$(srcdir)/autoconf \ + autoconf/configure.in > configure + chmod 755 configure + +config.status: + if test -x config.status; then config.status --recheck; \ + else $(SHELL) configure; fi + +autoconf/config.h.in: autoconf/configure.in autoconf/acconfig.h + cd $(srcdir); + autoheader --localdir=$(srcdir)/autoconf \ + autoconf/configure.in > autoconf/config.h.in + chmod 644 autoconf/config.h.in + +installdirs: + $(MKDIR) $(DESTDIR)$(sbindir) + $(MKDIR) $(DESTDIR)$(sysconfdir) + $(MKDIR) $(DESTDIR)$(working_dir) +# $(MKDIR) $(DESTDIR)$(mandir) + +install: installdirs + $(INSTALL_SCRIPT) startmysql $(DESTDIR)$(sysconfdir)/startmysql + $(INSTALL_SCRIPT) stopmysql $(DESTDIR)$(sysconfdir)/stopmysql + $(INSTALL_SCRIPT) console $(DESTDIR)$(sysconfdir)/console + $(INSTALL_SCRIPT) bacula $(DESTDIR)$(sysconfdir)/bacula + $(INSTALL_SCRIPT) fd $(DESTDIR)$(sysconfdir)/fd + $(INSTALL_SCRIPT) btraceback $(DESTDIR)$(sysconfdir)/btraceback + $(INSTALL_DATA) btraceback.gdb $(DESTDIR)$(sysconfdir)/btraceback.gdb + @for I in $(subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done + +uninstall: + (cd $(DESTDIR)$(sysconfdir); $(RMF) startmysql) + (cd $(DESTDIR)$(sysconfdir); $(RMF) stopmysql) + (cd $(DESTDIR)$(sysconfdir); $(RMF) console) + (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula) + (cd $(DESTDIR)$(sysconfdir); $(RMF) fd) + @for I in $(subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done + +install-autostart: install-autostart-dir install-autostart-fd install-autostart-sd + +install-autostart-dir: + (cd platforms; $(MAKE) $@ || exit 1) + +install-autostart-fd: + (cd platforms; $(MAKE) $@ || exit 1) + +install-autostart-sd: + (cd platforms; $(MAKE) $@ || exit 1) + +uninstall-autostart: uninstall-autostart-dir uninstall-autostart-fd uninstall-autrun-sd + +uninstall-autostart-dir: + (cd platforms; $(MAKE) $@ || exit 1) + +uninstall-autostart-fd: + (cd platforms; $(MAKE) $@ || exit 1) + +uninstall-autostart-sd: + (cd platforms; $(MAKE) $@ || exit 1) + +Makefile: Makefile.in + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +Makefiles: + $(SHELL) config.status + chmod 755 startmysql stopmysql bacula fd startit stopit btraceback + chmod 755 src/console/btraceback src/lib/btraceback + chmod 755 src/dird/btraceback src/filed/btraceback + chmod 755 src/stored/btraceback + chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables + chmod 755 src/cats/make_test_tables src/cats/drop_test_tables + chmod 755 src/cats/create_mysql_database + chmod 755 src/cats/grant_mysql_privileges + chmod 755 src/cats/make_sqlite_tables + +clean: + @for I in ${subdirs}; \ + do (cd $$I; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1); done + @(cd platforms; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1) + @$(RMF) *~ 1 2 3 core core.* + +# distclean goal is for making a clean source tree, but if you have run +# configure from a different directory, then doesn't destroy all your +# hardly compiled and linked stuff. That's why there is always $(srcdir)/ +# In that case most of those commands do nothing, except cleaning *~ +# and cleaning source links. +distclean: + @for I in $(subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done + @for I in $(subdirs); do (cd $$I; $(RMF) startit stopit btraceback btraceback.gdb); done + @(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status) + @(cd $(srcdir); $(RMF) Makefile autoconf/Make.common) + @(cd platforms; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1) + @$(RMF) bacula fd Makefile startmysql stopmysql startit stopit btraceback + @$(RMF) *~ 1 2 3 core core.* + @$(RMF) working/* + +distdirs: + mkdir ../$(VERNAME); + mkdir ../$(VERNAME)/autoconf; + @for I in $(subdirs); do (cd $$I; $(MAKE) $@ || (echo "Failed to make distclean in $$I"; exit 0) ); done + +distcopy: + $(CP) -p $(DIST) ../$(VERNAME); + $(CP) -p $(DIST_CFG) ../$(VERNAME)/autoconf; + @for I in $(subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done + +distrib: configure autoconf/config.h.in distdirs distcopy + +tar.gz: ../$(VERNAME).tar.gz +../$(VERNAME).tar.gz: + (cd ..; tar cvf - $(VERNAME) | gzip -f9 > $(VERNAME).tar.gz) + +tar.Z: ../$(VERNAME).tar.Z +../$(VERNAME).tar.Z: + (cd ..; tar cvf - $(VERNAME) | compress > $(VERNAME).tar.Z) + +tar.bz2: ../$(VERNAME).tar.bz2 +../$(VERNAME).tar.bz2: + (cd ..; tar cvf - $(VERNAME) | bzip2 -f9 > $(VERNAME).tar.bz2) + +uuencode: tar.gz + uuencode ../$(VERNAME).tar.gz $(VERNAME).tar.gz > ../$(VERNAME).tgz.uu + +# ------------------------------------------------------------------------ diff --git a/bacula/README b/bacula/README new file mode 100644 index 0000000000..db6f596a8d --- /dev/null +++ b/bacula/README @@ -0,0 +1,44 @@ + +This is the first release of Bacula, and as such it +is perhaps a bit rough around the edges. As you will +note, I don't follow the standard GNU release numbering +conventions, but rather one that I started in 1970. +My internal releases were 0.nn, the first release to +another user was 1.0, each modified source code release +then gets a new minor release (1.1, ...) as well as +a date. Each major change in the software -- e.g. new +tape format will have the major release number incremented. + +Your best bet for getting Bacula up and running +is to read the manual, which can be found in +/doc/html-manual, or in +/doc/bacula.pdf. + +Barring reading the manual, you might try the +following: + +CFLAGS="-g -Wall" \ + ./configure \ + --sbindir=$HOME/bacula/bin \ + --sysconfdir=$HOME/bacula/bin \ + --with-pid-dir=$HOME/bacula/bin \ + --with-subsys-dir=$HOME/bacula/bin \ + --enable-gnome \ + --with-mysql=$HOME/mysql \ + --with-working-dir=$HOME/bacula/bin/working \ + --with-dump-email=YOUR_EMAIL_ADDRESS \ + --with-job-email=YOUR_EMAIL_ADDRESS \ + --with-smtp-host=YOUR_SMTP_SERVER_ADDRESS \ + --with-baseport=9101 + + +Build Bacula + + make + + There should be no errors. The most likely source of + errors will probably come in the src/stored directory + in time.c or dev.c. There may also be problems in + lib/signal.c as I currently pull in all Linux signals, + some of which may not be available on your system. + diff --git a/bacula/autoconf/Make.common.in b/bacula/autoconf/Make.common.in new file mode 100644 index 0000000000..e2d86db61d --- /dev/null +++ b/bacula/autoconf/Make.common.in @@ -0,0 +1,72 @@ +# autoconf/Make.common.in -*- Makefile -*- +# release date (man), LSM date, version number/name, current maintainer +DATE="@DATE@" +LSMDATE=@LSMDATE@ +VERSION=@VERSION@ +VERNAME=bacula-$(VERSION)# +MAINT=Kern Sibbald# +MAINTEMAIL=# +WEBMAINT=# +WEBMAINTEMAIL=# +WEBPAGE=# +FTPSITENAME=# +FTPSITEDIR=# +#------------------------------------------------------------------------- + +SHELL = /bin/sh + +# This variable makes it possible to move the installation root to another +# directory. This is useful when you're creating a binary distribution +# If empty, normal root will be used. +# You can run eg. 'make install DESTDIR=/packages/rxvt-xx' to accomplish +# that. +# DESTDIR = /usr/local/X11/$(VERNAME) + +# Installation target directories & other installation stuff +prefix = @prefix@ +exec_prefix = @exec_prefix@ +binprefix = +manprefix = +sbindir = @sbindir@ +sysconfdir = @sysconfdir@ +mandir = @mandir@/man1 +manext = 1 + +# Tools & program stuff +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +MV = @MV@ +RM = @RM@ +RMF = @RM@ -f +CP = @CP@ +SED = @SED@ +AWK = @AWK@ +ECHO = @ECHO@ +CMP = @CMP@ +TBL = @TBL@ +AR = @AR@ +RANLIB = @RANLIB@ +INSTALL = @INSTALL@ +# add the -s to the following in PRODUCTION mode +INSTALL_PROGRAM = @INSTALL@ -m 755 +INSTALL_DATA = @INSTALL@ -m 644 +INSTALL_SCRIPT = @INSTALL@ -m 755 + +# Flags & libs +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +#DEFS = @DEFS@ +LIBS = @LIBS@ +DINCLUDE = @DINCLUDE@ +DLIB = @DLIB@ + +# X Include directory +#XINC = @X_CFLAGS@ @XPM_CFLAGS@ + +# extra libraries needed by X on some systems, X library location +#XLIB = @X_LIBS@ @XPM_LIBS@ -lX11 @X_EXTRA_LIBS@ + +# End of common section of the Makefile +#------------------------------------------------------------------------- diff --git a/bacula/autoconf/acconfig.h b/bacula/autoconf/acconfig.h new file mode 100644 index 0000000000..f442ee25ef --- /dev/null +++ b/bacula/autoconf/acconfig.h @@ -0,0 +1,190 @@ +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE SPECIFIED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +/* Define if you want to use MySQL as Catalog database */ +#undef USE_MYSQL_DB + +/* Define if you want SmartAlloc debug code enabled */ +#undef SMARTALLOC + +/* Define to `int' if doesn't define. */ +#undef daddr_t + +/* Define to `int' if doesn't define. */ +#undef major_t + +/* Define to `int' if doesn't define. */ +#undef minor_t + +/* Define to `int' if doesn't define. */ +#undef ssize_t + +/* Define if you want to use MySQL */ +#undef HAVE_MYSQL + +/* Define if you want to use SQLite */ +#undef HAVE_SQLITE + +/* Define if you want to use Berkeley DB */ +#undef HAVE_BERKELEY_DB + + +/* Define if you want to use PostgreSQL */ +#undef HAVE_PGSQL + +/* Define if you want to use mSQL */ +#undef HAVE_MSQL + +/* Define if you want to use iODBC */ +#undef HAVE_IODBC + +/* Define if you want to use unixODBC */ +#undef HAVE_UNIXODBC + +/* Define if you want to use Solid SQL Server */ +#undef HAVE_SOLID + +/* Define if you want to use OpenLink ODBC (Virtuoso) */ +#undef HAVE_VIRT + +/* Define if you want to use EasySoft ODBC */ +#undef HAVE_EASYSOFT + +/* Define if you want to use Interbase SQL Server */ +#undef HAVE_IBASE + +/* Define if you want to use Oracle 8 SQL Server */ +#undef HAVE_ORACLE8 + +/* Define if you want to use Oracle 7 SQL Server */ +#undef HAVE_ORACLE7 + + +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE DETECTED FEATURES -- */ +/* ------------------------------------------------------------------------- */ +@TOP@ + +/* Define if you need function prototypes */ +#undef PROTOTYPES + +/* Define if you have XPointer typedef */ +#undef HAVE_XPOINTER + +/* Define if you have _GNU_SOURCE getpt() */ +#undef HAVE_GETPT + +/* Define if you have GCC */ +#undef HAVE_GCC + +/* Define if you have the Andrew File System. */ +#undef AFS + +/* Define If you want find -nouser and -nogroup to make tables of + used UIDs and GIDs at startup instead of using getpwuid or + getgrgid when needed. Speeds up -nouser and -nogroup unless you + are running NIS or Hesiod, which make password and group calls + very expensive. */ +#undef CACHE_IDS + +/* Define to use SVR4 statvfs to get filesystem type. */ +#undef FSTYPE_STATVFS + +/* Define to use SVR3.2 statfs to get filesystem type. */ +#undef FSTYPE_USG_STATFS + +/* Define to use AIX3 statfs to get filesystem type. */ +#undef FSTYPE_AIX_STATFS + +/* Define to use 4.3BSD getmntent to get filesystem type. */ +#undef FSTYPE_MNTENT + +/* Define to use 4.4BSD and OSF1 statfs to get filesystem type. */ +#undef FSTYPE_STATFS + +/* Define to use Ultrix getmnt to get filesystem type. */ +#undef FSTYPE_GETMNT + +/* Define to `unsigned long' if doesn't define. */ +#undef dev_t + +/* Define to `unsigned long' if doesn't define. */ +#undef ino_t + +/* Define to 1 if utime.h exists and declares struct utimbuf. */ +#undef HAVE_UTIME_H + +#if (HAVE_MYSQL||HAVE_PGSQL||HAVE_MSQL||HAVE_IODBC||HAVE_UNIXODBC||HAVE_SOLID||HAVE_VIRT||HAVE_IBASE||HAVE_ORACLE8||HAVE_ORACLE7||HAVE_EASYSOFT) +#define HAVE_SQL +#endif + +/* Data types */ +#undef HAVE_U_INT +#undef HAVE_INTXX_T +#undef HAVE_U_INTXX_T +#undef HAVE_UINTXX_T +#undef HAVE_INT64_T +#undef HAVE_U_INT64_T +#undef HAVE_INTMAX_T +#undef HAVE_U_INTMAX_T + +/* Define if you want TCP Wrappers support */ +#undef HAVE_LIBWRAP + +/* Define if you have sys/bitypes.h */ +#undef HAVE_SYS_BITYPES_H + +/* Directory for PID files */ +#undef _PATH_BACULA_PIDDIR + +/* Define if you have zlib */ +#undef HAVE_LIBZ + +/* General libs */ +#undef LIBS + +/* File daemon specif libraries */ +#undef FDLIBS + +/* Path to Sendmail program */ +#undef SENDMAIL_PATH + +/* What kind of signals we have */ +#undef HAVE_POSIX_SIGNALS +#undef HAVE_BSD_SIGNALS +#undef HAVE_USG_SIGHOLD + +/* Operating systems */ +/* OSes */ +#undef HAVE_LINUX_OS +#undef HAVE_FREEBSD_OS +#undef HAVE_NETBSD_OS +#undef HAVE_OPENBSD_OS +#undef HAVE_BSDI_OS +#undef HAVE_HPUX_OS +#undef HAVE_SUN_OS +#undef HAVE_AIX_OS +#undef HAVE_SGI_OS +#undef HAVE_CYGWIN +#undef HAVE_OSF1_OS + +/* Set to correct scanf value for long long int */ +#undef lld +#undef llu + +#undef HAVE_READLINE + +#undef HAVE_GMP + +#undef HAVE_CWEB + +#undef HAVE_FCHDIR + +#undef HAVE_LOCALTIME_R + +#undef HAVE_READDIR_R + +#undef HAVE_GETOPT_LONG + +#undef HAVE_LIBSM diff --git a/bacula/autoconf/aclocal.m4 b/bacula/autoconf/aclocal.m4 new file mode 100644 index 0000000000..017f8536f7 --- /dev/null +++ b/bacula/autoconf/aclocal.m4 @@ -0,0 +1,1176 @@ +dnl +dnl If available, use support for large files unless the user specified +dnl one of the CPPFLAGS, LDFLAGS, or LIBS variables ( +dnl via GNU patch 2.5) +dnl +AC_DEFUN(LARGE_FILE_SUPPORT, +[AC_MSG_CHECKING(whether large file support needs explicit enabling) +ac_getconfs='' +ac_result=yes +ac_set='' +ac_shellvars='CPPFLAGS LDFLAGS LIBS' +for ac_shellvar in $ac_shellvars; do + case $ac_shellvar in + CPPFLAGS) ac_lfsvar=LFS_CFLAGS ac_lfs64var=LFS64_CFLAGS ;; + *) ac_lfsvar=LFS_$ac_shellvar ac_lfs64var=LFS64_$ac_shellvar ;; + esac + eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar + (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } + ac_getconf=`getconf $ac_lfsvar` + ac_getconf64=`getconf $ac_lfs64var` + ac_getconfs=$ac_getconfs$ac_getconf\ $ac_getconf64 + eval ac_test_$ac_shellvar="\$ac_getconf\ \$ac_getconf64" +done +case "$ac_result$ac_getconfs" in +yes) ac_result=no ;; +esac +case "$ac_result$ac_set" in +yes?*) ac_result="yes, but $ac_set is already set, so use its settings" +esac +AC_MSG_RESULT($ac_result) +case $ac_result in +yes) + for ac_shellvar in $ac_shellvars; do + eval $ac_shellvar=\$ac_test_$ac_shellvar + done ;; +esac +]) + +dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) +AC_DEFUN(SIGNAL_CHECK, +[AC_REQUIRE([AC_TYPE_SIGNAL]) +AC_MSG_CHECKING(for type of signal functions) +AC_CACHE_VAL(bash_cv_signal_vintage, +[ + AC_TRY_LINK([#include ],[ + sigset_t ss; + struct sigaction sa; + sigemptyset(&ss); sigsuspend(&ss); + sigaction(SIGINT, &sa, (struct sigaction *) 0); + sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); + ], bash_cv_signal_vintage=posix, + [ + AC_TRY_LINK([#include ], [ + int mask = sigmask(SIGINT); + sigsetmask(mask); sigblock(mask); sigpause(mask); + ], bash_cv_signal_vintage=4.2bsd, + [ + AC_TRY_LINK([ + #include + RETSIGTYPE foo() { }], [ + int mask = sigmask(SIGINT); + sigset(SIGINT, foo); sigrelse(SIGINT); + sighold(SIGINT); sigpause(SIGINT); + ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7 + )] + )] +) +]) +AC_MSG_RESULT($bash_cv_signal_vintage) +if test "$bash_cv_signal_vintage" = posix; then +AC_DEFINE(HAVE_POSIX_SIGNALS) +elif test "$bash_cv_signal_vintage" = "4.2bsd"; then +AC_DEFINE(HAVE_BSD_SIGNALS) +elif test "$bash_cv_signal_vintage" = svr3; then +AC_DEFINE(HAVE_USG_SIGHOLD) +fi +]) + +AC_DEFUN(BA_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + + +AC_DEFUN(BA_CHECK_OPSYS, +[AC_MSG_CHECKING(for Operating System) +AC_CYGWIN +if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS +then + BA_CONDITIONAL(HAVE_SUN_OS, $TRUEPRG) + AC_DEFINE(HAVE_SUN_OS) +else + BA_CONDITIONAL(HAVE_SUN_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xOSF1 +then + BA_CONDITIONAL(HAVE_OSF1_OS, $TRUEPRG) + AC_DEFINE(HAVE_OSF1_OS) +else + BA_CONDITIONAL(HAVE_OSF1_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xAIX +then + BA_CONDITIONAL(HAVE_AIX_OS, $TRUEPRG) + AC_DEFINE(HAVE_AIX_OS) +else + BA_CONDITIONAL(HAVE_AIX_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX +then + BA_CONDITIONAL(HAVE_HPUX_OS, $TRUEPRG) + AC_DEFINE(HAVE_HPUX_OS) +else + BA_CONDITIONAL(HAVE_HPUX_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xLinux +then + BA_CONDITIONAL(HAVE_LINUX_OS, $TRUEPRG) + AC_DEFINE(HAVE_LINUX_OS) +else + BA_CONDITIONAL(HAVE_LINUX_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD +then + BA_CONDITIONAL(HAVE_FREEBSD_OS, $TRUEPRG) + AC_DEFINE(HAVE_FREEBSD_OS) +else + BA_CONDITIONAL(HAVE_FREEBSD_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD +then + BA_CONDITIONAL(HAVE_NETBSD_OS, $TRUEPRG) + AC_DEFINE(HAVE_NETBSD_OS) +else + BA_CONDITIONAL(HAVE_NETBSD_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD +then + BA_CONDITIONAL(HAVE_OPENBSD_OS, $TRUEPRG) + AC_DEFINE(HAVE_OPENBSD_OS) +else + BA_CONDITIONAL(HAVE_OPENBSD_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS +then + BA_CONDITIONAL(HAVE_BSDI_OS, $TRUEPRG) + AC_DEFINE(HAVE_BSDI_OS) +else + BA_CONDITIONAL(HAVE_BSDI_OS, $FALSEPRG) +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xSGI +then + BA_CONDITIONAL(HAVE_SGI_OS, $TRUEPRG) + AC_DEFINE(HAVE_SGI_OS) +else + BA_CONDITIONAL(HAVE_SGI_OS, $FALSEPRG) +fi +AC_MSG_RESULT(" ") +]) + +AC_DEFUN(BA_CHECK_OPSYS_DISTNAME, +[AC_MSG_CHECKING(for Operating System Distribution) +if test "x$DISTNAME" != "x" +then + echo "distname set to $DISTNAME" +elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1 +then + DISTNAME=alpha +elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX +then + DISTNAME=hpux +elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS +then + DISTNAME=solaris +elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD +then + DISTNAME=freebsd +elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD +then + DISTNAME=netbsd +elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD +then + DISTNAME=openbsd +elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS +then + DISTNAME=bsdi +elif test -f /etc/SuSE-release +then + DISTNAME=suse +elif test -d /etc/SuSEconfig +then + DISTNAME=suse5 +elif test -d /usr/src/OpenLinux +then + DISTNAME=caldera +elif test -f /etc/redhat-release +then + DISTNAME=redhat +elif test -f /etc/debian_version +then + DISTNAME=debian +elif test -f /etc/slackware-version +then + DISTNAME=slackware +elif test "$ac_cv_cygwin" = yes +then + DISTNAME=cygwin + AC_DEFINE(HAVE_CYGWIN) +else + DISTNAME=unknown +fi +AC_MSG_RESULT(" ") +]) + +AC_DEFUN(BA_CHECK_MYSQL_DB, +[ +have_db=no +db_name=none +AC_MSG_CHECKING(for MySQL support) +AC_ARG_WITH(mysql, +[ +Which one DBMS do you want to use (please select only one): + --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base + install directory, default is to search through + a number of common places for the MySQL files.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + if test -f /usr/local/mysql/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/mysql/include/mysql + MYSQL_LIBDIR=/usr/local/mysql/lib/mysql + MYSQL_BINDIR=/usr/local/mysql/bin + elif test -f /usr/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/include/mysql + MYSQL_LIBDIR=/usr/lib/mysql + MYSQL_BINDIR=/usr/bin + elif test -f /usr/include/mysql.h; then + MYSQL_INCDIR=/usr/include + MYSQL_LIBDIR=/usr/lib + MYSQL_BINDIR=/usr/bin + elif test -f /usr/local/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + MYSQL_BINDIR=/usr/local/bin + elif test -f /usr/local/include/mysql.h; then + MYSQL_INCDIR=/usr/local/include + MYSQL_LIBDIR=/usr/local/lib + MYSQL_BINDIR=/usr/local/bin + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Unable to find mysql.h in standard locations) + fi + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + MYSQL_BINDIR=$withval/bin + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + MYSQL_BINDIR=$withval/bin + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval) + fi + fi + SQL_INCLUDE=-I$MYSQL_INCDIR + SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient" + SQL_BINDIR=$MYSQL_BINDIR + + AC_DEFINE(HAVE_MYSQL) + AC_MSG_RESULT(yes) + have_db=yes + support_mysql=yes + db_name=MySQL + + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(SQL_LFLAGS) +AC_SUBST(SQL_INCLUDE) +AC_SUBST(SQL_BINDIR) + +]) + + +AC_DEFUN(BA_CHECK_SQLITE_DB, +[ +have_db=no +db_name=none +AC_MSG_CHECKING(for SQLite support) +AC_ARG_WITH(sqlite, +[ +Which one DBMS do you want to use (please select only one): + --with-sqlite[=DIR] Include SQLite support. DIR is the SQLite base + install directory, default is to search through + a number of common places for the SQLite files.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + if test -f /usr/local/include/sqlite.h; then + SQLITE_INCDIR=/usr/local/include + SQLITE_LIBDIR=/usr/local/lib + SQLITE_BINDIR=/usr/local/bin + elif test -f /usr/include/sqlite.h; then + SQLITE_INCDIR=/usr/include + SQLITE_LIBDIR=/usr/lib + SQLITE_BINDIR=/usr/bin + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Unable to find sqlite.h in standard locations) + fi + else + if test -f $withval/sqlite.h; then + SQLITE_INCDIR=$withval + SQLITE_LIBDIR=$withval + SQLITE_BINDIR=$withval + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid SQLite directory $withval - unable to find sqlite.h under $withval) + fi + fi + SQL_INCLUDE=-I$SQLITE_INCDIR + SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite" + SQL_BINDIR=$SQLITE_BINDIR + + AC_DEFINE(HAVE_SQLITE) + AC_MSG_RESULT(yes) + have_db=yes + support_sqlite=yes + db_name=SQLite + + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(SQL_LFLAGS) +AC_SUBST(SQL_INCLUDE) +AC_SUBST(SQL_BINDIR) + +]) + + + +AC_DEFUN(BA_CHECK_SQL_DB, +[AC_MSG_CHECKING(Checking for various databases) +dnl# -------------------------------------------------------------------------- +dnl# CHECKING FOR VARIOUS DATABASES (thanks to UdmSearch team) +dnl# -------------------------------------------------------------------------- +dnl Check for some DBMS backend +dnl NOTE: we can use only one backend at a time +AC_MSG_RESULT(" ") + +have_db=no +db_name=none + + + +if test x$support_mysql = xyes; then + cats=cats +fi + + +AC_MSG_CHECKING(for Berkeley DB support) +AC_ARG_WITH(berkeleydb, +[ +Which one DBMS do you want to use (please select only one): + --with-berkeleydb[=DIR] Include Berkeley DB support. DIR is the Berkeley DB base + install directory, default is to search through + a number of common places for the DB files.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + if test -f /usr/include/db.h; then + BERKELEYDB_INCDIR=/usr/include + BERKELEYDB_LIBDIR=/usr/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid Berkeley DB directory - unable to find db.h) + fi + else + if test -f $withval/include/db.h; then + BERKELEYDB_INCDIR=$withval/include + BERKELEYDBL_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid Berkeley DB directory - unable to find db.h under $withval) + fi + fi + SQL_INCLUDE=-I$BERKELEYDB_INCDIR + SQL_LFLAGS="-L$BERKELEYDB_LIBDIR -ldb" + + AC_DEFINE(HAVE_BERKELEY_DB) + AC_MSG_RESULT(yes) + have_db=yes + support_mysql=yes + db_name=BerkelyDB + + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(SQL_LFLAGS) +AC_SUBST(SQL_INCLUDE) + +if test x$support_berkleydb = xyes; then + cats=cats +fi + + +AC_MSG_CHECKING(for PostgreSQL support) +AC_ARG_WITH(pgsql, +[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL + base install directory, defaults to /usr/local/pgsql.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + if test "$withval" = "yes"; then + if test -f /usr/include/pgsql/libpq-fe.h; then + PGSQL_INCDIR=/usr/include/pgsql + else + PGSQL_INCDIR=/usr/local/pgsql/include + fi + if test -f /usr/lib/libpq.a; then + PGSQL_LIBDIR=/usr/lib + else + PGSQL_LIBDIR=/usr/local/pgsql/lib + fi + else + PGSQL_INCDIR=$withval/include + test -d $withval/include/pgsql && PGSQL_INCDIR=$withval/include/pgsql + PGSQL_LIBDIR=$withval/lib + test -d $withval/lib/pgsql && PGSQL_LIBDIR=$withval/lib/pgsql + fi + PGSQL_INCLUDE=-I$PGSQL_INCDIR + PGSQL_LFLAGS="-L$PGSQL_LIBDIR -lpq" + AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, [LIBS="-lcrypt $LIBS"])) + + AC_DEFINE(HAVE_PGSQL) + AC_MSG_RESULT(yes) + have_db=yes + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(PGSQL_LFLAGS) +AC_SUBST(PGSQL_INCLUDE) + + +AC_MSG_CHECKING(for mSQL support) +AC_ARG_WITH(msql, +[ --with-msql[=DIR] Include mSQL support. DIR is the mSQL base + install directory, defaults to /usr/local/Hughes.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + + if test "$withval" = "yes"; then + MSQL_INCDIR=/usr/local/Hughes/include + MSQL_LIBDIR=/usr/local/Hughes/lib + else + MSQL_INCDIR=$withval/include + MSQL_LIBDIR=$withval/lib + fi + MSQL_INCLUDE=-I$MSQL_INCDIR + MSQL_LFLAGS="-L$MSQL_LIBDIR -lmsql" + + AC_DEFINE(HAVE_MSQL) + AC_MSG_RESULT(yes) + have_db=yes + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(MSQL_LFLAGS) +AC_SUBST(MSQL_INCLUDE) + + +AC_MSG_CHECKING(for iODBC support) +AC_ARG_WITH(iodbc, +[ --with-iodbc[=DIR] Include iODBC support. DIR is the iODBC base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + fi + + if test "$withval" = "yes"; then + withval=/usr/local + fi + + if test "$withval" != "no"; then + if test -f $withval/include/isql.h; then + IODBC_INCDIR=$withval/include + IODBC_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid iODBC directory - unable to find isql.h) + fi + IODBC_LFLAGS="-L$IODBC_LIBDIR -liodbc" + IODBC_INCLUDE=-I$IODBC_INCDIR + AC_DEFINE(HAVE_IODBC) + AC_MSG_RESULT(yes) + have_db=yes + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(IODBC_LFLAGS) +AC_SUBST(IODBC_INCLUDE) + + +AC_MSG_CHECKING(for unixODBC support) +AC_ARG_WITH(unixODBC, +[ --with-unixODBC[=DIR] Include unixODBC support. DIR is the unixODBC base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + fi + + if test "$withval" = "yes"; then + withval=/usr/local + fi + + if test "$withval" != "no"; then + if test -f $withval/include/sql.h; then + UNIXODBC_INCDIR=$withval/include + UNIXODBC_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid unixODBC directory - unable to find sql.h) + fi + UNIXODBC_LFLAGS="-L$UNIXODBC_LIBDIR -lodbc" + UNIXODBC_INCLUDE=-I$UNIXODBC_INCDIR + AC_DEFINE(HAVE_UNIXODBC) + AC_MSG_RESULT(yes) + have_db=yes + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(UNIXODBC_LFLAGS) +AC_SUBST(UNIXODBC_INCLUDE) + + +AC_MSG_CHECKING(for Solid support) +AC_ARG_WITH(solid, +[ --with-solid[=DIR] Include Solid support. DIR is the Solid base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + fi + + if test "$withval" = "yes"; then + withval=/usr/local + fi + + if test "$withval" != "no"; then + if test -f $withval/include/cli0cli.h; then + SOLID_INCDIR=$withval/include + SOLID_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid Solid directory - unable to find cli0cli.h) + fi + SOLID_LFLAGS="-L$SOLID_LIBDIR -lsolcli" + SOLID_INCLUDE="-I$SOLID_INCDIR" + AC_DEFINE(HAVE_SOLID) + AC_MSG_RESULT(yes) + have_db=yes + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(SOLID_LFLAGS) +AC_SUBST(SOLID_INCLUDE) + +AC_MSG_CHECKING(for OpenLink ODBC support) +AC_ARG_WITH(openlink, +[ --with-openlink[=DIR] Include OpenLink ODBC support. + DIR is the base OpenLink ODBC install directory], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + + if test -f /usr/local/virtuoso-ent/odbcsdk/include/isql.h; then + VIRT_INCDIR=/usr/local/virtuoso-ent/odbcsdk/include/ + VIRT_LIBDIR=/usr/local/virtuoso-ent/odbcsdk/lib/ + elif test -f /usr/local/virtuoso-lite/odbcsdk/include/isql.h; then + VIRT_INCDIR=/usr/local/virtuoso-lite/odbcsdk/include/ + VIRT_LIBDIR=/usr/local/virtuoso-lite/odbcsdk/lib/ + elif test -f /usr/local/virtuoso/odbcsdk/include/isql.h; then + VIRT_INCDIR=/usr/local/virtuoso/odbcsdk/include/ + VIRT_LIBDIR=/usr/local/virtuoso/odbcsdk/lib/ + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid OpenLink ODBC directory - unable to find isql.h) + fi + else + if test -f $withval/odbcsdk/include/isql.h; then + VIRT_INCDIR=$withval/odbcsdk/include/ + VIRT_LIBDIR=$withval/odbcsdk/lib/ + elif test -f $withval/include/isql.h; then + VIRT_INCDIR=$withval/include/ + VIRT_LIBDIR=$withval/lib/ + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid OpenLink ODBC directory - unable to find isql.h under $withval) + fi + fi + VIRT_INCLUDE=-I$VIRT_INCDIR + VIRT_LFLAGS="-L$VIRT_LIBDIR -liodbc" + + AC_DEFINE(HAVE_VIRT) + AC_MSG_RESULT(yes) + have_db=yes + + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(VIRT_LFLAGS) +AC_SUBST(VIRT_INCLUDE) + + +AC_MSG_CHECKING(for EasySoft ODBC support) +AC_ARG_WITH(easysoft, +[ --with-easysoft[=DIR] Include EasySoft ODBC support. + DIR is the base EasySoft ODBC install directory], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + + if test -f /usr/local/easysoft/oob/client/include/sql.h; then + EASYSOFT_INCDIR=/usr/local/easysoft/oob/client/include/ + EASYSOFT_LFLAGS="-L/usr/local/easysoft/oob/client/lib/ -L/usr/local/easysoft/lib" + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid EasySoft ODBC directory - unable to find sql.h) + fi + else + if test -f $withval/easysoft/oob/client/include/sql.h; then + EASYSOFT_INCDIR=$withval/easysoft/oob/client/include/ + EASYSOFT_LFLAGS="-L$withval/easysoft/oob/client/lib/ -L$withval/easysoft/lib" + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid EasySoft ODBC directory - unable to find sql.h under $withval) + fi + fi + EASYSOFT_INCLUDE=-I$EASYSOFT_INCDIR + EASYSOFT_LFLAGS="$EASYSOFT_LFLAGS -lesoobclient -lesrpc -lsupport -lextra" + + AC_DEFINE(HAVE_EASYSOFT) + AC_MSG_RESULT(yes) + have_db=yes + + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(EASYSOFT_LFLAGS) +AC_SUBST(EASYSOFT_INCLUDE) + + + +AC_MSG_CHECKING(for InterBase support) +AC_ARG_WITH(ibase, +[ --with-ibase[=DIR] Include InterBase support. DIR is the InterBase + install directory, defaults to /usr/interbase.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + fi + + if test "$withval" = "yes"; then + withval=/usr/interbase + fi + + if test "$withval" != "no"; then + if test -f $withval/include/ibase.h; then + IBASE_INCDIR=$withval/include + IBASE_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid InterBase directory - unable to find ibase.h) + fi + IBASE_LFLAGS="-L$IBASE_LIBDIR -lgds" + IBASE_INCLUDE=-I$IBASE_INCDIR + AC_DEFINE(HAVE_IBASE) + AC_MSG_RESULT(yes) + have_db=yes + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(IBASE_LFLAGS) +AC_SUBST(IBASE_INCLUDE) + +AC_MSG_CHECKING(for Oracle8 support) +AC_ARG_WITH(oracle8, +[ --with-oracle8[=DIR] Include Oracle8 support. DIR is the Oracle + home directory, defaults to $ORACLE_HOME or + /oracle8/app/oracle/product/8.0.5.], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + fi + + if test "$withval" = "yes"; then + withval="$ORACLE_HOME" + if test "$withval" = ""; then + withval=/oracle8/app/oracle/product/8.0.5 + fi + fi + + if test "$withval" != "no"; then + if test -f $withval/rdbms/demo/oci.h; then + ORACLE8_INCDIR1=$withval/rdbms/demo/ + ORACLE8_INCDIR2=$withval/rdbms/public/: + ORACLE8_INCDIR3=$withval/network/public/ + ORACLE8_INCDIR4=$withval/plsql/public/ + ORACLE8_LIBDIR1=$withval/lib + ORACLE8_LIBDIR2=$withval/rdbms/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid ORACLE directory - unable to find oci.h) + fi + ORACLE8_LFLAGS="-L$ORACLE8_LIBDIR1 -L$ORACLE8_LIBDIR2 $withval/lib/libclntsh.so -lmm -lepc -lclient -lvsn -lcommon -lgeneric -lcore4 -lnlsrtl3 -lnsl -lm -ldl -lnetv2 -lnttcp -lnetwork -lncr -lsql" + ORACLE8_INCLUDE="-I$ORACLE8_INCDIR1 -I$ORACLE8_INCDIR2 -I$ORACLE8_INCDIR3 -I$ORACLE8_INCDIR4" + AC_DEFINE(HAVE_ORACLE8) + AC_MSG_RESULT(yes) + have_db=yes + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(ORACLE8_LFLAGS) +AC_SUBST(ORACLE8_INCLUDE) + + +AC_MSG_CHECKING(for Oracle7 support) +AC_ARG_WITH(oracle7, +[ --with-oracle7[=DIR] Include Oracle 7.3 support. DIR is the Oracle + home directory, defaults to + ORACLE_HOME [$ORACLE_HOME]], +[ + if test "$withval" != "no"; then + if test "$have_db" = "yes"; then + AC_MSG_RESULT(error) + AC_MSG_ERROR("You can configure for only one database."); + fi + fi + + if test "$withval" = "yes"; then + withval="$ORACLE_HOME" + fi + + if test "$withval" != "no"; then + if test -f $withval/rdbms/demo/ocidfn.h; then + ORACLE7_INCDIR=$withval/rdbms/demo/ + ORACLE7_LIBDIR1=$withval/lib + ORACLE7_LIBDIR2=$withval/rdbms/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid ORACLE directory - unable to find ocidfn.h) + fi + + ORACLEINST_TOP=$withval + if test -f "$ORACLEINST_TOP/rdbms/lib/sysliblist" + then + ORA_SYSLIB="`cat $ORACLEINST_TOP/rdbms/lib/sysliblist`" + elif test -f "$ORACLEINST_TOP/lib/sysliblist" + then + ORA_SYSLIB="`cat $ORACLEINST_TOP/lib/sysliblist`" + else + ORA_SYSLIB="-lm" + fi + + ORACLE7_LFLAGS="-L$ORACLE7_LIBDIR1 -L$ORACLE7_LIBDIR2 \ + -lclient -lsqlnet -lncr -lsqlnet -lclient -lcommon \ + -lgeneric -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric \ + -lepc -lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 -lnlsrtl3 \ + $ORA_SYSLIB -lcore3 $ORA_SYSLIB" + ORACLE7_INCLUDE="-I$ORACLE7_INCDIR " + AC_DEFINE(HAVE_ORACLE7) + AC_MSG_RESULT(yes) + have_db=yes + fi +],[ + AC_MSG_RESULT(no) +]) +AC_SUBST(ORACLE7_LFLAGS) +AC_SUBST(ORACLE7_INCLUDE) +]) + +dnl AM_ACLOCAL_INCLUDE(macrodir) +AC_DEFUN([AM_ACLOCAL_INCLUDE], +[ + AM_CONDITIONAL(INSIDE_GNOME_COMMON, false) + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done +]) + +dnl +dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) +dnl +dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh +dnl is not found. +dnl + +AC_DEFUN([GNOME_INIT_HOOK],[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOMEUI_LIBS) + AC_SUBST(GNOMEGNORBA_LIBS) + AC_SUBST(GTKXMHTML_LIBS) + AC_SUBST(ZVT_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes Specify location of GNOME headers],[ + CFLAGS="$CFLAGS -I$withval" + ]) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs Specify location of GNOME libs],[ + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + ]) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + dnl Note that an empty true branch is not + dnl valid sh syntax. + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + AC_MSG_CHECKING(if $GNOME_CONFIG works) + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GNOME_GNORBA_HOOK([],$2) + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + $1 + else + AC_MSG_RESULT(no) + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) + if test -f $gnome_prefix/gnomeConf.sh; then + AC_MSG_RESULT(found) + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + $1 + else + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) + fi + fi + fi + fi + + if test -n "$3"; then + n="$3" + for i in $n; do + AC_MSG_CHECKING(extra library \"$i\") + case $i in + applets) + AC_SUBST(GNOME_APPLETS_LIBS) + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + AC_MSG_RESULT($GNOME_APPLETS_LIBS);; + docklets) + AC_SUBST(GNOME_DOCKLETS_LIBS) + GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` + AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);; + capplet) + AC_SUBST(GNOME_CAPPLET_LIBS) + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; + *) + AC_MSG_RESULT(unknown library) + esac + EXTRA_INCLUDEDIR=`$GNOME_CONFIG --cflags $i` + GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR $EXTRA_INCLUDEDIR" + done + fi +]) + +dnl +dnl GNOME_INIT ([additional-inits]) +dnl + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail,$1) +]) + +dnl GNOME_X_CHECKS +dnl +dnl Basic X11 related checks for X11. At the end, the following will be +dnl defined/changed: +dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK +dnl CPPFLAGS Will include $X_CFLAGS +dnl GNOME_HAVE_SM `true' or `false' depending on whether session +dnl management is available. It is available if +dnl both -lSM and X11/SM/SMlib.h exist. (Some +dnl Solaris boxes have the library but not the header) +dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" +dnl +dnl The following configure cache variables are defined (but not used): +dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} +dnl +AC_DEFUN([GNOME_X_CHECKS], +[ + AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) + dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could + dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" + dnl + dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses + dnl CPPFLAGS, not CFLAGS + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + +dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. + USE_DEVGTK=true + +dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) +dnl AC_EGREP_CPP(answer_affirmatively, +dnl [#include +dnl #ifdef GTK_HAVE_FEATURES_1_1_0 +dnl answer_affirmatively +dnl #endif +dnl ], dev_gtk=yes, dev_gtk=no) +dnl if test "$dev_gtk" = "yes"; then +dnl USE_DEVGTK=true +dnl fi +dnl AC_MSG_RESULT("$dev_gtk") + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + dnl Already found it. + ;; + *) + dnl Assume that if we have -lSM then we also have -lICE. + AC_CHECK_LIB(SM, SmcSaveYourselfDone, + [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, + $x_libs -lICE) + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) + fi + + if test "$GNOME_HAVE_SM" = true; then + AC_DEFINE(HAVE_LIBSM) + fi + + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + LDFLAGS="$saved_ldflags" + + AC_PROVIDE([GNOME_X_CHECKS]) +]) + +AC_DEFUN([GNOME_PTHREAD_CHECK],[ + PTHREAD_LIB="" + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_LIB(pthread, __pthread_attr_init_system, PTHREAD_LIB="-lpthread", + [AC_CHECK_FUNC(pthread_create)] + )] + )] + )] + ) + AC_SUBST(PTHREAD_LIB) + AC_PROVIDE([GNOME_PTHREAD_CHECK]) +]) + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +dnl +dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) +dnl +dnl if failflag is "failure" it aborts if gnorba is not found. +dnl + +AC_DEFUN([GNOME_GNORBA_HOOK],[ + GNOME_ORBIT_HOOK([],$2) + AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + ]) + AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + AC_SUBST(GNORBA_CFLAGS) + AC_SUBST(GNORBA_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(gnorba library not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_GNORBA_CHECK], [ + GNOME_GNORBA_HOOK([],failure) +]) + +dnl +dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) +dnl +dnl if failflag is "failure" it aborts if orbit is not found. +dnl + +AC_DEFUN([GNOME_ORBIT_HOOK],[ + AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) + AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) + AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + ]) + AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + AC_SUBST(ORBIT_CFLAGS) + AC_SUBST(ORBIT_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(ORBit not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_ORBIT_CHECK], [ + GNOME_ORBIT_HOOK([],failure) +]) + diff --git a/bacula/autoconf/confdefs.h b/bacula/autoconf/confdefs.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/bacula/autoconf/confdefs.h @@ -0,0 +1 @@ + diff --git a/bacula/autoconf/config.guess b/bacula/autoconf/config.guess new file mode 100755 index 0000000000..0ce538bb85 --- /dev/null +++ b/bacula/autoconf/config.guess @@ -0,0 +1,1183 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-cbm ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format. + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + echo "${UNAME_MACHINE}-pc-linux" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc | elf32ppclinux) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >$dummy.c < /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + elif test "${UNAME_MACHINE}" = "s390"; then + echo s390-ibm-linux && exit 0 + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-W:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in new file mode 100644 index 0000000000..cc1892aabe --- /dev/null +++ b/bacula/autoconf/config.h.in @@ -0,0 +1,460 @@ +/* autoconf/config.h.in. Generated automatically from autoconf/configure.in by autoheader. */ +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE SPECIFIED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +/* Define if you want to use MySQL as Catalog database */ +#undef USE_MYSQL_DB + +/* Define if you want SmartAlloc debug code enabled */ +#undef SMARTALLOC + +/* Define to `int' if doesn't define. */ +#undef daddr_t + +/* Define to `int' if doesn't define. */ +#undef major_t + +/* Define to `int' if doesn't define. */ +#undef minor_t + +/* Define to `int' if doesn't define. */ +#undef ssize_t + +/* Define if you want to use MySQL */ +#undef HAVE_MYSQL + +/* Define if you want to use SQLite */ +#undef HAVE_SQLITE + +/* Define if you want to use Berkeley DB */ +#undef HAVE_BERKELEY_DB + + +/* Define if you want to use PostgreSQL */ +#undef HAVE_PGSQL + +/* Define if you want to use mSQL */ +#undef HAVE_MSQL + +/* Define if you want to use iODBC */ +#undef HAVE_IODBC + +/* Define if you want to use unixODBC */ +#undef HAVE_UNIXODBC + +/* Define if you want to use Solid SQL Server */ +#undef HAVE_SOLID + +/* Define if you want to use OpenLink ODBC (Virtuoso) */ +#undef HAVE_VIRT + +/* Define if you want to use EasySoft ODBC */ +#undef HAVE_EASYSOFT + +/* Define if you want to use Interbase SQL Server */ +#undef HAVE_IBASE + +/* Define if you want to use Oracle 8 SQL Server */ +#undef HAVE_ORACLE8 + +/* Define if you want to use Oracle 7 SQL Server */ +#undef HAVE_ORACLE7 + + +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE DETECTED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define if the closedir function returns void instead of int. */ +#undef CLOSEDIR_VOID + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if your system has a working fnmatch function. */ +#undef HAVE_FNMATCH + +/* Define if you have the getmntent function. */ +#undef HAVE_GETMNTENT + +/* Define if your struct stat has st_blksize. */ +#undef HAVE_ST_BLKSIZE + +/* Define if your struct stat has st_blocks. */ +#undef HAVE_ST_BLOCKS + +/* Define if you have the strcoll function and it is properly defined. */ +#undef HAVE_STRCOLL + +/* Define if your struct stat has st_rdev. */ +#undef HAVE_ST_RDEV + +/* Define if you have the strftime function. */ +#undef HAVE_STRFTIME + +/* Define if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if your struct tm has tm_zone. */ +#undef HAVE_TM_ZONE + +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#undef HAVE_TZNAME + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if major, minor, and makedev are declared in . */ +#undef MAJOR_IN_MKDEV + +/* Define if major, minor, and makedev are declared in . */ +#undef MAJOR_IN_SYSMACROS + +/* Define to `int' if doesn't define. */ +#undef mode_t + +/* Define if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Define to `long' if doesn't define. */ +#undef off_t + +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define if the `setpgrp' function takes no argument. */ +#undef SETPGRP_VOID + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define if your declares struct tm. */ +#undef TM_IN_SYS_TIME + +/* Define to `int' if doesn't define. */ +#undef uid_t + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* Define if you need function prototypes */ +#undef PROTOTYPES + +/* Define if you have GCC */ +#undef HAVE_GCC + +/* Define to use SVR4 statvfs to get filesystem type. */ +#undef FSTYPE_STATVFS + +/* Define to use SVR3.2 statfs to get filesystem type. */ +#undef FSTYPE_USG_STATFS + +/* Define to use AIX3 statfs to get filesystem type. */ +#undef FSTYPE_AIX_STATFS + +/* Define to use 4.3BSD getmntent to get filesystem type. */ +#undef FSTYPE_MNTENT + +/* Define to use 4.4BSD and OSF1 statfs to get filesystem type. */ +#undef FSTYPE_STATFS + +/* Define to use Ultrix getmnt to get filesystem type. */ +#undef FSTYPE_GETMNT + +/* Define to `unsigned long' if doesn't define. */ +#undef dev_t + +/* Define to `unsigned long' if doesn't define. */ +#undef ino_t + +/* Define to 1 if utime.h exists and declares struct utimbuf. */ +#undef HAVE_UTIME_H + +/* Data types */ +#undef HAVE_U_INT +#undef HAVE_INTXX_T +#undef HAVE_U_INTXX_T +#undef HAVE_UINTXX_T +#undef HAVE_INT64_T +#undef HAVE_U_INT64_T +#undef HAVE_INTMAX_T +#undef HAVE_U_INTMAX_T + + +/* Define if you want TCP Wrappers support */ +#undef HAVE_LIBWRAP + +/* Define if you have sys/bitypes.h */ +#undef HAVE_SYS_BITYPES_H + + +/* Directory for PID files */ +#undef _PATH_BACULA_PIDDIR + +/* File daemon specif libraries */ +#undef FDLIBS + +/* What kind of signals we have */ +#undef HAVE_POSIX_SIGNALS +#undef HAVE_BSD_SIGNALS +#undef HAVE_USG_SIGHOLD + +/* Operating systems */ +/* OSes */ +#undef HAVE_LINUX_OS +#undef HAVE_FREEBSD_OS +#undef HAVE_NETBSD_OS +#undef HAVE_OPENBSD_OS +#undef HAVE_BSDI_OS +#undef HAVE_HPUX_OS +#undef HAVE_SUN_OS +#undef HAVE_AIX_OS +#undef HAVE_SGI_OS +#undef HAVE_CYGWIN +#undef HAVE_OSF1_OS + +/* Set to correct scanf value for long long int */ +#undef lld +#undef llu + +#undef HAVE_READLINE + +#undef HAVE_GMP + +#undef HAVE_CWEB + +#undef HAVE_FCHDIR + +#undef HAVE_LOCALTIME_R + +#undef HAVE_READDIR_R + +#undef HAVE_GETOPT_LONG + +/* The number of bytes in a char. */ +#undef SIZEOF_CHAR + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a int *. */ +#undef SIZEOF_INT_P + +/* The number of bytes in a long int. */ +#undef SIZEOF_LONG_INT + +/* The number of bytes in a long long int. */ +#undef SIZEOF_LONG_LONG_INT + +/* The number of bytes in a short int. */ +#undef SIZEOF_SHORT_INT + +/* Define if you have the fchdir function. */ +#undef HAVE_FCHDIR + +/* Define if you have the fork function. */ +#undef HAVE_FORK + +/* Define if you have the getcwd function. */ +#undef HAVE_GETCWD + +/* Define if you have the gethostname function. */ +#undef HAVE_GETHOSTNAME + +/* Define if you have the getpid function. */ +#undef HAVE_GETPID + +/* Define if you have the lchown function. */ +#undef HAVE_LCHOWN + +/* Define if you have the localtime_r function. */ +#undef HAVE_LOCALTIME_R + +/* Define if you have the lstat function. */ +#undef HAVE_LSTAT + +/* Define if you have the putenv function. */ +#undef HAVE_PUTENV + +/* Define if you have the readdir_r function. */ +#undef HAVE_READDIR_R + +/* Define if you have the select function. */ +#undef HAVE_SELECT + +/* Define if you have the setenv function. */ +#undef HAVE_SETENV + +/* Define if you have the setlocale function. */ +#undef HAVE_SETLOCALE + +/* Define if you have the setpgid function. */ +#undef HAVE_SETPGID + +/* Define if you have the setpgrp function. */ +#undef HAVE_SETPGRP + +/* Define if you have the setsid function. */ +#undef HAVE_SETSID + +/* Define if you have the signal function. */ +#undef HAVE_SIGNAL + +/* Define if you have the snprintf function. */ +#undef HAVE_SNPRINTF + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the strncmp function. */ +#undef HAVE_STRNCMP + +/* Define if you have the strncpy function. */ +#undef HAVE_STRNCPY + +/* Define if you have the tcgetattr function. */ +#undef HAVE_TCGETATTR + +/* Define if you have the vfprintf function. */ +#undef HAVE_VFPRINTF + +/* Define if you have the vsnprintf function. */ +#undef HAVE_VSNPRINTF + +/* Define if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define if you have the header file. */ +#undef HAVE_DIRENT_H + +/* Define if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the header file. */ +#undef HAVE_GRP_H + +/* Define if you have the header file. */ +#undef HAVE_LIBC_H + +/* Define if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the header file. */ +#undef HAVE_NDIR_H + +/* Define if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_BYTEORDER_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_DIR_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_NDIR_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PTE_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PTEM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STREAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#undef HAVE_TERMCAP_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_VARARGS_H + +/* Define if you have the inet library (-linet). */ +#undef HAVE_LIBINET + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the resolv library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the sun library (-lsun). */ +#undef HAVE_LIBSUN + +/* Define if you have the xnet library (-lxnet). */ +#undef HAVE_LIBXNET diff --git a/bacula/autoconf/config.log b/bacula/autoconf/config.log new file mode 100644 index 0000000000..fb9038e996 --- /dev/null +++ b/bacula/autoconf/config.log @@ -0,0 +1,3 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + diff --git a/bacula/autoconf/config.sub b/bacula/autoconf/config.sub new file mode 100755 index 0000000000..c8e77851e6 --- /dev/null +++ b/bacula/autoconf/config.sub @@ -0,0 +1,1268 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30 | avr) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -*MiNT) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in new file mode 100644 index 0000000000..179c880b6b --- /dev/null +++ b/bacula/autoconf/configure.in @@ -0,0 +1,1239 @@ +dnl# +dnl# +dnl# Process this file with autoconf to produce a configure script. +dnl# +AC_INIT(src/version.h) +BUILD_DIR=`pwd` +cd .. +TOP_DIR=`pwd` +cd ${BUILD_DIR} +AC_SUBST(BUILD_DIR) +AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf) +AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in) + +dnl require a recent autoconf +AC_PREREQ(2.12) + + +dnl search for true and false programs. +AC_PATH_PROGS(TRUEPRG, true, :) +AC_PATH_PROGS(FALSEPRG, false, :) + +AC_CANONICAL_HOST + +dnl bacula version +VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h` +DATE=`sed -n -e 's/^.*[ \t]*DATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h` +LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h` +AC_SUBST(VERSION)dnl +AC_SUBST(DATE)dnl +AC_SUBST(LSMDATE)dnl +echo "configuring for bacula $VERSION ($DATE)" + + +dnl ------------------------------------------------------- +dnl# Check for compiler. +dnl ------------------------------------------------------ + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CC_C_O dnl Determine if C compiler support -c -o. +AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional. + +if test x$CC = xgcc +then + AC_DEFINE(HAVE_GCC) +fi + +dnl ------------------------------------------------------- +dnl# Check for programs. +dnl ------------------------------------------------------ +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_PATH_PROG(MV, mv, mv) +AC_PATH_PROG(RM, rm, rm) +AC_PATH_PROG(CP, cp, cp) +AC_PATH_PROG(SED, sed, sed) +AC_PATH_PROG(AWK, awk, awk) +AC_PATH_PROG(ECHO, echo, echo) +AC_PATH_PROG(CMP, cmp, cmp) +AC_PATH_PROG(TBL, tbl, tbl) +AC_PATH_PROG(AR, ar, ar) +AC_PATH_PROG(RANLIB, ranlib, ranlib) +AC_PATH_PROG(OPENSSL, openssl, none) + +test -n "$ARFLAG" || ARFLAGS="cr" +AC_SUBST(ARFLAGS) + +MAKE_SHELL=/bin/sh +AC_SUBST(MAKE_SHELL) + +AC_SUBST(LOCAL_LIBS) +AC_SUBST(LOCAL_CFLAGS) +AC_SUBST(LOCAL_LDFLAGS) +AC_SUBST(LOCAL_DEFS) + + + +dnl -------------------------------------------------- +dnl Bacula OP Sys determination (see aclocal.m4) +dnl -------------------------------------------------- +BA_CHECK_OPSYS + +# ----------------------------------------------------------- +dnl Bacula OPSys Distribution determination (see aclocal.m4) +# ---------------------------------------------------------- +BA_CHECK_OPSYS_DISTNAME + +# ----------------------------------------------------------- +dnl Check for gnome stuff for gnome-console +# ---------------------------------------------------------- +AM_ACLOCAL_INCLUDE(gnome-macros) + +# ------------------------------------------------------------------ +# If the user has not set --prefix, we set our default to nothing. +# In this case, if the user has not set --sysconfdir, we set it +# to the package default of /etc/bacula. If either --prefix or +# --sysconfdir is set, we leave sysconfdir alone except to eval it. +# ------------------------------------------------------------------ +if test x${prefix} = xNONE ; then + if test `eval echo ${sysconfdir}` = NONE/etc ; then + sysconfdir=/etc/bacula + fi + prefix= +fi +sysconfdir=`eval echo ${sysconfdir}` + +# ------------------------------------------------------------------------- +# If the user has not set --exec-prefix, we default to ${prefix} +# ------------------------------------------------------------------------- +if test x${exec_prefix} = xNONE ; then + exec_prefix=${prefix} +fi + +# ------------------------------------------------------------------ +# If the user has not set --sbindir, we set our default as /sbin +# ------------------------------------------------------------------ +if test x$sbindir = x'${exec_prefix}/sbin' ; then + sbindir=${exec_prefix}/sbin +fi +sbindir=`eval echo ${sbindir}` + +# ------------------------------------------------------------------ +# All list of languages for which a translation exist. Each +# language is separated by a space. +# ------------------------------------------------------------------ +ALL_LINGUAS="" + +AC_PATH_PROGS(MSGFMT, msgfmt, no) +if test "$MSGFMT" = "no" +then + echo 'msgfmt program not found, disabling NLS !' + USE_NLS=no + USE_INCLUDED_LIBINTL=no +#else +# AM_GNU_GETTEXT +fi + + +support_mysql=no +support_sqlite=no +support_smartalloc=yes +cats= + +dnl# -------------------------------------------------------------------------- +dnl# CHECKING COMMAND LINE OPTIONS +dnl# -------------------------------------------------------------------------- +AC_ARG_ENABLE(everything, + [ --enable-everything enable standard non-multichoice features: marked *], + [if test x$enableval = xyes; then + support_smartalloc=yes + fi]) + +# ------------------------------------------- +# gnome (default off) +# ------------------------------------------- +support_gnome=no +AC_ARG_ENABLE(gnome, + [ --enable-gnome enable build of gnome-console GUI *], + [if test x$enableval = xyes; then + support_gnome=yes + fi]) + +GNOME_DIR= +if test x$support_gnome = xyes; then + GNOME_INIT + GNOME_DIR=src/gnome-console +fi +AC_SUBST(GNOME_DIR) + + +# ------------------------------------------- +# smartalloc (default off) +# ------------------------------------------- +AC_ARG_ENABLE(smartalloc, + [ --enable-smartalloc enable smartalloc debugging support *], + [if test x$enableval = xno; then + support_smartalloc=no + fi]) + +if test x$support_smartalloc = xyes; then + AC_DEFINE(SMARTALLOC) +fi + + + +# --------------------------------------------------- +# Check for readline support/directory (default on) +# --------------------------------------------------- +support_readline=yes +# this allows you to turn it completely off +AC_ARG_ENABLE(readline, + [ --disable-readline disable readline support ], + [if test x$enableval = xno; then + support_readline=no + fi]) + +got_readline="no" +READLINE_SRC= +if test x$support_readline = xyes; then + AC_ARG_WITH(readline, + [ --with-readline[=DIR] Specify readline library directory], + [ + case "$with_readline" in + no) : ;; + yes|*) + if test "$with_readline" != "yes"; then + CONS_INC="-I$with_readline" + CONS_LDFLAGS="-L$with_readline" + else + with_readline="/usr/include/readline" + fi + AC_CHECK_HEADER($with_readline/readline.h, + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_READLINE) + CONS_LIBS="-lreadline" + got_readline="yes" + ], + [ AC_MSG_ERROR([*** readline library missing]) + ] + ) + ;; + esac + ],[ + # check for standard readline library + AC_CHECK_HEADER(/usr/include/readline/readline.h, + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_READLINE) + got_readline="yes" + CONS_INC="-I/usr/include/readline" + CONS_LIBS="-lreadline" + ], [ + # Did not find starndard library, so user our own + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_READLINE) + got_readline="yes" + CONS_INC="-I${TOP_DIR}/depkgs" + CONS_LIBS="-lreadline -lhistory" + CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline" + READLINE_SRC="${TOP_DIR}/depkgs/readline" + ]) + ] + ) +fi +AC_SUBST(CONS_INC) +AC_SUBST(CONS_LIBS) +AC_SUBST(CONS_LDFLAGS) +AC_SUBST(READLINE_SRC) + +# Minimal stuff for readline Makefile configuration +MAKE_SHELL=/bin/sh +AC_SUBST(MAKE_SHELL) + +AC_HEADER_STAT +AC_HEADER_DIRENT + +AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat lchown) + +#AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG), +# [LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o" +# EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"]) + +AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG)) + + +AC_FUNC_STRCOLL + +AC_CHECK_HEADERS(varargs.h \ + sys/ptem.h sys/pte.h sys/stream.h \ + termcap.h termio.h ) + +TERMCAP_LIB=-ltermcap +AC_SUBST(TERMCAP_LIB) + + +# End of readline stuff +# ----------------------------------------------------------------------- + + +# --------------------------------------------------- +# Check for GMP support/directory +# --------------------------------------------------- +GMP_SRC= +local_gmp="no" +AC_ARG_WITH(gmp, + [ --with-gmp[=DIR] Specify gmp library directory], + [ + case "$with_gmp" in + no) : ;; + yes|*) + if test "$with_gmp" != "yes"; then + GMP_INC="-I$with_gmp" + GMP_LIBS="-lgmp" + GMP_LDFLAGS="-L$with_gmp" + else + with_gmp="/usr/include" + fi + AC_CHECK_HEADER($with_gmp/gmp.h, + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GMP) + GMP_LIBS="-lgmp" + got_gmp="yes" + ], + [ AC_MSG_ERROR([*** gmp library missing]) + ] + ) + ;; + esac + ],[ + # check for standard gmp library + AC_CHECK_HEADER(/usr/include/gmp.h, + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GMP) + got_gmp="yes" + GMP_INC= + GMP_LIBS="-lgmp" + ], [ + # Did not find standard library, so use our own + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GMP) + got_gmp="yes" + local_gmp="yes" + GMP_INC="-I${TOP_DIR}/depkgs/gmp" + GMP_LIBS="-lgmp" + GMP_LDFLAGS="-L${TOP_DIR}/depkgs/gmp" + GMP_SRC="${TOP_DIR}/depkgs/gmp" + ]) + ] +) +AC_SUBST(GMP_INC) +AC_SUBST(GMP_LIBS) +AC_SUBST(GMP_LDFLAGS) +AC_SUBST(GMP_SRC) + +# End of GMP stuff +# ----------------------------------------------------------------------- + + +# --------------------------------------------------- +# Check for CWEB support/directory +# --------------------------------------------------- +CWEB_SRC= +local_cweb="no" +AC_ARG_WITH(cweb, + [ --with-cweb[=DIR] Specify cweb library directory], + [ + case "$with_cweb" in + no) : ;; + yes|*) + if test "$with_cweb" != "yes"; then + CWEB_INC="-I$with_cweb" + CWEB_LIBS="-lcweb" + CWEB_LDFLAGS="-L$with_cweb" + else + with_cweb="/usr/include" + fi + AC_CHECK_HEADER($with_cweb/cweb.h, + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CWEB) + CWEB_LIBS="-lcweb" + got_cweb="yes" + ], + [ AC_MSG_ERROR([*** cweb library missing]) + ] + ) + ;; + esac + ],[ + # check for standard cweb library + AC_CHECK_HEADER(/usr/include/cweb.h, + [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CWEB) + got_cweb="yes" + CWEB_INC= + CWEB_LIBS="-lcweb" + ], [ + # Did not find starndard library, so use our own + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CWEB) + got_cweb="yes" + local_cweb="yes" + CWEB_INC="-I${TOP_DIR}/depkgs/cweb" + CWEB_LIBS="-lcweb" + CWEB_LDFLAGS="-L${TOP_DIR}/depkgs/cweb" + CWEB_SRC="${TOP_DIR}/depkgs/cweb" + ]) + ] +) +AC_SUBST(CWEB_INC) +AC_SUBST(CWEB_LIBS) +AC_SUBST(CWEB_LDFLAGS) +AC_SUBST(CWEB_SRC) + +# End of CWEB stuff +# ----------------------------------------------------------------------- + + + +# ----------------------------------------------------------- +# Check whether user wants TCP wrappers support (default off) +# ----------------------------------------------------------- +TCPW_MSG="no" +AC_ARG_WITH(tcp-wrappers, + [ --with-tcp-wrappers=DIR Enable tcpwrappers support], + [ + if test "x$withval" != "xno" ; then + saved_LIBS="$LIBS" + LIBS="$LIBS -lwrap -lnsl" + AC_MSG_CHECKING(for libwrap) + AC_TRY_LINK( + [ #include + int deny_severity = 0; + int allow_severity = 0; + struct request_info *req; ], + [ hosts_access(req); ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LIBWRAP) + TCPW_MSG="yes" + ], + [AC_MSG_ERROR([*** libwrap missing]) ] + ) + fi + ] +) + +# ------------------------------------------ +# Where to place working dir +# ------------------------------------------ +working_dir=`eval echo ${sysconfdir}/working` +AC_ARG_WITH(working-dir, + [ --with-working-dir=PATH Specify location of Bacula working files], + [ + if test "x$withval" != "xno" ; then + working_dir=$withval + fi + ] +) + +AC_SUBST(working_dir) + +# ------------------------------------------ +# Where to send dump email +# ------------------------------------------ +dump_email=root +AC_ARG_WITH(dump-email, + [ --with-dump-email=Dump email address], + [ + if test "x$withval" != "xno" ; then + dump_email=$withval + fi + ] +) + +AC_SUBST(dump_email) + +# ------------------------------------------ +# Where to send job email +# ------------------------------------------ +job_email=root +AC_ARG_WITH(job-email, + [ --with-job-email=Job output email address], + [ + if test "x$withval" != "xno" ; then + job_email=$withval + fi + ] +) + +AC_SUBST(job_email) + +# ------------------------------------------ +# Where to find smtp host +# ------------------------------------------ +smtp_host=localhost +AC_ARG_WITH(smtp_host, + [ --with-smtp-host=SMTP mail host address], + [ + if test "x$withval" != "xno" ; then + smtp_host=$withval + fi + ] +) + +AC_SUBST(smtp_host) + + +# ------------------------------------ +# Where to place pid files +# ------------------------------------ +piddir=/var/run +AC_ARG_WITH(pid-dir, + [ --with-pid-dir=PATH Specify location of Bacula pid files], + [ + if test "x$withval" != "xno" ; then + piddir=$withval + fi + ] +) + +# make sure the pid directory exists +if test ! -d $piddir ; then + piddir=`eval echo ${sysconfdir}` + case $piddir in + NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;; + esac +fi + +AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir") +AC_SUBST(piddir) + + +# ------------------------------------ +# Where to place subsys "lock file" +# ------------------------------------ +subsysdir=/var/run/subsys +AC_ARG_WITH(subsys-dir, + [ --with-subsys-dir=PATH Specify location of Bacula subsys file], + [ + if test "x$withval" != "xno" ; then + subsysdir=$withval + fi + ] +) + +# make sure the pid directory exists +if test ! -d $subsysdir ; then + subsysdir=`eval echo ${sysconfdir}` + case $subsysdir in + NONE/*) subsysdir=`echo $subsysdir | sed "s~NONE~$ac_default_prefix~"` ;; + esac +fi + +AC_SUBST(subsysdir) + + + +# ------------------------------------ +# Where to start assigning ports +# ------------------------------------ +baseport=9101 +AC_ARG_WITH(baseport, + [ --with-baseport=PORT Specify base port address for daemons], + [ + if test "x$withval" != "xno" ; then + baseport=$withval + fi + ] +) + +AC_SUBST(baseport) +dir_port=`expr $baseport` +fd_port=`expr $baseport + 1` +sd_port=`expr $fd_port + 1` + +AC_SUBST(dir_port) +AC_SUBST(fd_port) +AC_SUBST(sd_port) + + +# ------------------------------------------ +# Generate passwords +# ------------------------------------------ +dir_password= +AC_ARG_WITH(dir-password, + [ --with-dir-password=PASSWORD Specify Director's password], + [ + if test "x$withval" != "xno" ; then + dir_password=$withval + fi + ] +) + +if test "x$dir_password" = "x" ; then + if test "x$OPENSSL" = "xnone" ; then + key=`date | uuencode 1 | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'` + else + key=`openssl rand -base64 33` + fi + dir_password=$key +fi + +fd_password= +AC_ARG_WITH(fd-password, + [ --with-fd-password=PASSWORD Specify Client's password], + [ + if test "x$withval" != "xno" ; then + fd_password=$withval + fi + ] +) + +if test "x$fd_password" = "x" ; then + if test "x$OPENSSL" = "xnone" ; then + key=`date | uuencode 1 | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'` + else + key=`openssl rand -base64 33` + fi + fd_password=$key +fi + +sd_password= +AC_ARG_WITH(sd-password, + [ --with-sd-password=PASSWORD Specify Storage daemon's password], + [ + if test "x$withval" != "xno" ; then + sd_password=$withval + fi + ] +) + +if test "x$sd_password" = "x" ; then + if test "x$OPENSSL" = "xnone" ; then + key=`date | uuencode 1 | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'` + else + key=`openssl rand -base64 33` + fi + sd_password=$key +fi + + +AC_SUBST(dir_password) +AC_SUBST(fd_password) +AC_SUBST(sd_password) + + + +AC_SUBST(cats) + +# ------------------------------------------------ +# Bacula check for various SQL database engines +# ------------------------------------------------ +BA_CHECK_MYSQL_DB + + +# ------------------------------------------------ +# Bacula check for various SQL database engines +# ------------------------------------------------ +BA_CHECK_SQLITE_DB + + +AC_DEFINE(PROTOTYPES) + +dnl# -------------------------------------------------------------------------- +dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure' +dnl# +if test -z "$CFLAGS"; then + if test -z "$CCOPTS"; then + CCOPTS='-O' +dnl> if test "x$GCC" = xyes; then +dnl> if test x$system = xLinux; then +dnl> CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce' +dnl> fi +dnl> fi + fi + CFLAGS="$CCOPTS" +fi + + +dnl A few others +AC_EXEEXT +dnl # AC_SYS_LARGEFILE must modify aclocal.m4 +dnl LARGE_FILE_SUPPORT + + + +AC_PATH_XTRA + +dnl# -------------------------------------------------------------------------- +dnl# CHECKING FOR HEADER FILES +dnl# -------------------------------------------------------------------------- +AC_CHECK_HEADERS( \ + assert.h \ + fcntl.h \ + grp.h \ + libc.h \ + limits.h \ + stdarg.h \ + stdlib.h \ + string.h \ + termios.h \ + unistd.h \ + sys/byteorder.h \ + sys/ioctl.h \ + sys/select.h \ + sys/sockio.h \ + sys/time.h \ +) +AC_HEADER_STDC +AC_HEADER_MAJOR +AC_HEADER_DIRENT +AC_HEADER_STAT +AC_HEADER_SYS_WAIT +AC_HEADER_TIME +AC_STRUCT_ST_BLKSIZE +AC_STRUCT_ST_BLOCKS +AC_STRUCT_TIMEZONE + +# It seems that that many machines where seems to be +# broken just require something like -D_XXX_SOURCE, where XXX might +# be POSIX, POSIX_C, ALL, HPUX or whatever, depending on the machine. + +AC_CACHE_CHECK(for utime.h, tar_cv_header_utime_h, + [AC_TRY_COMPILE([ +#include +#include ], [struct utimbuf foo], + tar_cv_header_utime_h=yes, tar_cv_header_utime_h=no)]) +test $tar_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H) + +AC_C_CONST + + +dnl# -------------------------------------------------------------------------- +dnl# CHECKING FOR FILESYSTEM TYPE +dnl# -------------------------------------------------------------------------- +AC_MSG_CHECKING(how to get filesystem type) +fstype=no +# The order of these tests is important. +AC_TRY_CPP([#include +#include ], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4) +if test $fstype = no; then +AC_TRY_CPP([#include +#include ], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3) +fi +if test $fstype = no; then +AC_TRY_CPP([#include +#include ], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX) +fi +if test $fstype = no; then +AC_TRY_CPP([#include ], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD) +fi +if test $fstype = no; then +AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1) +fi +if test $fstype = no; then +AC_TRY_CPP([#include +#include ], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix) +fi +AC_MSG_RESULT($fstype) + +dnl# -------------------------------------------------------------------------- +dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS. +dnl# -------------------------------------------------------------------------- +AC_TYPE_SIGNAL +SIGNAL_CHECK +AC_TYPE_MODE_T +AC_TYPE_UID_T +AC_TYPE_SIZE_T +AC_TYPE_PID_T +AC_TYPE_OFF_T +AC_CHECK_TYPE(ino_t, unsigned long) +AC_CHECK_TYPE(dev_t, unsigned long) +AC_CHECK_TYPE(daddr_t, long) +AC_CHECK_TYPE(major_t, int) +AC_CHECK_TYPE(minor_t, int) +AC_CHECK_TYPE(ssize_t, int) +AC_STRUCT_ST_BLOCKS +AC_STRUCT_ST_RDEV +AC_STRUCT_TM +AC_C_CONST + + +AC_CHECK_SIZEOF(char, 1) +AC_CHECK_SIZEOF(short int, 2) +AC_CHECK_SIZEOF(int, 4) +AC_CHECK_SIZEOF(long int, 4) +AC_CHECK_SIZEOF(long long int, 8) +AC_CHECK_SIZEOF(int *, 4) + +# Check for sys/types.h types +AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ + AC_TRY_COMPILE( + [ #include ], + [ u_int a; a = 1;], + [ ac_cv_have_u_int="yes" ], + [ ac_cv_have_u_int="no" ] + ) +]) +if test "x$ac_cv_have_u_int" = "xyes" ; then + AC_DEFINE(HAVE_U_INT) + have_u_int=1 +fi + +AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [ + AC_TRY_COMPILE( + [ #include ], + [ intmax_t a; a = 1;], + [ ac_cv_have_intmax_t="yes" ], + [ + AC_TRY_COMPILE( + [ #include ], + [ intmax_t a; a = 1;], + [ ac_cv_have_intmax_t="yes" ], + [ ac_cv_have_intmax_t="no" ] + ) + ] + ) + +]) +if test "x$ac_cv_have_intmax_t" = "xyes" ; then + AC_DEFINE(HAVE_INTMAX_T) + have_intmax_t=1 +fi + + +AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [ + AC_TRY_COMPILE( + [ #include ], + [ u_intmax_t a; a = 1;], + [ ac_cv_have_u_intmax_t="yes" ], + [ + AC_TRY_COMPILE( + [ #include ], + [ u_intmax_t a; a = 1;], + [ ac_cv_have_u_intmax_t="yes" ], + [ ac_cv_have_u_intmax_t="no" ] + ) + ] + ) +]) +if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then + AC_DEFINE(HAVE_U_INTMAX_T) + have_u_intmax_t=1 +fi + + +AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [ + AC_TRY_COMPILE( + [ #include ], + [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], + [ ac_cv_have_intxx_t="yes" ], + [ ac_cv_have_intxx_t="no" ] + ) +]) +if test "x$ac_cv_have_intxx_t" = "xyes" ; then + AC_DEFINE(HAVE_INTXX_T) + have_intxx_t=1 +fi + +AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [ + AC_TRY_COMPILE( + [ #include ], + [ int64_t a; a = 1;], + [ ac_cv_have_int64_t="yes" ], + [ ac_cv_have_int64_t="no" ] + ) +]) +if test "x$ac_cv_have_int64_t" = "xyes" ; then + AC_DEFINE(HAVE_INT64_T) + have_int64_t=1 +fi + +AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [ + AC_TRY_COMPILE( + [ #include ], + [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], + [ ac_cv_have_u_intxx_t="yes" ], + [ ac_cv_have_u_intxx_t="no" ] + ) +]) +if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then + AC_DEFINE(HAVE_U_INTXX_T) + have_u_intxx_t=1 +fi + +AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [ + AC_TRY_COMPILE( + [ #include ], + [ u_int64_t a; a = 1;], + [ ac_cv_have_u_int64_t="yes" ], + [ ac_cv_have_u_int64_t="no" ] + ) +]) +if test "x$ac_cv_have_u_int64_t" = "xyes" ; then + AC_DEFINE(HAVE_U_INT64_T) + have_u_int64_t=1 +fi + +if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ + test "x$ac_cv_header_sys_bitypes_h" = "xyes") +then + AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h]) + AC_TRY_COMPILE( + [ #include ], + [ int8_t a; int16_t b; int32_t c; + u_int8_t e; u_int16_t f; u_int32_t g; + a = b = c = e = f = g = 1; ], + [ AC_DEFINE(HAVE_U_INTXX_T) + AC_DEFINE(HAVE_INTXX_T) + AC_DEFINE(HAVE_SYS_BITYPES_H) + AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no)] + ) +fi + +if test -z "$have_u_intxx_t" ; then + AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [ + AC_TRY_COMPILE( + [ #include ], + [ uint8_t a; uint16_t b; + uint32_t c; a = b = c = 1; ], + [ ac_cv_have_uintxx_t="yes" ], + [ ac_cv_have_uintxx_t="no" ] + ) + ]) + if test "x$ac_cv_have_uintxx_t" = "xyes" ; then + AC_DEFINE(HAVE_UINTXX_T) + fi +fi + + +dnl# -------------------------------------------------------------------------- +dnl# CHECKING FOR LIBRARY FUNCTIONS +dnl# -------------------------------------------------------------------------- +AC_CHECK_FUNCS( \ + fork \ + getcwd \ + gethostname \ + getpid \ + setpgid \ + setpgrp \ + setsid \ + signal \ + strerror \ + strncmp \ + strncpy \ + vfprintf \ + ,, + [echo 'configure: cannot find needed function.'; exit 1] +) + +AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)]) + +AC_CHECK_FUNCS(snprintf vsnprintf) + +AC_CHECK_FUNCS(localtime_r, [AC_DEFINE(HAVE_LOCALTIME_R)]) + +AC_CHECK_FUNCS(readdir_r, [AC_DEFINE(HAVE_READDIR_R)]) + +# Find where sockets are (especially for Solaris) +AC_CHECK_FUNC(socket, + AC_MSG_RESULT(using libc's socket), + AC_CHECK_LIB(xnet,socket) + AC_CHECK_LIB(socket,socket) + AC_CHECK_LIB(inet,socket)) + +# If resolver functions are not in libc check for -lnsl or -lresolv. +AC_CHECK_FUNC(gethostbyname, + AC_MSG_RESULT(using libc's resolver), + AC_CHECK_LIB(nsl,gethostbyname) + AC_CHECK_LIB(resolv,gethostbyname)) + + +AC_FUNC_STRFTIME +AC_FUNC_VPRINTF +AC_FUNC_ALLOCA +AC_FUNC_GETMNTENT +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_SETPGRP dnl check for BSD setpgrp. +AC_FUNC_FNMATCH + + +dnl# FreeBSD needs to link libxpg4 +AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"]) + + +AC_CHECK_LIB(sun, getpwnam) +AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"]) +have_zlib=no +if test x$FDLIBS = x-lz; then + have_zlib=yes +fi + +dnl Check for pthread libraries +PTHREAD_LIB="" +AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_FUNC(pthread_create)] + )] + )] +) + +AC_SUBST(FDLIBS) +AC_DEFINE(FDLIBS) + + +CFLAGS=${CFLAGS--O} +LDFLAGS=${LDFLAGS--O} +LIBS="${LIBS} ${SQL_LFLAGS}" + +CPPFLAGS="$CPPFLAGS" +AC_SUBST(DEBUG) +AC_SUBST(DINCLUDE) +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(X_CFLAGS) +AC_SUBST(LIBS) +AC_SUBST(DLIB) +AC_SUBST(X_LIBS) +AC_SUBST(X_EXTRA_LIBS) + +dnl# extra configurable objects +OBJLIST= +AC_SUBST(OBJLIST) + +lld="lld" +llu="llu" + +# +# Finally we set appropriate distribution specific +# variables and defaults +# +# PFILES are platform specific files +PFILES="platforms/Makefile" +PSCMD="ps -e" +WIN32= +hostname=`hostname` +case "$DISTNAME" in +alpha) + DISTVER=`uname -r` + PTHREAD_LIB="-lpthread -lexc" + if test "${CC}" = "gcc" ; then + lld="lld" + llu="llu" + else + lld="ld" + llu="lu" + fi + TAPEDRIVE="/dev/nrmt0" + ;; +bsdi) + DISTVER=`uname -a |awk '{print $3}'` + TAPEDRIVE="/dev/nrst0" + ;; +caldera) + DISTVER=`cat /etc/.issue | grep Version | cut -f 2 -d ' '` + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +cygwin) + DISTVER=`uname -a |awk '{print $3}'` + TAPEDRIVE="/dev/nrst0" + WIN32=win32 + CFLAGS="${CFLAGS} -mwindows" + LDFLAGS="${LDFLAGS} -mwindows" + ;; +debian) + DISTVER=`cat /etc/debian_version` + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +freebsd) + DISTVER=`uname -a |awk '{print $3}'` + PTHREAD_LIB="-pthread" + CFLAGS="${CFLAGS} -pthread" + lld="qd" + llu="qu" + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -x -o pid,command" + PFILES="${PFILES} \ + platforms/freebsd/Makefile \ + platforms/freebsd/bacula-fd \ + platforms/freebsd/bacula-sd \ + platforms/freebsd/bacula-dir" + hostname=`hostname -s` + ;; +hpux) + DISTVER=`uname -r` + TAPEDRIVE="/dev/rmt/0hnb" + ;; +netbsd) + DISTVER=`uname -a |awk '{print $3}'` + lld="qd" + llu="qu" + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -a -o pid,command" + ;; +openbsd) + DISTVER=`uname -a |awk '{print $3}'` + lld="qd" + llu="qu" + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -a -o pid,command" + ;; +redhat) + DISTVER=`cat /etc/redhat-release | grep release |\ + cut -f 5 -d ' '` + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + PFILES="${PFILES} \ + platforms/redhat/Makefile \ + platforms/redhat/bacula-fd \ + platforms/redhat/bacula-sd \ + platforms/redhat/bacula-dir" + hostname=`hostname -s` + ;; +slackware) + DISTVER=`cat /etc/slackware-version` + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +solaris) + DISTVER=Solaris + TAPEDRIVE="/dev/rmt/0cbn" + PSCMD="ps -e -o pid,comm" + PFILES="${PFILES} \ + platforms/solaris/Makefile \ + platforms/solaris/bacula-fd \ + platforms/solaris/bacula-sd \ + platforms/solaris/bacula-dir" + ;; +suse) + DISTVER=`cat /etc/SuSE-release |grep VERSION|\ + cut -f 3 -d ' '` + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +suse5) + DISTNAME=suse + DISTVER=5.x + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +unknown) + DISTVER=unknown + TAPEDRIVE="/dev/nst0" + ;; +*) + echo " === Something went wrong. Unknown DISTNAME $DISTNAME ===" + ;; +esac + +AC_SUBST(hostname) + + +LIBS="$PTHREAD_LIB $LIBS" + +AC_DEFINE_UNQUOTED(lld, "$lld") +AC_DEFINE_UNQUOTED(llu, "$llu") +AC_SUBST(TAPEDRIVE) +AC_SUBST(PSCMD) +AC_SUBST(WIN32) +AC_SUBST(DISTNAME) +AC_SUBST(DISTVER) + + +dnl# common parts of the Makefile +MCOMMON=./autoconf/Make.common +AC_SUBST_FILE(MCOMMON) + +AC_OUTPUT([autoconf/Make.common \ + Makefile \ + startmysql \ + stopmysql \ + btraceback \ + startit \ + stopit \ + bacula \ + fd \ + doc/Makefile \ + src/Makefile \ + src/console/Makefile \ + src/console/console.conf \ + src/gnome-console/Makefile \ + src/gnome-console/gnome-console.conf \ + src/dird/Makefile \ + src/dird/bacula-dir.conf \ + src/lib/Makefile \ + src/stored/Makefile \ + src/stored/bacula-sd.conf \ + src/filed/Makefile \ + src/filed/bacula-fd.conf \ + src/filed/win32/Makefile \ + src/cats/Makefile \ + src/cats/make_mysql_tables \ + src/cats/drop_mysql_tables \ + src/cats/create_mysql_database \ + src/cats/grant_mysql_privileges \ + src/cats/make_sqlite_tables \ + src/cats/sqlite \ + src/findlib/Makefile \ + $PFILES ], + [(echo "Doing make of dependencies"; make depend;) ] +) + +chmod 755 startmysql stopmysql bacula startit stopit btraceback +cp -f startit stopit btraceback btraceback.gdb src/console +cp -f startit stopit btraceback btraceback.gdb src/dird +cp -f startit stopit btraceback btraceback.gdb src/filed +cp -f startit stopit btraceback btraceback.gdb src/lib +cp -f startit stopit btraceback btraceback.gdb src/stored +chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables +chmod 755 src/cats/make_test_tables src/cats/drop_test_tables +chmod 755 src/cats/create_mysql_database +chmod 755 src/cats/grant_mysql_privileges +chmod 755 src/cats/make_sqlite_tables +chmod 755 src/cats/sqlite + + +echo " +Configuration: + + Host: ${DISTNAME} ${DISTVER} + Bacula version: ${VERSION} (${DATE}) + Source code location: ${srcdir} + Install binaries: ${sbindir} + Install config files: ${sysconfdir} + C Compiler: ${CC} + C++ Compiler: ${CXX} + Compiler flags: ${CFLAGS} + Linker flags: ${LDFLAGS} + Libraries: ${LIBS} + Database found: ${have_db} + Database type: ${db_name} + + Job Output Email: ${job_email} + Traceback Email: ${dump_email} + SMTP Host Address: ${smtp_host} + Director Port ${dir_port} + File daemon Port ${fd_port} + Storage daemon Port ${sd_port} + Working directory ${working_dir} + SQL binaries Directory ${SQL_BINDIR} + + readline support: ${got_readline} ${READLINE_SRC} + cweb support: ${got_cweb} ${CWEB_SRC} + TCP Wrappers support: ${TCPW_MSG} + ZLIB support: ${have_zlib} + enable-smartalloc: ${support_smartalloc} + enable-gnome: ${support_gnome} + gmp support: ${got_gmp} ${GMP_SRC} + + " diff --git a/bacula/autoconf/gnome-macros/Makefile b/bacula/autoconf/gnome-macros/Makefile new file mode 100644 index 0000000000..a8037c36e2 --- /dev/null +++ b/bacula/autoconf/gnome-macros/Makefile @@ -0,0 +1,254 @@ +# Generated automatically from Makefile.in by configure. +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = /bin/sh + +srcdir = . +top_srcdir = .. +prefix = /usr/local +exec_prefix = ${prefix} + +bindir = ${exec_prefix}/bin +sbindir = ${exec_prefix}/sbin +libexecdir = ${exec_prefix}/libexec +datadir = ${prefix}/share +sysconfdir = ${prefix}/etc +sharedstatedir = ${prefix}/com +localstatedir = ${prefix}/var +libdir = ${exec_prefix}/lib +infodir = ${prefix}/info +mandir = ${prefix}/man +includedir = ${prefix}/include +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/bacula +pkglibdir = $(libdir)/bacula +pkgincludedir = $(includedir)/bacula + +top_builddir = .. + +ACLOCAL = aclocal -I macros +AUTOCONF = autoconf +AUTOMAKE = automake +AUTOHEADER = autoheader + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} +transform = s,x,x, + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = +CATOBJEXT = .gmo +CC = gcc +DATADIRNAME = share +GENCAT = +GMOFILES = +GMSGFMT = /usr/bin/msgfmt +GNOMEGNORBA_LIBS = -rdynamic -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -ldl -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib +GNOMEUI_LIBS = -rdynamic -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -ldl -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib +GNOME_APPLETS_LIBS = +GNOME_CAPPLET_LIBS = +GNOME_CONFIG = /usr/bin/gnome-config +GNOME_DOCKLETS_LIBS = +GNOME_INCLUDEDIR = -I/usr/include/gnome-1.0 -DNEED_GNOMESUPPORT_H -I/usr/lib/gnome-libs/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/orbit-1.0 -I/usr/include/gtk-1.2 -I/usr/X11R6/include +GNOME_LIBDIR = -rdynamic -L/usr/lib -L/usr/X11R6/lib +GNOME_LIBS = -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib +GNORBA_CFLAGS = -I/usr/include/gnome-1.0 -DNEED_GNOMESUPPORT_H -I/usr/lib/gnome-libs/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/orbit-1.0 -I/usr/include/gtk-1.2 -I/usr/X11R6/include +GNORBA_LIBS = -rdynamic -L/usr/lib -L/usr/X11R6/lib -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -ldl -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib +GTKXMHTML_LIBS = -rdynamic -lgtkxmhtml -lXpm -ljpeg -lpng -lz -lSM -lICE -lgtk -lgdk -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm +GTK_CFLAGS = -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include +GTK_CONFIG = /usr/bin/gtk-config +GTK_LIBS = -lSM -lICE -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm +GT_NO = +GT_YES = #YES# +INCLUDE_LOCALE_H = #include +INSTOBJEXT = .mo +INTLDEPS = +INTLLIBS = +INTLOBJS = +MAKEINFO = makeinfo +MKINSTALLDIRS = ./mkinstalldirs +MSGFMT = /usr/bin/msgfmt +ORBIT_CFLAGS = -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/orbit-1.0 +ORBIT_CONFIG = /usr/bin/orbit-config +ORBIT_IDL = /usr/bin/orbit-idl +ORBIT_LIBS = -L/usr/lib -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lglib -lnsl -lm +PACKAGE = bacula +POFILES = +POSUB = po +PTHREAD_LIB = -lpthread +RANLIB = ranlib +USE_INCLUDED_LIBINTL = no +USE_NLS = yes +VERSION = 0.1 +XPM_LIBS = -lXpm +ZVT_LIBS = -rdynamic -lzvt -lutil -lSM -lICE -lgdk_imlib -lgtk -lgdk -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm +cflags_set = yes +cxxflags_set = @cxxflags_set@ +l = + +MACROS = aclocal-include.m4 compiler-flags.m4 curses.m4 gnome-bonobo-check.m4 gnome-fileutils.m4 gnome-ghttp-check.m4 gnome-gnorba-check.m4 gnome-guile-checks.m4 gnome-libgtop-check.m4 gnome-objc-checks.m4 gnome-orbit-check.m4 gnome-print-check.m4 gnome-pthread-check.m4 gnome-support.m4 gnome-undelfs.m4 gnome-vfs.m4 gnome-x-checks.m4 gnome-xml-check.m4 gnome.m4 gperf-check.m4 linger.m4 need-declaration.m4 + + +EXTRA_DIST = $(MACROS) gnome-common.m4 gnome-gettext.m4 autogen.sh +MAINTAINERCLEANFILES = macros.dep + +#gnome_aclocaldir = $(datadir)/aclocal/gnome-macros + +#gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 gnome-gettext.m4 autogen.sh +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DATA = $(gnome_aclocal_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +install-gnome_aclocalDATA: $(gnome_aclocal_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir) + @list='$(gnome_aclocal_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + fi; fi; \ + done + +uninstall-gnome_aclocalDATA: + @$(NORMAL_UNINSTALL) + list='$(gnome_aclocal_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + done +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = macros + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu macros/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-gnome_aclocalDATA +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-gnome_aclocalDATA +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: uninstall-gnome_aclocalDATA install-gnome_aclocalDATA tags \ +distdir info-am info dvi-am dvi check check-am installcheck-am \ +installcheck install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +macros.dep: Makefile.am + @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ + +#gnome-macros.dep: Makefile.am +# @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bacula/autoconf/gnome-macros/Makefile.am b/bacula/autoconf/gnome-macros/Makefile.am new file mode 100644 index 0000000000..f5cc043be2 --- /dev/null +++ b/bacula/autoconf/gnome-macros/Makefile.am @@ -0,0 +1,42 @@ +## Please update this variable if any new macros are created + +MACROS= \ + aclocal-include.m4 \ + compiler-flags.m4 \ + curses.m4 \ + gnome-bonobo-check.m4 \ + gnome-fileutils.m4 \ + gnome-ghttp-check.m4 \ + gnome-gnorba-check.m4 \ + gnome-guile-checks.m4 \ + gnome-libgtop-check.m4 \ + gnome-objc-checks.m4 \ + gnome-orbit-check.m4 \ + gnome-print-check.m4 \ + gnome-pthread-check.m4 \ + gnome-support.m4 \ + gnome-undelfs.m4 \ + gnome-vfs.m4 \ + gnome-x-checks.m4 \ + gnome-xml-check.m4 \ + gnome.m4 \ + gperf-check.m4 \ + linger.m4 \ + need-declaration.m4 + +EXTRA_DIST=$(MACROS) gnome-common.m4 gnome-gettext.m4 autogen.sh +MAINTAINERCLEANFILES=macros.dep + +@MAINT@macros.dep: Makefile.am +@MAINT@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ + +if INSIDE_GNOME_COMMON +gnome_aclocaldir = $(datadir)/aclocal/gnome-macros + +gnome-macros.dep: Makefile.am + @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@ + +gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 \ + gnome-gettext.m4 autogen.sh + +endif diff --git a/bacula/autoconf/gnome-macros/Makefile.in b/bacula/autoconf/gnome-macros/Makefile.in new file mode 100644 index 0000000000..111a372c79 --- /dev/null +++ b/bacula/autoconf/gnome-macros/Makefile.in @@ -0,0 +1,254 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_DOCKLETS_LIBS = @GNOME_DOCKLETS_LIBS@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +MACROS = aclocal-include.m4 compiler-flags.m4 curses.m4 gnome-bonobo-check.m4 gnome-fileutils.m4 gnome-ghttp-check.m4 gnome-gnorba-check.m4 gnome-guile-checks.m4 gnome-libgtop-check.m4 gnome-objc-checks.m4 gnome-orbit-check.m4 gnome-print-check.m4 gnome-pthread-check.m4 gnome-support.m4 gnome-undelfs.m4 gnome-vfs.m4 gnome-x-checks.m4 gnome-xml-check.m4 gnome.m4 gperf-check.m4 linger.m4 need-declaration.m4 + + +EXTRA_DIST = $(MACROS) gnome-common.m4 gnome-gettext.m4 autogen.sh +MAINTAINERCLEANFILES = macros.dep + +@INSIDE_GNOME_COMMON_TRUE@gnome_aclocaldir = $(datadir)/aclocal/gnome-macros + +@INSIDE_GNOME_COMMON_TRUE@gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 gnome-gettext.m4 autogen.sh +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DATA = $(gnome_aclocal_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +install-gnome_aclocalDATA: $(gnome_aclocal_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir) + @list='$(gnome_aclocal_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + fi; fi; \ + done + +uninstall-gnome_aclocalDATA: + @$(NORMAL_UNINSTALL) + list='$(gnome_aclocal_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + done +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = macros + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu macros/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-gnome_aclocalDATA +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-gnome_aclocalDATA +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: uninstall-gnome_aclocalDATA install-gnome_aclocalDATA tags \ +distdir info-am info dvi-am dvi check check-am installcheck-am \ +installcheck install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +macros.dep: Makefile.am + @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ + +@INSIDE_GNOME_COMMON_TRUE@gnome-macros.dep: Makefile.am +@INSIDE_GNOME_COMMON_TRUE@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bacula/autoconf/gnome-macros/aclocal-include.m4 b/bacula/autoconf/gnome-macros/aclocal-include.m4 new file mode 100644 index 0000000000..43f9dbc48a --- /dev/null +++ b/bacula/autoconf/gnome-macros/aclocal-include.m4 @@ -0,0 +1,16 @@ +# aclocal-include.m4 +# +# This macro adds the name macrodir to the set of directories +# that `aclocal' searches for macros. + +# serial 1 + +dnl AM_ACLOCAL_INCLUDE(macrodir) +AC_DEFUN([AM_ACLOCAL_INCLUDE], +[ + AM_CONDITIONAL(INSIDE_GNOME_COMMON, false) + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done +]) diff --git a/bacula/autoconf/gnome-macros/autogen.sh b/bacula/autoconf/gnome-macros/autogen.sh new file mode 100644 index 0000000000..71f7dfcf92 --- /dev/null +++ b/bacula/autoconf/gnome-macros/autogen.sh @@ -0,0 +1,207 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +DIE=0 + +if [ -n "$GNOME2_PATH" ]; then + ACLOCAL_FLAGS="-I $GNOME2_PATH/share/aclocal $ACLOCAL_FLAGS" + PATH="$GNOME2_PATH/bin:$PATH" + export PATH +fi + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AC_PROG_INTLTOOL" $srcdir/configure.in >/dev/null) && { + (intltoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`intltoolize' installed to compile $PKG_NAME." + echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.10.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.in >/dev/null) && { + (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`xml-i18n-toolize' installed to compile $PKG_NAME." + echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/xml-i18n-tools/xml-i18n-tools-0.9.tar.gz" + echo "(or a newer version of xml-i18n-tools or intltool if it is available)" + DIE=1 + } +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +#grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && { +# grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ +# (gettext --version) < /dev/null > /dev/null 2>&1 || { +# echo +# echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME." +# echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.10.39.tar.gz" +# echo "(or a newer version if it is available)" +# DIE=1 +# } +#} + +#grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && { +# grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ +# (gettext --version) < /dev/null > /dev/null 2>&1 || { +# echo +# echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME." +# echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.10.39.tar.gz" +# echo "(or a newer version if it is available)" +# DIE=1 +# } +#} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile $PKG_NAME." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -name configure.in -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo processing $dr + macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` + ( cd $dr + macrosdir=`find . -name macros -print` + for i in $macrodirs; do + if test -f $i/gnome-gettext.m4; then + DELETEFILES="$DELETEFILES $i/gnome-gettext.m4" + fi + done + + echo "deletefiles is $DELETEFILES" + aclocalinclude="$ACLOCAL_FLAGS" + for k in $aclocalinclude; do + if test -d $k; then + if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then + rm -f $DELETEFILES + fi + fi + done + for k in $macrodirs; do + if test -d $k; then + aclocalinclude="$aclocalinclude -I $k" + if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then + rm -f $DELETEFILES + fi + fi + done + if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then + if grep "sed.*POTFILES" configure.in >/dev/null; then + : do nothing -- we still have an old unmodified configure.in + else + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + echo "no" | gettextize --force --copy + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + fi + if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + echo "no" | gettextize --force --copy + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + if grep "^AC_PROG_INTLTOOL" configure.in >/dev/null; then + echo "Running intltoolize..." + intltoolize --copy --force --automake + fi + if grep "^AM_PROG_XML_I18N_TOOLS" configure.in >/dev/null; then + echo "Running xml-i18n-toolize..." + xml-i18n-toolize --copy --force --automake + fi + if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + fi + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 + } + + if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } + fi + echo "Running automake --gnu $am_opt ..." + automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } + echo "Running autoconf ..." + autoconf || { echo "**Error**: autoconf failed."; exit 1; } + ) || exit 1 + fi +done + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi diff --git a/bacula/autoconf/gnome-macros/compiler-flags.m4 b/bacula/autoconf/gnome-macros/compiler-flags.m4 new file mode 100644 index 0000000000..63f8e2e6ac --- /dev/null +++ b/bacula/autoconf/gnome-macros/compiler-flags.m4 @@ -0,0 +1,109 @@ +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) + +dnl For C++, do basically the same thing. + +AC_DEFUN([GNOME_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) diff --git a/bacula/autoconf/gnome-macros/curses.m4 b/bacula/autoconf/gnome-macros/curses.m4 new file mode 100644 index 0000000000..5307e13d38 --- /dev/null +++ b/bacula/autoconf/gnome-macros/curses.m4 @@ -0,0 +1,318 @@ +dnl Curses detection: Munged from Midnight Commander's configure.in +dnl +dnl What it does: +dnl ============= +dnl +dnl - Determine which version of curses is installed on your system +dnl and set the -I/-L/-l compiler entries and add a few preprocessor +dnl symbols +dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that +dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in +dnl Makefile.in's +dnl - Modify the following configure variables (these are the only +dnl curses.m4 variables you can access from within configure.in) +dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if +dnl an ncurses.h that's been renamed to curses.h +dnl is found. +dnl CURSES_LIBS - sets -L and -l's appropriately +dnl CFLAGS - if --with-sco, add -D_SVID3 +dnl has_curses - exports result of tests to rest of configure +dnl +dnl Usage: +dnl ====== +dnl 1) Add lines indicated below to acconfig.h +dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in +dnl 3) Instead of #include you should use the following to +dnl properly locate ncurses or curses header file +dnl +dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +dnl #include +dnl #else +dnl #include +dnl #endif +dnl +dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags +dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS +dnl +dnl Notes with automake: +dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from +dnl configure.in +dnl - your Makefile.am can look something like this +dnl ----------------------------------------------- +dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR) +dnl if HAS_CURSES +dnl CURSES_TARGETS=name_of_curses_prog +dnl endif +dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS) +dnl other_programs_SOURCES = blah blah blah +dnl name_of_curses_prog_SOURCES = blah blah blah +dnl other_programs_LDADD = blah +dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS) +dnl ----------------------------------------------- +dnl +dnl +dnl The following lines should be added to acconfig.h: +dnl ================================================== +dnl +dnl /*=== Curses version detection defines ===*/ +dnl /* Found some version of curses that we're going to use */ +dnl #undef HAS_CURSES +dnl +dnl /* Use SunOS SysV curses? */ +dnl #undef USE_SUNOS_CURSES +dnl +dnl /* Use old BSD curses - not used right now */ +dnl #undef USE_BSD_CURSES +dnl +dnl /* Use SystemV curses? */ +dnl #undef USE_SYSV_CURSES +dnl +dnl /* Use Ncurses? */ +dnl #undef USE_NCURSES +dnl +dnl /* If you Curses does not have color define this one */ +dnl #undef NO_COLOR_CURSES +dnl +dnl /* Define if you want to turn on SCO-specific code */ +dnl #undef SCO_FLAVOR +dnl +dnl /* Set to reflect version of ncurses * +dnl * 0 = version 1.* +dnl * 1 = version 1.9.9g +dnl * 2 = version 4.0/4.1 */ +dnl #undef NCURSES_970530 +dnl +dnl /*=== End new stuff for acconfig.h ===*/ +dnl + + +AC_DEFUN([AC_CHECK_CURSES],[ + search_ncurses=true + screen_manager="" + has_curses=false + + CFLAGS=${CFLAGS--O} + + AC_SUBST(CURSES_LIBS) + AC_SUBST(CURSES_INCLUDEDIR) + + AC_ARG_WITH(sco, + [ --with-sco Use this to turn on SCO-specific code],[ + if test x$withval = xyes; then + AC_DEFINE(SCO_FLAVOR) + CFLAGS="$CFLAGS -D_SVID3" + fi + ]) + + AC_ARG_WITH(sunos-curses, + [ --with-sunos-curses Used to force SunOS 4.x curses],[ + if test x$withval = xyes; then + AC_USE_SUNOS_CURSES + fi + ]) + + AC_ARG_WITH(osf1-curses, + [ --with-osf1-curses Used to force OSF/1 curses],[ + if test x$withval = xyes; then + AC_USE_OSF1_CURSES + fi + ]) + + AC_ARG_WITH(vcurses, + [ --with-vcurses[=incdir] Used to force SysV curses], + if test x$withval != xyes; then + CURSES_INCLUDEDIR="-I$withval" + fi + AC_USE_SYSV_CURSES + ) + + AC_ARG_WITH(ncurses, + [ --with-ncurses[=dir] Compile with ncurses/locate base dir], + if test x$withval = xno ; then + search_ncurses=false + elif test x$withval != xyes ; then + CURSES_LIBS="$LIBS -L$withval/lib -lncurses" + CURSES_INCLUDEDIR="-I$withval/include" + search_ncurses=false + screen_manager="ncurses" + AC_DEFINE(USE_NCURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + fi + ) + + if $search_ncurses + then + AC_SEARCH_NCURSES() + fi + + +]) + + +AC_DEFUN([AC_USE_SUNOS_CURSES], [ + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses) + AC_DEFINE(USE_SUNOS_CURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + AC_MSG_RESULT(Please note that some screen refreshs may fail) +]) + +AC_DEFUN([AC_USE_OSF1_CURSES], [ + AC_MSG_RESULT(Using OSF1 curses) + search_ncurses=false + screen_manager="OSF1 curses" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_LIBS="-lcurses" +]) + +AC_DEFUN([AC_USE_SYSV_CURSES], [ + AC_MSG_RESULT(Using SysV curses) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_SYSV_CURSES) + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" +]) + +dnl AC_ARG_WITH(bsd-curses, +dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy], +dnl search_ncurses=false +dnl screen_manager="Ultrix/cursesX" +dnl if test $system = ULTRIX +dnl then +dnl THIS_CURSES=cursesX +dnl else +dnl THIS_CURSES=curses +dnl fi +dnl +dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap" +dnl AC_DEFINE(HAS_CURSES) +dnl has_curses=true +dnl AC_DEFINE(USE_BSD_CURSES) +dnl AC_MSG_RESULT(Please note that some screen refreshs may fail) +dnl AC_MSG_WARN(Use of the bsdcurses extension has some) +dnl AC_MSG_WARN(display/input problems.) +dnl AC_MSG_WARN(Reconsider using xcurses) +dnl) + + +dnl +dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename +dnl +AC_DEFUN([AC_NCURSES], [ + if $search_ncurses + then + if test -f $1/$2 + then + AC_MSG_RESULT(Found ncurses on $1/$2) + CURSES_LIBS="$3" + CURSES_INCLUDEDIR="$4" + search_ncurses=false + screen_manager=$5 + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + fi + fi +]) + +AC_DEFUN([AC_SEARCH_NCURSES], [ + AC_CHECKING("location of ncurses.h file") + + AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include") + AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses") + AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local") + AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses") + + AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses") + + AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses") + + dnl + dnl We couldn't find ncurses, try SysV curses + dnl + if $search_ncurses + then + AC_EGREP_HEADER(init_color, /usr/include/curses.h, + AC_USE_SYSV_CURSES) + AC_EGREP_CPP(USE_NCURSES,[ +#include +#ifdef __NCURSES_H +#undef USE_NCURSES +USE_NCURSES +#endif +],[ + CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + search_ncurses=false + screen_manager="ncurses installed as curses" +]) + fi + + dnl + dnl Try SunOS 4.x /usr/5{lib,include} ncurses + dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES + dnl should be replaced by a more fine grained selection routine + dnl + if $search_ncurses + then + if test -f /usr/5include/curses.h + then + AC_USE_SUNOS_CURSES + fi + else + # check for ncurses version, to properly ifdef mouse-fix + AC_MSG_CHECKING(for ncurses version) + ncurses_version=unknown +cat > conftest.$ac_ext < +#else +#include +#endif +#undef VERSION +VERSION:NCURSES_VERSION +EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | + egrep "VERSION:" >conftest.out 2>&1; then +changequote(,)dnl + ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'` +changequote([,])dnl + fi + rm -rf conftest* + AC_MSG_RESULT($ncurses_version) + case "$ncurses_version" in +changequote(,)dnl + 4.[01]) +changequote([,])dnl + AC_DEFINE(NCURSES_970530,2) + ;; + 1.9.9g) + AC_DEFINE(NCURSES_970530,1) + ;; + 1*) + AC_DEFINE(NCURSES_970530,0) + ;; + esac + fi +]) + + + + + diff --git a/bacula/autoconf/gnome-macros/gnome-bonobo-check.m4 b/bacula/autoconf/gnome-macros/gnome-bonobo-check.m4 new file mode 100644 index 0000000000..daa109c0f4 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-bonobo-check.m4 @@ -0,0 +1,166 @@ +# Configure paths for Bonobo +# Miguel de Icaza, 99-04-12 +# Stolen from Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS +dnl +AC_DEFUN([AM_PATH_BONOBO], +[ +dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)], + bonobo_prefix="$withval", bonobo_prefix="") +AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)], + bonobo_exec_prefix="$withval", bonobo_exec_prefix="") +AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program], + , enable_bonobotest=yes) + + if test x$bonobo_exec_prefix != x ; then + bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config + fi + fi + if test x$bonobo_prefix != x ; then + bonobo_args="$bonobo_args --prefix=$bonobo_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_bonobo_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version) + no_bonobo="" + if test "$GNOME_CONFIG" = "no" ; then + no_bonobo=yes + else + BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo bonobox` + BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo bonobox` + + bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_bonobotest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" +dnl +dnl Now check if the installed BONOBO is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.bonobotest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.bonobotest"); + bonobo_object_get_type (); + return 0; +} + +],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_bonobo" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.bonobotest ; then + : + else + echo "*** Could not run BONOBO test program, checking why..." + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding BONOBO or finding the wrong" + echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means BONOBO was incorrectly installed" + echo "*** or that you have moved BONOBO since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + BONOBO_CFLAGS="" + BONOBO_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(BONOBO_CFLAGS) + AC_SUBST(BONOBO_LIBS) + rm -f conf.bonobotest +]) + +AC_DEFUN([BONOBO_CHECK], [ + AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)]) +]) + +AC_DEFUN([AM_BONOBO_USES_OAF], +[ + AC_REQUIRE([AM_PATH_BONOBO]) + + AC_MSG_CHECKING(if Bonobo uses OAF) + if ( gnome-config --libs bonobo | grep oaf ) > /dev/null 2>&1 ; then + using_oaf="yes" + AC_DEFINE(BONOBO_USES_OAF) + else + using_oaf="no" + fi + + AC_MSG_RESULT("$using_oaf") + + AM_CONDITIONAL(BONOBO_USES_OAF, test x"using_oaf" = "xyes") +]) diff --git a/bacula/autoconf/gnome-macros/gnome-common.m4 b/bacula/autoconf/gnome-macros/gnome-common.m4 new file mode 100644 index 0000000000..83bb00d709 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-common.m4 @@ -0,0 +1,14 @@ +# gnome-common.m4 +# +# This only for packages that are not in the GNOME CVS tree. + +dnl GNOME_COMMON_INIT + +AC_DEFUN([GNOME_COMMON_INIT], +[ + GNOME_ACLOCAL_DIR="$GNOME_COMMON_MACROS_DIR" + AC_SUBST(GNOME_ACLOCAL_DIR) + + ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" +]) + diff --git a/bacula/autoconf/gnome-macros/gnome-fileutils.m4 b/bacula/autoconf/gnome-macros/gnome-fileutils.m4 new file mode 100644 index 0000000000..a8456f2a8f --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-fileutils.m4 @@ -0,0 +1,414 @@ +dnl +dnl GNOME_FILEUTILS_CHECKS +dnl +dnl checks that are needed for the diskusage applet. +dnl + +AC_DEFUN([GNOME_FILEUTILS_CHECKS], +[ +AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \ +mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \ +sys/filsys.h sys/fs_types.h sys/fs/s5param.h) + +AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \ +getcwd getmntinfo gettimeofday isascii lchown \ +listmntent memcpy mkfifo strchr strerror strrchr vprintf) + +dnl Set some defaults when cross-compiling + +if test x$cross_compiling = xyes ; then + case "$host_os" in + linux*) + fu_cv_sys_mounted_getmntent1=yes + fu_cv_sys_stat_statfs2_bsize=yes + ;; + sunos*) + fu_cv_sys_stat_statfs4=yes + ;; + freebsd*) + fu_cv_sys_stat_statfs2_bsize=yes + ;; + osf*) + fu_cv_sys_stat_statfs3_osf1=yes + ;; + esac +fi + +# Determine how to get the list of mounted filesystems. +list_mounted_fs= + +# If the getmntent function is available but not in the standard library, +# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX). +AC_FUNC_GETMNTENT + +# This test must precede the ones for getmntent because Unicos-9 is +# reported to have the getmntent function, but its support is incompatible +# with other getmntent implementations. + +# NOTE: Normally, I wouldn't use a check for system type as I've done for +# `CRAY' below since that goes against the whole autoconf philosophy. But +# I think there is too great a chance that some non-Cray system has a +# function named listmntent to risk the false positive. + +if test -z "$list_mounted_fs"; then +# Cray UNICOS 9 +AC_MSG_CHECKING([for listmntent of Cray/Unicos-9]) +AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent, +[fu_cv_sys_mounted_cray_listmntent=no +AC_EGREP_CPP(yes, +[#ifdef _CRAY +yes +#endif +], [test $ac_cv_func_listmntent = yes \ +&& fu_cv_sys_mounted_cray_listmntent=yes] +) +] +) +AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) +if test $fu_cv_sys_mounted_cray_listmntent = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_LISTMNTENT) +fi +fi + +if test $ac_cv_func_getmntent = yes; then + +# This system has the getmntent function. +# Determine whether it's the one-argument variant or the two-argument one. + +if test -z "$list_mounted_fs"; then +# 4.3BSD, SunOS, HP-UX, Dynix, Irix +AC_MSG_CHECKING([for one-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, +[test $ac_cv_header_mntent_h = yes \ +&& fu_cv_sys_mounted_getmntent1=yes \ +|| fu_cv_sys_mounted_getmntent1=no]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) +if test $fu_cv_sys_mounted_getmntent1 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT1) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR4 +AC_MSG_CHECKING([for two-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2, +[AC_EGREP_HEADER(getmntent, sys/mnttab.h, +fu_cv_sys_mounted_getmntent2=yes, +fu_cv_sys_mounted_getmntent2=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) +if test $fu_cv_sys_mounted_getmntent2 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT2) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +fi + +fi + +if test -z "$list_mounted_fs"; then +# DEC Alpha running OSF/1. +AC_MSG_CHECKING([for getfsstat function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getsstat, +[AC_TRY_LINK([ +#include +#include +#include ], +[struct statfs *stats; +int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ], +fu_cv_sys_mounted_getsstat=yes, +fu_cv_sys_mounted_getsstat=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getsstat) +if test $fu_cv_sys_mounted_getsstat = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETFSSTAT) +fi +fi + +if test -z "$list_mounted_fs"; then +# AIX. +AC_MSG_CHECKING([for mntctl function and struct vmount]) +AC_CACHE_VAL(fu_cv_sys_mounted_vmount, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_vmount=yes, +fu_cv_sys_mounted_vmount=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_vmount) +if test $fu_cv_sys_mounted_vmount = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_VMOUNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR3 +AC_MSG_CHECKING([for FIXME existence of three headers]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, +[AC_TRY_CPP([ +#include +#include +#include ], +fu_cv_sys_mounted_fread_fstyp=yes, +fu_cv_sys_mounted_fread_fstyp=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) +if test $fu_cv_sys_mounted_fread_fstyp = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD_FSTYP) +fi +fi + +if test -z "$list_mounted_fs"; then +# 4.4BSD and DEC OSF/1. +AC_MSG_CHECKING([for getmntinfo function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, +[ +ok= +if test $ac_cv_func_getmntinfo = yes; then +AC_EGREP_HEADER(f_type;, sys/mount.h, +ok=yes) +fi +test -n "$ok" \ +&& fu_cv_sys_mounted_getmntinfo=yes \ +|| fu_cv_sys_mounted_getmntinfo=no +]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) +if test $fu_cv_sys_mounted_getmntinfo = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTINFO) +fi +fi + +# FIXME: add a test for netbsd-1.1 here + +if test -z "$list_mounted_fs"; then +# Ultrix +AC_MSG_CHECKING([for getmnt function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmnt, +[AC_TRY_CPP([ +#include +#include ], +fu_cv_sys_mounted_getmnt=yes, +fu_cv_sys_mounted_getmnt=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) +if test $fu_cv_sys_mounted_getmnt = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR2 +AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_fread=yes, +fu_cv_sys_mounted_fread=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread) +if test $fu_cv_sys_mounted_fread = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +# FIXME -- no need to abort building the whole package +# Cannot build mountlist.c or anything that needs its functions +fi + +AC_CHECKING(how to get filesystem space usage) +space=no + +# Perform only the link test since it seems there are no variants of the +# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs) +# because that got a false positive on SCO OSR5. Adding the declaration +# of a `struct statvfs' causes this test to fail (as it should) on such +# systems. That system is reported to work fine with STAT_STATFS4 which +# is what it gets when this test fails. +if test $space = no; then +# SVR4 +AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs, +[AC_TRY_LINK([#include +#include ], +[struct statvfs fsd; statvfs (0, &fsd);], +fu_cv_sys_stat_statvfs=yes, +fu_cv_sys_stat_statvfs=no)]) +if test $fu_cv_sys_stat_statvfs = yes; then +space=yes +AC_DEFINE(STAT_STATVFS) +fi +fi + +if test $space = no; then +# DEC Alpha running OSF/1 +AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1, +[AC_TRY_RUN([ +#include +#include +#include +int main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +return (statfs (".", &fsd, sizeof (struct statfs))); +}], +fu_cv_sys_stat_statfs3_osf1=yes, +fu_cv_sys_stat_statfs3_osf1=no, +fu_cv_sys_stat_statfs3_osf1=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1) +if test $fu_cv_sys_stat_statfs3_osf1 = yes; then +space=yes +AC_DEFINE(STAT_STATFS3_OSF1) +fi +fi + +if test $space = no; then +# AIX +AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl +member (AIX, 4.3BSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize, +[AC_TRY_RUN([ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +int main () +{ +struct statfs fsd; +fsd.f_bsize = 0; +return (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_bsize=yes, +fu_cv_sys_stat_statfs2_bsize=no, +fu_cv_sys_stat_statfs2_bsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize) +if test $fu_cv_sys_stat_statfs2_bsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_BSIZE) +fi +fi + +if test $space = no; then +# SVR3 +AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs4, +[AC_TRY_RUN([#include +#include +int main () +{ +struct statfs fsd; +return (statfs (".", &fsd, sizeof fsd, 0)); +}], +fu_cv_sys_stat_statfs4=yes, +fu_cv_sys_stat_statfs4=no, +fu_cv_sys_stat_statfs4=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs4) +if test $fu_cv_sys_stat_statfs4 = yes; then +space=yes +AC_DEFINE(STAT_STATFS4) +fi +fi + +if test $space = no; then +# 4.4BSD and NetBSD +AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl +member (4.4BSD and NetBSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +int main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +return (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_fsize=yes, +fu_cv_sys_stat_statfs2_fsize=no, +fu_cv_sys_stat_statfs2_fsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize) +if test $fu_cv_sys_stat_statfs2_fsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FSIZE) +fi +fi + +if test $space = no; then +# Ultrix +AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) +AC_CACHE_VAL(fu_cv_sys_stat_fs_data, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_FS_TYPES_H +#include +#endif +int main () +{ +struct fs_data fsd; +/* Ultrix's statfs returns 1 for success, +0 for not mounted, -1 for failure. */ +return (statfs (".", &fsd) != 1); +}], +fu_cv_sys_stat_fs_data=yes, +fu_cv_sys_stat_fs_data=no, +fu_cv_sys_stat_fs_data=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_fs_data) +if test $fu_cv_sys_stat_fs_data = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FS_DATA) +fi +fi + +if test $space = no; then +# SVR2 +AC_TRY_CPP([#include ], +AC_DEFINE(STAT_READ_FILSYS) space=yes) +fi + +if test -n "$list_mounted_fs" && test $space != no; then +DF_PROG="df" +# LIBOBJS="$LIBOBJS fsusage.o" +# LIBOBJS="$LIBOBJS mountlist.o" +fi + +# Check for SunOS statfs brokenness wrt partitions 2GB and larger. +# If exists and struct statfs has a member named f_spare, +# enable the work-around code in fsusage.c. +AC_MSG_CHECKING([for statfs that truncates block counts]) +AC_CACHE_VAL(fu_cv_sys_truncating_statfs, +[AC_TRY_COMPILE([ +#if !defined(sun) && !defined(__sun) +choke -- this is a workaround for a Sun-specific problem +#endif +#include +#include ], +[struct statfs t; long c = *(t.f_spare);], +fu_cv_sys_truncating_statfs=yes, +fu_cv_sys_truncating_statfs=no, +)]) +if test $fu_cv_sys_truncating_statfs = yes; then +AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS) +fi +AC_MSG_RESULT($fu_cv_sys_truncating_statfs) + +AC_CHECKING(for AFS) +test -d /afs && AC_DEFINE(AFS) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-ghttp-check.m4 b/bacula/autoconf/gnome-macros/gnome-ghttp-check.m4 new file mode 100644 index 0000000000..0ecacaaf05 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-ghttp-check.m4 @@ -0,0 +1,14 @@ +AC_DEFUN([GNOME_GHTTP_CHECK],[ + AC_REQUIRE([GNOME_INIT_HOOK]) + GHTTP_LIB= + AC_CHECK_FUNC(connect,,[ + AC_CHECK_LIB(socket,connect, + GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_FUNC(gethostbyname,,[ + AC_CHECK_LIB(nsl,gethostbyname, + GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_LIB(ghttp, ghttp_request_new, + GHTTP_LIB="-lghttp $GHTTP_LIB",GHTTP_LIB="",-L$gnome_prefix $GHTTP_LIB) + AC_SUBST(GHTTP_LIB) + AC_PROVIDE([GNOME_GHTTP_CHECK]) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-gnorba-check.m4 b/bacula/autoconf/gnome-macros/gnome-gnorba-check.m4 new file mode 100644 index 0000000000..dbac0a6cf7 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-gnorba-check.m4 @@ -0,0 +1,35 @@ +dnl +dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) +dnl +dnl if failflag is "failure" it aborts if gnorba is not found. +dnl + +AC_DEFUN([GNOME_GNORBA_HOOK],[ + GNOME_ORBIT_HOOK([],$2) + AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + ]) + AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + AC_SUBST(GNORBA_CFLAGS) + AC_SUBST(GNORBA_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(gnorba library not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_GNORBA_CHECK], [ + GNOME_GNORBA_HOOK([],failure) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-guile-checks.m4 b/bacula/autoconf/gnome-macros/gnome-guile-checks.m4 new file mode 100644 index 0000000000..102351cffd --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-guile-checks.m4 @@ -0,0 +1,134 @@ +dnl +dnl GNOME_CHECK_GUILE (failflag) +dnl +dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found. +dnl + +AC_DEFUN([GNOME_CHECK_GUILE], +[ +dnl AC_MSG_WARN([Withval is: $withval]) + guile_msg = 'Huh?' +if test x$withval = xno ; then + guile_msg = 'disabled' + GUILE_LIBS= + GUILE_INCS= + AC_SUBST(GUILE_LIBS) + AC_SUBST(GUILE_INCS) + AM_CONDITIONAL(GUILE, /bin/false) +else + guile_msg="no" + + saved_ldflags="$LDFLAGS" + saved_cppflags="$CPPFLAGS" + LDFLAGS="$LDFLAGS $GNOME_LIBDIR" + + AC_CHECK_LIB(qthreads,qt_null,[ + QTTHREADS_LIB="-lqthreads" + ],[ + AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt") + ],$LIBS) + AC_SUBST(QTTHREADS_LIB) + + AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap") + AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB) + + AC_SUBST(TERMCAP_LIB) + AC_SUBST(READLINE_LIB) + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-guile-config" + else + name_build_guile="guile-config" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + else + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-build-guile" + else + name_build_guile="build-guile" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + fi + fi + + AC_CHECK_LIB(m, sin) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(for guile libraries) + GUILE_LIBS="`$name_build_guile link`" + AC_MSG_RESULT($GUILE_LIBS) + AC_MSG_CHECKING(for guile headers) + GUILE_INCS="`$name_build_guile compile`" + AC_MSG_RESULT($GUILE_INCS) + else + GUILE_LIBS="$GNOME_LIBDIR" + GUILE_INCS="$GNOME_INCLUDEDIR" + AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS") + AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS") + AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS") + AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl") + AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket") + GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB" + fi + + AC_SUBST(GUILE_LIBS) + AC_SUBST(GUILE_INCS) + + saved_LIBS="$LIBS" + LIBS="$LIBS $GUILE_LIBS" + CPPFLAGS="$saved_cppflags $GUILE_INCS" + + AC_MSG_CHECKING(whether guile works) + AC_TRY_LINK([ + #include + #include + ],[ + gh_eval_str("(newline)"); + scm_boot_guile(0,NULL,NULL,NULL); + ],[ + ac_cv_guile_found=yes + AC_DEFINE(HAVE_GUILE) + ],[ + ac_cv_guile_found=no + ]) + AC_MSG_RESULT($ac_cv_guile_found) + + guile_msg=$ac_cv_guile_found + + if test x$ac_cv_guile_found = xno ; then + if test x$1 = xfail ; then + AC_MSG_ERROR(Can not find Guile on this system) + else + AC_MSG_WARN(Can not find Guile on this system) + fi + ac_cv_guile_found=no + GUILE_LIBS= GUILE_INCS= + fi + + LIBS="$saved_LIBS" + LDFLAGS="$saved_ldflags" + CPPFLAGS="$saved_cppflags" + + AC_SUBST(GUILE_LIBS) + AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes) +fi +]) diff --git a/bacula/autoconf/gnome-macros/gnome-libgtop-check.m4 b/bacula/autoconf/gnome-macros/gnome-libgtop-check.m4 new file mode 100644 index 0000000000..1b4e1745cb --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-libgtop-check.m4 @@ -0,0 +1,217 @@ +dnl +dnl LIBGTOP_CHECK_TYPE +dnl +dnl Improved version of AC_CHECK_TYPE which takes into account +dnl that we need to #include some other header files on some +dnl systems to get some types. + +dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN([AC_LIBGTOP_CHECK_TYPE], +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include +#if STDC_HEADERS +#include +#include +#endif + +/* For Tru64 */ +#ifdef HAVE_SYS_BITYPES_H +#include +#endif +], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = no; then + AC_DEFINE($1, $2) +fi +]) + +dnl +dnl GNOME_LIBGTOP_TYPES +dnl +dnl some typechecks for libgtop. +dnl + +AC_DEFUN([GNOME_LIBGTOP_TYPES], +[ + AC_CHECK_HEADERS(sys/bitypes.h) + AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int) + AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int) +]) + +dnl +dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag) +dnl +dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop +dnl is not found. +dnl + +AC_DEFUN([GNOME_LIBGTOP_HOOK], +[ + AC_REQUIRE([GNOME_LIBGTOP_TYPES]) + + AC_SUBST(LIBGTOP_LIBDIR) + AC_SUBST(LIBGTOP_INCLUDEDIR) + AC_SUBST(LIBGTOP_EXTRA_LIBS) + AC_SUBST(LIBGTOP_LIBS) + AC_SUBST(LIBGTOP_INCS) + AC_SUBST(LIBGTOP_NAMES_LIBS) + AC_SUBST(LIBGTOP_NAMES_INCS) + AC_SUBST(LIBGTOP_MAJOR_VERSION) + AC_SUBST(LIBGTOP_MINOR_VERSION) + AC_SUBST(LIBGTOP_MICRO_VERSION) + AC_SUBST(LIBGTOP_VERSION) + AC_SUBST(LIBGTOP_VERSION_CODE) + AC_SUBST(LIBGTOP_SERVER_VERSION) + AC_SUBST(LIBGTOP_INTERFACE_AGE) + AC_SUBST(LIBGTOP_BINARY_AGE) + AC_SUBST(LIBGTOP_BINDIR) + AC_SUBST(LIBGTOP_SERVER) + + dnl Get the cflags and libraries from the libgtop-config script + dnl + AC_ARG_WITH(libgtop, + [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)], + libgtop_config_prefix="$withval", libgtop_config_prefix="") + AC_ARG_WITH(libgtop-exec, + [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)], + libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="") + + if test x$libgtop_config_exec_prefix != x ; then + libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config + fi + fi + if test x$libgtop_config_prefix != x ; then + libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config + fi + fi + + AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no) + dnl IMPORTANT NOTICE: + dnl If you increase this number here, this means that *ALL* + dnl modules will require the new version, even if they explicitly + dnl give a lower number in their `configure.in' !!! + real_min_libgtop_version=1.0.0 + min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1) + dnl I know, the following code looks really ugly, but if you want + dnl to make changes, please test it with a brain-dead /bin/sh and + dnl with a brain-dead /bin/test (not all shells/tests support the + dnl `<' operator to compare strings, that's why I convert everything + dnl into numbers and test them). + min_libgtop_major=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + min_libgtop_minor=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + min_libgtop_micro=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$min_libgtop_micro = x && min_libgtop_micro=0 + real_min_libgtop_major=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + real_min_libgtop_minor=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + real_min_libgtop_micro=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0 + dnl You cannot require a version less then $real_min_libgtop_version, + dnl so you don't need to update each `configure.in' when it's increased. + if test $real_min_libgtop_major -gt $min_libgtop_major ; then + min_libgtop_major=$real_min_libgtop_major + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_major = $min_libgtop_major ; then + if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_minor = $min_libgtop_minor ; then + if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then + min_libgtop_micro=$real_min_libgtop_micro + fi + fi + fi + min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro" + AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version) + no_libgtop="" + if test "$LIBGTOP_CONFIG" = "no" ; then + no_libgtop=yes + else + configfile=`$LIBGTOP_CONFIG --config` + libgtop_major_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + libgtop_minor_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + libgtop_micro_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test $libgtop_major_version != $min_libgtop_major ; then + no_libgtop=mismatch + else + test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes + if test $libgtop_minor_version = $min_libgtop_minor ; then + test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes + fi + fi + . $configfile + fi + if test x$no_libgtop = x ; then + AC_DEFINE(HAVE_LIBGTOP) + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION") + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE) + AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION) + AC_MSG_RESULT(yes) + dnl Note that an empty true branch is not valid sh syntax. + ifelse([$2], [], :, [$2]) + else + AC_MSG_RESULT(no) + if test "$no_libgtop"x = mismatchx; then + AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major) + fi + if test "x$3" = "xfail"; then + AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found) + else + AC_MSG_WARN(LibGTop >= $min_libgtop_version not found) + fi + fi + + AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes) +]) + +AC_DEFUN([GNOME_INIT_LIBGTOP],[ + GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2) +]) + +dnl +dnl GNOME_LIBGTOP_DOCU +dnl +dnl checks whether the documentation of LibGTop is installed +dnl + +AC_DEFUN([GNOME_LIBGTOP_DOCU], +[ + AC_REQUIRE([GNOME_LIBGTOP_HOOK]) + + helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop" + + AC_MSG_CHECKING(whether you have the LibGTop Documentation) + + if test -f "$helpdir/C/topic.dat" ; then + have_libgtop_docu=yes + AC_DEFINE(HAVE_LIBGTOP_DOCU) + else + have_libgtop_docu=no + fi + + AC_MSG_RESULT($have_libgtop_docu) + + AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes) +]) + diff --git a/bacula/autoconf/gnome-macros/gnome-objc-checks.m4 b/bacula/autoconf/gnome-macros/gnome-objc-checks.m4 new file mode 100644 index 0000000000..c69acb077e --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-objc-checks.m4 @@ -0,0 +1,83 @@ +AC_DEFUN([GNOME_CHECK_OBJC], +[ +dnl Look for an ObjC compiler. +dnl FIXME: extend list of possible names of ObjC compilers. + AC_CHECK_PROGS(OBJC, $OBJC egcs, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC egcc, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC gcc, "") + fi + fi + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + + OBJC_LIBS="-lobjc $PTHREAD_LIB" + AC_CHECK_FUNC(sched_yield,,[ + AC_CHECK_LIB(rt,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lrt",[ + AC_CHECK_LIB(posix4,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lposix4",, + $OBJC_LIBS)], + $OBJC_LIBS)]) + AC_SUBST(OBJC_LIBS) + + AC_CACHE_CHECK([if Objective C compiler ($OBJC) works], + ac_cv_prog_objc_works, [ + if test -n "$OBJC"; then + cat > conftest.m < +@interface myRandomObj : Object +{ +} +@end +@implementation myRandomObj +@end +int main () { + /* No, you are not seeing double. Remember that square brackets + are the autoconf m4 quotes. */ + id myid = [[myRandomObj alloc]]; + [[myid free]]; + return 0; +} +EOF + + $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1 + result=$? + rm -f conftest* + + if test $result -eq 0; then + ac_cv_prog_objc_works=yes + fi + else + ac_cv_prog_objc_works=no + fi + ]) + + AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes) + dnl Also set the shell variable OBJECTIVE_C to "yes" or "no". + OBJECTIVE_C=$ac_cv_prog_objc_works +]) + +AC_DEFUN([GNOME_INIT_OBJC], +[ + AC_MSG_CHECKING(for an obGnomeConf.sh) + my_gnome_libdir=`$GNOME_CONFIG --libdir` + if test -f $my_gnome_libdir/obGnomeConf.sh; then + . $my_gnome_libdir/obGnomeConf.sh + AC_MSG_RESULT(found $my_gnome_libdir) + ac_cv_have_gnome_objc=yes + else + AC_MSG_RESULT(not found) + AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install) + ac_cv_have_gnome_objc=no + fi + + dnl Add a conditional on whether or not we have gnome-objc + AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes) + HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc + + AC_SUBST(OBGNOME_INCLUDEDIR) + AC_SUBST(OBGNOME_LIBS) + AC_SUBST(OBGTK_LIBS) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-orbit-check.m4 b/bacula/autoconf/gnome-macros/gnome-orbit-check.m4 new file mode 100644 index 0000000000..54bf33aa4b --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-orbit-check.m4 @@ -0,0 +1,33 @@ +dnl +dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) +dnl +dnl if failflag is "failure" it aborts if orbit is not found. +dnl + +AC_DEFUN([GNOME_ORBIT_HOOK],[ + AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) + AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) + AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + ]) + AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + AC_SUBST(ORBIT_CFLAGS) + AC_SUBST(ORBIT_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(ORBit not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_ORBIT_CHECK], [ + GNOME_ORBIT_HOOK([],failure) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-print-check.m4 b/bacula/autoconf/gnome-macros/gnome-print-check.m4 new file mode 100644 index 0000000000..968fcc01c2 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-print-check.m4 @@ -0,0 +1,63 @@ +# Configure paths for GNOME-PRINT +# Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS +dnl +AC_DEFUN([AM_PATH_GNOME_PRINT], +[ + min_version=ifelse([$1],,0.21,$1) + + gnome_print_ok="" + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + if test "$GNOME_CONFIG" = "no" ; then + AC_MSG_RESULT(gnome-config is missing, check your gnome installation) + else + AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_version) + if `$GNOME_CONFIG --libs print > /dev/null 2>&1`; then + rqmajor=`echo "$min_version" | sed -e 's/cvs-//' | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + rqminor=`echo "$min_version" | sed -e 's/cvs-//' | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + major=`$GNOME_CONFIG --modversion print | sed -e 's/gnome-print-//' | sed -e 's/cvs-//' | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + minor=`$GNOME_CONFIG --modversion print | sed -e 's/gnome-print-//' | sed -e 's/cvs-//' | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + if test "$major" -ge "$rqmajor"; then + if test "$major" -gt "$rqmajor"; then + AC_MSG_RESULT("found $major.$minor") + gnome_print_ok="yes" + else + if test "$minor" -ge "$rqminor"; then + AC_MSG_RESULT("found $major.$minor") + gnome_print_ok="yes" + else + AC_MSG_RESULT("you have $major.$minor") + fi + fi + else + AC_MSG_RESULT("you have $major.$minor") + fi + else + AC_MSG_RESULT("did not find any version") + fi + fi + + if test "x$gnome_print_ok" != "x" ; then + GNOME_PRINT_CFLAGS=`$GNOME_CONFIG --cflags print` + GNOME_PRINT_LIBS=`$GNOME_CONFIG --libs print` + ifelse([$2], , :, [$2]) + else + GNOME_PRINT_CFLAGS="" + GNOME_PRINT_LIBS="" + ifelse([$3], , :, [$3]) + fi + + AC_SUBST(GNOME_PRINT_CFLAGS) + AC_SUBST(GNOME_PRINT_LIBS) +]) + +AC_DEFUN([GNOME_PRINT_CHECK], [ + AM_PATH_GNOME_PRINT($1,,[AC_MSG_ERROR(GNOME-PRINT not found or wrong version)]) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-pthread-check.m4 b/bacula/autoconf/gnome-macros/gnome-pthread-check.m4 new file mode 100644 index 0000000000..5a1afee014 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-pthread-check.m4 @@ -0,0 +1,18 @@ +dnl +dnl And better, use gthreads instead... +dnl + +AC_DEFUN([GNOME_PTHREAD_CHECK],[ + PTHREAD_LIB="" + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_LIB(pthread, __pthread_attr_init_system, PTHREAD_LIB="-lpthread", + [AC_CHECK_FUNC(pthread_create)] + )] + )] + )] + ) + AC_SUBST(PTHREAD_LIB) + AC_PROVIDE([GNOME_PTHREAD_CHECK]) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-support.m4 b/bacula/autoconf/gnome-macros/gnome-support.m4 new file mode 100644 index 0000000000..2c1d049842 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-support.m4 @@ -0,0 +1,68 @@ +dnl GNOME_SUPPORT_CHECKS +dnl Check for various support functions needed by the standard +dnl Gnome libraries. Sets LIBOBJS, might define some macros. +dnl This should only be used when building the Gnome libs; +dnl Gnome clients should not need this macro. +AC_DEFUN([GNOME_SUPPORT_CHECKS],[ + # we need an `awk' to build `gnomesupport.h' + AC_REQUIRE([AC_PROG_AWK]) + + # this should go away soon + need_gnome_support=yes + + save_LIBOBJS="$LIBOBJS" + LIBOBJS= + + AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o") + + # for `scandir' + AC_HEADER_DIRENT + + # copied from `configure.in' of `libiberty' + vars="program_invocation_short_name program_invocation_name sys_errlist" + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(gnome_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;], + [eval "gnome_cv_var_$v=yes"], + [eval "gnome_cv_var_$v=no"])]) + if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + + AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen) + AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf) + + AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o") + + # to include `error.c' error.c has some HAVE_* checks + AC_CHECK_FUNCS(vprintf doprnt strerror_r) + AM_FUNC_ERROR_AT_LINE + + # This is required if we declare setreuid () and setregid (). + AC_TYPE_UID_T + + # see if we need to declare some functions. Solaris is notorious for + # putting functions into the `libc' but not listing them in the headers + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h) + GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize) + GCC_NEED_DECLARATION(scandir,[ +#ifdef HAVE_DIRENT_H +#include +#endif +]) + + # Turn our LIBOBJS into libtool objects. This is gross, but it + # requires changes to autoconf before it goes away. + LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'` + AC_SUBST(need_gnome_support) + AC_SUBST(LTLIBOBJS) + + LIBOBJS="$save_LIBOBJS" + AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-undelfs.m4 b/bacula/autoconf/gnome-macros/gnome-undelfs.m4 new file mode 100644 index 0000000000..fe031cd6fc --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-undelfs.m4 @@ -0,0 +1,22 @@ +dnl GNOME_UNDELFS_CHECKS +dnl Check for ext2fs undel support. +dnl Set shell variable ext2fs_undel to "yes" if we have it, +dnl "no" otherwise. May define USE_EXT2FSLIB for cpp. +dnl Will set EXT2FS_UNDEL_LIBS to required libraries. + +AC_DEFUN([GNOME_UNDELFS_CHECKS], [ + ext2fs_undel=no + EXT2FS_UNDEL_LIBS= + AC_CHECK_HEADERS(linux/ext2_fs.h) + if test x$ac_cv_header_linux_ext2_fs_h = xyes + then + AC_CHECK_HEADERS(ext2fs/ext2fs.h, , , [#include +#include ]) + if test x$ac_cv_header_ext2fs_ext2fs_h = xyes + then + AC_DEFINE(USE_EXT2FSLIB) + ext2fs_undel=yes + EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err" + fi + fi +]) diff --git a/bacula/autoconf/gnome-macros/gnome-vfs.m4 b/bacula/autoconf/gnome-macros/gnome-vfs.m4 new file mode 100644 index 0000000000..6dce307783 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-vfs.m4 @@ -0,0 +1,126 @@ +dnl GNOME_VFS_CHECKS +dnl Check for various functions needed by libvfs. +dnl This has various effects: +dnl Sets GNOME_VFS_LIBS to libraries required +dnl Sets termnet to true or false depending on whether it is required. +dnl If yes, defines USE_TERMNET. +dnl Sets vfs_flags to "pretty" list of vfs implementations we include. +dnl Sets shell variable use_vfs to yes (default, --with-vfs) or +dnl "no" (--without-vfs). +dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv". + +dnl Private define +AC_DEFUN([GNOME_WITH_VFS],[ + dnl FIXME: network checks should probably be in their own macro. + AC_CHECK_LIB(nsl, t_accept) + AC_CHECK_LIB(socket, socket) + + have_socket=no + AC_CHECK_FUNCS(socket, have_socket=yes) + if test $have_socket = no; then + # socket is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, socket, [ + LIBS="$LIBS -l$lib" + have_socket=yes + AC_DEFINE(HAVE_SOCKET) + break]) + done + fi + + have_gethostbyname=no + AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes) + if test $have_gethostbyname = no; then + # gethostbyname is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break]) + done + fi + + vfs_flags="tarfs" + use_net_code=false + if test $have_socket = yes; then + AC_STRUCT_LINGER + AC_CHECK_FUNCS(pmap_set, , [ + AC_CHECK_LIB(rpc, pmap_set, [ + LIBS="-lrpc $LIBS" + AC_DEFINE(HAVE_PMAP_SET) + ])]) + AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport) + dnl add for source routing support setsockopt + AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [ +#include +#include +#include +#include +#include + ]) + vfs_flags="$vfs_flags, mcfs, ftpfs, fish" + use_net_code=true + fi + + dnl + dnl Samba support + dnl + smbfs="" + SAMBAFILES="" + AC_ARG_WITH(samba, + [--with-samba Support smb virtual file system],[ + if test "x$withval" != "xno"; then + AC_DEFINE(WITH_SMBFS) + vfs_flags="$vfs_flags, smbfs" + smbfs="smbfs.o" + SAMBAFILES="\$(SAMBAFILES)" + fi + ]) + AC_SUBST(smbfs) + AC_SUBST(SAMBAFILES) + + dnl + dnl The termnet support + dnl + termnet=false + AC_ARG_WITH(termnet, + [--with-termnet If you want a termified net support],[ + if test x$withval = xyes; then + AC_DEFINE(USE_TERMNET) + termnet=true + fi + ]) + + TERMNET="" + AC_DEFINE(USE_VFS) + if $use_net_code; then + AC_DEFINE(USE_NETCODE) + fi + mcserv= + if test $have_socket = yes; then + mcserv="mcserv" + if $termnet; then + TERMNET="-ltermnet" + fi + fi + + AC_SUBST(TERMNET) + AC_SUBST(mcserv) + +dnl FIXME: +dnl GNOME_VFS_LIBS= + +]) + +AC_DEFUN([GNOME_VFS_CHECKS],[ + use_vfs=yes + AC_ARG_WITH(vfs, + [--with-vfs Compile with the VFS code], + use_vfs=$withval + ) + case $use_vfs in + yes) GNOME_WITH_VFS;; + no) use_vfs=no;; + *) use_vfs=no;; + dnl Should we issue a warning? + esac +]) + + diff --git a/bacula/autoconf/gnome-macros/gnome-x-checks.m4 b/bacula/autoconf/gnome-macros/gnome-x-checks.m4 new file mode 100644 index 0000000000..1e397ef8e3 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-x-checks.m4 @@ -0,0 +1,80 @@ +dnl GNOME_X_CHECKS +dnl +dnl Basic X11 related checks for X11. At the end, the following will be +dnl defined/changed: +dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK +dnl CPPFLAGS Will include $X_CFLAGS +dnl GNOME_HAVE_SM `true' or `false' depending on whether session +dnl management is available. It is available if +dnl both -lSM and X11/SM/SMlib.h exist. (Some +dnl Solaris boxes have the library but not the header) +dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" +dnl +dnl The following configure cache variables are defined (but not used): +dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} +dnl +AC_DEFUN([GNOME_X_CHECKS], +[ + AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) + dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could + dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" + dnl + dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses + dnl CPPFLAGS, not CFLAGS + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + +dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. + USE_DEVGTK=true + +dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) +dnl AC_EGREP_CPP(answer_affirmatively, +dnl [#include +dnl #ifdef GTK_HAVE_FEATURES_1_1_0 +dnl answer_affirmatively +dnl #endif +dnl ], dev_gtk=yes, dev_gtk=no) +dnl if test "$dev_gtk" = "yes"; then +dnl USE_DEVGTK=true +dnl fi +dnl AC_MSG_RESULT("$dev_gtk") + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + dnl Already found it. + ;; + *) + dnl Assume that if we have -lSM then we also have -lICE. + AC_CHECK_LIB(SM, SmcSaveYourselfDone, + [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, + $x_libs -lICE) + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) + fi + + if test "$GNOME_HAVE_SM" = true; then + AC_DEFINE(HAVE_LIBSM) + fi + + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + LDFLAGS="$saved_ldflags" + + AC_PROVIDE([GNOME_X_CHECKS]) +]) diff --git a/bacula/autoconf/gnome-macros/gnome-xml-check.m4 b/bacula/autoconf/gnome-macros/gnome-xml-check.m4 new file mode 100644 index 0000000000..1caad1009f --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome-xml-check.m4 @@ -0,0 +1,32 @@ +dnl +dnl GNOME_XML_HOOK (script-if-xml-found, failflag) +dnl +dnl If failflag is "failure", script aborts due to lack of XML +dnl +dnl Check for availability of the libxml library +dnl the XML parser uses libz if available too +dnl + +AC_DEFUN([GNOME_XML_HOOK],[ + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = no; then + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not find gnome-config) + fi + fi + GNOME_XML_CFLAGS=`$GNOME_CONFIG --cflags xml` + AC_SUBST(GNOME_XML_CFLAGS) + AC_CHECK_LIB(xml, xmlNewDoc, [ + $1 + GNOME_XML_LIB=`$GNOME_CONFIG --libs xml` + ], [ + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not link sample xml program) + fi + ], `$GNOME_CONFIG --libs xml`) + AC_SUBST(GNOME_XML_LIB) +]) + +AC_DEFUN([GNOME_XML_CHECK], [ + GNOME_XML_HOOK([],failure) +]) diff --git a/bacula/autoconf/gnome-macros/gnome.m4 b/bacula/autoconf/gnome-macros/gnome.m4 new file mode 100644 index 0000000000..2d23de8772 --- /dev/null +++ b/bacula/autoconf/gnome-macros/gnome.m4 @@ -0,0 +1,130 @@ +dnl +dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) +dnl +dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh +dnl is not found. +dnl + +AC_DEFUN([GNOME_INIT_HOOK],[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOMEUI_LIBS) + AC_SUBST(GNOMEGNORBA_LIBS) + AC_SUBST(GTKXMHTML_LIBS) + AC_SUBST(ZVT_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes Specify location of GNOME headers],[ + CFLAGS="$CFLAGS -I$withval" + ]) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs Specify location of GNOME libs],[ + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + ]) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + dnl Note that an empty true branch is not + dnl valid sh syntax. + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + AC_MSG_CHECKING(if $GNOME_CONFIG works) + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GNOME_GNORBA_HOOK([],$2) + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + $1 + else + AC_MSG_RESULT(no) + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) + if test -f $gnome_prefix/gnomeConf.sh; then + AC_MSG_RESULT(found) + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + $1 + else + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) + fi + fi + fi + fi + + if test -n "$3"; then + n="$3" + for i in $n; do + AC_MSG_CHECKING(extra library \"$i\") + case $i in + applets) + AC_SUBST(GNOME_APPLETS_LIBS) + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + AC_MSG_RESULT($GNOME_APPLETS_LIBS);; + docklets) + AC_SUBST(GNOME_DOCKLETS_LIBS) + GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` + AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);; + capplet) + AC_SUBST(GNOME_CAPPLET_LIBS) + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; + *) + AC_MSG_RESULT(unknown library) + esac + EXTRA_INCLUDEDIR=`$GNOME_CONFIG --cflags $i` + GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR $EXTRA_INCLUDEDIR" + done + fi +]) + +dnl +dnl GNOME_INIT ([additional-inits]) +dnl + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail,$1) +]) diff --git a/bacula/autoconf/gnome-macros/gperf-check.m4 b/bacula/autoconf/gnome-macros/gperf-check.m4 new file mode 100644 index 0000000000..3869459ebc --- /dev/null +++ b/bacula/autoconf/gnome-macros/gperf-check.m4 @@ -0,0 +1,79 @@ +dnl +dnl AC_PROG_GPERF (MINIMUM-VERSION) +dnl +dnl Check for availability of gperf. +dnl Abort if not found or if current version is not up to par. +dnl + +AC_DEFUN([AC_PROG_GPERF],[ + AC_PATH_PROG(GPERF, gperf, no) + if test "$GPERF" = no; then + AC_MSG_ERROR(Could not find gperf) + fi + min_gperf_version=ifelse([$1], ,2.7,$1) + AC_MSG_CHECKING(for gperf - version >= $min_gperf_version) + gperf_major_version=`$GPERF --version | \ + sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'` + gperf_minor_version=`$GPERF --version | \ + sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'` + no_gperf="" +dnl +dnl Now check if the installed gperf is sufficiently new. +dnl + AC_TRY_RUN([ +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int +main () +{ + char *tmp_version; + + int major; + int minor; + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_gperf_version"); + if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) { + printf ("%s, bad version string\n", "$min_gperf_version"); + return 1; + } + + if (($gperf_major_version > major) || + (($gperf_major_version == major) && ($gperf_minor_version >= minor))) { + return 0; + } else { + printf ("\n"); + printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n"); + printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n", + major, minor); + printf ("*** gperf is always available from ftp://ftp.gnu.org.\n"); + printf ("***\n"); + return 1; + } +} +],,no_gperf=yes,[/bin/true]) + if test "x$no_gperf" = x ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + +]) diff --git a/bacula/autoconf/gnome-macros/linger.m4 b/bacula/autoconf/gnome-macros/linger.m4 new file mode 100644 index 0000000000..f1c7060398 --- /dev/null +++ b/bacula/autoconf/gnome-macros/linger.m4 @@ -0,0 +1,28 @@ +dnl +dnl Check for struct linger +dnl +AC_DEFUN([AC_STRUCT_LINGER], [ +av_struct_linger=no +AC_MSG_CHECKING(struct linger is available) +AC_TRY_RUN([ +#include +#include + +struct linger li; + +int main () +{ + li.l_onoff = 1; + li.l_linger = 120; + return 0; +} +],[ +AC_DEFINE(HAVE_STRUCT_LINGER) +av_struct_linger=yes +],[ +av_struct_linger=no +],[ +av_struct_linger=no +]) +AC_MSG_RESULT($av_struct_linger) +]) diff --git a/bacula/autoconf/gnome-macros/need-declaration.m4 b/bacula/autoconf/gnome-macros/need-declaration.m4 new file mode 100644 index 0000000000..8a217b8a30 --- /dev/null +++ b/bacula/autoconf/gnome-macros/need-declaration.m4 @@ -0,0 +1,42 @@ +dnl See whether we need a declaration for a function. +dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) +AC_DEFUN([GCC_NEED_DECLARATION], +[AC_MSG_CHECKING([whether $1 must be declared]) +AC_CACHE_VAL(gcc_cv_decl_needed_$1, +[AC_TRY_COMPILE([ +#include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +$2], +[char *(*pfn) = (char *(*)) $1], +eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) +if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + gcc_need_declarations="$gcc_need_declarations $1" + gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($gcc_tr_decl) +else + AC_MSG_RESULT(no) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) +AC_DEFUN([GCC_NEED_DECLARATIONS], +[for ac_func in $1 +do +GCC_NEED_DECLARATION($ac_func, $2) +done +] +) diff --git a/bacula/autoconf/install-sh b/bacula/autoconf/install-sh new file mode 100755 index 0000000000..89fc9b098b --- /dev/null +++ b/bacula/autoconf/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/bacula/autoconf/install.sh b/bacula/autoconf/install.sh new file mode 100755 index 0000000000..ea88212bb5 --- /dev/null +++ b/bacula/autoconf/install.sh @@ -0,0 +1,235 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/bacula/autoconf/mkinstalldirs b/bacula/autoconf/mkinstalldirs new file mode 100755 index 0000000000..91f6d04e17 --- /dev/null +++ b/bacula/autoconf/mkinstalldirs @@ -0,0 +1,32 @@ +#!/bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/bacula/configure b/bacula/configure new file mode 100755 index 0000000000..2707774c10 --- /dev/null +++ b/bacula/configure @@ -0,0 +1,9480 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-everything enable standard non-multichoice features: marked *" +ac_help="$ac_help + --enable-gnome enable build of gnome-console GUI *" +ac_help="$ac_help + --with-gnome-includes Specify location of GNOME headers" +ac_help="$ac_help + --with-gnome-libs Specify location of GNOME libs" +ac_help="$ac_help + --with-gnome Specify prefix for GNOME files" +ac_help="$ac_help + --enable-smartalloc enable smartalloc debugging support *" +ac_help="$ac_help + --disable-readline disable readline support " +ac_help="$ac_help + --with-readline[=DIR] Specify readline library directory" +ac_help="$ac_help + --with-gmp[=DIR] Specify gmp library directory" +ac_help="$ac_help + --with-cweb[=DIR] Specify cweb library directory" +ac_help="$ac_help + --with-tcp-wrappers=DIR Enable tcpwrappers support" +ac_help="$ac_help + --with-working-dir=PATH Specify location of Bacula working files" +ac_help="$ac_help + --with-dump-email=Dump email address" +ac_help="$ac_help + --with-job-email=Job output email address" +ac_help="$ac_help + --with-smtp-host=SMTP mail host address" +ac_help="$ac_help + --with-pid-dir=PATH Specify location of Bacula pid files" +ac_help="$ac_help + --with-subsys-dir=PATH Specify location of Bacula subsys file" +ac_help="$ac_help + --with-baseport=PORT Specify base port address for daemons" +ac_help="$ac_help + --with-dir-password=PASSWORD Specify Director's password" +ac_help="$ac_help + --with-fd-password=PASSWORD Specify Client's password" +ac_help="$ac_help + --with-sd-password=PASSWORD Specify Storage daemon's password" +ac_help="$ac_help + +Which one DBMS do you want to use (please select only one): + --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base + install directory, default is to search through + a number of common places for the MySQL files." +ac_help="$ac_help + +Which one DBMS do you want to use (please select only one): + --with-sqlite[=DIR] Include SQLite support. DIR is the SQLite base + install directory, default is to search through + a number of common places for the SQLite files." +ac_help="$ac_help + --with-x use the X Window System" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=src/version.h + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +BUILD_DIR=`pwd` +cd .. +TOP_DIR=`pwd` +cd ${BUILD_DIR} + +ac_aux_dir= +for ac_dir in ${BUILD_DIR}/autoconf $srcdir/${BUILD_DIR}/autoconf; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${BUILD_DIR}/autoconf $srcdir/${BUILD_DIR}/autoconf" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + + + + +for ac_prog in true +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:615: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_TRUEPRG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$TRUEPRG" in + /*) + ac_cv_path_TRUEPRG="$TRUEPRG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_TRUEPRG="$TRUEPRG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_TRUEPRG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +TRUEPRG="$ac_cv_path_TRUEPRG" +if test -n "$TRUEPRG"; then + echo "$ac_t""$TRUEPRG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$TRUEPRG" && break +done +test -n "$TRUEPRG" || TRUEPRG=":" + +for ac_prog in false +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:656: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_FALSEPRG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$FALSEPRG" in + /*) + ac_cv_path_FALSEPRG="$FALSEPRG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_FALSEPRG="$FALSEPRG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_FALSEPRG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +FALSEPRG="$ac_cv_path_FALSEPRG" +if test -n "$FALSEPRG"; then + echo "$ac_t""$FALSEPRG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$FALSEPRG" && break +done +test -n "$FALSEPRG" || FALSEPRG=":" + + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:700: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h` +DATE=`sed -n -e 's/^.* \t*DATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h` +LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h` +echo "configuring for bacula $VERSION ($DATE)" + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:731: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:761: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:812: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:844: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 855 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:886: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:891: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:919: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:955: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:987: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 998 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:1003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1029: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:1034: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:1062: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +if test "x$CC" != xcc; then + echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6 +echo "configure:1095: checking whether $CC and cc understand -c and -o together" >&5 +else + echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6 +echo "configure:1098: checking whether cc understands -c and -o together" >&5 +fi +set dummy $CC; ac_cc="`echo $2 | + sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'foo(){}' > conftest.c +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5' +if { (eval echo configure:1110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1116: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + ac_try='cc -c conftest.c -o conftest.o 1>&5' + if { (eval echo configure:1118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:1119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 + cat >> confdefs.h <<\EOF +#define NO_MINUS_C_MINUS_O 1 +EOF + +fi + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1145: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1166: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 +echo "configure:1226: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext < +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext < +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +if test x$CC = xgcc +then + cat >> confdefs.h <<\EOF +#define HAVE_GCC 1 +EOF + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1291: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1346: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "mv", so it can be a program name with args. +set dummy mv; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1376: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MV" in + /*) + ac_cv_path_MV="$MV" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_MV="$MV" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_MV="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MV" && ac_cv_path_MV="mv" + ;; +esac +fi +MV="$ac_cv_path_MV" +if test -n "$MV"; then + echo "$ac_t""$MV" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1412: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$RM" in + /*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_RM="$RM" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_RM="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm" + ;; +esac +fi +RM="$ac_cv_path_RM" +if test -n "$RM"; then + echo "$ac_t""$RM" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1448: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CP" in + /*) + ac_cv_path_CP="$CP" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CP="$CP" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CP="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_CP" && ac_cv_path_CP="cp" + ;; +esac +fi +CP="$ac_cv_path_CP" +if test -n "$CP"; then + echo "$ac_t""$CP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1484: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$SED" in + /*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_SED="$SED" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_SED="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_SED" && ac_cv_path_SED="sed" + ;; +esac +fi +SED="$ac_cv_path_SED" +if test -n "$SED"; then + echo "$ac_t""$SED" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "awk", so it can be a program name with args. +set dummy awk; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1520: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AWK" in + /*) + ac_cv_path_AWK="$AWK" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AWK="$AWK" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AWK="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_AWK" && ac_cv_path_AWK="awk" + ;; +esac +fi +AWK="$ac_cv_path_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "echo", so it can be a program name with args. +set dummy echo; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1556: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_ECHO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$ECHO" in + /*) + ac_cv_path_ECHO="$ECHO" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_ECHO="$ECHO" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_ECHO="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_ECHO" && ac_cv_path_ECHO="echo" + ;; +esac +fi +ECHO="$ac_cv_path_ECHO" +if test -n "$ECHO"; then + echo "$ac_t""$ECHO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "cmp", so it can be a program name with args. +set dummy cmp; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1592: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CMP" in + /*) + ac_cv_path_CMP="$CMP" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CMP="$CMP" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CMP="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_CMP" && ac_cv_path_CMP="cmp" + ;; +esac +fi +CMP="$ac_cv_path_CMP" +if test -n "$CMP"; then + echo "$ac_t""$CMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "tbl", so it can be a program name with args. +set dummy tbl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1628: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_TBL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$TBL" in + /*) + ac_cv_path_TBL="$TBL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_TBL="$TBL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_TBL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_TBL" && ac_cv_path_TBL="tbl" + ;; +esac +fi +TBL="$ac_cv_path_TBL" +if test -n "$TBL"; then + echo "$ac_t""$TBL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1664: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AR" in + /*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AR="$AR" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AR="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_AR" && ac_cv_path_AR="ar" + ;; +esac +fi +AR="$ac_cv_path_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1700: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$RANLIB" in + /*) + ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_RANLIB="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_RANLIB" && ac_cv_path_RANLIB="ranlib" + ;; +esac +fi +RANLIB="$ac_cv_path_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "openssl", so it can be a program name with args. +set dummy openssl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1736: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_OPENSSL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$OPENSSL" in + /*) + ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_OPENSSL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_OPENSSL" && ac_cv_path_OPENSSL="none" + ;; +esac +fi +OPENSSL="$ac_cv_path_OPENSSL" +if test -n "$OPENSSL"; then + echo "$ac_t""$OPENSSL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +test -n "$ARFLAG" || ARFLAGS="cr" + + +MAKE_SHELL=/bin/sh + + + + + + + + + +echo $ac_n "checking for Operating System""... $ac_c" 1>&6 +echo "configure:1784: checking for Operating System" >&5 +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1786: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS +then + + +if $TRUEPRG; then + HAVE_SUN_OS_TRUE= + HAVE_SUN_OS_FALSE='#' +else + HAVE_SUN_OS_TRUE='#' + HAVE_SUN_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_SUN_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_SUN_OS_TRUE= + HAVE_SUN_OS_FALSE='#' +else + HAVE_SUN_OS_TRUE='#' + HAVE_SUN_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xOSF1 +then + + +if $TRUEPRG; then + HAVE_OSF1_OS_TRUE= + HAVE_OSF1_OS_FALSE='#' +else + HAVE_OSF1_OS_TRUE='#' + HAVE_OSF1_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_OSF1_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_OSF1_OS_TRUE= + HAVE_OSF1_OS_FALSE='#' +else + HAVE_OSF1_OS_TRUE='#' + HAVE_OSF1_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xAIX +then + + +if $TRUEPRG; then + HAVE_AIX_OS_TRUE= + HAVE_AIX_OS_FALSE='#' +else + HAVE_AIX_OS_TRUE='#' + HAVE_AIX_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_AIX_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_AIX_OS_TRUE= + HAVE_AIX_OS_FALSE='#' +else + HAVE_AIX_OS_TRUE='#' + HAVE_AIX_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX +then + + +if $TRUEPRG; then + HAVE_HPUX_OS_TRUE= + HAVE_HPUX_OS_FALSE='#' +else + HAVE_HPUX_OS_TRUE='#' + HAVE_HPUX_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_HPUX_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_HPUX_OS_TRUE= + HAVE_HPUX_OS_FALSE='#' +else + HAVE_HPUX_OS_TRUE='#' + HAVE_HPUX_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xLinux +then + + +if $TRUEPRG; then + HAVE_LINUX_OS_TRUE= + HAVE_LINUX_OS_FALSE='#' +else + HAVE_LINUX_OS_TRUE='#' + HAVE_LINUX_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_LINUX_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_LINUX_OS_TRUE= + HAVE_LINUX_OS_FALSE='#' +else + HAVE_LINUX_OS_TRUE='#' + HAVE_LINUX_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD +then + + +if $TRUEPRG; then + HAVE_FREEBSD_OS_TRUE= + HAVE_FREEBSD_OS_FALSE='#' +else + HAVE_FREEBSD_OS_TRUE='#' + HAVE_FREEBSD_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_FREEBSD_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_FREEBSD_OS_TRUE= + HAVE_FREEBSD_OS_FALSE='#' +else + HAVE_FREEBSD_OS_TRUE='#' + HAVE_FREEBSD_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD +then + + +if $TRUEPRG; then + HAVE_NETBSD_OS_TRUE= + HAVE_NETBSD_OS_FALSE='#' +else + HAVE_NETBSD_OS_TRUE='#' + HAVE_NETBSD_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_NETBSD_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_NETBSD_OS_TRUE= + HAVE_NETBSD_OS_FALSE='#' +else + HAVE_NETBSD_OS_TRUE='#' + HAVE_NETBSD_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD +then + + +if $TRUEPRG; then + HAVE_OPENBSD_OS_TRUE= + HAVE_OPENBSD_OS_FALSE='#' +else + HAVE_OPENBSD_OS_TRUE='#' + HAVE_OPENBSD_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_OPENBSD_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_OPENBSD_OS_TRUE= + HAVE_OPENBSD_OS_FALSE='#' +else + HAVE_OPENBSD_OS_TRUE='#' + HAVE_OPENBSD_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS +then + + +if $TRUEPRG; then + HAVE_BSDI_OS_TRUE= + HAVE_BSDI_OS_FALSE='#' +else + HAVE_BSDI_OS_TRUE='#' + HAVE_BSDI_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_BSDI_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_BSDI_OS_TRUE= + HAVE_BSDI_OS_FALSE='#' +else + HAVE_BSDI_OS_TRUE='#' + HAVE_BSDI_OS_FALSE= +fi +fi + +if test $HAVE_UNAME=yes -a x`uname -s` = xSGI +then + + +if $TRUEPRG; then + HAVE_SGI_OS_TRUE= + HAVE_SGI_OS_FALSE='#' +else + HAVE_SGI_OS_TRUE='#' + HAVE_SGI_OS_FALSE= +fi + cat >> confdefs.h <<\EOF +#define HAVE_SGI_OS 1 +EOF + +else + + +if $FALSEPRG; then + HAVE_SGI_OS_TRUE= + HAVE_SGI_OS_FALSE='#' +else + HAVE_SGI_OS_TRUE='#' + HAVE_SGI_OS_FALSE= +fi +fi +echo "$ac_t""" "" 1>&6 + + +# ----------------------------------------------------------- +# ---------------------------------------------------------- +echo $ac_n "checking for Operating System Distribution""... $ac_c" 1>&6 +echo "configure:2093: checking for Operating System Distribution" >&5 +if test "x$DISTNAME" != "x" +then + echo "distname set to $DISTNAME" +elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1 +then + DISTNAME=alpha +elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX +then + DISTNAME=hpux +elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS +then + DISTNAME=solaris +elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD +then + DISTNAME=freebsd +elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD +then + DISTNAME=netbsd +elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD +then + DISTNAME=openbsd +elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS +then + DISTNAME=bsdi +elif test -f /etc/SuSE-release +then + DISTNAME=suse +elif test -d /etc/SuSEconfig +then + DISTNAME=suse5 +elif test -d /usr/src/OpenLinux +then + DISTNAME=caldera +elif test -f /etc/redhat-release +then + DISTNAME=redhat +elif test -f /etc/debian_version +then + DISTNAME=debian +elif test -f /etc/slackware-version +then + DISTNAME=slackware +elif test "$ac_cv_cygwin" = yes +then + DISTNAME=cygwin + cat >> confdefs.h <<\EOF +#define HAVE_CYGWIN 1 +EOF + +else + DISTNAME=unknown +fi +echo "$ac_t""" "" 1>&6 + + +# ----------------------------------------------------------- +# ---------------------------------------------------------- + + + +if false; then + INSIDE_GNOME_COMMON_TRUE= + INSIDE_GNOME_COMMON_FALSE='#' +else + INSIDE_GNOME_COMMON_TRUE='#' + INSIDE_GNOME_COMMON_FALSE= +fi + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in gnome-macros ; do ACLOCAL="$ACLOCAL -I $k" ; done + + +# ------------------------------------------------------------------ +# If the user has not set --prefix, we set our default to nothing. +# In this case, if the user has not set --sysconfdir, we set it +# to the package default of /etc/bacula. If either --prefix or +# --sysconfdir is set, we leave sysconfdir alone except to eval it. +# ------------------------------------------------------------------ +if test x${prefix} = xNONE ; then + if test `eval echo ${sysconfdir}` = NONE/etc ; then + sysconfdir=/etc/bacula + fi + prefix= +fi +sysconfdir=`eval echo ${sysconfdir}` + +# ------------------------------------------------------------------------- +# If the user has not set --exec-prefix, we default to ${prefix} +# ------------------------------------------------------------------------- +if test x${exec_prefix} = xNONE ; then + exec_prefix=${prefix} +fi + +# ------------------------------------------------------------------ +# If the user has not set --sbindir, we set our default as /sbin +# ------------------------------------------------------------------ +if test x$sbindir = x'${exec_prefix}/sbin' ; then + sbindir=${exec_prefix}/sbin +fi +sbindir=`eval echo ${sbindir}` + +# ------------------------------------------------------------------ +# All list of languages for which a translation exist. Each +# language is separated by a space. +# ------------------------------------------------------------------ +ALL_LINGUAS="" + +for ac_prog in msgfmt +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2207: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$MSGFMT" && break +done +test -n "$MSGFMT" || MSGFMT="no" + +if test "$MSGFMT" = "no" +then + echo 'msgfmt program not found, disabling NLS !' + USE_NLS=no + USE_INCLUDED_LIBINTL=no +#else +# AM_GNU_GETTEXT +fi + + +support_mysql=no +support_sqlite=no +support_smartalloc=yes +cats= + +# Check whether --enable-everything or --disable-everything was given. +if test "${enable_everything+set}" = set; then + enableval="$enable_everything" + if test x$enableval = xyes; then + support_smartalloc=yes + fi +fi + + +# ------------------------------------------- +# gnome (default off) +# ------------------------------------------- +support_gnome=no +# Check whether --enable-gnome or --disable-gnome was given. +if test "${enable_gnome+set}" = set; then + enableval="$enable_gnome" + if test x$enableval = xyes; then + support_gnome=yes + fi +fi + + +GNOME_DIR= +if test x$support_gnome = xyes; then + + + + + + + + + + + # Check whether --with-gnome-includes or --without-gnome-includes was given. +if test "${with_gnome_includes+set}" = set; then + withval="$with_gnome_includes" + + CFLAGS="$CFLAGS -I$withval" + +fi + + + # Check whether --with-gnome-libs or --without-gnome-libs was given. +if test "${with_gnome_libs+set}" = set; then + withval="$with_gnome_libs" + + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + +fi + + + # Check whether --with-gnome or --without-gnome was given. +if test "${with_gnome+set}" = set; then + withval="$with_gnome" + if test x$withval = xyes; then + want_gnome=yes + : + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi +else + want_gnome=yes +fi + + + if test "x$want_gnome" = xyes; then + + # Extract the first word of "gnome-config", so it can be a program name with args. +set dummy gnome-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2337: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GNOME_CONFIG" in + /*) + ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GNOME_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GNOME_CONFIG" && ac_cv_path_GNOME_CONFIG="no" + ;; +esac +fi +GNOME_CONFIG="$ac_cv_path_GNOME_CONFIG" +if test -n "$GNOME_CONFIG"; then + echo "$ac_t""$GNOME_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + echo $ac_n "checking if $GNOME_CONFIG works""... $ac_c" 1>&6 +echo "configure:2374: checking if $GNOME_CONFIG works" >&5 + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + echo "$ac_t""yes" 1>&6 + + + # Extract the first word of "orbit-config", so it can be a program name with args. +set dummy orbit-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2382: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_ORBIT_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$ORBIT_CONFIG" in + /*) + ac_cv_path_ORBIT_CONFIG="$ORBIT_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_ORBIT_CONFIG="$ORBIT_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_ORBIT_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_ORBIT_CONFIG" && ac_cv_path_ORBIT_CONFIG="no" + ;; +esac +fi +ORBIT_CONFIG="$ac_cv_path_ORBIT_CONFIG" +if test -n "$ORBIT_CONFIG"; then + echo "$ac_t""$ORBIT_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "orbit-idl", so it can be a program name with args. +set dummy orbit-idl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2418: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_ORBIT_IDL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$ORBIT_IDL" in + /*) + ac_cv_path_ORBIT_IDL="$ORBIT_IDL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_ORBIT_IDL="$ORBIT_IDL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_ORBIT_IDL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_ORBIT_IDL" && ac_cv_path_ORBIT_IDL="no" + ;; +esac +fi +ORBIT_IDL="$ac_cv_path_ORBIT_IDL" +if test -n "$ORBIT_IDL"; then + echo "$ac_t""$ORBIT_IDL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for working ORBit environment""... $ac_c" 1>&6 +echo "configure:2452: checking for working ORBit environment" >&5 +if eval "test \"`echo '$''{'gnome_cv_orbit_found'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + +fi + +echo "$ac_t""$gnome_cv_orbit_found" 1>&6 + + +if test x$gnome_cv_orbit_found = xyes; then + HAVE_ORBIT_TRUE= + HAVE_ORBIT_FALSE='#' +else + HAVE_ORBIT_TRUE='#' + HAVE_ORBIT_FALSE= +fi + if test x$gnome_cv_orbit_found = xyes; then + + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + + + else + if test xfail = xfailure; then + { echo "configure: error: ORBit not installed or installation problem" 1>&2; exit 1; } + fi + fi + + echo $ac_n "checking for gnorba libraries""... $ac_c" 1>&6 +echo "configure:2488: checking for gnorba libraries" >&5 +if eval "test \"`echo '$''{'gnome_cv_gnorba_found'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + +fi + +echo "$ac_t""$gnome_cv_gnorba_found" 1>&6 + + +if test x$gnome_cv_gnorba_found = xyes; then + HAVE_GNORBA_TRUE= + HAVE_GNORBA_FALSE='#' +else + HAVE_GNORBA_TRUE='#' + HAVE_GNORBA_FALSE= +fi + if test x$gnome_cv_orbit_found = xyes; then + + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + + + else + if test xfail = xfailure; then + { echo "configure: error: gnorba library not installed or installation problem" 1>&2; exit 1; } + fi + fi + + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + + else + echo "$ac_t""no" 1>&6 + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + echo $ac_n "checking for gnomeConf.sh file in $gnome_prefix""... $ac_c" 1>&6 +echo "configure:2552: checking for gnomeConf.sh file in $gnome_prefix" >&5 + if test -f $gnome_prefix/gnomeConf.sh; then + echo "$ac_t""found" 1>&6 + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + + else + echo "$ac_t""not found" 1>&6 + if test xfail = xfail; then + { echo "configure: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install" 1>&2; exit 1; } + fi + fi + fi + fi + + if test -n ""; then + n="" + for i in $n; do + echo $ac_n "checking extra library \"$i\"""... $ac_c" 1>&6 +echo "configure:2572: checking extra library \"$i\"" >&5 + case $i in + applets) + + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + echo "$ac_t""$GNOME_APPLETS_LIBS" 1>&6;; + docklets) + + GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` + echo "$ac_t""$GNOME_DOCKLETS_LIBS" 1>&6;; + capplet) + + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + echo "$ac_t""$GNOME_CAPPLET_LIBS" 1>&6;; + *) + echo "$ac_t""unknown library" 1>&6 + esac + EXTRA_INCLUDEDIR=`$GNOME_CONFIG --cflags $i` + GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR $EXTRA_INCLUDEDIR" + done + fi + + + GNOME_DIR=src/gnome-console +fi + + + +# ------------------------------------------- +# smartalloc (default off) +# ------------------------------------------- +# Check whether --enable-smartalloc or --disable-smartalloc was given. +if test "${enable_smartalloc+set}" = set; then + enableval="$enable_smartalloc" + if test x$enableval = xno; then + support_smartalloc=no + fi +fi + + +if test x$support_smartalloc = xyes; then + cat >> confdefs.h <<\EOF +#define SMARTALLOC 1 +EOF + +fi + + + +# --------------------------------------------------- +# Check for readline support/directory (default on) +# --------------------------------------------------- +support_readline=yes +# this allows you to turn it completely off +# Check whether --enable-readline or --disable-readline was given. +if test "${enable_readline+set}" = set; then + enableval="$enable_readline" + if test x$enableval = xno; then + support_readline=no + fi +fi + + +got_readline="no" +READLINE_SRC= +if test x$support_readline = xyes; then + # Check whether --with-readline or --without-readline was given. +if test "${with_readline+set}" = set; then + withval="$with_readline" + + case "$with_readline" in + no) : ;; + yes|*) + if test "$with_readline" != "yes"; then + CONS_INC="-I$with_readline" + CONS_LDFLAGS="-L$with_readline" + else + with_readline="/usr/include/readline" + fi + ac_safe=`echo "$with_readline/readline.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $with_readline/readline.h""... $ac_c" 1>&6 +echo "configure:2653: checking for $with_readline/readline.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_READLINE 1 +EOF + + CONS_LIBS="-lreadline" + got_readline="yes" + +else + echo "$ac_t""no" 1>&6 + { echo "configure: error: *** readline library missing" 1>&2; exit 1; } + + +fi + + ;; + esac + +else + + # check for standard readline library + ac_safe=`echo "/usr/include/readline/readline.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for /usr/include/readline/readline.h""... $ac_c" 1>&6 +echo "configure:2702: checking for /usr/include/readline/readline.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_READLINE 1 +EOF + + got_readline="yes" + CONS_INC="-I/usr/include/readline" + CONS_LIBS="-lreadline" + +else + echo "$ac_t""no" 1>&6 + + # Did not find starndard library, so user our own + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_READLINE 1 +EOF + + got_readline="yes" + CONS_INC="-I${TOP_DIR}/depkgs" + CONS_LIBS="-lreadline -lhistory" + CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline" + READLINE_SRC="${TOP_DIR}/depkgs/readline" + +fi + + + +fi + +fi + + + + + +# Minimal stuff for readline Makefile configuration +MAKE_SHELL=/bin/sh + + +echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 +echo "configure:2769: checking whether stat file-mode macros are broken" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include + +#if defined(S_ISBLK) && defined(S_IFDIR) +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined(S_ISBLK) && defined(S_IFCHR) +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined(S_ISLNK) && defined(S_IFREG) +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined(S_ISSOCK) && defined(S_IFREG) +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "You lose" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_header_stat_broken=yes +else + rm -rf conftest* + ac_cv_header_stat_broken=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_stat_broken" 1>&6 +if test $ac_cv_header_stat_broken = yes; then + cat >> confdefs.h <<\EOF +#define STAT_MACROS_BROKEN 1 +EOF + +fi + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:2829: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:2842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:2867: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:2908: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + + +for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat lchown +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2953: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +#AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG), +# [LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o" +# EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"]) + +echo $ac_n "checking for getopt_long""... $ac_c" 1>&6 +echo "configure:3011: checking for getopt_long" >&5 +if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char getopt_long(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_getopt_long) || defined (__stub___getopt_long) +choke me +#else +getopt_long(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_getopt_long=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_getopt_long=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'getopt_long`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETOPT_LONG 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 +echo "configure:3064: checking for working strcoll" >&5 +if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_strcoll_works=no +else + cat > conftest.$ac_ext < +main () +{ + exit (strcoll ("abc", "def") >= 0 || + strcoll ("ABC", "DEF") >= 0 || + strcoll ("123", "456") >= 0); +} +EOF +if { (eval echo configure:3082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_strcoll_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_strcoll_works=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_strcoll_works" 1>&6 +if test $ac_cv_func_strcoll_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_STRCOLL 1 +EOF + +fi + + +for ac_hdr in varargs.h \ + sys/ptem.h sys/pte.h sys/stream.h \ + termcap.h termio.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3111: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +TERMCAP_LIB=-ltermcap + + + +# End of readline stuff +# ----------------------------------------------------------------------- + + +# --------------------------------------------------- +# Check for GMP support/directory +# --------------------------------------------------- +GMP_SRC= +local_gmp="no" +# Check whether --with-gmp or --without-gmp was given. +if test "${with_gmp+set}" = set; then + withval="$with_gmp" + + case "$with_gmp" in + no) : ;; + yes|*) + if test "$with_gmp" != "yes"; then + GMP_INC="-I$with_gmp" + GMP_LIBS="-lgmp" + GMP_LDFLAGS="-L$with_gmp" + else + with_gmp="/usr/include" + fi + ac_safe=`echo "$with_gmp/gmp.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $with_gmp/gmp.h""... $ac_c" 1>&6 +echo "configure:3177: checking for $with_gmp/gmp.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GMP 1 +EOF + + GMP_LIBS="-lgmp" + got_gmp="yes" + +else + echo "$ac_t""no" 1>&6 + { echo "configure: error: *** gmp library missing" 1>&2; exit 1; } + + +fi + + ;; + esac + +else + + # check for standard gmp library + ac_safe=`echo "/usr/include/gmp.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for /usr/include/gmp.h""... $ac_c" 1>&6 +echo "configure:3226: checking for /usr/include/gmp.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GMP 1 +EOF + + got_gmp="yes" + GMP_INC= + GMP_LIBS="-lgmp" + +else + echo "$ac_t""no" 1>&6 + + # Did not find standard library, so use our own + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GMP 1 +EOF + + got_gmp="yes" + local_gmp="yes" + GMP_INC="-I${TOP_DIR}/depkgs/gmp" + GMP_LIBS="-lgmp" + GMP_LDFLAGS="-L${TOP_DIR}/depkgs/gmp" + GMP_SRC="${TOP_DIR}/depkgs/gmp" + +fi + + + +fi + + + + + + +# End of GMP stuff +# ----------------------------------------------------------------------- + + +# --------------------------------------------------- +# Check for CWEB support/directory +# --------------------------------------------------- +CWEB_SRC= +local_cweb="no" +# Check whether --with-cweb or --without-cweb was given. +if test "${with_cweb+set}" = set; then + withval="$with_cweb" + + case "$with_cweb" in + no) : ;; + yes|*) + if test "$with_cweb" != "yes"; then + CWEB_INC="-I$with_cweb" + CWEB_LIBS="-lcweb" + CWEB_LDFLAGS="-L$with_cweb" + else + with_cweb="/usr/include" + fi + ac_safe=`echo "$with_cweb/cweb.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $with_cweb/cweb.h""... $ac_c" 1>&6 +echo "configure:3313: checking for $with_cweb/cweb.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CWEB 1 +EOF + + CWEB_LIBS="-lcweb" + got_cweb="yes" + +else + echo "$ac_t""no" 1>&6 + { echo "configure: error: *** cweb library missing" 1>&2; exit 1; } + + +fi + + ;; + esac + +else + + # check for standard cweb library + ac_safe=`echo "/usr/include/cweb.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for /usr/include/cweb.h""... $ac_c" 1>&6 +echo "configure:3362: checking for /usr/include/cweb.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CWEB 1 +EOF + + got_cweb="yes" + CWEB_INC= + CWEB_LIBS="-lcweb" + +else + echo "$ac_t""no" 1>&6 + + # Did not find starndard library, so use our own + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CWEB 1 +EOF + + got_cweb="yes" + local_cweb="yes" + CWEB_INC="-I${TOP_DIR}/depkgs/cweb" + CWEB_LIBS="-lcweb" + CWEB_LDFLAGS="-L${TOP_DIR}/depkgs/cweb" + CWEB_SRC="${TOP_DIR}/depkgs/cweb" + +fi + + + +fi + + + + + + +# End of CWEB stuff +# ----------------------------------------------------------------------- + + + +# ----------------------------------------------------------- +# Check whether user wants TCP wrappers support (default off) +# ----------------------------------------------------------- +TCPW_MSG="no" +# Check whether --with-tcp-wrappers or --without-tcp-wrappers was given. +if test "${with_tcp_wrappers+set}" = set; then + withval="$with_tcp_wrappers" + + if test "x$withval" != "xno" ; then + saved_LIBS="$LIBS" + LIBS="$LIBS -lwrap -lnsl" + echo $ac_n "checking for libwrap""... $ac_c" 1>&6 +echo "configure:3441: checking for libwrap" >&5 + cat > conftest.$ac_ext < + int deny_severity = 0; + int allow_severity = 0; + struct request_info *req; +int main() { + hosts_access(req); +; return 0; } +EOF +if { (eval echo configure:3453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_LIBWRAP 1 +EOF + + TCPW_MSG="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: *** libwrap missing" 1>&2; exit 1; } + +fi +rm -f conftest* + fi + + +fi + + +# ------------------------------------------ +# Where to place working dir +# ------------------------------------------ +working_dir=`eval echo ${sysconfdir}/working` +# Check whether --with-working-dir or --without-working-dir was given. +if test "${with_working_dir+set}" = set; then + withval="$with_working_dir" + + if test "x$withval" != "xno" ; then + working_dir=$withval + fi + + +fi + + + + +# ------------------------------------------ +# Where to send dump email +# ------------------------------------------ +dump_email=root +# Check whether --with-dump-email or --without-dump-email was given. +if test "${with_dump_email+set}" = set; then + withval="$with_dump_email" + + if test "x$withval" != "xno" ; then + dump_email=$withval + fi + + +fi + + + + +# ------------------------------------------ +# Where to send job email +# ------------------------------------------ +job_email=root +# Check whether --with-job-email or --without-job-email was given. +if test "${with_job_email+set}" = set; then + withval="$with_job_email" + + if test "x$withval" != "xno" ; then + job_email=$withval + fi + + +fi + + + + +# ------------------------------------------ +# Where to find smtp host +# ------------------------------------------ +smtp_host=localhost +# Check whether --with-smtp_host or --without-smtp_host was given. +if test "${with_smtp_host+set}" = set; then + withval="$with_smtp_host" + + if test "x$withval" != "xno" ; then + smtp_host=$withval + fi + + +fi + + + + + +# ------------------------------------ +# Where to place pid files +# ------------------------------------ +piddir=/var/run +# Check whether --with-pid-dir or --without-pid-dir was given. +if test "${with_pid_dir+set}" = set; then + withval="$with_pid_dir" + + if test "x$withval" != "xno" ; then + piddir=$withval + fi + + +fi + + +# make sure the pid directory exists +if test ! -d $piddir ; then + piddir=`eval echo ${sysconfdir}` + case $piddir in + NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;; + esac +fi + +cat >> confdefs.h <&6 +echo "configure:3720: checking for MySQL support" >&5 +# Check whether --with-mysql or --without-mysql was given. +if test "${with_mysql+set}" = set; then + withval="$with_mysql" + + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + if test -f /usr/local/mysql/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/mysql/include/mysql + MYSQL_LIBDIR=/usr/local/mysql/lib/mysql + MYSQL_BINDIR=/usr/local/mysql/bin + elif test -f /usr/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/include/mysql + MYSQL_LIBDIR=/usr/lib/mysql + MYSQL_BINDIR=/usr/bin + elif test -f /usr/include/mysql.h; then + MYSQL_INCDIR=/usr/include + MYSQL_LIBDIR=/usr/lib + MYSQL_BINDIR=/usr/bin + elif test -f /usr/local/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + MYSQL_BINDIR=/usr/local/bin + elif test -f /usr/local/include/mysql.h; then + MYSQL_INCDIR=/usr/local/include + MYSQL_LIBDIR=/usr/local/lib + MYSQL_BINDIR=/usr/local/bin + else + echo "$ac_t""no" 1>&6 + { echo "configure: error: Unable to find mysql.h in standard locations" 1>&2; exit 1; } + fi + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + MYSQL_BINDIR=$withval/bin + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + MYSQL_BINDIR=$withval/bin + else + echo "$ac_t""no" 1>&6 + { echo "configure: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" 1>&2; exit 1; } + fi + fi + SQL_INCLUDE=-I$MYSQL_INCDIR + SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient" + SQL_BINDIR=$MYSQL_BINDIR + + cat >> confdefs.h <<\EOF +#define HAVE_MYSQL 1 +EOF + + echo "$ac_t""yes" 1>&6 + have_db=yes + support_mysql=yes + db_name=MySQL + + else + echo "$ac_t""no" 1>&6 + fi + +else + + echo "$ac_t""no" 1>&6 + +fi + + + + + + + + +# ------------------------------------------------ +# Bacula check for various SQL database engines +# ------------------------------------------------ + +have_db=no +db_name=none +echo $ac_n "checking for SQLite support""... $ac_c" 1>&6 +echo "configure:3802: checking for SQLite support" >&5 +# Check whether --with-sqlite or --without-sqlite was given. +if test "${with_sqlite+set}" = set; then + withval="$with_sqlite" + + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + if test -f /usr/local/include/sqlite.h; then + SQLITE_INCDIR=/usr/local/include + SQLITE_LIBDIR=/usr/local/lib + SQLITE_BINDIR=/usr/local/bin + elif test -f /usr/include/sqlite.h; then + SQLITE_INCDIR=/usr/include + SQLITE_LIBDIR=/usr/lib + SQLITE_BINDIR=/usr/bin + else + echo "$ac_t""no" 1>&6 + { echo "configure: error: Unable to find sqlite.h in standard locations" 1>&2; exit 1; } + fi + else + if test -f $withval/sqlite.h; then + SQLITE_INCDIR=$withval + SQLITE_LIBDIR=$withval + SQLITE_BINDIR=$withval + else + echo "$ac_t""no" 1>&6 + { echo "configure: error: Invalid SQLite directory $withval - unable to find sqlite.h under $withval" 1>&2; exit 1; } + fi + fi + SQL_INCLUDE=-I$SQLITE_INCDIR + SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite" + SQL_BINDIR=$SQLITE_BINDIR + + cat >> confdefs.h <<\EOF +#define HAVE_SQLITE 1 +EOF + + echo "$ac_t""yes" 1>&6 + have_db=yes + support_sqlite=yes + db_name=SQLite + + else + echo "$ac_t""no" 1>&6 + fi + +else + + echo "$ac_t""no" 1>&6 + +fi + + + + + + + + +cat >> confdefs.h <<\EOF +#define PROTOTYPES 1 +EOF + + +if test -z "$CFLAGS"; then + if test -z "$CCOPTS"; then + CCOPTS='-O' + fi + CFLAGS="$CCOPTS" +fi + + +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:3875: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:3906: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:3916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + + + + +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# Uses ac_ vars as temps to allow command line to override cache and checks. +# --without-x overrides everything else, but does not touch the cache. +echo $ac_n "checking for X""... $ac_c" 1>&6 +echo "configure:3944: checking for X" >&5 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + : +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else +if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=NO ac_x_libraries=NO +rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat > Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case "$ac_im_incroot" in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + esac + case "$ac_im_usrlibdir" in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + esac + fi + cd .. + rm -fr conftestdir +fi + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + # Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done +fi +rm -f conftest* +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest* +fi # $ac_x_libraries = NO + +if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$ac_t""$have_x" 1>&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + cat >> confdefs.h <<\EOF +#define X_DISPLAY_MISSING 1 +EOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case "`(uname -sr) 2>/dev/null`" in + "SunOS 5"*) + echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 +echo "configure:4193: checking whether -R must be followed by a space" >&5 + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_R_nospace=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_R_nospace=no +fi +rm -f conftest* + if test $ac_R_nospace = yes; then + echo "$ac_t""no" 1>&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_R_space=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_R_space=no +fi +rm -f conftest* + if test $ac_R_space = yes; then + echo "$ac_t""yes" 1>&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$ac_t""neither works" 1>&6 + fi + fi + LIBS="$ac_xsave_LIBS" + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 +echo "configure:4258: checking for dnet_ntoa in -ldnet" >&5 +ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldnet $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 +echo "configure:4299: checking for dnet_ntoa in -ldnet_stub" >&5 +ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldnet_stub $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to dickey@clark.net. + echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 +echo "configure:4347: checking for gethostbyname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +gethostbyname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_gethostbyname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostbyname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_gethostbyname = no; then + echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:4396: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + echo $ac_n "checking for connect""... $ac_c" 1>&6 +echo "configure:4445: checking for connect" >&5 +if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +connect(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_connect=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_connect=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_connect = no; then + echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 +echo "configure:4494: checking for connect in -lsocket" >&5 +ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. + echo $ac_n "checking for remove""... $ac_c" 1>&6 +echo "configure:4537: checking for remove" >&5 +if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_remove) || defined (__stub___remove) +choke me +#else +remove(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_remove=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_remove=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_remove = no; then + echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 +echo "configure:4586: checking for remove in -lposix" >&5 +ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lposix $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo $ac_n "checking for shmat""... $ac_c" 1>&6 +echo "configure:4629: checking for shmat" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shmat) || defined (__stub___shmat) +choke me +#else +shmat(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shmat=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shmat=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_shmat = no; then + echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 +echo "configure:4678: checking for shmat in -lipc" >&5 +ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lipc $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS="$LDFLAGS" + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. + echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 +echo "configure:4730: checking for IceConnectionNumber in -lICE" >&5 +ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +else + echo "$ac_t""no" 1>&6 +fi + + LDFLAGS="$ac_save_LDFLAGS" + +fi + + +for ac_hdr in \ + assert.h \ + fcntl.h \ + grp.h \ + libc.h \ + limits.h \ + stdarg.h \ + stdlib.h \ + string.h \ + termios.h \ + unistd.h \ + sys/byteorder.h \ + sys/ioctl.h \ + sys/select.h \ + sys/sockio.h \ + sys/time.h \ + +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4794: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:4831: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:4911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6 +echo "configure:4935: checking whether sys/types.h defines makedev" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_types_h_makedev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return makedev(0, 0); +; return 0; } +EOF +if { (eval echo configure:4947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_sys_types_h_makedev=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_types_h_makedev=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_sys_types_h_makedev" 1>&6 + +if test $ac_cv_header_sys_types_h_makedev = no; then +ac_safe=`echo "sys/mkdev.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/mkdev.h""... $ac_c" 1>&6 +echo "configure:4965: checking for sys/mkdev.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4975: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define MAJOR_IN_MKDEV 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + + if test $ac_cv_header_sys_mkdev_h = no; then +ac_safe=`echo "sys/sysmacros.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/sysmacros.h""... $ac_c" 1>&6 +echo "configure:5003: checking for sys/sysmacros.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define MAJOR_IN_SYSMACROS 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + fi +fi + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:5045: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:5058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:5083: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:5124: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 +echo "configure:5166: checking whether stat file-mode macros are broken" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include + +#if defined(S_ISBLK) && defined(S_IFDIR) +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined(S_ISBLK) && defined(S_IFCHR) +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined(S_ISLNK) && defined(S_IFREG) +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined(S_ISSOCK) && defined(S_IFREG) +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "You lose" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_header_stat_broken=yes +else + rm -rf conftest* + ac_cv_header_stat_broken=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_stat_broken" 1>&6 +if test $ac_cv_header_stat_broken = yes; then + cat >> confdefs.h <<\EOF +#define STAT_MACROS_BROKEN 1 +EOF + +fi + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:5222: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:5243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:5264: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:5278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 +echo "configure:5299: checking for st_blksize in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct stat s; s.st_blksize; +; return 0; } +EOF +if { (eval echo configure:5312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blksize=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blksize=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 +if test $ac_cv_struct_st_blksize = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLKSIZE 1 +EOF + +fi + +echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 +echo "configure:5333: checking for st_blocks in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct stat s; s.st_blocks; +; return 0; } +EOF +if { (eval echo configure:5346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blocks=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blocks=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6 +if test $ac_cv_struct_st_blocks = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLOCKS 1 +EOF + +else + LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:5369: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:5382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 +echo "configure:5403: checking for tm_zone in struct tm" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include <$ac_cv_struct_tm> +int main() { +struct tm tm; tm.tm_zone; +; return 0; } +EOF +if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm_zone=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm_zone=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6 +if test "$ac_cv_struct_tm_zone" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_TM_ZONE 1 +EOF + +else + echo $ac_n "checking for tzname""... $ac_c" 1>&6 +echo "configure:5436: checking for tzname" >&5 +if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif +int main() { +atoi(*tzname); +; return 0; } +EOF +if { (eval echo configure:5451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_var_tzname=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_var_tzname=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_var_tzname" 1>&6 + if test $ac_cv_var_tzname = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_TZNAME 1 +EOF + + fi +fi + + +# It seems that that many machines where seems to be +# broken just require something like -D_XXX_SOURCE, where XXX might +# be POSIX, POSIX_C, ALL, HPUX or whatever, depending on the machine. + +echo $ac_n "checking for utime.h""... $ac_c" 1>&6 +echo "configure:5478: checking for utime.h" >&5 +if eval "test \"`echo '$''{'tar_cv_header_utime_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct utimbuf foo +; return 0; } +EOF +if { (eval echo configure:5492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + tar_cv_header_utime_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tar_cv_header_utime_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$tar_cv_header_utime_h" 1>&6 +test $tar_cv_header_utime_h = yes && cat >> confdefs.h <<\EOF +#define HAVE_UTIME_H 1 +EOF + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:5511: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:5565: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + + + +echo $ac_n "checking how to get filesystem type""... $ac_c" 1>&6 +echo "configure:5588: checking how to get filesystem type" >&5 +fstype=no +# The order of these tests is important. +cat > conftest.$ac_ext < +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5598: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define FSTYPE_STATVFS 1 +EOF + fstype=SVR4 +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $fstype = no; then +cat > conftest.$ac_ext < +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5620: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define FSTYPE_USG_STATFS 1 +EOF + fstype=SVR3 +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +if test $fstype = no; then +cat > conftest.$ac_ext < +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define FSTYPE_AIX_STATFS 1 +EOF + fstype=AIX +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +if test $fstype = no; then +cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5665: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define FSTYPE_MNTENT 1 +EOF + fstype=4.3BSD +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +if test $fstype = no; then +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "f_type;" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define FSTYPE_STATFS 1 +EOF + fstype=4.4BSD/OSF1 +fi +rm -f conftest* + +fi +if test $fstype = no; then +cat > conftest.$ac_ext < +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define FSTYPE_GETMNT 1 +EOF + fstype=Ultrix +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +echo "$ac_t""$fstype" 1>&6 + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:5723: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:5745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <&6 +echo "configure:5765: checking for type of signal functions" >&5 +if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + + sigset_t ss; + struct sigaction sa; + sigemptyset(&ss); sigsuspend(&ss); + sigaction(SIGINT, &sa, (struct sigaction *) 0); + sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); + +; return 0; } +EOF +if { (eval echo configure:5784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + bash_cv_signal_vintage=posix +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext < +int main() { + + int mask = sigmask(SIGINT); + sigsetmask(mask); sigblock(mask); sigpause(mask); + +; return 0; } +EOF +if { (eval echo configure:5803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + bash_cv_signal_vintage=4.2bsd +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext < + RETSIGTYPE foo() { } +int main() { + + int mask = sigmask(SIGINT); + sigset(SIGINT, foo); sigrelse(SIGINT); + sighold(SIGINT); sigpause(SIGINT); + +; return 0; } +EOF +if { (eval echo configure:5825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + bash_cv_signal_vintage=svr3 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bash_cv_signal_vintage=v7 + +fi +rm -f conftest* + +fi +rm -f conftest* + +fi +rm -f conftest* + +fi + +echo "$ac_t""$bash_cv_signal_vintage" 1>&6 +if test "$bash_cv_signal_vintage" = posix; then +cat >> confdefs.h <<\EOF +#define HAVE_POSIX_SIGNALS 1 +EOF + +elif test "$bash_cv_signal_vintage" = "4.2bsd"; then +cat >> confdefs.h <<\EOF +#define HAVE_BSD_SIGNALS 1 +EOF + +elif test "$bash_cv_signal_vintage" = svr3; then +cat >> confdefs.h <<\EOF +#define HAVE_USG_SIGHOLD 1 +EOF + +fi + +echo $ac_n "checking for mode_t""... $ac_c" 1>&6 +echo "configure:5864: checking for mode_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_mode_t=yes +else + rm -rf conftest* + ac_cv_type_mode_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_mode_t" 1>&6 +if test $ac_cv_type_mode_t = no; then + cat >> confdefs.h <<\EOF +#define mode_t int +EOF + +fi + +echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 +echo "configure:5897: checking for uid_t in sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uid_t=yes +else + rm -rf conftest* + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +if test $ac_cv_type_uid_t = no; then + cat >> confdefs.h <<\EOF +#define uid_t int +EOF + + cat >> confdefs.h <<\EOF +#define gid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:5931: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:5964: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:5997: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for ino_t""... $ac_c" 1>&6 +echo "configure:6030: checking for ino_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ino_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ino_t=yes +else + rm -rf conftest* + ac_cv_type_ino_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ino_t" 1>&6 +if test $ac_cv_type_ino_t = no; then + cat >> confdefs.h <<\EOF +#define ino_t unsigned long +EOF + +fi + +echo $ac_n "checking for dev_t""... $ac_c" 1>&6 +echo "configure:6063: checking for dev_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_dev_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])dev_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_dev_t=yes +else + rm -rf conftest* + ac_cv_type_dev_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_dev_t" 1>&6 +if test $ac_cv_type_dev_t = no; then + cat >> confdefs.h <<\EOF +#define dev_t unsigned long +EOF + +fi + +echo $ac_n "checking for daddr_t""... $ac_c" 1>&6 +echo "configure:6096: checking for daddr_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_daddr_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])daddr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_daddr_t=yes +else + rm -rf conftest* + ac_cv_type_daddr_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_daddr_t" 1>&6 +if test $ac_cv_type_daddr_t = no; then + cat >> confdefs.h <<\EOF +#define daddr_t long +EOF + +fi + +echo $ac_n "checking for major_t""... $ac_c" 1>&6 +echo "configure:6129: checking for major_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_major_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])major_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_major_t=yes +else + rm -rf conftest* + ac_cv_type_major_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_major_t" 1>&6 +if test $ac_cv_type_major_t = no; then + cat >> confdefs.h <<\EOF +#define major_t int +EOF + +fi + +echo $ac_n "checking for minor_t""... $ac_c" 1>&6 +echo "configure:6162: checking for minor_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_minor_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])minor_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_minor_t=yes +else + rm -rf conftest* + ac_cv_type_minor_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_minor_t" 1>&6 +if test $ac_cv_type_minor_t = no; then + cat >> confdefs.h <<\EOF +#define minor_t int +EOF + +fi + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:6195: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t int +EOF + +fi + +echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 +echo "configure:6228: checking for st_blocks in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct stat s; s.st_blocks; +; return 0; } +EOF +if { (eval echo configure:6241: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blocks=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blocks=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6 +if test $ac_cv_struct_st_blocks = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLOCKS 1 +EOF + +else + LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" +fi + +echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 +echo "configure:6264: checking for st_rdev in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct stat s; s.st_rdev; +; return 0; } +EOF +if { (eval echo configure:6277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_rdev=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_rdev=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6 +if test $ac_cv_struct_st_rdev = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_RDEV 1 +EOF + +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:6298: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:6311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:6332: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:6386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + + + +echo $ac_n "checking size of char""... $ac_c" 1>&6 +echo "configure:6409: checking size of char" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_char=1 +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(char)); + exit(0); +} +EOF +if { (eval echo configure:6428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_char=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_char=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_char" 1>&6 +cat >> confdefs.h <&6 +echo "configure:6448: checking size of short int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_short_int=2 +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(short int)); + exit(0); +} +EOF +if { (eval echo configure:6467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_short_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_short_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_short_int" 1>&6 +cat >> confdefs.h <&6 +echo "configure:6487: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_int=4 +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:6506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <&6 +echo "configure:6526: checking size of long int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_long_int=4 +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long int)); + exit(0); +} +EOF +if { (eval echo configure:6545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long_int" 1>&6 +cat >> confdefs.h <&6 +echo "configure:6565: checking size of long long int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_long_long_int=8 +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long long int)); + exit(0); +} +EOF +if { (eval echo configure:6584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_long_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_long_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long_long_int" 1>&6 +cat >> confdefs.h <&6 +echo "configure:6604: checking size of int *" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_int_p=4 +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int *)); + exit(0); +} +EOF +if { (eval echo configure:6623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int_p=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int_p=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int_p" 1>&6 +cat >> confdefs.h <&6 +echo "configure:6645: checking for u_int type" >&5 +if eval "test \"`echo '$''{'ac_cv_have_u_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + u_int a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_u_int="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_u_int="no" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_u_int" 1>&6 +if test "x$ac_cv_have_u_int" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_U_INT 1 +EOF + + have_u_int=1 +fi + +echo $ac_n "checking for intmax_t type""... $ac_c" 1>&6 +echo "configure:6682: checking for intmax_t type" >&5 +if eval "test \"`echo '$''{'ac_cv_have_intmax_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + intmax_t a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_intmax_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext < +int main() { + intmax_t a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_intmax_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_intmax_t="no" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + +fi + +echo "$ac_t""$ac_cv_have_intmax_t" 1>&6 +if test "x$ac_cv_have_intmax_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_INTMAX_T 1 +EOF + + have_intmax_t=1 +fi + + +echo $ac_n "checking for u_intmax_t type""... $ac_c" 1>&6 +echo "configure:6741: checking for u_intmax_t type" >&5 +if eval "test \"`echo '$''{'ac_cv_have_u_intmax_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + u_intmax_t a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_u_intmax_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext < +int main() { + u_intmax_t a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_u_intmax_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_u_intmax_t="no" + +fi +rm -f conftest* + + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_u_intmax_t" 1>&6 +if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_U_INTMAX_T 1 +EOF + + have_u_intmax_t=1 +fi + + +echo $ac_n "checking for intXX_t types""... $ac_c" 1>&6 +echo "configure:6799: checking for intXX_t types" >&5 +if eval "test \"`echo '$''{'ac_cv_have_intxx_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + int8_t a; int16_t b; int32_t c; a = b = c = 1; +; return 0; } +EOF +if { (eval echo configure:6812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_intxx_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_intxx_t="no" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_intxx_t" 1>&6 +if test "x$ac_cv_have_intxx_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_INTXX_T 1 +EOF + + have_intxx_t=1 +fi + +echo $ac_n "checking for int64_t type""... $ac_c" 1>&6 +echo "configure:6836: checking for int64_t type" >&5 +if eval "test \"`echo '$''{'ac_cv_have_int64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + int64_t a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_int64_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_int64_t="no" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_int64_t" 1>&6 +if test "x$ac_cv_have_int64_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_INT64_T 1 +EOF + + have_int64_t=1 +fi + +echo $ac_n "checking for u_intXX_t types""... $ac_c" 1>&6 +echo "configure:6873: checking for u_intXX_t types" >&5 +if eval "test \"`echo '$''{'ac_cv_have_u_intxx_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1; +; return 0; } +EOF +if { (eval echo configure:6886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_u_intxx_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_u_intxx_t="no" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_u_intxx_t" 1>&6 +if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_U_INTXX_T 1 +EOF + + have_u_intxx_t=1 +fi + +echo $ac_n "checking for u_int64_t types""... $ac_c" 1>&6 +echo "configure:6910: checking for u_int64_t types" >&5 +if eval "test \"`echo '$''{'ac_cv_have_u_int64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + u_int64_t a; a = 1; +; return 0; } +EOF +if { (eval echo configure:6923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_u_int64_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_u_int64_t="no" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_u_int64_t" 1>&6 +if test "x$ac_cv_have_u_int64_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_U_INT64_T 1 +EOF + + have_u_int64_t=1 +fi + +if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ + test "x$ac_cv_header_sys_bitypes_h" = "xyes") +then + echo $ac_n "checking for intXX_t and u_intXX_t types in sys/bitypes.h""... $ac_c" 1>&6 +echo "configure:6950: checking for intXX_t and u_intXX_t types in sys/bitypes.h" >&5 + cat > conftest.$ac_ext < +int main() { + int8_t a; int16_t b; int32_t c; + u_int8_t e; u_int16_t f; u_int32_t g; + a = b = c = e = f = g = 1; +; return 0; } +EOF +if { (eval echo configure:6961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_U_INTXX_T 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_INTXX_T 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_BITYPES_H 1 +EOF + + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 + +fi +rm -f conftest* +fi + +if test -z "$have_u_intxx_t" ; then + echo $ac_n "checking for uintXX_t types""... $ac_c" 1>&6 +echo "configure:6988: checking for uintXX_t types" >&5 +if eval "test \"`echo '$''{'ac_cv_have_uintxx_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + uint8_t a; uint16_t b; + uint32_t c; a = b = c = 1; +; return 0; } +EOF +if { (eval echo configure:7002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_have_uintxx_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_have_uintxx_t="no" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_have_uintxx_t" 1>&6 + if test "x$ac_cv_have_uintxx_t" = "xyes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_UINTXX_T 1 +EOF + + fi +fi + + +for ac_func in \ + fork \ + getcwd \ + gethostname \ + getpid \ + setpgid \ + setpgrp \ + setsid \ + signal \ + strerror \ + strncmp \ + strncpy \ + vfprintf \ + +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7042: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +echo 'configure: cannot find needed function.'; exit 1 + +fi +done + + +for ac_func in fchdir +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7100: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <> confdefs.h <<\EOF +#define HAVE_FCHDIR 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +for ac_func in snprintf vsnprintf +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7159: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +for ac_func in localtime_r +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7215: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <> confdefs.h <<\EOF +#define HAVE_LOCALTIME_R 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +for ac_func in readdir_r +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7274: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <> confdefs.h <<\EOF +#define HAVE_READDIR_R 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +# Find where sockets are (especially for Solaris) +echo $ac_n "checking for socket""... $ac_c" 1>&6 +echo "configure:7332: checking for socket" >&5 +if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_socket) || defined (__stub___socket) +choke me +#else +socket(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_socket=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_socket=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""using libc's socket" 1>&6 +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for socket in -lxnet""... $ac_c" 1>&6 +echo "configure:7378: checking for socket in -lxnet" >&5 +ac_lib_var=`echo xnet'_'socket | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lxnet $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo xnet | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 +echo "configure:7425: checking for socket in -lsocket" >&5 +ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6 +echo "configure:7472: checking for socket in -linet" >&5 +ac_lib_var=`echo inet'_'socket | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-linet $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo inet | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +fi + + +# If resolver functions are not in libc check for -lnsl or -lresolv. +echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 +echo "configure:7523: checking for gethostbyname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +gethostbyname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_gethostbyname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostbyname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo "$ac_t""using libc's resolver" 1>&6 +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:7569: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for gethostbyname in -lresolv""... $ac_c" 1>&6 +echo "configure:7616: checking for gethostbyname in -lresolv" >&5 +ac_lib_var=`echo resolv'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lresolv $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +fi + + + +echo $ac_n "checking for strftime""... $ac_c" 1>&6 +echo "configure:7667: checking for strftime" >&5 +if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strftime(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strftime) || defined (__stub___strftime) +choke me +#else +strftime(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_strftime=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_strftime=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'strftime`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_STRFTIME 1 +EOF + +else + echo "$ac_t""no" 1>&6 +# strftime is in -lintl on SCO UNIX. +echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 +echo "configure:7717: checking for strftime in -lintl" >&5 +ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_STRFTIME 1 +EOF + +LIBS="-lintl $LIBS" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking for vprintf""... $ac_c" 1>&6 +echo "configure:7763: checking for vprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +echo "configure:7815: checking for _doprnt" >&5 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +_doprnt(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func__doprnt=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:7870: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:7882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:7903: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:7936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:7968: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7998: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:8053: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:8080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <&6 +echo "configure:8103: checking for getmntent in -lsun" >&5 +ac_lib_var=`echo sun'_'getmntent | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsun $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lsun $LIBS" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for getmntent in -lseq""... $ac_c" 1>&6 +echo "configure:8141: checking for getmntent in -lseq" >&5 +ac_lib_var=`echo seq'_'getmntent | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lseq $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lseq $LIBS" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for getmntent in -lgen""... $ac_c" 1>&6 +echo "configure:8179: checking for getmntent in -lgen" >&5 +ac_lib_var=`echo gen'_'getmntent | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgen $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lgen $LIBS" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +fi + +echo $ac_n "checking for getmntent""... $ac_c" 1>&6 +echo "configure:8223: checking for getmntent" >&5 +if eval "test \"`echo '$''{'ac_cv_func_getmntent'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char getmntent(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_getmntent) || defined (__stub___getmntent) +choke me +#else +getmntent(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_getmntent=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_getmntent=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'getmntent`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETMNTENT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&6 +echo "configure:8274: checking whether closedir returns void" >&5 +if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_closedir_void=yes +else + cat > conftest.$ac_ext < +#include <$ac_header_dirent> +int closedir(); main() { exit(closedir(opendir(".")) != 0); } +EOF +if { (eval echo configure:8288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_closedir_void=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_closedir_void=yes +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_closedir_void" 1>&6 +if test $ac_cv_func_closedir_void = yes; then + cat >> confdefs.h <<\EOF +#define CLOSEDIR_VOID 1 +EOF + +fi + +echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 +echo "configure:8311: checking whether setpgrp takes no argument" >&5 +if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +#endif + +/* + * If this system has a BSD-style setpgrp, which takes arguments, exit + * successfully. + */ +main() +{ + if (setpgrp(1,1) == -1) + exit(0); + else + exit(1); +} + +EOF +if { (eval echo configure:8339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_setpgrp_void=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_setpgrp_void=yes +fi +rm -fr conftest* +fi + + +fi + +echo "$ac_t""$ac_cv_func_setpgrp_void" 1>&6 +if test $ac_cv_func_setpgrp_void = yes; then + cat >> confdefs.h <<\EOF +#define SETPGRP_VOID 1 +EOF + +fi + echo $ac_n "checking for working fnmatch""... $ac_c" 1>&6 +echo "configure:8362: checking for working fnmatch" >&5 +if eval "test \"`echo '$''{'ac_cv_func_fnmatch_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # Some versions of Solaris or SCO have a broken fnmatch function. +# So we run a test program. If we are cross-compiling, take no chance. +# Thanks to John Oleynick and Franc,ois Pinard for this test. +if test "$cross_compiling" = yes; then + ac_cv_func_fnmatch_works=no +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_fnmatch_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_fnmatch_works=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_fnmatch_works" 1>&6 +if test $ac_cv_func_fnmatch_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_FNMATCH 1 +EOF + +fi + + + +echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6 +echo "configure:8402: checking for setlocale in -lxpg4" >&5 +ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lxpg4 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lxpg4" +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking for getpwnam in -lsun""... $ac_c" 1>&6 +echo "configure:8444: checking for getpwnam in -lsun" >&5 +ac_lib_var=`echo sun'_'getpwnam | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsun $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo sun | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 +echo "configure:8491: checking for deflate in -lz" >&5 +ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lz $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + FDLIBS="-lz" +else + echo "$ac_t""no" 1>&6 +fi + +have_zlib=no +if test x$FDLIBS = x-lz; then + have_zlib=yes +fi + +PTHREAD_LIB="" +echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:8537: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PTHREAD_LIB="-lpthread" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 +echo "configure:8575: checking for pthread_create in -lpthreads" >&5 +ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthreads $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PTHREAD_LIB="-lpthreads" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 +echo "configure:8613: checking for pthread_create in -lc_r" >&5 +ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lc_r $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PTHREAD_LIB="-lc_r" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 +echo "configure:8651: checking for pthread_create" >&5 +if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_pthread_create) || defined (__stub___pthread_create) +choke me +#else +pthread_create(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_pthread_create=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_pthread_create=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'pthread_create`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + + +cat >> confdefs.h <<\EOF +#define FDLIBS 1 +EOF + + + +CFLAGS=${CFLAGS--O} +LDFLAGS=${LDFLAGS--O} +LIBS="${LIBS} ${SQL_LFLAGS}" + +CPPFLAGS="$CPPFLAGS" + + + + + + + + + + + +OBJLIST= + + +lld="lld" +llu="llu" + +# +# Finally we set appropriate distribution specific +# variables and defaults +# +# PFILES are platform specific files +PFILES="platforms/Makefile" +PSCMD="ps -e" +WIN32= +hostname=`hostname` +case "$DISTNAME" in +alpha) + DISTVER=`uname -r` + PTHREAD_LIB="-lpthread -lexc" + if test "${CC}" = "gcc" ; then + lld="lld" + llu="llu" + else + lld="ld" + llu="lu" + fi + TAPEDRIVE="/dev/nrmt0" + ;; +bsdi) + DISTVER=`uname -a |awk '{print $3}'` + TAPEDRIVE="/dev/nrst0" + ;; +caldera) + DISTVER=`cat /etc/.issue | grep Version | cut -f 2 -d ' '` + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +cygwin) + DISTVER=`uname -a |awk '{print $3}'` + TAPEDRIVE="/dev/nrst0" + WIN32=win32 + CFLAGS="${CFLAGS} -mwindows" + LDFLAGS="${LDFLAGS} -mwindows" + ;; +debian) + DISTVER=`cat /etc/debian_version` + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +freebsd) + DISTVER=`uname -a |awk '{print $3}'` + PTHREAD_LIB="-pthread" + CFLAGS="${CFLAGS} -pthread" + lld="qd" + llu="qu" + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -x -o pid,command" + PFILES="${PFILES} \ + platforms/freebsd/Makefile \ + platforms/freebsd/bacula-fd \ + platforms/freebsd/bacula-sd \ + platforms/freebsd/bacula-dir" + hostname=`hostname -s` + ;; +hpux) + DISTVER=`uname -r` + TAPEDRIVE="/dev/rmt/0hnb" + ;; +netbsd) + DISTVER=`uname -a |awk '{print $3}'` + lld="qd" + llu="qu" + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -a -o pid,command" + ;; +openbsd) + DISTVER=`uname -a |awk '{print $3}'` + lld="qd" + llu="qu" + TAPEDRIVE="/dev/nrst0" + PSCMD="ps -a -o pid,command" + ;; +redhat) + DISTVER=`cat /etc/redhat-release | grep release |\ + cut -f 5 -d ' '` + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + PFILES="${PFILES} \ + platforms/redhat/Makefile \ + platforms/redhat/bacula-fd \ + platforms/redhat/bacula-sd \ + platforms/redhat/bacula-dir" + hostname=`hostname -s` + ;; +slackware) + DISTVER=`cat /etc/slackware-version` + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +solaris) + DISTVER=Solaris + TAPEDRIVE="/dev/rmt/0cbn" + PSCMD="ps -e -o pid,comm" + PFILES="${PFILES} \ + platforms/solaris/Makefile \ + platforms/solaris/bacula-fd \ + platforms/solaris/bacula-sd \ + platforms/solaris/bacula-dir" + ;; +suse) + DISTVER=`cat /etc/SuSE-release |grep VERSION|\ + cut -f 3 -d ' '` + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +suse5) + DISTNAME=suse + DISTVER=5.x + TAPEDRIVE="/dev/nst0" + PSCMD="ps -e -o pid,command" + hostname=`hostname -s` + ;; +unknown) + DISTVER=unknown + TAPEDRIVE="/dev/nst0" + ;; +*) + echo " === Something went wrong. Unknown DISTNAME $DISTNAME ===" + ;; +esac + + + + +LIBS="$PTHREAD_LIB $LIBS" + +cat >> confdefs.h <> confdefs.h < confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "autoconf/Make.common \ + Makefile \ + startmysql \ + stopmysql \ + btraceback \ + startit \ + stopit \ + bacula \ + fd \ + doc/Makefile \ + src/Makefile \ + src/console/Makefile \ + src/console/console.conf \ + src/gnome-console/Makefile \ + src/gnome-console/gnome-console.conf \ + src/dird/Makefile \ + src/dird/bacula-dir.conf \ + src/lib/Makefile \ + src/stored/Makefile \ + src/stored/bacula-sd.conf \ + src/filed/Makefile \ + src/filed/bacula-fd.conf \ + src/filed/win32/Makefile \ + src/cats/Makefile \ + src/cats/make_mysql_tables \ + src/cats/drop_mysql_tables \ + src/cats/create_mysql_database \ + src/cats/grant_mysql_privileges \ + src/cats/make_sqlite_tables \ + src/cats/sqlite \ + src/findlib/Makefile \ + $PFILES src/config.h:autoconf/config.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@BUILD_DIR@%$BUILD_DIR%g +s%@TRUEPRG@%$TRUEPRG%g +s%@FALSEPRG@%$FALSEPRG%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@VERSION@%$VERSION%g +s%@DATE@%$DATE%g +s%@LSMDATE@%$LSMDATE%g +s%@CC@%$CC%g +s%@CXX@%$CXX%g +s%@CPP@%$CPP%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@MV@%$MV%g +s%@RM@%$RM%g +s%@CP@%$CP%g +s%@SED@%$SED%g +s%@AWK@%$AWK%g +s%@ECHO@%$ECHO%g +s%@CMP@%$CMP%g +s%@TBL@%$TBL%g +s%@AR@%$AR%g +s%@OPENSSL@%$OPENSSL%g +s%@ARFLAGS@%$ARFLAGS%g +s%@MAKE_SHELL@%$MAKE_SHELL%g +s%@LOCAL_LIBS@%$LOCAL_LIBS%g +s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g +s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g +s%@LOCAL_DEFS@%$LOCAL_DEFS%g +s%@HAVE_SUN_OS_TRUE@%$HAVE_SUN_OS_TRUE%g +s%@HAVE_SUN_OS_FALSE@%$HAVE_SUN_OS_FALSE%g +s%@HAVE_OSF1_OS_TRUE@%$HAVE_OSF1_OS_TRUE%g +s%@HAVE_OSF1_OS_FALSE@%$HAVE_OSF1_OS_FALSE%g +s%@HAVE_AIX_OS_TRUE@%$HAVE_AIX_OS_TRUE%g +s%@HAVE_AIX_OS_FALSE@%$HAVE_AIX_OS_FALSE%g +s%@HAVE_HPUX_OS_TRUE@%$HAVE_HPUX_OS_TRUE%g +s%@HAVE_HPUX_OS_FALSE@%$HAVE_HPUX_OS_FALSE%g +s%@HAVE_LINUX_OS_TRUE@%$HAVE_LINUX_OS_TRUE%g +s%@HAVE_LINUX_OS_FALSE@%$HAVE_LINUX_OS_FALSE%g +s%@HAVE_FREEBSD_OS_TRUE@%$HAVE_FREEBSD_OS_TRUE%g +s%@HAVE_FREEBSD_OS_FALSE@%$HAVE_FREEBSD_OS_FALSE%g +s%@HAVE_NETBSD_OS_TRUE@%$HAVE_NETBSD_OS_TRUE%g +s%@HAVE_NETBSD_OS_FALSE@%$HAVE_NETBSD_OS_FALSE%g +s%@HAVE_OPENBSD_OS_TRUE@%$HAVE_OPENBSD_OS_TRUE%g +s%@HAVE_OPENBSD_OS_FALSE@%$HAVE_OPENBSD_OS_FALSE%g +s%@HAVE_BSDI_OS_TRUE@%$HAVE_BSDI_OS_TRUE%g +s%@HAVE_BSDI_OS_FALSE@%$HAVE_BSDI_OS_FALSE%g +s%@HAVE_SGI_OS_TRUE@%$HAVE_SGI_OS_TRUE%g +s%@HAVE_SGI_OS_FALSE@%$HAVE_SGI_OS_FALSE%g +s%@INSIDE_GNOME_COMMON_TRUE@%$INSIDE_GNOME_COMMON_TRUE%g +s%@INSIDE_GNOME_COMMON_FALSE@%$INSIDE_GNOME_COMMON_FALSE%g +s%@MSGFMT@%$MSGFMT%g +s%@GNOME_LIBS@%$GNOME_LIBS%g +s%@GNOMEUI_LIBS@%$GNOMEUI_LIBS%g +s%@GNOMEGNORBA_LIBS@%$GNOMEGNORBA_LIBS%g +s%@GTKXMHTML_LIBS@%$GTKXMHTML_LIBS%g +s%@ZVT_LIBS@%$ZVT_LIBS%g +s%@GNOME_LIBDIR@%$GNOME_LIBDIR%g +s%@GNOME_INCLUDEDIR@%$GNOME_INCLUDEDIR%g +s%@GNOME_CONFIG@%$GNOME_CONFIG%g +s%@ORBIT_CONFIG@%$ORBIT_CONFIG%g +s%@ORBIT_IDL@%$ORBIT_IDL%g +s%@HAVE_ORBIT_TRUE@%$HAVE_ORBIT_TRUE%g +s%@HAVE_ORBIT_FALSE@%$HAVE_ORBIT_FALSE%g +s%@ORBIT_CFLAGS@%$ORBIT_CFLAGS%g +s%@ORBIT_LIBS@%$ORBIT_LIBS%g +s%@HAVE_GNORBA_TRUE@%$HAVE_GNORBA_TRUE%g +s%@HAVE_GNORBA_FALSE@%$HAVE_GNORBA_FALSE%g +s%@GNORBA_CFLAGS@%$GNORBA_CFLAGS%g +s%@GNORBA_LIBS@%$GNORBA_LIBS%g +s%@GNOME_APPLETS_LIBS@%$GNOME_APPLETS_LIBS%g +s%@GNOME_DOCKLETS_LIBS@%$GNOME_DOCKLETS_LIBS%g +s%@GNOME_CAPPLET_LIBS@%$GNOME_CAPPLET_LIBS%g +s%@GNOME_DIR@%$GNOME_DIR%g +s%@CONS_INC@%$CONS_INC%g +s%@CONS_LIBS@%$CONS_LIBS%g +s%@CONS_LDFLAGS@%$CONS_LDFLAGS%g +s%@READLINE_SRC@%$READLINE_SRC%g +s%@TERMCAP_LIB@%$TERMCAP_LIB%g +s%@GMP_INC@%$GMP_INC%g +s%@GMP_LIBS@%$GMP_LIBS%g +s%@GMP_LDFLAGS@%$GMP_LDFLAGS%g +s%@GMP_SRC@%$GMP_SRC%g +s%@CWEB_INC@%$CWEB_INC%g +s%@CWEB_LIBS@%$CWEB_LIBS%g +s%@CWEB_LDFLAGS@%$CWEB_LDFLAGS%g +s%@CWEB_SRC@%$CWEB_SRC%g +s%@working_dir@%$working_dir%g +s%@dump_email@%$dump_email%g +s%@job_email@%$job_email%g +s%@smtp_host@%$smtp_host%g +s%@piddir@%$piddir%g +s%@subsysdir@%$subsysdir%g +s%@baseport@%$baseport%g +s%@dir_port@%$dir_port%g +s%@fd_port@%$fd_port%g +s%@sd_port@%$sd_port%g +s%@dir_password@%$dir_password%g +s%@fd_password@%$fd_password%g +s%@sd_password@%$sd_password%g +s%@cats@%$cats%g +s%@SQL_LFLAGS@%$SQL_LFLAGS%g +s%@SQL_INCLUDE@%$SQL_INCLUDE%g +s%@SQL_BINDIR@%$SQL_BINDIR%g +s%@EXEEXT@%$EXEEXT%g +s%@X_CFLAGS@%$X_CFLAGS%g +s%@X_PRE_LIBS@%$X_PRE_LIBS%g +s%@X_LIBS@%$X_LIBS%g +s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g +s%@LIBOBJS@%$LIBOBJS%g +s%@ALLOCA@%$ALLOCA%g +s%@FDLIBS@%$FDLIBS%g +s%@DEBUG@%$DEBUG%g +s%@DINCLUDE@%$DINCLUDE%g +s%@DLIB@%$DLIB%g +s%@OBJLIST@%$OBJLIST%g +s%@hostname@%$hostname%g +s%@TAPEDRIVE@%$TAPEDRIVE%g +s%@PSCMD@%$PSCMD%g +s%@WIN32@%$WIN32%g +s%@DISTNAME@%$DISTNAME%g +s%@DISTVER@%$DISTVER%g +/@MCOMMON@/r $MCOMMON +s%@MCOMMON@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +(echo "Doing make of dependencies"; make depend;) + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + +chmod 755 startmysql stopmysql bacula startit stopit btraceback +cp -f startit stopit btraceback btraceback.gdb src/console +cp -f startit stopit btraceback btraceback.gdb src/dird +cp -f startit stopit btraceback btraceback.gdb src/filed +cp -f startit stopit btraceback btraceback.gdb src/lib +cp -f startit stopit btraceback btraceback.gdb src/stored +chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables +chmod 755 src/cats/make_test_tables src/cats/drop_test_tables +chmod 755 src/cats/create_mysql_database +chmod 755 src/cats/grant_mysql_privileges +chmod 755 src/cats/make_sqlite_tables +chmod 755 src/cats/sqlite + + +echo " +Configuration: + + Host: ${DISTNAME} ${DISTVER} + Bacula version: ${VERSION} (${DATE}) + Source code location: ${srcdir} + Install binaries: ${sbindir} + Install config files: ${sysconfdir} + C Compiler: ${CC} + C++ Compiler: ${CXX} + Compiler flags: ${CFLAGS} + Linker flags: ${LDFLAGS} + Libraries: ${LIBS} + Database found: ${have_db} + Database type: ${db_name} + + Job Output Email: ${job_email} + Traceback Email: ${dump_email} + SMTP Host Address: ${smtp_host} + Director Port ${dir_port} + File daemon Port ${fd_port} + Storage daemon Port ${sd_port} + Working directory ${working_dir} + SQL binaries Directory ${SQL_BINDIR} + + readline support: ${got_readline} ${READLINE_SRC} + cweb support: ${got_cweb} ${CWEB_SRC} + TCP Wrappers support: ${TCPW_MSG} + ZLIB support: ${have_zlib} + enable-smartalloc: ${support_smartalloc} + enable-gnome: ${support_gnome} + gmp support: ${got_gmp} ${GMP_SRC} + + " diff --git a/bacula/intl/ChangeLog b/bacula/intl/ChangeLog new file mode 100644 index 0000000000..198950159d --- /dev/null +++ b/bacula/intl/ChangeLog @@ -0,0 +1,1086 @@ +1998-04-29 Ulrich Drepper + + * intl/localealias.c (read_alias_file): Use unsigned char for + local variables. Remove unused variable tp. + * intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char * + for type of codeset. For loosing Solaris systems. + * intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset. + * intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable + len if not needed. + Patches by Jim Meyering. + +1998-04-28 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if + mmap is not supported. + + * hash-string.h: Don't include . + +1998-04-27 Ulrich Drepper + + * textdomain.c: Use strdup is available. + + * localealias.c: Define HAVE_MEMPCPY so that we can use this + function. Define and use semapahores to protect modfication of + global objects when compiling for glibc. Add code to allow + freeing alias table. + + * l10nflist.c: Don't assume stpcpy not being a macro. + + * gettextP.h: Define internal_function macri if not already done. + Use glibc byte-swap macros instead of defining SWAP when compiled + for glibc. + (struct loaded_domain): Add elements to allow unloading. + + * Makefile.in (distclean): Don't remove libintl.h here. + + * bindtextdomain.c: Carry over changes from glibc. Use strdup if + available. + + * dcgettext.c: Don't assume stpcpy not being a macro. Mark internal + functions. Add memory freeing code for glibc. + + * dgettext.c: Update copyright. + + * explodename.c: Include stdlib.h and string.h only if they exist. + Use strings.h eventually. + + * finddomain.c: Mark internal functions. Use strdup if available. + Add memory freeing code for glibc. + +1997-10-10 20:00 Ulrich Drepper + + * libgettext.h: Fix dummy textdomain and bindtextdomain macros. + They should return reasonable values. + Reported by Tom Tromey . + +1997-09-16 03:33 Ulrich Drepper + + * libgettext.h: Define PARAMS also to `args' if __cplusplus is defined. + * intlh.inst.in: Likewise. + Reported by Jean-Marc Lasgouttes . + + * libintl.glibc: Update from current glibc version. + +1997-09-06 02:10 Ulrich Drepper + + * intlh.inst.in: Reformat copyright. + +1997-08-19 15:22 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Remove wrong comment. + +1997-08-16 00:13 Ulrich Drepper + + * Makefile.in (install-data): Don't change directory to install. + +1997-08-01 14:30 Ulrich Drepper + + * cat-compat.c: Fix copyright. + + * localealias.c: Don't define strchr unless !HAVE_STRCHR. + + * loadmsgcat.c: Update copyright. Fix typos. + + * l10nflist.c: Don't define strchr unless !HAVE_STRCHR. + (_nl_make_l10nflist): Handle sponsor and revision correctly. + + * gettext.c: Update copyright. + * gettext.h: Likewise. + * hash-string.h: Likewise. + + * finddomain.c: Remoave dead code. Define strchr only if + !HAVE_STRCHR. + + * explodename.c: Include . + + * explodename.c: Reformat copyright text. + (_nl_explode_name): Fix typo. + + * dcgettext.c: Define and use __set_errno. + (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is + not defined. + + * bindtextdom.c: Pretty printing. + +1997-05-01 02:25 Ulrich Drepper + + * dcgettext.c (guess_category_value): Don't depend on + HAVE_LC_MESSAGES. We don't need the macro here. + Patch by Bruno Haible . + + * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL + macro. Instead use HAVE_LOCALE_NULL and define it when using + glibc, as in dcgettext.c. + Patch by Bruno Haible . + + * Makefile.in (CPPFLAGS): New variable. Reported by Franc,ois + Pinard. + +Mon Mar 10 06:51:17 1997 Ulrich Drepper + + * Makefile.in: Implement handling of libtool. + + * gettextP.h: Change data structures for use of generic lowlevel + i18n file handling. + +Wed Dec 4 20:21:18 1996 Ulrich Drepper + + * textdomain.c: Put parentheses around arguments of memcpy macro + definition. + * localealias.c: Likewise. + * l10nflist.c: Likewise. + * finddomain.c: Likewise. + * bindtextdom.c: Likewise. + Reported by Thomas Esken. + +Mon Nov 25 22:57:51 1996 Ulrich Drepper + + * textdomain.c: Move definition of `memcpy` macro to right + position. + +Fri Nov 22 04:01:58 1996 Ulrich Drepper + + * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using + bcopy if not already defined. Reported by Thomas Esken. + * bindtextdom.c: Likewise. + * l10nflist.c: Likewise. + * localealias.c: Likewise. + * textdomain.c: Likewise. + +Tue Oct 29 11:10:27 1996 Ulrich Drepper + + * Makefile.in (libdir): Change to use exec_prefix instead of + prefix. Reported by Knut-HÃ¥vardAksnes . + +Sat Aug 31 03:07:09 1996 Ulrich Drepper + + * l10nflist.c (_nl_normalize_codeset): We convert to lower case, + so don't prepend uppercase `ISO' for only numeric arg. + +Fri Jul 19 00:15:46 1996 Ulrich Drepper + + * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after + definition of _GNU_SOURCE. Patch by Roland McGrath. + + * Makefile.in (uninstall): Fix another bug with `for' loop and + empty arguments. Patch by Jim Meyering. Correct name os + uninstalled files: no intl- prefix anymore. + + * Makefile.in (install-data): Again work around shells which + cannot handle mpty for list. Reported by Jim Meyering. + +Sat Jul 13 18:11:35 1996 Ulrich Drepper + + * Makefile.in (install): Split goal. Now depend on install-exec + and install-data. + (install-exec, install-data): New goals. Created from former + install goal. + Reported by Karl Berry. + +Sat Jun 22 04:58:14 1996 Ulrich Drepper + + * Makefile.in (MKINSTALLDIRS): New variable. Path to + mkinstalldirs script. + (install): use MKINSTALLDIRS variable or if the script is not present + try to find it in the $top_scrdir). + +Wed Jun 19 02:56:56 1996 Ulrich Drepper + + * l10nflist.c: Linux libc *partly* includes the argz_* functions. + Grr. Work around by renaming the static version and use macros + for renaming. + +Tue Jun 18 20:11:17 1996 Ulrich Drepper + + * l10nflist.c: Correct presence test macros of __argz_* functions. + + * l10nflist.c: Include based on test of it instead when + __argz_* functions are available. + Reported by Andreas Schwab. + +Thu Jun 13 15:17:44 1996 Ulrich Drepper + + * explodename.c, l10nflist.c: Define NULL for dumb systems. + +Tue Jun 11 17:05:13 1996 Ulrich Drepper + + * intlh.inst.in, libgettext.h (dcgettext): Rename local variable + result to __result to prevent name clash. + + * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to + get prototype for stpcpy and strcasecmp. + + * intlh.inst.in, libgettext.h: Move declaration of + `_nl_msg_cat_cntr' outside __extension__ block to prevent warning + from gcc's -Wnested-extern option. + +Fri Jun 7 01:58:00 1996 Ulrich Drepper + + * Makefile.in (install): Remove comment. + +Thu Jun 6 17:28:17 1996 Ulrich Drepper + + * Makefile.in (install): Work around for another Buglix stupidity. + Always use an `else' close for `if's. Reported by Nelson Beebe. + + * Makefile.in (intlh.inst): Correct typo in phony rule. + Reported by Nelson Beebe. + +Thu Jun 6 01:49:52 1996 Ulrich Drepper + + * dcgettext.c (read_alias_file): Rename variable alloca_list to + block_list as the macro calls assume. + Patch by Eric Backus. + + * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using + malloc. + (read_alias_file): Rename varriabe alloca_list to block_list as the + macro calls assume. + Patch by Eric Backus. + + * l10nflist.c: Correct conditional for inclusion. + Reported by Roland McGrath. + + * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not + all-@USE_NLS@. + + * Makefile.in (install): intlh.inst comes from local dir, not + $(srcdir). + + * Makefile.in (intlh.inst): Special handling of this goal. If + used in gettext, this is really a rul to construct this file. If + used in any other package it is defined as a .PHONY rule with + empty body. + + * finddomain.c: Extract locale file information handling into + l10nfile.c. Rename local stpcpy__ function to stpcpy. + + * dcgettext.c (stpcpy): Add local definition. + + * l10nflist.c: Solve some portability problems. Patches partly by + Thomas Esken. Add local definition of stpcpy. + +Tue Jun 4 02:47:49 1996 Ulrich Drepper + + * intlh.inst.in: Don't depend including on + HAVE_LOCALE_H. Instead configure must rewrite this fiile + depending on the result of the configure run. + + * Makefile.in (install): libintl.inst is now called intlh.inst. + Add rules for updating intlh.inst from intlh.inst.in. + + * libintl.inst: Renamed to intlh.inst.in. + + * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1 + because gcc has __buitlin_alloca. + Reported by Roland McGrath. + +Mon Jun 3 00:32:16 1996 Ulrich Drepper + + * Makefile.in (installcheck): New goal to fulfill needs of + automake's distcheck. + + * Makefile.in (install): Reorder commands so that VERSION is + found. + + * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in + @datadir@/gettext. + (COMSRCS): Add l10nfile.c. + (OBJECTS): Add l10nfile.o. + (DISTFILES): Rename to DISTFILE.normal. Remove $(DISTFILES.common). + (DISTFILE.gettext): Remove $(DISTFILES.common). + (all-gettext): Remove goal. + (install): If $(PACKAGE) = gettext install, otherwose do nothing. No + package but gettext itself should install libintl.h + headers. + (dist): Extend goal to work for gettext, too. + (dist-gettext): Remove goal. + + * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc. + +Sun Jun 2 17:33:06 1996 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Parameter is now comes from + find_l10nfile. + +Sat Jun 1 02:23:03 1996 Ulrich Drepper + + * l10nflist.c (__argz_next): Add definition. + + * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca + code. Use new l10nfile handling. + + * localealias.c [!HAVE_ALLOCA]: Add code for handling missing + alloca code. + + * l10nflist.c: Initial revision. + +Tue Apr 2 18:51:18 1996 Ulrich Drepper + + * Makefile.in (all-gettext): New goal. Same as all-yes. + +Thu Mar 28 23:01:22 1996 Karl Eichwalder + + * Makefile.in (gettextsrcdir): Define using @datadir@. + +Tue Mar 26 12:39:14 1996 Ulrich Drepper + + * finddomain.c: Include . Reported by Roland McGrath. + +Sat Mar 23 02:00:35 1996 Ulrich Drepper + + * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing + with external declaration. + +Sat Mar 2 00:47:09 1996 Ulrich Drepper + + * Makefile.in (all-no): Rename from all_no. + +Sat Feb 17 00:25:59 1996 Ulrich Drepper + + * gettextP.h [loaded_domain]: Array `successor' must now contain up + to 63 elements (because of codeset name normalization). + + * finddomain.c: Implement codeset name normalization. + +Thu Feb 15 04:39:09 1996 Ulrich Drepper + + * Makefile.in (all): Define to `all-@USE_NLS@'. + (all-yes, all_no): New goals. `all-no' is noop, `all-yes' + is former all. + +Mon Jan 15 21:46:01 1996 Howard Gayle + + * localealias.c (alias_compare): Increment string pointers in loop + of strcasecmp replacement. + +Fri Dec 29 21:16:34 1995 Ulrich Drepper + + * Makefile.in (install-src): Who commented this goal out ? :-) + +Fri Dec 29 15:08:16 1995 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Save `errno'. Failing system calls + should not effect it because a missing catalog is no error. + Reported by Harald Knig . + +Tue Dec 19 22:09:13 1995 Ulrich Drepper + + * Makefile.in (Makefile): Explicitly use $(SHELL) for running + shell scripts. + +Fri Dec 15 17:34:59 1995 Andreas Schwab + + * Makefile.in (install-src): Only install library and header when + we use the own implementation. Don't do it when using the + system's gettext or catgets functions. + + * dcgettext.c (find_msg): Must not swap domain->hash_size here. + +Sat Dec 9 16:24:37 1995 Ulrich Drepper + + * localealias.c, libintl.inst, libgettext.h, hash-string.h, + gettextP.h, finddomain.c, dcgettext.c, cat-compat.c: + Use PARAMS instead of __P. Suggested by Roland McGrath. + +Tue Dec 5 11:39:14 1995 Larry Schwimmer + + * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if + !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty. + +Mon Dec 4 15:42:07 1995 Ulrich Drepper + + * Makefile.in (install-src): + Install libintl.inst instead of libintl.h.install. + +Sat Dec 2 22:51:38 1995 Marcus Daniels + + * cat-compat.c (textdomain): + Reverse order in which files are tried you load. First + try local file, when this failed absolute path. + +Wed Nov 29 02:03:53 1995 Nelson H. F. Beebe + + * cat-compat.c (bindtextdomain): Add missing { }. + +Sun Nov 26 18:21:41 1995 Ulrich Drepper + + * libintl.inst: Add missing __P definition. Reported by Nelson Beebe. + + * Makefile.in: + Add dummy `all' and `dvi' goals. Reported by Tom Tromey. + +Sat Nov 25 16:12:01 1995 Franc,ois Pinard + + * hash-string.h: Capitalize arguments of macros. + +Sat Nov 25 12:01:36 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Prevent files names longer than 13 + characters. libintl.h.glibc->libintl.glibc, + libintl.h.install->libintl.inst. Reported by Joshua R. Poulson. + +Sat Nov 25 11:31:12 1995 Eric Backus + + * dcgettext.c: Fix bug in preprocessor conditionals. + +Sat Nov 25 02:35:27 1995 Nelson H. F. Beebe + + * libgettext.h: Solaris cc does not understand + #if !SYMBOL1 && !SYMBOL2. Sad but true. + +Thu Nov 23 16:22:14 1995 Ulrich Drepper + + * hash-string.h (hash_string): + Fix for machine with >32 bit `unsigned long's. + + * dcgettext.c (DCGETTEXT): + Fix horrible bug in loop for alternative translation. + +Thu Nov 23 01:45:29 1995 Ulrich Drepper + + * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed: + Some further simplifications in message number generation. + +Mon Nov 20 21:08:43 1995 Ulrich Drepper + + * libintl.h.glibc: Use __const instead of const in prototypes. + + * Makefile.in (install-src): + Install libintl.h.install instead of libintl.h. This + is a stripped-down version. Suggested by Peter Miller. + + * libintl.h.install, libintl.h.glibc: Initial revision. + + * localealias.c (_nl_expand_alias, read_alias_file): + Protect prototypes in type casts by __P. + +Tue Nov 14 16:43:58 1995 Ulrich Drepper + + * hash-string.h: Correct prototype for hash_string. + +Sun Nov 12 12:42:30 1995 Ulrich Drepper + + * hash-string.h (hash_string): Add prototype. + + * gettextP.h: Fix copyright. + (SWAP): Add prototype. + +Wed Nov 8 22:56:33 1995 Ulrich Drepper + + * localealias.c (read_alias_file): Forgot sizeof. + Avoid calling *printf function. This introduces a big overhead. + Patch by Roland McGrath. + +Tue Nov 7 14:21:08 1995 Ulrich Drepper + + * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy. + + * finddomain.c (stpcpy): + Define substitution function local. The macro was to flaky. + + * cat-compat.c: Fix typo. + + * xopen-msg.sed, linux-msg.sed: + While bringing message number to right place only accept digits. + + * linux-msg.sed, xopen-msg.sed: Now that the counter does not have + leading 0s we don't need to remove them. Reported by Marcus + Daniels. + + * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in + dependency. Reported by Marcus Daniels. + + * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement. + Generally cleanup using #if instead of #ifndef. + + * Makefile.in: Correct typos in comment. By Franc,ois Pinard. + +Mon Nov 6 00:27:02 1995 Ulrich Drepper + + * Makefile.in (install-src): Don't install libintl.h and libintl.a + if we use an available gettext implementation. + +Sun Nov 5 22:02:08 1995 Ulrich Drepper + + * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS. Reported + by Franc,ois Pinard. + + * libgettext.h: Use #if instead of #ifdef/#ifndef. + + * finddomain.c: + Comments describing what has to be done should start with FIXME. + +Sun Nov 5 19:38:01 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Split. Use DISTFILES with normal meaning. + DISTFILES.common names the files common to both dist goals. + DISTFILES.gettext are the files only distributed in GNU gettext. + +Sun Nov 5 17:32:54 1995 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Correct searching in derived locales. + This was necessary since a change in _nl_find_msg several weeks + ago. I really don't know this is still not fixed. + +Sun Nov 5 12:43:12 1995 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL. This + might mark a special condition. + + * finddomain.c (make_entry_rec): Don't make illegal entry as decided. + + * Makefile.in (dist): Suppress error message when ln failed. + Get files from $(srcdir) explicitly. + + * libgettext.h (gettext_const): Rename to gettext_noop. + +Fri Nov 3 07:36:50 1995 Ulrich Drepper + + * finddomain.c (make_entry_rec): + Protect against wrong locale names by testing mask. + + * libgettext.h (gettext_const): Add macro definition. + Capitalize macro arguments. + +Thu Nov 2 23:15:51 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Test for pointer != NULL before accessing value. + Reported by Tom Tromey. + + * gettext.c (NULL): + Define as (void*)0 instad of 0. Reported by Franc,ois Pinard. + +Mon Oct 30 21:28:52 1995 Ulrich Drepper + + * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering. + +Sat Oct 28 23:20:47 1995 Ulrich Drepper + + * libgettext.h: Disable dcgettext optimization for Solaris 2.3. + + * localealias.c (alias_compare): + Peter Miller reported that tolower in some systems is + even dumber than I thought. Protect call by `isupper'. + +Fri Oct 27 22:22:51 1995 Ulrich Drepper + + * Makefile.in (libdir, includedir): New variables. + (install-src): Install libintl.a and libintl.h in correct dirs. + +Fri Oct 27 22:07:29 1995 Ulrich Drepper + + * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c. + + * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques. + + * localealias.c: + Fix typo and superflous test. Reported by Christian von Roques. + +Fri Oct 6 11:52:05 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Correct some remainder from the pre-CEN syntax. Now + we don't have a constant number of successors anymore. + +Wed Sep 27 21:41:13 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Add libintl.h.glibc. + + * Makefile.in (dist-libc): Add goal for packing sources for glibc. + (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc. + + * loadmsgcat.c: Forget to continue #if line. + + * localealias.c: + [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name + space clean. + + * dcgettext.c, finddomain.c: Better comment to last change. + + * loadmsgcat.c: + [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to + __fstat, __open, __close, __read, __mmap, and __munmap resp + to keep ANSI C name space clean. + + * finddomain.c: + [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean. + + * dcgettext.c: + [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to + keep ANSI C name space clean. + + * libgettext.h: + Include sys/types.h for those old SysV systems out there. + Reported by Francesco Potorti`. + + * loadmsgcat.c (use_mmap): Define if compiled for glibc. + + * bindtextdom.c: Include all those standard headers + unconditionally if _LIBC is defined. + + * finddomain.c: Fix 2 times defiend -> defined. + + * textdomain.c: Include libintl.h instead of libgettext.h when + compiling for glibc. Include all those standard headers + unconditionally if _LIBC is defined. + + * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc. + + * gettext.c: + Include libintl.h instead of libgettext.h when compiling for glibc. + Get NULL from stddef.h if we compile for glibc. + + * finddomain.c: Include libintl.h instead of libgettext.h when + compiling for glibc. Include all those standard headers + unconditionally if _LIBC is defined. + + * dcgettext.c: Include all those standard headers unconditionally + if _LIBC is defined. + + * dgettext.c: If compiled in glibc include libintl.h instead of + libgettext.h. + (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc. + + * dcgettext.c: If compiled in glibc include libintl.h instead of + libgettext.h. + (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc. + + * bindtextdom.c: + If compiled in glibc include libintl.h instead of libgettext.h. + +Mon Sep 25 22:23:06 1995 Ulrich Drepper + + * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0. + Reported by Marcus Daniels. + + * cat-compat.c (bindtextdomain): + String used in putenv must not be recycled. + Reported by Marcus Daniels. + + * libgettext.h (__USE_GNU_GETTEXT): + Additional symbol to signal that we use GNU gettext + library. + + * cat-compat.c (bindtextdomain): + Fix bug with the strange stpcpy replacement. + Reported by Nelson Beebe. + +Sat Sep 23 08:23:51 1995 Ulrich Drepper + + * cat-compat.c: Include for stpcpy prototype. + + * localealias.c (read_alias_file): + While expand strdup code temporary variable `cp' hided + higher level variable with same name. Rename to `tp'. + + * textdomain.c (textdomain): + Avoid warning by using temporary variable in strdup code. + + * finddomain.c (_nl_find_domain): Remove unused variable `application'. + +Thu Sep 21 15:51:44 1995 Ulrich Drepper + + * localealias.c (alias_compare): + Use strcasecmp() only if available. Else use + implementation in place. + + * intl-compat.c: + Wrapper functions now call *__ functions instead of __*. + + * libgettext.h: Declare prototypes for *__ functions instead for __*. + + * cat-compat.c, loadmsgcat.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + + * bindtextdom.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + Rename to bindtextdomain__ if not used in GNU C Library. + + * dgettext.c: + Rename function to dgettext__ if not used in GNU C Library. + + * gettext.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + Functions now called gettext__ if not used in GNU C Library. + + * dcgettext.c, localealias.c, textdomain.c, finddomain.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + +Sun Sep 17 23:14:49 1995 Ulrich Drepper + + * finddomain.c: Correct some bugs in handling of CEN standard + locale definitions. + +Thu Sep 7 01:49:28 1995 Ulrich Drepper + + * finddomain.c: Implement CEN syntax. + + * gettextP.h (loaded_domain): Extend number of successors to 31. + +Sat Aug 19 19:25:29 1995 Ulrich Drepper + + * Makefile.in (aliaspath): Remove path to X11 locale dir. + + * Makefile.in: Make install-src depend on install. This helps + gettext to install the sources and other packages can use the + install goal. + +Sat Aug 19 15:19:33 1995 Ulrich Drepper + + * Makefile.in (uninstall): Remove stuff installed by install-src. + +Tue Aug 15 13:13:53 1995 Ulrich Drepper + + * VERSION.in: Initial revision. + + * Makefile.in (DISTFILES): + Add VERSION file. This is not necessary for gettext, but + for other packages using this library. + +Tue Aug 15 06:16:44 1995 Ulrich Drepper + + * gettextP.h (_nl_find_domain): + New prototype after changing search strategy. + + * finddomain.c (_nl_find_domain): + We now try only to find a specified catalog. Fall back to other + catalogs listed in the locale list is now done in __dcgettext. + + * dcgettext.c (__dcgettext): + Now we provide message fall back even to different languages. + I.e. if a message is not available in one language all the other + in the locale list a tried. Formerly fall back was only possible + within one language. Implemented by moving one loop from + _nl_find_domain to here. + +Mon Aug 14 23:45:50 1995 Ulrich Drepper + + * Makefile.in (gettextsrcdir): + Directory where source of GNU gettext library are made + available. + (INSTALL, INSTALL_DATA): Programs used for installing sources. + (gettext-src): New. Rule to install GNU gettext sources for use in + gettextize shell script. + +Sun Aug 13 14:40:48 1995 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): + Use mmap for loading only when munmap function is + also available. + + * Makefile.in (install): Depend on `all' goal. + +Wed Aug 9 11:04:33 1995 Ulrich Drepper + + * localealias.c (read_alias_file): + Do not overwrite '\n' when terminating alias value string. + + * localealias.c (read_alias_file): + Handle long lines. Ignore the rest not fitting in + the buffer after the initial `fgets' call. + +Wed Aug 9 00:54:29 1995 Ulrich Drepper + + * gettextP.h (_nl_load_domain): + Add prototype, replacing prototype for _nl_load_msg_cat. + + * finddomain.c (_nl_find_domain): + Remove unneeded variable filename and filename_len. + (expand_alias): Remove prototype because functions does not + exist anymore. + + * localealias.c (read_alias_file): + Change type of fname_len parameter to int. + (xmalloc): Add prototype. + + * loadmsgcat.c: Better prototypes for xmalloc. + +Tue Aug 8 22:30:39 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Allow alias name to be constructed from the four components. + + * Makefile.in (aliaspath): New variable. Set to preliminary value. + (SOURCES): Add localealias.c. + (OBJECTS): Add localealias.o. + + * gettextP.h: Add prototype for _nl_expand_alias. + + * finddomain.c: Aliasing handled in intl/localealias.c. + + * localealias.c: Aliasing for locale names. + + * bindtextdom.c: Better prototypes for xmalloc and xstrdup. + +Mon Aug 7 23:47:42 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): gettext.perl is now found in misc/. + + * cat-compat.c (bindtextdomain): + Correct implementation. dirname parameter was not used. + Reported by Marcus Daniels. + + * gettextP.h (loaded_domain): + New fields `successor' and `decided' for oo, lazy + message handling implementation. + + * dcgettext.c: + Adopt for oo, lazy message handliing. + Now we can inherit translations from less specific locales. + (find_msg): New function. + + * loadmsgcat.c, finddomain.c: + Complete rewrite. Implement oo, lazy message handling :-). + We now have an additional environment variable `LANGUAGE' with + a higher priority than LC_ALL for the LC_MESSAGE locale. + Here we can set a colon separated list of specifications each + of the form `language[_territory[.codeset]][@modifier]'. + +Sat Aug 5 09:55:42 1995 Ulrich Drepper + + * finddomain.c (unistd.h): + Include to get _PC_PATH_MAX defined on system having it. + +Fri Aug 4 22:42:00 1995 Ulrich Drepper + + * finddomain.c (stpcpy): Include prototype. + + * Makefile.in (dist): Remove `copying instead' message. + +Wed Aug 2 18:52:03 1995 Ulrich Drepper + + * Makefile.in (ID, TAGS): Do not use $^. + +Tue Aug 1 20:07:11 1995 Ulrich Drepper + + * Makefile.in (TAGS, ID): Use $^ as command argument. + (TAGS): Give etags -o option t write to current directory, + not $(srcdir). + (ID): Use $(srcdir) instead os $(top_srcdir)/src. + (distclean): Remove ID. + +Sun Jul 30 11:51:46 1995 Ulrich Drepper + + * Makefile.in (gnulocaledir): + New variable, always using share/ for data directory. + (DEFS): Add GNULOCALEDIR, used in finddomain.c. + + * finddomain.c (_nl_default_dirname): + Set to GNULOCALEDIR, because it always has to point + to the directory where GNU gettext Library writes it to. + + * intl-compat.c (textdomain, bindtextdomain): + Undefine macros before function definition. + +Sat Jul 22 01:10:02 1995 Ulrich Drepper + + * libgettext.h (_LIBINTL_H): + Protect definition in case where this file is included as + libgettext.h on Solaris machines. Add comment about this. + +Wed Jul 19 02:36:42 1995 Ulrich Drepper + + * intl-compat.c (textdomain): Correct typo. + +Wed Jul 19 01:51:35 1995 Ulrich Drepper + + * dcgettext.c (dcgettext): Function now called __dcgettext. + + * dgettext.c (dgettext): Now called __dgettext and calls + __dcgettext. + + * gettext.c (gettext): + Function now called __gettext and calls __dgettext. + + * textdomain.c (textdomain): Function now called __textdomain. + + * bindtextdom.c (bindtextdomain): Function now called + __bindtextdomain. + + * intl-compat.c: Initial revision. + + * Makefile.in (SOURCES): Add intl-compat.c. + (OBJECTS): We always compile the GNU gettext library functions. + OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o, + and intl-compat.o. + (GETTOBJS): Contains now only intl-compat.o. + + * libgettext.h: + Re-include protection matches dualistic character of libgettext.h. + For all functions in GNU gettext library define __ counter part. + + * finddomain.c (strchr): Define as index if not found in C library. + (_nl_find_domain): For relative paths paste / in between. + +Tue Jul 18 16:37:45 1995 Ulrich Drepper + + * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h. + + * xopen-msg.sed: Fix bug with `msgstr ""' lines. + A little bit better comments. + +Tue Jul 18 01:18:27 1995 Ulrich Drepper + + * Makefile.in: + po-mode.el, makelinks, combine-sh are now found in ../misc. + + * po-mode.el, makelinks, combine-sh, elisp-comp: + Moved to ../misc/. + + * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__. + +Sun Jul 16 22:33:02 1995 Ulrich Drepper + + * Makefile.in (INSTALL, INSTALL_DATA): New variables. + (install-data, uninstall): Install/uninstall .elc file. + + * po-mode.el (Installation comment): + Add .pox as possible extension of .po files. + +Sun Jul 16 13:23:27 1995 Ulrich Drepper + + * elisp-comp: Complete new version by Franc,ois: This does not + fail when not compiling in the source directory. + +Sun Jul 16 00:12:17 1995 Ulrich Drepper + + * Makefile.in (../po/cat-id-tbl.o): + Use $(MAKE) instead of make for recursive make. + + * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh. + (install-exec): Add missing dummy goal. + (install-data, uninstall): @ in multi-line shell command at + beginning, not in front of echo. Reported by Eric Backus. + +Sat Jul 15 00:21:28 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): + Rename libgettext.perl to gettext.perl to fit in 14 chars + file systems. + + * gettext.perl: + Rename to gettext.perl to fit in 14 chars file systems. + +Thu Jul 13 23:17:20 1995 Ulrich Drepper + + * cat-compat.c: If !STDC_HEADERS try to include malloc.h. + +Thu Jul 13 20:55:02 1995 Ulrich Drepper + + * po2tbl.sed.in: Pretty printing. + + * linux-msg.sed, xopen-msg.sed: + Correct bugs with handling substitute flags in branches. + + * hash-string.h (hash_string): + Old K&R compilers don't under stand `unsigned char'. + + * gettext.h (nls_uint32): + Some old K&R compilers (eg HP) don't understand `unsigned int'. + + * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes. + +Thu Jul 13 01:34:33 1995 Ulrich Drepper + + * Makefile.in (ELCFILES): New variable. + (DISTFILES): Add elisp-comp. + Add implicit rule for .el -> .elc compilation. + (install-data): install $ELCFILES + (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp. + + * elisp-comp: Initial revision + +Wed Jul 12 16:14:52 1995 Ulrich Drepper + + * Makefile.in: + cat-id-tbl.c is now found in po/. This enables us to use an identical + intl/ directory in all packages. + + * dcgettext.c (dcgettext): hashing does not work for table size <= 2. + + * textdomain.c: fix typo (#if def -> #if defined) + +Tue Jul 11 18:44:43 1995 Ulrich Drepper + + * Makefile.in (stamp-cat-id): use top_srcdir to address source files + (DISTFILES,distclean): move tupdate.perl to src/ + + * po-to-tbl.sed.in: + add additional jump to clear change flag to recognize multiline strings + +Tue Jul 11 01:32:50 1995 Ulrich Drepper + + * textdomain.c: Protect inclusion of stdlib.h and string.h. + + * loadmsgcat.c: Protect inclusion of stdlib.h. + + * libgettext.h: Protect inclusion of locale.h. + Allow use in C++ programs. + Define NULL is not happened already. + + * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of + po-to-tbl.sed. + (distclean): remove po-to-tbl.sed and tupdate.perl. + + * tupdate.perl.in: Substitute Perl path even in exec line. + Don't include entries without translation from old .po file. + +Tue Jul 4 00:41:51 1995 Ulrich Drepper + + * tupdate.perl.in: use "Updated: " in msgid "". + + * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR). + Define getenv if !__STDC__. + + * bindtextdom.c: Protect stdlib.h and string.h inclusion. + Define free if !__STDC__. + + * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR. + Define free if !__STDC__. + + * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR. + +Mon Jul 3 23:56:30 1995 Ulrich Drepper + + * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR. + Remove unneeded $(srcdir) from Makefile.in dependency. + + * makelinks: Add copyright and short description. + + * po-mode.el: Last version for 0.7. + + * tupdate.perl.in: Fix die message. + + * dcgettext.c: Protect include of string.h. + + * gettext.c: Protect include of stdlib.h and further tries to get NULL. + + * finddomain.c: Some corrections in includes. + + * Makefile.in (INCLUDES): Prune list correct path to Makefile.in. + + * po-to-tbl.sed: Adopt for new .po file format. + + * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format. + +Sun Jul 2 23:55:03 1995 Ulrich Drepper + + * tupdate.perl.in: Complete rewrite for new .po file format. + +Sun Jul 2 02:06:50 1995 Ulrich Drepper + + * First official release. This directory contains all the code + needed to internationalize own packages. It provides functions + which allow to use the X/Open catgets function with an interface + like the Uniforum gettext function. For system which does not + have neither of those a complete implementation is provided. diff --git a/bacula/intl/Makefile.in b/bacula/intl/Makefile.in new file mode 100644 index 0000000000..3f14c13c29 --- /dev/null +++ b/bacula/intl/Makefile.in @@ -0,0 +1,216 @@ +# Makefile for directory with message catalog handling in GNU NLS Utilities. +# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +transform = @program_transform_name@ +libdir = $(exec_prefix)/lib +includedir = $(prefix)/include +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(datadir)/gettext/intl +aliaspath = $(localedir):. +subdir = intl + +DESTDIR = + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @MKINSTALLDIRS@ + +l = @l@ + +AR = ar +CC = @CC@ +LIBTOOL = @LIBTOOL@ +RANLIB = @RANLIB@ + +DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \ +-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +HEADERS = $(COMHDRS) libgettext.h loadinfo.h +COMHDRS = gettext.h gettextP.h hash-string.h +SOURCES = $(COMSRCS) intl-compat.c cat-compat.c +COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \ +finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \ +explodename.c +OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \ +finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \ +explodename.$lo +CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo +GETTOBJS = intl-compat.$lo +DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \ +xopen-msg.sed $(HEADERS) $(SOURCES) +DISTFILES.normal = VERSION +DISTFILES.gettext = libintl.glibc intlh.inst.in + +.SUFFIXES: +.SUFFIXES: .c .o .lo +.c.o: + $(COMPILE) $< +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) $< + +INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib + +all: all-@USE_INCLUDED_LIBINTL@ + +all-yes: libintl.$la intlh.inst +all-no: + +libintl.a: $(OBJECTS) + rm -f $@ + $(AR) cru $@ $(OBJECTS) + $(RANLIB) $@ + +libintl.la: $(OBJECTS) + $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \ + -version-info 1:0 -rpath $(libdir) + +../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot + cd ../po && $(MAKE) cat-id-tbl.$lo + +check: all + +# This installation goal is only used in GNU gettext. Packages which +# only use the library should use install instead. + +# We must not install the libintl.h/libintl.a files if we are on a +# system which has the gettext() function in its C library or in a +# separate library or use the catgets interface. A special case is +# where configure found a previously installed GNU gettext library. +# If you want to use the one which comes with this version of the +# package, you have to use `configure --with-included-gettext'. +install: install-exec install-data +install-exec: all + if test "$(PACKAGE)" = "gettext" \ + && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ + else \ + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ + fi; \ + $(INSTALL_DATA) intlh.inst $(DESTDIR)$(includedir)/libintl.h; \ + $(INSTALL_DATA) libintl.a $(DESTDIR)$(libdir)/libintl.a; \ + else \ + : ; \ + fi +install-data: all + if test "$(PACKAGE)" = "gettext"; then \ + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ + else \ + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ + fi; \ + $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \ + dists="$(DISTFILES.common)"; \ + for file in $$dists; do \ + $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + dists="$(DISTFILES.common)"; \ + for file in $$dists; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done + +info dvi: + +$(OBJECTS): ../config.h libgettext.h +bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h +dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h + +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) + here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES) + +id: ID + +ID: $(HEADERS) $(SOURCES) + here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES) + + +mostlyclean: + rm -f *.a *.o *.lo core core.* + +clean: mostlyclean + +distclean: clean + rm -f Makefile ID TAGS po2msg.sed po2tbl.sed + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + + +# GNU gettext needs not contain the file `VERSION' but contains some +# other files which should not be distributed in other packages. +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: Makefile $(DISTFILES) + if test "$(PACKAGE)" = gettext; then \ + additional="$(DISTFILES.gettext)"; \ + else \ + additional="$(DISTFILES.normal)"; \ + fi; \ + for file in $(DISTFILES.common) $$additional; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +dist-libc: + tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc + +Makefile: Makefile.in ../config.status + cd .. \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +# The dependency for intlh.inst is different in gettext and all other +# packages. Because we cannot you GNU make features we have to solve +# the problem while rewriting Makefile.in. +@GT_YES@intlh.inst: intlh.inst.in ../config.status +@GT_YES@ cd .. \ +@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \ +@GT_YES@ $(SHELL) ./config.status +@GT_NO@.PHONY: intlh.inst +@GT_NO@intlh.inst: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bacula/intl/VERSION b/bacula/intl/VERSION new file mode 100644 index 0000000000..ee66b0612b --- /dev/null +++ b/bacula/intl/VERSION @@ -0,0 +1 @@ +GNU gettext library from gettext-0.10.35 diff --git a/bacula/intl/bindtextdom.c b/bacula/intl/bindtextdom.c new file mode 100644 index 0000000000..d9c3f349e0 --- /dev/null +++ b/bacula/intl/bindtextdom.c @@ -0,0 +1,203 @@ +/* Implementation of the bindtextdomain(3) function + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif +#include "gettext.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +/* Contains the default location of the message catalogs. */ +extern const char _nl_default_dirname[]; + +/* List with bindings of specific domains. */ +extern struct binding *_nl_domain_bindings; + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define BINDTEXTDOMAIN __bindtextdomain +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +#else +# define BINDTEXTDOMAIN bindtextdomain__ +#endif + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +char * +BINDTEXTDOMAIN (domainname, dirname) + const char *domainname; + const char *dirname; +{ + struct binding *binding; + + /* Some sanity checks. */ + if (domainname == NULL || domainname[0] == '\0') + return NULL; + + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (dirname == NULL) + /* The current binding has be to returned. */ + return binding == NULL ? (char *) _nl_default_dirname : binding->dirname; + + if (binding != NULL) + { + /* The domain is already bound. If the new value and the old + one are equal we simply do nothing. Otherwise replace the + old binding. */ + if (strcmp (dirname, binding->dirname) != 0) + { + char *new_dirname; + + if (strcmp (dirname, _nl_default_dirname) == 0) + new_dirname = (char *) _nl_default_dirname; + else + { +#if defined _LIBC || defined HAVE_STRDUP + new_dirname = strdup (dirname); + if (new_dirname == NULL) + return NULL; +#else + size_t len = strlen (dirname) + 1; + new_dirname = (char *) malloc (len); + if (new_dirname == NULL) + return NULL; + + memcpy (new_dirname, dirname, len); +#endif + } + + if (binding->dirname != _nl_default_dirname) + free (binding->dirname); + + binding->dirname = new_dirname; + } + } + else + { + /* We have to create a new binding. */ +#if !defined _LIBC && !defined HAVE_STRDUP + size_t len; +#endif + struct binding *new_binding = + (struct binding *) malloc (sizeof (*new_binding)); + + if (new_binding == NULL) + return NULL; + +#if defined _LIBC || defined HAVE_STRDUP + new_binding->domainname = strdup (domainname); + if (new_binding->domainname == NULL) + return NULL; +#else + len = strlen (domainname) + 1; + new_binding->domainname = (char *) malloc (len); + if (new_binding->domainname == NULL) + return NULL; + memcpy (new_binding->domainname, domainname, len); +#endif + + if (strcmp (dirname, _nl_default_dirname) == 0) + new_binding->dirname = (char *) _nl_default_dirname; + else + { +#if defined _LIBC || defined HAVE_STRDUP + new_binding->dirname = strdup (dirname); + if (new_binding->dirname == NULL) + return NULL; +#else + len = strlen (dirname) + 1; + new_binding->dirname = (char *) malloc (len); + if (new_binding->dirname == NULL) + return NULL; + memcpy (new_binding->dirname, dirname, len); +#endif + } + + /* Now enqueue it. */ + if (_nl_domain_bindings == NULL + || strcmp (domainname, _nl_domain_bindings->domainname) < 0) + { + new_binding->next = _nl_domain_bindings; + _nl_domain_bindings = new_binding; + } + else + { + binding = _nl_domain_bindings; + while (binding->next != NULL + && strcmp (domainname, binding->next->domainname) > 0) + binding = binding->next; + + new_binding->next = binding->next; + binding->next = new_binding; + } + + binding = new_binding; + } + + return binding->dirname; +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__bindtextdomain, bindtextdomain); +#endif diff --git a/bacula/intl/cat-compat.c b/bacula/intl/cat-compat.c new file mode 100644 index 0000000000..867d901b8f --- /dev/null +++ b/bacula/intl/cat-compat.c @@ -0,0 +1,262 @@ +/* Compatibility code for gettext-using-catgets interface. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef STDC_HEADERS +# include +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# endif +#endif + +#ifdef HAVE_NL_TYPES_H +# include +#endif + +#include "libgettext.h" + +/* @@ end of prolog @@ */ + +/* XPG3 defines the result of `setlocale (category, NULL)' as: + ``Directs `setlocale()' to query `category' and return the current + setting of `local'.'' + However it does not specify the exact format. And even worse: POSIX + defines this not at all. So we can use this feature only on selected + system (e.g. those using GNU C Library). */ +#ifdef _LIBC +# define HAVE_LOCALE_NULL +#endif + +/* The catalog descriptor. */ +static nl_catd catalog = (nl_catd) -1; + +/* Name of the default catalog. */ +static const char default_catalog_name[] = "messages"; + +/* Name of currently used catalog. */ +static const char *catalog_name = default_catalog_name; + +/* Get ID for given string. If not found return -1. */ +static int msg_to_cat_id PARAMS ((const char *msg)); + +/* Substitution for systems lacking this function in their C library. */ +#if !_LIBC && !HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +#endif + + +/* Set currently used domain/catalog. */ +char * +textdomain (domainname) + const char *domainname; +{ + nl_catd new_catalog; + char *new_name; + size_t new_name_len; + char *lang; + +#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \ + && defined HAVE_LOCALE_NULL + lang = setlocale (LC_MESSAGES, NULL); +#else + lang = getenv ("LC_ALL"); + if (lang == NULL || lang[0] == '\0') + { + lang = getenv ("LC_MESSAGES"); + if (lang == NULL || lang[0] == '\0') + lang = getenv ("LANG"); + } +#endif + if (lang == NULL || lang[0] == '\0') + lang = "C"; + + /* See whether name of currently used domain is asked. */ + if (domainname == NULL) + return (char *) catalog_name; + + if (domainname[0] == '\0') + domainname = default_catalog_name; + + /* Compute length of added path element. */ + new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang) + + sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1 + + sizeof (".cat"); + + new_name = (char *) malloc (new_name_len); + if (new_name == NULL) + return NULL; + + strcpy (new_name, PACKAGE); + new_catalog = catopen (new_name, 0); + + if (new_catalog == (nl_catd) -1) + { + /* NLSPATH search didn't work, try absolute path */ + sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang, + PACKAGE); + new_catalog = catopen (new_name, 0); + + if (new_catalog == (nl_catd) -1) + { + free (new_name); + return (char *) catalog_name; + } + } + + /* Close old catalog. */ + if (catalog != (nl_catd) -1) + catclose (catalog); + if (catalog_name != default_catalog_name) + free ((char *) catalog_name); + + catalog = new_catalog; + catalog_name = new_name; + + return (char *) catalog_name; +} + +char * +bindtextdomain (domainname, dirname) + const char *domainname; + const char *dirname; +{ +#if HAVE_SETENV || HAVE_PUTENV + char *old_val, *new_val, *cp; + size_t new_val_len; + + /* This does not make much sense here but to be compatible do it. */ + if (domainname == NULL) + return NULL; + + /* Compute length of added path element. If we use setenv we don't need + the first byts for NLSPATH=, but why complicate the code for this + peanuts. */ + new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname) + + sizeof ("/%L/LC_MESSAGES/%N.cat"); + + old_val = getenv ("NLSPATH"); + if (old_val == NULL || old_val[0] == '\0') + { + old_val = NULL; + new_val_len += 1 + sizeof (LOCALEDIR) - 1 + + sizeof ("/%L/LC_MESSAGES/%N.cat"); + } + else + new_val_len += strlen (old_val); + + new_val = (char *) malloc (new_val_len); + if (new_val == NULL) + return NULL; + +# if HAVE_SETENV + cp = new_val; +# else + cp = stpcpy (new_val, "NLSPATH="); +# endif + + cp = stpcpy (cp, dirname); + cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:"); + + if (old_val == NULL) + { +# if __STDC__ + stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat"); +# else + + cp = stpcpy (cp, LOCALEDIR); + stpcpy (cp, "/%L/LC_MESSAGES/%N.cat"); +# endif + } + else + stpcpy (cp, old_val); + +# if HAVE_SETENV + setenv ("NLSPATH", new_val, 1); + free (new_val); +# else + putenv (new_val); + /* Do *not* free the environment entry we just entered. It is used + from now on. */ +# endif + +#endif + + return (char *) domainname; +} + +#undef gettext +char * +gettext (msg) + const char *msg; +{ + int msgid; + + if (msg == NULL || catalog == (nl_catd) -1) + return (char *) msg; + + /* Get the message from the catalog. We always use set number 1. + The message ID is computed by the function `msg_to_cat_id' + which works on the table generated by `po-to-tbl'. */ + msgid = msg_to_cat_id (msg); + if (msgid == -1) + return (char *) msg; + + return catgets (catalog, 1, msgid, (char *) msg); +} + +/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries + for the one equal to msg. If it is found return the ID. In case when + the string is not found return -1. */ +static int +msg_to_cat_id (msg) + const char *msg; +{ + int cnt; + + for (cnt = 0; cnt < _msg_tbl_length; ++cnt) + if (strcmp (msg, _msg_tbl[cnt]._msg) == 0) + return _msg_tbl[cnt]._msg_number; + + return -1; +} + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/bacula/intl/dcgettext.c b/bacula/intl/dcgettext.c new file mode 100644 index 0000000000..c4c7a2c7d1 --- /dev/null +++ b/bacula/intl/dcgettext.c @@ -0,0 +1,624 @@ +/* Implementation of the dcgettext(3) function. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#ifndef errno +extern int errno; +#endif +#ifndef __set_errno +# define __set_errno(val) errno = (val) +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +#else +# include +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include "gettext.h" +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif +#include "hash-string.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define getcwd __getcwd +# ifndef stpcpy +# define stpcpy __stpcpy +# endif +#else +# if !defined HAVE_GETCWD +char *getwd (); +# define getcwd(buf, max) getwd (buf) +# else +char *getcwd (); +# endif +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + +/* Amount to increase buffer size by in each try. */ +#define PATH_INCR 32 + +/* The following is from pathmax.h. */ +/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define + PATH_MAX but might cause redefinition warnings when sys/param.h is + later included (as on MORE/BSD 4.3). */ +#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__)) +# include +#endif + +#ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 255 +#endif + +#if !defined(PATH_MAX) && defined(_PC_PATH_MAX) +# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) +#endif + +/* Don't include sys/param.h if it already has been. */ +#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN) +# include +#endif + +#if !defined(PATH_MAX) && defined(MAXPATHLEN) +# define PATH_MAX MAXPATHLEN +#endif + +#ifndef PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +#endif + +/* XPG3 defines the result of `setlocale (category, NULL)' as: + ``Directs `setlocale()' to query `category' and return the current + setting of `local'.'' + However it does not specify the exact format. And even worse: POSIX + defines this not at all. So we can use this feature only on selected + system (e.g. those using GNU C Library). */ +#ifdef _LIBC +# define HAVE_LOCALE_NULL +#endif + +/* Name of the default domain used for gettext(3) prior any call to + textdomain(3). The default value for this is "messages". */ +const char _nl_default_default_domain[] = "messages"; + +/* Value used as the default domain for gettext(3). */ +const char *_nl_current_default_domain = _nl_default_default_domain; + +/* Contains the default location of the message catalogs. */ +const char _nl_default_dirname[] = GNULOCALEDIR; + +/* List with bindings of specific domains created by bindtextdomain() + calls. */ +struct binding *_nl_domain_bindings; + +/* Prototypes for local functions. */ +static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file, + const char *msgid)) internal_function; +static const char *category_to_name PARAMS ((int category)) internal_function; +static const char *guess_category_value PARAMS ((int category, + const char *categoryname)) + internal_function; + + +/* For those loosing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +/* Nothing has to be done. */ +# define ADD_BLOCK(list, address) /* nothing */ +# define FREE_BLOCKS(list) /* nothing */ +#else +struct block_list +{ + void *address; + struct block_list *next; +}; +# define ADD_BLOCK(list, addr) \ + do { \ + struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ + /* If we cannot get a free block we cannot add the new element to \ + the list. */ \ + if (newp != NULL) { \ + newp->address = (addr); \ + newp->next = (list); \ + (list) = newp; \ + } \ + } while (0) +# define FREE_BLOCKS(list) \ + do { \ + while (list != NULL) { \ + struct block_list *old = list; \ + list = list->next; \ + free (old); \ + } \ + } while (0) +# undef alloca +# define alloca(size) (malloc (size)) +#endif /* have alloca */ + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCGETTEXT __dcgettext +#else +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +char * +DCGETTEXT (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ +#ifndef HAVE_ALLOCA + struct block_list *block_list = NULL; +#endif + struct loaded_l10nfile *domain; + struct binding *binding; + const char *categoryname; + const char *categoryvalue; + char *dirname, *xdomainname; + char *single_locale; + char *retval; + int saved_errno = errno; + + /* If no real MSGID is given return NULL. */ + if (msgid == NULL) + return NULL; + + /* If DOMAINNAME is NULL, we are interested in the default domain. If + CATEGORY is not LC_MESSAGES this might not make much sense but the + defintion left this undefined. */ + if (domainname == NULL) + domainname = _nl_current_default_domain; + + /* First find matching binding. */ + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (binding == NULL) + dirname = (char *) _nl_default_dirname; + else if (binding->dirname[0] == '/') + dirname = binding->dirname; + else + { + /* We have a relative path. Make it absolute now. */ + size_t dirname_len = strlen (binding->dirname) + 1; + size_t path_max; + char *ret; + + path_max = (unsigned) PATH_MAX; + path_max += 2; /* The getcwd docs say to do this. */ + + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + + __set_errno (0); + while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE) + { + path_max += PATH_INCR; + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + __set_errno (0); + } + + if (ret == NULL) + { + /* We cannot get the current working directory. Don't signal an + error but simply return the default string. */ + FREE_BLOCKS (block_list); + __set_errno (saved_errno); + return (char *) msgid; + } + + stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); + } + + /* Now determine the symbolic name of CATEGORY and its value. */ + categoryname = category_to_name (category); + categoryvalue = guess_category_value (category, categoryname); + + xdomainname = (char *) alloca (strlen (categoryname) + + strlen (domainname) + 5); + ADD_BLOCK (block_list, xdomainname); + + stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), + domainname), + ".mo"); + + /* Creating working area. */ + single_locale = (char *) alloca (strlen (categoryvalue) + 1); + ADD_BLOCK (block_list, single_locale); + + + /* Search for the given string. This is a loop because we perhaps + got an ordered list of languages to consider for th translation. */ + while (1) + { + /* Make CATEGORYVALUE point to the next element of the list. */ + while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') + ++categoryvalue; + if (categoryvalue[0] == '\0') + { + /* The whole contents of CATEGORYVALUE has been searched but + no valid entry has been found. We solve this situation + by implicitly appending a "C" entry, i.e. no translation + will take place. */ + single_locale[0] = 'C'; + single_locale[1] = '\0'; + } + else + { + char *cp = single_locale; + while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') + *cp++ = *categoryvalue++; + *cp = '\0'; + } + + /* If the current locale value is C (or POSIX) we don't load a + domain. Return the MSGID. */ + if (strcmp (single_locale, "C") == 0 + || strcmp (single_locale, "POSIX") == 0) + { + FREE_BLOCKS (block_list); + __set_errno (saved_errno); + return (char *) msgid; + } + + + /* Find structure describing the message catalog matching the + DOMAINNAME and CATEGORY. */ + domain = _nl_find_domain (dirname, single_locale, xdomainname); + + if (domain != NULL) + { + retval = find_msg (domain, msgid); + + if (retval == NULL) + { + int cnt; + + for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) + { + retval = find_msg (domain->successor[cnt], msgid); + + if (retval != NULL) + break; + } + } + + if (retval != NULL) + { + FREE_BLOCKS (block_list); + __set_errno (saved_errno); + return retval; + } + } + } + /* NOTREACHED */ +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dcgettext, dcgettext); +#endif + + +static char * +internal_function +find_msg (domain_file, msgid) + struct loaded_l10nfile *domain_file; + const char *msgid; +{ + size_t top, act, bottom; + struct loaded_domain *domain; + + if (domain_file->decided == 0) + _nl_load_domain (domain_file); + + if (domain_file->data == NULL) + return NULL; + + domain = (struct loaded_domain *) domain_file->data; + + /* Locate the MSGID and its translation. */ + if (domain->hash_size > 2 && domain->hash_tab != NULL) + { + /* Use the hashing table. */ + nls_uint32 len = strlen (msgid); + nls_uint32 hash_val = hash_string (msgid); + nls_uint32 idx = hash_val % domain->hash_size; + nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); + nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]); + + if (nstr == 0) + /* Hash table entry is empty. */ + return NULL; + + if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len + && strcmp (msgid, + domain->data + W (domain->must_swap, + domain->orig_tab[nstr - 1].offset)) == 0) + return (char *) domain->data + W (domain->must_swap, + domain->trans_tab[nstr - 1].offset); + + while (1) + { + if (idx >= domain->hash_size - incr) + idx -= domain->hash_size - incr; + else + idx += incr; + + nstr = W (domain->must_swap, domain->hash_tab[idx]); + if (nstr == 0) + /* Hash table entry is empty. */ + return NULL; + + if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len + && strcmp (msgid, + domain->data + W (domain->must_swap, + domain->orig_tab[nstr - 1].offset)) + == 0) + return (char *) domain->data + + W (domain->must_swap, domain->trans_tab[nstr - 1].offset); + } + /* NOTREACHED */ + } + + /* Now we try the default method: binary search in the sorted + array of messages. */ + bottom = 0; + top = domain->nstrings; + while (bottom < top) + { + int cmp_val; + + act = (bottom + top) / 2; + cmp_val = strcmp (msgid, domain->data + + W (domain->must_swap, + domain->orig_tab[act].offset)); + if (cmp_val < 0) + top = act; + else if (cmp_val > 0) + bottom = act + 1; + else + break; + } + + /* If an translation is found return this. */ + return bottom >= top ? NULL : (char *) domain->data + + W (domain->must_swap, + domain->trans_tab[act].offset); +} + + +/* Return string representation of locale CATEGORY. */ +static const char * +internal_function +category_to_name (category) + int category; +{ + const char *retval; + + switch (category) + { +#ifdef LC_COLLATE + case LC_COLLATE: + retval = "LC_COLLATE"; + break; +#endif +#ifdef LC_CTYPE + case LC_CTYPE: + retval = "LC_CTYPE"; + break; +#endif +#ifdef LC_MONETARY + case LC_MONETARY: + retval = "LC_MONETARY"; + break; +#endif +#ifdef LC_NUMERIC + case LC_NUMERIC: + retval = "LC_NUMERIC"; + break; +#endif +#ifdef LC_TIME + case LC_TIME: + retval = "LC_TIME"; + break; +#endif +#ifdef LC_MESSAGES + case LC_MESSAGES: + retval = "LC_MESSAGES"; + break; +#endif +#ifdef LC_RESPONSE + case LC_RESPONSE: + retval = "LC_RESPONSE"; + break; +#endif +#ifdef LC_ALL + case LC_ALL: + /* This might not make sense but is perhaps better than any other + value. */ + retval = "LC_ALL"; + break; +#endif + default: + /* If you have a better idea for a default value let me know. */ + retval = "LC_XXX"; + } + + return retval; +} + +/* Guess value of current locale from value of the environment variables. */ +static const char * +internal_function +guess_category_value (category, categoryname) + int category; + const char *categoryname; +{ + const char *retval; + + /* The highest priority value is the `LANGUAGE' environment + variable. This is a GNU extension. */ + retval = getenv ("LANGUAGE"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* `LANGUAGE' is not set. So we have to proceed with the POSIX + methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some + systems this can be done by the `setlocale' function itself. */ +#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL + return setlocale (category, NULL); +#else + /* Setting of LC_ALL overwrites all other. */ + retval = getenv ("LC_ALL"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Next comes the name of the desired category. */ + retval = getenv (categoryname); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Last possibility is the LANG environment variable. */ + retval = getenv ("LANG"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* We use C as the default domain. POSIX says this is implementation + defined. */ + return "C"; +#endif +} + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif + + +#ifdef _LIBC +/* If we want to free all resources we have to do some work at + program's end. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + struct binding *runp; + + for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next) + { + free (runp->domainname); + if (runp->dirname != _nl_default_dirname) + /* Yes, this is a pointer comparison. */ + free (runp->dirname); + } + + if (_nl_current_default_domain != _nl_default_default_domain) + /* Yes, again a pointer comparison. */ + free ((char *) _nl_current_default_domain); +} + +text_set_element (__libc_subfreeres, free_mem); +#endif diff --git a/bacula/intl/dgettext.c b/bacula/intl/dgettext.c new file mode 100644 index 0000000000..0510c2b071 --- /dev/null +++ b/bacula/intl/dgettext.c @@ -0,0 +1,59 @@ +/* Implementation of the dgettext(3) function + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined HAVE_LOCALE_H || defined _LIBC +# include +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DGETTEXT __dgettext +# define DCGETTEXT __dcgettext +#else +# define DGETTEXT dgettext__ +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog of the current + LC_MESSAGES locale. */ +char * +DGETTEXT (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return DCGETTEXT (domainname, msgid, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dgettext, dgettext); +#endif diff --git a/bacula/intl/explodename.c b/bacula/intl/explodename.c new file mode 100644 index 0000000000..8066dc2996 --- /dev/null +++ b/bacula/intl/explodename.c @@ -0,0 +1,188 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +#endif +#include + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +int +_nl_explode_name (name, language, modifier, territory, codeset, + normalized_codeset, special, sponsor, revision) + char *name; + const char **language; + const char **modifier; + const char **territory; + const char **codeset; + const char **normalized_codeset; + const char **special; + const char **sponsor; + const char **revision; +{ + enum { undecided, xpg, cen } syntax; + char *cp; + int mask; + + *modifier = NULL; + *territory = NULL; + *codeset = NULL; + *normalized_codeset = NULL; + *special = NULL; + *sponsor = NULL; + *revision = NULL; + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = 0; + syntax = undecided; + *language = cp = name; + while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@' + && cp[0] != '+' && cp[0] != ',') + ++cp; + + if (*language == cp) + /* This does not make sense: language has to be specified. Use + this entry as it is without exploding. Perhaps it is an alias. */ + cp = strchr (*language, '\0'); + else if (cp[0] == '_') + { + /* Next is the territory. */ + cp[0] = '\0'; + *territory = ++cp; + + while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' + && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= TERRITORY; + + if (cp[0] == '.') + { + /* Next is the codeset. */ + syntax = xpg; + cp[0] = '\0'; + *codeset = ++cp; + + while (cp[0] != '\0' && cp[0] != '@') + ++cp; + + mask |= XPG_CODESET; + + if (*codeset != cp && (*codeset)[0] != '\0') + { + *normalized_codeset = _nl_normalize_codeset (*codeset, + cp - *codeset); + if (strcmp (*codeset, *normalized_codeset) == 0) + free ((char *) *normalized_codeset); + else + mask |= XPG_NORM_CODESET; + } + } + } + + if (cp[0] == '@' || (syntax != xpg && cp[0] == '+')) + { + /* Next is the modifier. */ + syntax = cp[0] == '@' ? xpg : cen; + cp[0] = '\0'; + *modifier = ++cp; + + while (syntax == cen && cp[0] != '\0' && cp[0] != '+' + && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= XPG_MODIFIER | CEN_AUDIENCE; + } + + if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) + { + syntax = cen; + + if (cp[0] == '+') + { + /* Next is special application (CEN syntax). */ + cp[0] = '\0'; + *special = ++cp; + + while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= CEN_SPECIAL; + } + + if (cp[0] == ',') + { + /* Next is sponsor (CEN syntax). */ + cp[0] = '\0'; + *sponsor = ++cp; + + while (cp[0] != '\0' && cp[0] != '_') + ++cp; + + mask |= CEN_SPONSOR; + } + + if (cp[0] == '_') + { + /* Next is revision (CEN syntax). */ + cp[0] = '\0'; + *revision = ++cp; + + mask |= CEN_REVISION; + } + } + + /* For CEN syntax values it might be important to have the + separator character in the file name, not for XPG syntax. */ + if (syntax == xpg) + { + if (*territory != NULL && (*territory)[0] == '\0') + mask &= ~TERRITORY; + + if (*codeset != NULL && (*codeset)[0] == '\0') + mask &= ~XPG_CODESET; + + if (*modifier != NULL && (*modifier)[0] == '\0') + mask &= ~XPG_MODIFIER; + } + + return mask; +} diff --git a/bacula/intl/finddomain.c b/bacula/intl/finddomain.c new file mode 100644 index 0000000000..81ea29bf4e --- /dev/null +++ b/bacula/intl/finddomain.c @@ -0,0 +1,216 @@ +/* Handle list of needed message catalogs + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include "gettext.h" +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ +/* List of already loaded domains. */ +static struct loaded_l10nfile *_nl_loaded_domains; + + +/* Return a data structure describing the message catalog described by + the DOMAINNAME and CATEGORY parameters with respect to the currently + established bindings. */ +struct loaded_l10nfile * +internal_function +_nl_find_domain (dirname, locale, domainname) + const char *dirname; + char *locale; + const char *domainname; +{ + struct loaded_l10nfile *retval; + const char *language; + const char *modifier; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *special; + const char *sponsor; + const char *revision; + const char *alias_value; + int mask; + + /* LOCALE can consist of up to four recognized parts for the XPG syntax: + + language[_territory[.codeset]][@modifier] + + and six parts for the CEN syntax: + + language[_territory][+audience][+special][,[sponsor][_revision]] + + Beside the first part all of them are allowed to be missing. If + the full specified locale is not found, the less specific one are + looked for. The various parts will be stripped off according to + the following order: + (1) revision + (2) sponsor + (3) special + (4) codeset + (5) normalized codeset + (6) territory + (7) audience/modifier + */ + + /* If we have already tested for this locale entry there has to + be one data set in the list of loaded domains. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, 0, locale, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, domainname, 0); + if (retval != NULL) + { + /* We know something about this locale. */ + int cnt; + + if (retval->decided == 0) + _nl_load_domain (retval); + + if (retval->data != NULL) + return retval; + + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt]); + + if (retval->successor[cnt]->data != NULL) + break; + } + return cnt >= 0 ? retval : NULL; + /* NOTREACHED */ + } + + /* See whether the locale value is an alias. If yes its value + *overwrites* the alias name. No test for the original value is + done. */ + alias_value = _nl_expand_alias (locale); + if (alias_value != NULL) + { +#if defined _LIBC || defined HAVE_STRDUP + locale = strdup (alias_value); + if (locale == NULL) + return NULL; +#else + size_t len = strlen (alias_value) + 1; + locale = (char *) malloc (len); + if (locale == NULL) + return NULL; + + memcpy (locale, alias_value, len); +#endif + } + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = _nl_explode_name (locale, &language, &modifier, &territory, + &codeset, &normalized_codeset, &special, + &sponsor, &revision); + + /* Create all possible locale entries which might be interested in + generalization. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, mask, language, territory, + codeset, normalized_codeset, modifier, special, + sponsor, revision, domainname, 1); + if (retval == NULL) + /* This means we are out of core. */ + return NULL; + + if (retval->decided == 0) + _nl_load_domain (retval); + if (retval->data == NULL) + { + int cnt; + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt]); + if (retval->successor[cnt]->data != NULL) + break; + } + } + + /* The room for an alias was dynamically allocated. Free it now. */ + if (alias_value != NULL) + free (locale); + + return retval; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + struct loaded_l10nfile *runp = _nl_loaded_domains; + + while (runp != NULL) + { + struct loaded_l10nfile *here = runp; + if (runp->data != NULL) + _nl_unload_domain ((struct loaded_domain *) runp->data); + runp = runp->next; + free (here); + } +} + +text_set_element (__libc_subfreeres, free_mem); +#endif diff --git a/bacula/intl/gettext.c b/bacula/intl/gettext.c new file mode 100644 index 0000000000..d929f98d68 --- /dev/null +++ b/bacula/intl/gettext.c @@ -0,0 +1,70 @@ +/* Implementation of gettext(3) function. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define __need_NULL +# include +#else +# ifdef STDC_HEADERS +# include /* Just for NULL. */ +# else +# ifdef HAVE_STRING_H +# include +# else +# define NULL ((void *) 0) +# endif +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define GETTEXT __gettext +# define DGETTEXT __dgettext +#else +# define GETTEXT gettext__ +# define DGETTEXT dgettext__ +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +char * +GETTEXT (msgid) + const char *msgid; +{ + return DGETTEXT (NULL, msgid); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__gettext, gettext); +#endif diff --git a/bacula/intl/gettext.h b/bacula/intl/gettext.h new file mode 100644 index 0000000000..3cd23d7d6a --- /dev/null +++ b/bacula/intl/gettext.h @@ -0,0 +1,105 @@ +/* Internal header for GNU gettext internationalization functions. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _GETTEXT_H +#define _GETTEXT_H 1 + +#include + +#if HAVE_LIMITS_H || _LIBC +# include +#endif + +/* @@ end of prolog @@ */ + +/* The magic number of the GNU message catalog format. */ +#define _MAGIC 0x950412de +#define _MAGIC_SWAPPED 0xde120495 + +/* Revision number of the currently used .mo (binary) file format. */ +#define MO_REVISION_NUMBER 0 + +/* The following contortions are an attempt to use the C preprocessor + to determine an unsigned integral type that is 32 bits wide. An + alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but + doing that would require that the configure script compile and *run* + the resulting executable. Locally running cross-compiled executables + is usually not possible. */ + +#if __STDC__ +# define UINT_MAX_32_BITS 4294967295U +#else +# define UINT_MAX_32_BITS 0xFFFFFFFF +#endif + +/* If UINT_MAX isn't defined, assume it's a 32-bit type. + This should be valid for all systems GNU cares about because + that doesn't include 16-bit systems, and only modern systems + (that certainly have ) have 64+-bit integral types. */ + +#ifndef UINT_MAX +# define UINT_MAX UINT_MAX_32_BITS +#endif + +#if UINT_MAX == UINT_MAX_32_BITS +typedef unsigned nls_uint32; +#else +# if USHRT_MAX == UINT_MAX_32_BITS +typedef unsigned short nls_uint32; +# else +# if ULONG_MAX == UINT_MAX_32_BITS +typedef unsigned long nls_uint32; +# else + /* The following line is intended to throw an error. Using #error is + not portable enough. */ + "Cannot determine unsigned 32-bit data type." +# endif +# endif +#endif + + +/* Header for binary .mo file format. */ +struct mo_file_header +{ + /* The magic number. */ + nls_uint32 magic; + /* The revision number of the file format. */ + nls_uint32 revision; + /* The number of strings pairs. */ + nls_uint32 nstrings; + /* Offset of table with start offsets of original strings. */ + nls_uint32 orig_tab_offset; + /* Offset of table with start offsets of translation strings. */ + nls_uint32 trans_tab_offset; + /* Size of hashing table. */ + nls_uint32 hash_tab_size; + /* Offset of first hashing entry. */ + nls_uint32 hash_tab_offset; +}; + +struct string_desc +{ + /* Length of addressed string. */ + nls_uint32 length; + /* Offset of string in file. */ + nls_uint32 offset; +}; + +/* @@ begin of epilog @@ */ + +#endif /* gettext.h */ diff --git a/bacula/intl/gettextP.h b/bacula/intl/gettextP.h new file mode 100644 index 0000000000..00c5203197 --- /dev/null +++ b/bacula/intl/gettextP.h @@ -0,0 +1,89 @@ +/* Header describing internals of gettext library + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _GETTEXTP_H +#define _GETTEXTP_H + +#include "loadinfo.h" + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +#ifndef W +# define W(flag, data) ((flag) ? SWAP (data) : (data)) +#endif + + +#ifdef _LIBC +# include +# define SWAP(i) bswap_32 (i) +#else +static nls_uint32 SWAP PARAMS ((nls_uint32 i)); + +static inline nls_uint32 +SWAP (i) + nls_uint32 i; +{ + return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); +} +#endif + + +struct loaded_domain +{ + const char *data; + int use_mmap; + size_t mmap_size; + int must_swap; + nls_uint32 nstrings; + struct string_desc *orig_tab; + struct string_desc *trans_tab; + nls_uint32 hash_size; + nls_uint32 *hash_tab; +}; + +struct binding +{ + struct binding *next; + char *domainname; + char *dirname; +}; + +struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, + char *__locale, + const char *__domainname)) + internal_function; +void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain)) + internal_function; +void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) + internal_function; + +/* @@ begin of epilog @@ */ + +#endif /* gettextP.h */ diff --git a/bacula/intl/hash-string.h b/bacula/intl/hash-string.h new file mode 100644 index 0000000000..cacb38e479 --- /dev/null +++ b/bacula/intl/hash-string.h @@ -0,0 +1,59 @@ +/* Implements a string hashing function. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +/* We assume to have `unsigned long int' value with at least 32 bits. */ +#define HASHWORDBITS 32 + + +/* Defines the so called `hashpjw' function by P.J. Weinberger + [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, + 1986, 1987 Bell Telephone Laboratories, Inc.] */ +static unsigned long hash_string PARAMS ((const char *__str_param)); + +static inline unsigned long +hash_string (str_param) + const char *str_param; +{ + unsigned long int hval, g; + const char *str = str_param; + + /* Compute the hash value for the given string. */ + hval = 0; + while (*str != '\0') + { + hval <<= 4; + hval += (unsigned long) *str++; + g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4)); + if (g != 0) + { + hval ^= g >> (HASHWORDBITS - 8); + hval ^= g; + } + } + return hval; +} diff --git a/bacula/intl/intl-compat.c b/bacula/intl/intl-compat.c new file mode 100644 index 0000000000..503efa0fa9 --- /dev/null +++ b/bacula/intl/intl-compat.c @@ -0,0 +1,76 @@ +/* intl-compat.c - Stub functions to call gettext functions from GNU gettext + Library. + Copyright (C) 1995 Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "libgettext.h" + +/* @@ end of prolog @@ */ + + +#undef gettext +#undef dgettext +#undef dcgettext +#undef textdomain +#undef bindtextdomain + + +char * +bindtextdomain (domainname, dirname) + const char *domainname; + const char *dirname; +{ + return bindtextdomain__ (domainname, dirname); +} + + +char * +dcgettext (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ + return dcgettext__ (domainname, msgid, category); +} + + +char * +dgettext (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return dgettext__ (domainname, msgid); +} + + +char * +gettext (msgid) + const char *msgid; +{ + return gettext__ (msgid); +} + + +char * +textdomain (domainname) + const char *domainname; +{ + return textdomain__ (domainname); +} diff --git a/bacula/intl/l10nflist.c b/bacula/intl/l10nflist.c new file mode 100644 index 0000000000..9c7dc18360 --- /dev/null +++ b/bacula/intl/l10nflist.c @@ -0,0 +1,411 @@ +/* Handle list of needed message catalogs + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + + +#if defined HAVE_STRING_H || defined _LIBC +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined _LIBC || defined HAVE_ARGZ_H +# include +#endif +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# ifndef stpcpy +# define stpcpy(dest, src) __stpcpy(dest, src) +# endif +#else +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + +/* Define function which are usually not available. */ + +#if !defined _LIBC && !defined HAVE___ARGZ_COUNT +/* Returns the number of strings in ARGZ. */ +static size_t argz_count__ PARAMS ((const char *argz, size_t len)); + +static size_t +argz_count__ (argz, len) + const char *argz; + size_t len; +{ + size_t count = 0; + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len + 1; + len -= part_len + 1; + count++; + } + return count; +} +# undef __argz_count +# define __argz_count(argz, len) argz_count__ (argz, len) +#endif /* !_LIBC && !HAVE___ARGZ_COUNT */ + +#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY +/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's + except the last into the character SEP. */ +static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep)); + +static void +argz_stringify__ (argz, len, sep) + char *argz; + size_t len; + int sep; +{ + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len; + len -= part_len + 1; + if (len > 0) + *argz++ = sep; + } +} +# undef __argz_stringify +# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) +#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */ + +#if !defined _LIBC && !defined HAVE___ARGZ_NEXT +static char *argz_next__ PARAMS ((char *argz, size_t argz_len, + const char *entry)); + +static char * +argz_next__ (argz, argz_len, entry) + char *argz; + size_t argz_len; + const char *entry; +{ + if (entry) + { + if (entry < argz + argz_len) + entry = strchr (entry, '\0') + 1; + + return entry >= argz + argz_len ? NULL : (char *) entry; + } + else + if (argz_len > 0) + return argz; + else + return 0; +} +# undef __argz_next +# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) +#endif /* !_LIBC && !HAVE___ARGZ_NEXT */ + + +/* Return number of bits set in X. */ +static int pop PARAMS ((int x)); + +static inline int +pop (x) + int x; +{ + /* We assume that no more than 16 bits are used. */ + x = ((x & ~0x5555) >> 1) + (x & 0x5555); + x = ((x & ~0x3333) >> 2) + (x & 0x3333); + x = ((x >> 4) + x) & 0x0f0f; + x = ((x >> 8) + x) & 0xff; + + return x; +} + + +struct loaded_l10nfile * +_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, + territory, codeset, normalized_codeset, modifier, special, + sponsor, revision, filename, do_allocate) + struct loaded_l10nfile **l10nfile_list; + const char *dirlist; + size_t dirlist_len; + int mask; + const char *language; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *modifier; + const char *special; + const char *sponsor; + const char *revision; + const char *filename; + int do_allocate; +{ + char *abs_filename; + struct loaded_l10nfile *last = NULL; + struct loaded_l10nfile *retval; + char *cp; + size_t entries; + int cnt; + + /* Allocate room for the full file name. */ + abs_filename = (char *) malloc (dirlist_len + + strlen (language) + + ((mask & TERRITORY) != 0 + ? strlen (territory) + 1 : 0) + + ((mask & XPG_CODESET) != 0 + ? strlen (codeset) + 1 : 0) + + ((mask & XPG_NORM_CODESET) != 0 + ? strlen (normalized_codeset) + 1 : 0) + + (((mask & XPG_MODIFIER) != 0 + || (mask & CEN_AUDIENCE) != 0) + ? strlen (modifier) + 1 : 0) + + ((mask & CEN_SPECIAL) != 0 + ? strlen (special) + 1 : 0) + + (((mask & CEN_SPONSOR) != 0 + || (mask & CEN_REVISION) != 0) + ? (1 + ((mask & CEN_SPONSOR) != 0 + ? strlen (sponsor) + 1 : 0) + + ((mask & CEN_REVISION) != 0 + ? strlen (revision) + 1 : 0)) : 0) + + 1 + strlen (filename) + 1); + + if (abs_filename == NULL) + return NULL; + + retval = NULL; + last = NULL; + + /* Construct file name. */ + memcpy (abs_filename, dirlist, dirlist_len); + __argz_stringify (abs_filename, dirlist_len, ':'); + cp = abs_filename + (dirlist_len - 1); + *cp++ = '/'; + cp = stpcpy (cp, language); + + if ((mask & TERRITORY) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, territory); + } + if ((mask & XPG_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, codeset); + } + if ((mask & XPG_NORM_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, normalized_codeset); + } + if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) + { + /* This component can be part of both syntaces but has different + leading characters. For CEN we use `+', else `@'. */ + *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; + cp = stpcpy (cp, modifier); + } + if ((mask & CEN_SPECIAL) != 0) + { + *cp++ = '+'; + cp = stpcpy (cp, special); + } + if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0) + { + *cp++ = ','; + if ((mask & CEN_SPONSOR) != 0) + cp = stpcpy (cp, sponsor); + if ((mask & CEN_REVISION) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, revision); + } + } + + *cp++ = '/'; + stpcpy (cp, filename); + + /* Look in list of already loaded domains whether it is already + available. */ + last = NULL; + for (retval = *l10nfile_list; retval != NULL; retval = retval->next) + if (retval->filename != NULL) + { + int compare = strcmp (retval->filename, abs_filename); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It's not in the list. */ + retval = NULL; + break; + } + + last = retval; + } + + if (retval != NULL || do_allocate == 0) + { + free (abs_filename); + return retval; + } + + retval = (struct loaded_l10nfile *) + malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len) + * (1 << pop (mask)) + * sizeof (struct loaded_l10nfile *))); + if (retval == NULL) + return NULL; + + retval->filename = abs_filename; + retval->decided = (__argz_count (dirlist, dirlist_len) != 1 + || ((mask & XPG_CODESET) != 0 + && (mask & XPG_NORM_CODESET) != 0)); + retval->data = NULL; + + if (last == NULL) + { + retval->next = *l10nfile_list; + *l10nfile_list = retval; + } + else + { + retval->next = last->next; + last->next = retval; + } + + entries = 0; + /* If the DIRLIST is a real list the RETVAL entry corresponds not to + a real file. So we have to use the DIRLIST separation mechanism + of the inner loop. */ + cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask; + for (; cnt >= 0; --cnt) + if ((cnt & ~mask) == 0 + && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) + && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) + { + /* Iterate over all elements of the DIRLIST. */ + char *dir = NULL; + + while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) + != NULL) + retval->successor[entries++] + = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, + language, territory, codeset, + normalized_codeset, modifier, special, + sponsor, revision, filename, 1); + } + retval->successor[entries] = NULL; + + return retval; +} + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. */ +const char * +_nl_normalize_codeset (codeset, name_len) + const unsigned char *codeset; + size_t name_len; +{ + int len = 0; + int only_digit = 1; + char *retval; + char *wp; + size_t cnt; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalnum (codeset[cnt])) + { + ++len; + + if (isalpha (codeset[cnt])) + only_digit = 0; + } + + retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); + + if (retval != NULL) + { + if (only_digit) + wp = stpcpy (retval, "iso"); + else + wp = retval; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalpha (codeset[cnt])) + *wp++ = tolower (codeset[cnt]); + else if (isdigit (codeset[cnt])) + *wp++ = codeset[cnt]; + + *wp = '\0'; + } + + return (const char *) retval; +} + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/bacula/intl/libgettext.h b/bacula/intl/libgettext.h new file mode 100644 index 0000000000..3a92960ae3 --- /dev/null +++ b/bacula/intl/libgettext.h @@ -0,0 +1,182 @@ +/* Message catalogs for internationalization. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Because on some systems (e.g. Solaris) we sometimes have to include + the systems libintl.h as well as this file we have more complex + include protection above. But the systems header might perhaps also + define _LIBINTL_H and therefore we have to protect the definition here. */ + +#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H +#ifndef _LIBINTL_H +# define _LIBINTL_H 1 +#endif +#define _LIBGETTEXT_H 1 + +/* We define an additional symbol to signal that we use the GNU + implementation of gettext. */ +#define __USE_GNU_GETTEXT 1 + +#include + +#if HAVE_LOCALE_H +# include +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ || defined __cplusplus +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef NULL +# if !defined __cplusplus || defined __GNUC__ +# define NULL ((void *) 0) +# else +# define NULL (0) +# endif +#endif + +#if !HAVE_LC_MESSAGES +/* This value determines the behaviour of the gettext() and dgettext() + function. But some system does not have this defined. Define it + to a default value. */ +# define LC_MESSAGES (-1) +#endif + + +/* Declarations for gettext-using-catgets interface. Derived from + Jim Meyering's libintl.h. */ +struct _msg_ent +{ + const char *_msg; + int _msg_number; +}; + + +#if HAVE_CATGETS +/* These two variables are defined in the automatically by po-to-tbl.sed + generated file `cat-id-tbl.c'. */ +extern const struct _msg_ent _msg_tbl[]; +extern int _msg_tbl_length; +#endif + + +/* For automatical extraction of messages sometimes no real + translation is needed. Instead the string itself is the result. */ +#define gettext_noop(Str) (Str) + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +extern char *gettext PARAMS ((const char *__msgid)); +extern char *gettext__ PARAMS ((const char *__msgid)); + +/* Look up MSGID in the DOMAINNAME message catalog for the current + LC_MESSAGES locale. */ +extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid)); +extern char *dgettext__ PARAMS ((const char *__domainname, + const char *__msgid)); + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid, + int __category)); +extern char *dcgettext__ PARAMS ((const char *__domainname, + const char *__msgid, int __category)); + + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +extern char *textdomain PARAMS ((const char *__domainname)); +extern char *textdomain__ PARAMS ((const char *__domainname)); + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +extern char *bindtextdomain PARAMS ((const char *__domainname, + const char *__dirname)); +extern char *bindtextdomain__ PARAMS ((const char *__domainname, + const char *__dirname)); + +#if ENABLE_NLS + +/* Solaris 2.3 has the gettext function but dcgettext is missing. + So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4 + has dcgettext. */ +# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT) + +# define gettext(Msgid) \ + dgettext (NULL, Msgid) + +# define dgettext(Domainname, Msgid) \ + dcgettext (Domainname, Msgid, LC_MESSAGES) + +# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +/* This global variable is defined in loadmsgcat.c. We need a sign, + whether a new catalog was loaded, which can be associated with all + translations. */ +extern int _nl_msg_cat_cntr; + +# define dcgettext(Domainname, Msgid, Category) \ + (__extension__ \ + ({ \ + char *__result; \ + if (__builtin_constant_p (Msgid)) \ + { \ + static char *__translation__; \ + static int __catalog_counter__; \ + if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \ + { \ + __translation__ = \ + dcgettext__ (Domainname, Msgid, Category); \ + __catalog_counter__ = _nl_msg_cat_cntr; \ + } \ + __result = __translation__; \ + } \ + else \ + __result = dcgettext__ (Domainname, Msgid, Category); \ + __result; \ + })) +# endif +# endif + +#else + +# define gettext(Msgid) (Msgid) +# define dgettext(Domainname, Msgid) (Msgid) +# define dcgettext(Domainname, Msgid, Category) (Msgid) +# define textdomain(Domainname) ((char *) Domainname) +# define bindtextdomain(Domainname, Dirname) ((char *) Dirname) + +#endif + +/* @@ begin of epilog @@ */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bacula/intl/linux-msg.sed b/bacula/intl/linux-msg.sed new file mode 100644 index 0000000000..5918e720a9 --- /dev/null +++ b/bacula/intl/linux-msg.sed @@ -0,0 +1,100 @@ +# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file +# Copyright (C) 1995 Free Software Foundation, Inc. +# Ulrich Drepper , 1995. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# The first directive in the .msg should be the definition of the +# message set number. We use always set number 1. +# +1 { + i\ +$set 1 # Automatically created by po2msg.sed + h + s/.*/0/ + x +} +# +# Mitch's old catalog format does not allow comments. +# +# We copy the original message as a comment into the .msg file. +# +/^msgid/ { + s/msgid[ ]*"// +# +# This does not work now with the new format. +# /"$/! { +# s/\\$// +# s/$/ ... (more lines following)"/ +# } + x +# The following nice solution is by +# Bruno + td +# Increment a decimal number in pattern space. +# First hide trailing `9' digits. + :d + s/9\(_*\)$/_\1/ + td +# Assure at least one digit is available. + s/^\(_*\)$/0\1/ +# Increment the last digit. + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ +# Convert the hidden `9' digits to `0's. + s/_/0/g + x + G + s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p +} +# +# The .msg file contains, other then the .po file, only the translations +# but each given a unique ID. Starting from 1 and incrementing by 1 for +# each message we assign them to the messages. +# It is important that the .po file used to generate the cat-id-tbl.c file +# (with po-to-tbl) is the same as the one used here. (At least the order +# of declarations must not be changed.) +# +/^msgstr/ { + s/msgstr[ ]*"\(.*\)"/# \1/ +# Clear substitution flag. + tb +# Append the next line. + :b + N +# Look whether second part is continuation line. + s/\(.*\n\)"\(.*\)"/\1\2/ +# Yes, then branch. + ta + P + D +# Note that D includes a jump to the start!! +# We found a continuation line. But before printing insert '\'. + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P +# We cannot use D here. + s/.*\n\(.*\)/\1/ + tb +} +d diff --git a/bacula/intl/loadinfo.h b/bacula/intl/loadinfo.h new file mode 100644 index 0000000000..f4ebf6d811 --- /dev/null +++ b/bacula/intl/loadinfo.h @@ -0,0 +1,76 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +/* Encoding of locale name parts. */ +#define CEN_REVISION 1 +#define CEN_SPONSOR 2 +#define CEN_SPECIAL 4 +#define XPG_NORM_CODESET 8 +#define XPG_CODESET 16 +#define TERRITORY 32 +#define CEN_AUDIENCE 64 +#define XPG_MODIFIER 128 + +#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) +#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) + + +struct loaded_l10nfile +{ + const char *filename; + int decided; + + const void *data; + + struct loaded_l10nfile *next; + struct loaded_l10nfile *successor[1]; +}; + + +extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset, + size_t name_len)); + +extern struct loaded_l10nfile * +_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, + const char *dirlist, size_t dirlist_len, int mask, + const char *language, const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, const char *special, + const char *sponsor, const char *revision, + const char *filename, int do_allocate)); + + +extern const char *_nl_expand_alias PARAMS ((const char *name)); + +extern int _nl_explode_name PARAMS ((char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision)); diff --git a/bacula/intl/loadmsgcat.c b/bacula/intl/loadmsgcat.c new file mode 100644 index 0000000000..515892dfb8 --- /dev/null +++ b/bacula/intl/loadmsgcat.c @@ -0,0 +1,222 @@ +/* Load needed message catalogs. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC +# include +#endif + +#include "gettext.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ISO C functions. This is required by the standard + because some ISO C functions will require linking with this object + file and the name space must not be polluted. */ +# define open __open +# define close __close +# define read __read +# define mmap __mmap +# define munmap __munmap +#endif + +/* We need a sign, whether a new catalog was loaded, which can be associated + with all translations. This is important if the translations are + cached by one of GCC's features. */ +int _nl_msg_cat_cntr = 0; + + +/* Load the message catalogs specified by FILENAME. If it is no valid + message catalog do nothing. */ +void +internal_function +_nl_load_domain (domain_file) + struct loaded_l10nfile *domain_file; +{ + int fd; + size_t size; + struct stat st; + struct mo_file_header *data = (struct mo_file_header *) -1; +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + int use_mmap = 0; +#endif + struct loaded_domain *domain; + + domain_file->decided = 1; + domain_file->data = NULL; + + /* If the record does not represent a valid locale the FILENAME + might be NULL. This can happen when according to the given + specification the locale file name is different for XPG and CEN + syntax. */ + if (domain_file->filename == NULL) + return; + + /* Try to open the addressed file. */ + fd = open (domain_file->filename, O_RDONLY); + if (fd == -1) + return; + + /* We must know about the size of the file. */ + if (fstat (fd, &st) != 0 + || (size = (size_t) st.st_size) != st.st_size + || size < sizeof (struct mo_file_header)) + { + /* Something went wrong. */ + close (fd); + return; + } + +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + /* Now we are ready to load the file. If mmap() is available we try + this first. If not available or it failed we try to load it. */ + data = (struct mo_file_header *) mmap (NULL, size, PROT_READ, + MAP_PRIVATE, fd, 0); + + if (data != (struct mo_file_header *) -1) + { + /* mmap() call was successful. */ + close (fd); + use_mmap = 1; + } +#endif + + /* If the data is not yet available (i.e. mmap'ed) we try to load + it manually. */ + if (data == (struct mo_file_header *) -1) + { + size_t to_read; + char *read_ptr; + + data = (struct mo_file_header *) malloc (size); + if (data == NULL) + return; + + to_read = size; + read_ptr = (char *) data; + do + { + long int nb = (long int) read (fd, read_ptr, to_read); + if (nb == -1) + { + close (fd); + return; + } + + read_ptr += nb; + to_read -= nb; + } + while (to_read > 0); + + close (fd); + } + + /* Using the magic number we can test whether it really is a message + catalog file. */ + if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED) + { + /* The magic number is wrong: not a message catalog file. */ +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + return; + } + + domain_file->data + = (struct loaded_domain *) malloc (sizeof (struct loaded_domain)); + if (domain_file->data == NULL) + return; + + domain = (struct loaded_domain *) domain_file->data; + domain->data = (char *) data; +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + domain->use_mmap = use_mmap; +#endif + domain->mmap_size = size; + domain->must_swap = data->magic != _MAGIC; + + /* Fill in the information about the available tables. */ + switch (W (domain->must_swap, data->revision)) + { + case 0: + domain->nstrings = W (domain->must_swap, data->nstrings); + domain->orig_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->orig_tab_offset)); + domain->trans_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->trans_tab_offset)); + domain->hash_size = W (domain->must_swap, data->hash_tab_size); + domain->hash_tab = (nls_uint32 *) + ((char *) data + W (domain->must_swap, data->hash_tab_offset)); + break; + default: + /* This is an illegal revision. */ +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + free (domain); + domain_file->data = NULL; + return; + } + + /* Show that one domain is changed. This might make some cached + translations invalid. */ + ++_nl_msg_cat_cntr; +} + + +#ifdef _LIBC +void +internal_function +_nl_unload_domain (domain) + struct loaded_domain *domain; +{ + if (domain->use_mmap) + munmap ((caddr_t) domain->data, domain->mmap_size); + else + free ((void *) domain->data); + + free (domain); +} +#endif diff --git a/bacula/intl/localealias.c b/bacula/intl/localealias.c new file mode 100644 index 0000000000..bca555a610 --- /dev/null +++ b/bacula/intl/localealias.c @@ -0,0 +1,424 @@ +/* Handle aliases for locale names. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#include "gettext.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define strcasecmp __strcasecmp + +# define mempcpy __mempcpy +# define HAVE_MEMPCPY 1 + +/* We need locking here since we can be called from different places. */ +# include + +__libc_lock_define_initialized (static, lock); +#endif + + +/* For those loosing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +/* Nothing has to be done. */ +# define ADD_BLOCK(list, address) /* nothing */ +# define FREE_BLOCKS(list) /* nothing */ +#else +struct block_list +{ + void *address; + struct block_list *next; +}; +# define ADD_BLOCK(list, addr) \ + do { \ + struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ + /* If we cannot get a free block we cannot add the new element to \ + the list. */ \ + if (newp != NULL) { \ + newp->address = (addr); \ + newp->next = (list); \ + (list) = newp; \ + } \ + } while (0) +# define FREE_BLOCKS(list) \ + do { \ + while (list != NULL) { \ + struct block_list *old = list; \ + list = list->next; \ + free (old); \ + } \ + } while (0) +# undef alloca +# define alloca(size) (malloc (size)) +#endif /* have alloca */ + + +struct alias_map +{ + const char *alias; + const char *value; +}; + + +static char *string_space = NULL; +static size_t string_space_act = 0; +static size_t string_space_max = 0; +static struct alias_map *map; +static size_t nmap = 0; +static size_t maxmap = 0; + + +/* Prototypes for local functions. */ +static size_t read_alias_file PARAMS ((const char *fname, int fname_len)) + internal_function; +static void extend_alias_table PARAMS ((void)); +static int alias_compare PARAMS ((const struct alias_map *map1, + const struct alias_map *map2)); + + +const char * +_nl_expand_alias (name) + const char *name; +{ + static const char *locale_alias_path = LOCALE_ALIAS_PATH; + struct alias_map *retval; + const char *result = NULL; + size_t added; + +#ifdef _LIBC + __libc_lock_lock (lock); +#endif + + do + { + struct alias_map item; + + item.alias = name; + + if (nmap > 0) + retval = (struct alias_map *) bsearch (&item, map, nmap, + sizeof (struct alias_map), + (int (*) PARAMS ((const void *, + const void *)) + ) alias_compare); + else + retval = NULL; + + /* We really found an alias. Return the value. */ + if (retval != NULL) + { + result = retval->value; + break; + } + + /* Perhaps we can find another alias file. */ + added = 0; + while (added == 0 && locale_alias_path[0] != '\0') + { + const char *start; + + while (locale_alias_path[0] == ':') + ++locale_alias_path; + start = locale_alias_path; + + while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':') + ++locale_alias_path; + + if (start < locale_alias_path) + added = read_alias_file (start, locale_alias_path - start); + } + } + while (added != 0); + +#ifdef _LIBC + __libc_lock_unlock (lock); +#endif + + return result; +} + + +static size_t +internal_function +read_alias_file (fname, fname_len) + const char *fname; + int fname_len; +{ +#ifndef HAVE_ALLOCA + struct block_list *block_list = NULL; +#endif + FILE *fp; + char *full_fname; + size_t added; + static const char aliasfile[] = "/locale.alias"; + + full_fname = (char *) alloca (fname_len + sizeof aliasfile); + ADD_BLOCK (block_list, full_fname); +#ifdef HAVE_MEMPCPY + mempcpy (mempcpy (full_fname, fname, fname_len), + aliasfile, sizeof aliasfile); +#else + memcpy (full_fname, fname, fname_len); + memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); +#endif + + fp = fopen (full_fname, "r"); + if (fp == NULL) + { + FREE_BLOCKS (block_list); + return 0; + } + + added = 0; + while (!feof (fp)) + { + /* It is a reasonable approach to use a fix buffer here because + a) we are only interested in the first two fields + b) these fields must be usable as file names and so must not + be that long + */ + unsigned char buf[BUFSIZ]; + unsigned char *alias; + unsigned char *value; + unsigned char *cp; + + if (fgets (buf, sizeof buf, fp) == NULL) + /* EOF reached. */ + break; + + /* Possibly not the whole line fits into the buffer. Ignore + the rest of the line. */ + if (strchr (buf, '\n') == NULL) + { + char altbuf[BUFSIZ]; + do + if (fgets (altbuf, sizeof altbuf, fp) == NULL) + /* Make sure the inner loop will be left. The outer loop + will exit at the `feof' test. */ + break; + while (strchr (altbuf, '\n') == NULL); + } + + cp = buf; + /* Ignore leading white space. */ + while (isspace (cp[0])) + ++cp; + + /* A leading '#' signals a comment line. */ + if (cp[0] != '\0' && cp[0] != '#') + { + alias = cp++; + while (cp[0] != '\0' && !isspace (cp[0])) + ++cp; + /* Terminate alias name. */ + if (cp[0] != '\0') + *cp++ = '\0'; + + /* Now look for the beginning of the value. */ + while (isspace (cp[0])) + ++cp; + + if (cp[0] != '\0') + { + size_t alias_len; + size_t value_len; + + value = cp++; + while (cp[0] != '\0' && !isspace (cp[0])) + ++cp; + /* Terminate value. */ + if (cp[0] == '\n') + { + /* This has to be done to make the following test + for the end of line possible. We are looking for + the terminating '\n' which do not overwrite here. */ + *cp++ = '\0'; + *cp = '\n'; + } + else if (cp[0] != '\0') + *cp++ = '\0'; + + if (nmap >= maxmap) + extend_alias_table (); + + alias_len = strlen (alias) + 1; + value_len = strlen (value) + 1; + + if (string_space_act + alias_len + value_len > string_space_max) + { + /* Increase size of memory pool. */ + size_t new_size = (string_space_max + + (alias_len + value_len > 1024 + ? alias_len + value_len : 1024)); + char *new_pool = (char *) realloc (string_space, new_size); + if (new_pool == NULL) + { + FREE_BLOCKS (block_list); + return added; + } + string_space = new_pool; + string_space_max = new_size; + } + + map[nmap].alias = memcpy (&string_space[string_space_act], + alias, alias_len); + string_space_act += alias_len; + + map[nmap].value = memcpy (&string_space[string_space_act], + value, value_len); + string_space_act += value_len; + + ++nmap; + ++added; + } + } + } + + /* Should we test for ferror()? I think we have to silently ignore + errors. --drepper */ + fclose (fp); + + if (added > 0) + qsort (map, nmap, sizeof (struct alias_map), + (int (*) PARAMS ((const void *, const void *))) alias_compare); + + FREE_BLOCKS (block_list); + return added; +} + + +static void +extend_alias_table () +{ + size_t new_size; + struct alias_map *new_map; + + new_size = maxmap == 0 ? 100 : 2 * maxmap; + new_map = (struct alias_map *) realloc (map, (new_size + * sizeof (struct alias_map))); + if (new_map == NULL) + /* Simply don't extend: we don't have any more core. */ + return; + + map = new_map; + maxmap = new_size; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + if (string_space != NULL) + free (string_space); + if (map != NULL) + free (map); +} +text_set_element (__libc_subfreeres, free_mem); +#endif + + +static int +alias_compare (map1, map2) + const struct alias_map *map1; + const struct alias_map *map2; +{ +#if defined _LIBC || defined HAVE_STRCASECMP + return strcasecmp (map1->alias, map2->alias); +#else + const unsigned char *p1 = (const unsigned char *) map1->alias; + const unsigned char *p2 = (const unsigned char *) map2->alias; + unsigned char c1, c2; + + if (p1 == p2) + return 0; + + do + { + /* I know this seems to be odd but the tolower() function in + some systems libc cannot handle nonalpha characters. */ + c1 = isupper (*p1) ? tolower (*p1) : *p1; + c2 = isupper (*p2) ? tolower (*p2) : *p2; + if (c1 == '\0') + break; + ++p1; + ++p2; + } + while (c1 == c2); + + return c1 - c2; +#endif +} diff --git a/bacula/intl/po2tbl.sed b/bacula/intl/po2tbl.sed new file mode 100644 index 0000000000..93c0435f4d --- /dev/null +++ b/bacula/intl/po2tbl.sed @@ -0,0 +1,60 @@ +1 { + i\ +/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\ +\ +#if HAVE_CONFIG_H\ +# include \ +#endif\ +\ +#include "libgettext.h"\ +\ +const struct _msg_ent _msg_tbl[] = { + h + s/.*/0/ + x +} +/^msgid/ { + s/msgid[ ]*\(".*"\)/ {\1/ + tb + :b + N + s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/ + ta + s/\(.*\)\n.*/\1/ + bc + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P + s/.*\n\(.*\)/\1/ + tb + :c + x + td + :d + s/9\(_*\)$/_\1/ + td + s/^\(_*\)$/0\1/ + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ + s/_/0/g + x + G + s/\(.*\)\n\([0-9]*\)/\1, \2},/ + s/\(.*\)"$/\1/ + p +} +$ { + i\ +};\ + + g + s/0*\(.*\)/int _msg_tbl_length = \1;/p +} +d diff --git a/bacula/intl/po2tbl.sed.in b/bacula/intl/po2tbl.sed.in new file mode 100644 index 0000000000..b3bcca4d73 --- /dev/null +++ b/bacula/intl/po2tbl.sed.in @@ -0,0 +1,102 @@ +# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets +# Copyright (C) 1995 Free Software Foundation, Inc. +# Ulrich Drepper , 1995. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +1 { + i\ +/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\ +\ +#if HAVE_CONFIG_H\ +# include \ +#endif\ +\ +#include "libgettext.h"\ +\ +const struct _msg_ent _msg_tbl[] = { + h + s/.*/0/ + x +} +# +# Write msgid entries in C array form. +# +/^msgid/ { + s/msgid[ ]*\(".*"\)/ {\1/ + tb +# Append the next line + :b + N +# Look whether second part is continuation line. + s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/ +# Yes, then branch. + ta +# Because we assume that the input file correctly formed the line +# just read cannot be again be a msgid line. So it's safe to ignore +# it. + s/\(.*\)\n.*/\1/ + bc +# We found a continuation line. But before printing insert '\'. + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P +# We cannot use D here. + s/.*\n\(.*\)/\1/ +# Some buggy seds do not clear the `successful substitution since last ``t''' +# flag on `N', so we do a `t' here to clear it. + tb +# Not reached + :c + x +# The following nice solution is by +# Bruno + td +# Increment a decimal number in pattern space. +# First hide trailing `9' digits. + :d + s/9\(_*\)$/_\1/ + td +# Assure at least one digit is available. + s/^\(_*\)$/0\1/ +# Increment the last digit. + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ +# Convert the hidden `9' digits to `0's. + s/_/0/g + x + G + s/\(.*\)\n\([0-9]*\)/\1, \2},/ + s/\(.*\)"$/\1/ + p +} +# +# Last line. +# +$ { + i\ +};\ + + g + s/0*\(.*\)/int _msg_tbl_length = \1;/p +} +d diff --git a/bacula/intl/textdomain.c b/bacula/intl/textdomain.c new file mode 100644 index 0000000000..88557460f3 --- /dev/null +++ b/bacula/intl/textdomain.c @@ -0,0 +1,108 @@ +/* Implementation of the textdomain(3) function. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ + +/* Name of the default text domain. */ +extern const char _nl_default_default_domain[]; + +/* Default text domain in which entries for gettext(3) are to be found. */ +extern const char *_nl_current_default_domain; + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define TEXTDOMAIN __textdomain +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +#else +# define TEXTDOMAIN textdomain__ +#endif + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +char * +TEXTDOMAIN (domainname) + const char *domainname; +{ + char *old; + + /* A NULL pointer requests the current setting. */ + if (domainname == NULL) + return (char *) _nl_current_default_domain; + + old = (char *) _nl_current_default_domain; + + /* If domain name is the null string set to default domain "messages". */ + if (domainname[0] == '\0' + || strcmp (domainname, _nl_default_default_domain) == 0) + _nl_current_default_domain = _nl_default_default_domain; + else + { + /* If the following malloc fails `_nl_current_default_domain' + will be NULL. This value will be returned and so signals we + are out of core. */ +#if defined _LIBC || defined HAVE_STRDUP + _nl_current_default_domain = strdup (domainname); +#else + size_t len = strlen (domainname) + 1; + char *cp = (char *) malloc (len); + if (cp != NULL) + memcpy (cp, domainname, len); + _nl_current_default_domain = cp; +#endif + } + + if (old != _nl_default_default_domain) + free (old); + + return (char *) _nl_current_default_domain; +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__textdomain, textdomain); +#endif diff --git a/bacula/intl/xopen-msg.sed b/bacula/intl/xopen-msg.sed new file mode 100644 index 0000000000..b19c0bbd0e --- /dev/null +++ b/bacula/intl/xopen-msg.sed @@ -0,0 +1,104 @@ +# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file +# Copyright (C) 1995 Free Software Foundation, Inc. +# Ulrich Drepper , 1995. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# The first directive in the .msg should be the definition of the +# message set number. We use always set number 1. +# +1 { + i\ +$set 1 # Automatically created by po2msg.sed + h + s/.*/0/ + x +} +# +# We copy all comments into the .msg file. Perhaps they can help. +# +/^#/ s/^#[ ]*/$ /p +# +# We copy the original message as a comment into the .msg file. +# +/^msgid/ { +# Does not work now +# /"$/! { +# s/\\$// +# s/$/ ... (more lines following)"/ +# } + s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/ + p +} +# +# The .msg file contains, other then the .po file, only the translations +# but each given a unique ID. Starting from 1 and incrementing by 1 for +# each message we assign them to the messages. +# It is important that the .po file used to generate the cat-id-tbl.c file +# (with po-to-tbl) is the same as the one used here. (At least the order +# of declarations must not be changed.) +# +/^msgstr/ { + s/msgstr[ ]*"\(.*\)"/\1/ + x +# The following nice solution is by +# Bruno + td +# Increment a decimal number in pattern space. +# First hide trailing `9' digits. + :d + s/9\(_*\)$/_\1/ + td +# Assure at least one digit is available. + s/^\(_*\)$/0\1/ +# Increment the last digit. + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ +# Convert the hidden `9' digits to `0's. + s/_/0/g + x +# Bring the line in the format ` ' + G + s/^[^\n]*$/& / + s/\(.*\)\n\([0-9]*\)/\2 \1/ +# Clear flag from last substitution. + tb +# Append the next line. + :b + N +# Look whether second part is a continuation line. + s/\(.*\n\)"\(.*\)"/\1\2/ +# Yes, then branch. + ta + P + D +# Note that `D' includes a jump to the start!! +# We found a continuation line. But before printing insert '\'. + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P +# We cannot use the sed command `D' here + s/.*\n\(.*\)/\1/ + tb +} +d diff --git a/bacula/platforms/Makefile.in b/bacula/platforms/Makefile.in new file mode 100644 index 0000000000..9152769dc2 --- /dev/null +++ b/bacula/platforms/Makefile.in @@ -0,0 +1,86 @@ +# +# This is the makefile template for the platform directory +# which contains general platform installation. +# +# 15 November 2001 -- Kern Sibbald +# +# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + + +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL = @INSTALL@ + +SUBDIRS = freebsd redhat solaris unknown hpux suse openbsd \ + slackware alpha netbsd caldera debian + +MAKE = make + +DISTNAME=@DISTNAME@ +DISTVER=@DISTVER@ + +all: + @for subdir in ${SUBDIRS}; do \ + if [ -f $${subdir}/Makefile ]; then \ + (cd $${subdir}; make;) \ + fi; \ + done + + +install: install-autostart-dir install-autostart-fd install-autostart-sd + +install-autostart-dir: + @if test x$(DISTNAME) != x ; then \ + (cd $(DISTNAME); \ + $(MAKE) "DISTNAME=$(DISTNAME)" "DISTVER=$(DISTVER)" $@) \ + fi + +install-autostart-fd: + @if test x$(DISTNAME) != x ; then \ + (cd $(DISTNAME); \ + $(MAKE) "DISTNAME=$(DISTNAME)" "DISTVER=$(DISTVER)" $@) \ + fi + +install-autostart-sd: + @if test x$(DISTNAME) != x ; then \ + (cd $(DISTNAME); \ + $(MAKE) "DISTNAME=$(DISTNAME)" "DISTVER=$(DISTVER)" $@) \ + fi + +uninstall: uninstall-autostart-dir uninstall-autostart-fd uninstall-autrun-sd + +uninstall-autostart-dir: + @if test x$(DISTNAME) != x ; then \ + (cd $(DISTNAME); \ + $(MAKE) "DISTNAME=$(DISTNAME)" "DISTVER=$(DISTVER)" $@) \ + fi + +uninstall-autostart-fd: + @if test x$(DISTNAME) != x ; then \ + (cd $(DISTNAME); \ + $(MAKE) "DISTNAME=$(DISTNAME)" "DISTVER=$(DISTVER)" $@) \ + fi + +uninstall-autostart-sd: + @if test x$(DISTNAME) != x ; then \ + (cd $(DISTNAME); \ + $(MAKE) "DISTNAME=$(DISTNAME)" "DISTVER=$(DISTVER)" $@) \ + fi + +depend: + +clean: + @for subdir in ${SUBDIRS}; do \ + if [ -f $${subdir}/Makefile ]; then \ + (cd $${subdir}; make clean;) \ + fi; \ + done + rm -f 1 2 3 + +distclean: + rm -f Makefile + @for subdir in ${SUBDIRS}; do \ + if [ -f $${subdir}/Makefile ]; then \ + (cd $${subdir}; make distclean;) \ + fi; \ + done diff --git a/bacula/platforms/README b/bacula/platforms/README new file mode 100644 index 0000000000..e8d215291f --- /dev/null +++ b/bacula/platforms/README @@ -0,0 +1,5 @@ + +This directory, /platforms, contains the platform +specific installation files. Files that are common to all +platforms are in this directory, and files that are specific +to a particular platform are contained in subdirectories. diff --git a/bacula/platforms/freebsd/Makefile.in b/bacula/platforms/freebsd/Makefile.in new file mode 100644 index 0000000000..bb7169aa11 --- /dev/null +++ b/bacula/platforms/freebsd/Makefile.in @@ -0,0 +1,135 @@ +# +# This file is used as the template to create the +# Makefile for the Solaris specific installation. +# +# 15 November 2001 -- Kern Sibbald +# +# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +VPATH = @srcdir@ +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +SED = /usr/bin/sed + +nothing: + +install: install-autostart + +install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir + + +install-autostart-fd: + @echo "FreeBSD platform installation" + $(INSTALL_PROGRAM) -m 744 bacula-fd /etc/rc.bacula-fd + @-today="`date +%Y%m%d%H%M`"; \ + grep -q /etc/rc.bacula-fd /etc/rc.local; \ + if [ $$? -eq 0 ]; then \ + echo "/etc/rc.local already patched"; \ + else \ + rm -f /etc/rc.local.$$today; \ + cp -p /etc/rc.local /etc/rc.local.$$today; \ + ( echo "Start the Bacula File daemon. Do not remove the 'TAG_BACULA_FD' text"; \ + echo "if [ -x /etc/rc.bacula-fd ]; then # TAG_BACULA_FD"; \ + echo " /etc/rc.bacula-fd start # TAG_BACULA_FD"; \ + echo "fi # TAG_BACULA_FD"; \ + ) >> /etc/rc.local; \ + echo ""; \ + fi + + +install-autostart-sd: + @echo "FreeBSD platform installation" + $(INSTALL_PROGRAM) -m 744 bacula-sd /etc/rc.bacula-sd + @-today="`date +%Y%m%d%H%M`"; \ + grep -q /etc/rc.bacula-sd /etc/rc.local; \ + if [ $$? -eq 0 ]; then \ + echo "/etc/rc.local already patched"; \ + else \ + rm -f /etc/rc.local.$$today; \ + cp -p /etc/rc.local /etc/rc.local.$$today; \ + ( echo "Start the Bacula Storage daemon. Do not remove the 'TAG_BACULA_SD' text"; \ + echo "if [ -x /etc/rc.bacula-fd ]; then # TAG_BACULA_SD"; \ + echo " /etc/rc.bacula-fd start # TAG_BACULA_SD"; \ + echo "fi # TAG_BACULA_SD"; \ + ) >> /etc/rc.local; \ + echo ""; \ + fi + +install-autostart-dir: + @echo "FreeBSD platform installation" + $(INSTALL_PROGRAM) -m 744 bacula-dir /etc/rc.bacula-dir + @-today="`date +%Y%m%d%H%M`"; \ + grep -q /etc/rc.bacula-dir /etc/rc.local; \ + if [ $$? -eq 0 ]; then \ + echo "/etc/rc.local already patched"; \ + else \ + rm -f /etc/rc.local.$$today; \ + cp -p /etc/rc.local /etc/rc.local.$$today; \ + ( echo "Start the Bacula Director. Do not remove the 'TAG_BACULA_DIR' text"; \ + echo "if [ -x /etc/rc.bacula-dir ]; then # TAG_BACULA_DIR"; \ + echo " /etc/rc.bacula-dir start # TAG_BACULA_DIR"; \ + echo "fi # TAG_BACULA_DIR"; \ + ) >> /etc/rc.local; \ + echo ""; \ + fi + + +uninstall: uninstall-autostart + +uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir + +uninstall-autostart-fd: + @echo "FreeBSD platform uninstall" + rm -f /etc/rc.bacula-fd + @-today="`date +%Y%m%d%H%M`"; \ + for f in /etc/rc.local ; do \ + grep -q '# TAG_BACULA_FD' $$f; \ + if [ $$? -eq 0 ]; then \ + echo "removing Bacula lines from $$f"; \ + rm -f $$f.$$today; \ + cp -p $$f $$f.$$today; \ + $(SED) -e '/TAG_BACULA_FD/d;' \ + < $$f.$$today > $$f; \ + chmod 644 $$f; \ + fi; \ + done + + +uninstall-autostart-sd: + @echo "FreeBSD platform uninstall" + rm -f /etc/rc.bacula-sd + @-today="`date +%Y%m%d%H%M`"; \ + for f in /etc/rc.local ; do \ + grep -q '# TAG_BACULA_SD' $$f; \ + if [ $$? -eq 0 ]; then \ + echo "removing Bacula lines from $$f"; \ + rm -f $$f.$$today; \ + cp -p $$f $$f.$$today; \ + $(SED) -e '/TAG_BACULA_SD/d;' \ + < $$f.$$today > $$f; \ + chmod 644 $$f; \ + fi; \ + done + +uninstall-autostart-dir: + @echo "FreeBSD platform uninstall" + rm -f /etc/rc.bacula-dir + @-today="`date +%Y%m%d%H%M`"; \ + for f in /etc/rc.local ; do \ + grep -q '# TAG_BACULA_DIR' $$f; \ + if [ $$? -eq 0 ]; then \ + echo "removing Bacula lines from $$f"; \ + rm -f $$f.$$today; \ + cp -p $$f $$f.$$today; \ + $(SED) -e '/TAG_BACULA_DIR/d;' \ + < $$f.$$today > $$f; \ + chmod 644 $$f; \ + fi; \ + done + +clean: + @rm -f bacula-sd bacula-fd bacula-dir + +distclean: clean + @rm -f Makefile bacula-*.spec diff --git a/bacula/platforms/freebsd/bacula-dir.in b/bacula/platforms/freebsd/bacula-dir.in new file mode 100755 index 0000000000..8ff091906e --- /dev/null +++ b/bacula/platforms/freebsd/bacula-dir.in @@ -0,0 +1,38 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Director daemon +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +RETVAL=0 +case "$1" in + start) + echo "Starting the Bacula Director: " + @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir + ;; + stop) + echo "Stopping the Director daemon: " +# killproc @sbindir@/bacula-dir + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/freebsd/bacula-fd.in b/bacula/platforms/freebsd/bacula-fd.in new file mode 100755 index 0000000000..9f26adea5d --- /dev/null +++ b/bacula/platforms/freebsd/bacula-fd.in @@ -0,0 +1,37 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula File daemon. +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +case "$1" in + start) + echo "Starting the Bacula File daemon: " + @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd + ;; + stop) + echo "Stopping the Bacula File daemon: " +# killproc @sbindir@/bacula-fd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/freebsd/bacula-sd.in b/bacula/platforms/freebsd/bacula-sd.in new file mode 100755 index 0000000000..79e1a91ee6 --- /dev/null +++ b/bacula/platforms/freebsd/bacula-sd.in @@ -0,0 +1,37 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Storage daemon. +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +case "$1" in + start) + echo "Starting the Bacula Storage daemon: " + @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd + ;; + stop) + echo "Stopping the Bacula Storage daemon: " +# killproc @sbindir@/bacula-sd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/install-symlinks b/bacula/platforms/install-symlinks new file mode 100755 index 0000000000..ed91cd62d6 --- /dev/null +++ b/bacula/platforms/install-symlinks @@ -0,0 +1,99 @@ +#!/bin/sh +# +# install-symlinks.sh - shell script for installing symbolic lynks +# for system startup +# +# Copyright (C) 1999-2000 Riccardo Facchetti +# +# Modified for use with Bacula 15 November 2001, Kern Sibbald +# +# +# Theory of operation: +# this script attempts to detect which runlevels are appropriate for +# apcupsd startup and consequently installs the OS startup symbolic links +# in the correct locations. +# +# For example, suse distribution uses sysvinit so the scripts will do: +# 1. searches for init scripts directory +# 2. try to detect on which runlevels is appropriate to run apcupsd +# (presumably all the runlevels at which also syslogd runs) +# 3. installs the symbolic links into the previously detected runlevels + +action=$1 +dist=$2 + +if [ -z "$action" -o -z "$dist" ] +then + echo "Missing parameter on command line." + exit 1 +fi + +case $action in + install) + echo "Generic symlinks installation..." + case $dist in + suse) + + if [ -d /etc/rc.d ] + then + initrcd="/etc/rc.d" + elif [ -d /sbin/init.d ] + then + initrcd="/sbin/init.d" + else + echo "Can not find init scripts directory." + exit 1 + fi + + for runlevel in 1 2 3 4 5 + do + if [ -L $initrcd/rc$runlevel.d/S*syslog ] + then + echo " Installing runlevel $runlevel..." + ln -sf $initrcd/apcupsd $initrcd/rc$runlevel.d/K20apcupsd + ln -sf $initrcd/apcupsd $initrcd/rc$runlevel.d/S20apcupsd + fi + done + ;; + *) + echo " relying on $dist-specific Makefile for symlink installation" + ;; + esac + ;; + uninstall) + echo "Genering symlinks uninstallation..." + case $dist in + suse) + + if [ -d /etc/rc.d ] + then + initrcd="/etc/rc.d" + elif [ -d /sbin/init.d ] + then + initrcd="/sbin/init.d" + else + echo "Can not detect init scripts directory." + exit 1 + fi + + for runlevel in 1 2 3 4 5 + do + if [ -L $initrcd/rc$runlevel.d/S20apcupsd ] + then + echo " Removing runlevel $runlevel..." + rm -f $initrcd/rc$runlevel.d/K20apcupsd + rm -f $initrcd/rc$runlevel.d/S20apcupsd + fi + done + ;; + *) + echo " relying on $dist-specific Makefile for symlink uninstallation" + ;; + esac + ;; + *) + echo "Wrong parameter $action." + exit 1 +esac + +exit 0 diff --git a/bacula/platforms/redhat/Makefile.in b/bacula/platforms/redhat/Makefile.in new file mode 100644 index 0000000000..96ffa2e0bb --- /dev/null +++ b/bacula/platforms/redhat/Makefile.in @@ -0,0 +1,74 @@ +# +# This file is used as the template to create the +# Makefile for the RedHat specific installation. +# +# 15 November 2001 -- Kern Sibbald +# +# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +nothing: + +install: install-autostart + +install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir + + +install-autostart-fd: + @if test -f /etc/rc.d/init.d/bacula-fd; then \ + /sbin/chkconfig --del bacula-fd; \ + fi + @$(INSTALL_PROGRAM) -m 744 bacula-fd /etc/rc.d/init.d/bacula-fd + # set symlinks for script at startup and shutdown + @/sbin/chkconfig --add bacula-fd + + +install-autostart-sd: + @if test -f /etc/rc.d/init.d/bacula-sd; then \ + /sbin/chkconfig --del bacula-sd; \ + fi + @$(INSTALL_PROGRAM) -m 744 bacula-sd /etc/rc.d/init.d/bacula-sd + # set symlinks for script at startup and shutdown + @/sbin/chkconfig --add bacula-sd + + +install-autostart-dir: + @if test -f /etc/rc.d/init.d/bacula-dir; then \ + /sbin/chkconfig --del bacula-dir; \ + fi + @$(INSTALL_PROGRAM) -m 744 bacula-dir /etc/rc.d/init.d/bacula-dir + # set symlinks for script at startup and shutdown + @/sbin/chkconfig --add bacula-dir + + +uninstall: uninstall-autostart + +uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir + +uninstall-autostart-fd: + @if test -f /etc/rc.d/init.d/bacula-fd; then \ + /sbin/chkconfig --del bacula-fd; \ + fi + @rm -f /etc/rc.d/init.d/bacula-fd + + +uninstall-autostart-sd: + @if test -f /etc/rc.d/init.d/bacula-sd; then \ + /sbin/chkconfig --del bacula-sd; \ + fi + @rm -f /etc/rc.d/init.d/bacula-sd + +uninstall-autostart-dir: + @if test -f /etc/rc.d/init.d/bacula-dir; then \ + /sbin/chkconfig --del bacula-dir; \ + fi + @rm -f /etc/rc.d/init.d/bacula-dir + +clean: + +distclean: clean + @rm -f Makefile bacula-*.spec + @rm -f bacula-sd bacula-fd bacula-dir diff --git a/bacula/platforms/redhat/bacula-dir.in b/bacula/platforms/redhat/bacula-dir.in new file mode 100755 index 0000000000..d568cdb999 --- /dev/null +++ b/bacula/platforms/redhat/bacula-dir.in @@ -0,0 +1,44 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Director daemon +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +# Source function library +. /etc/rc.d/init.d/functions + +RETVAL=0 +case "$1" in + start) + echo -n "Starting the Bacula Director: " + daemon @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir + ;; + stop) + echo -n "Stopping the Director daemon: " + killproc @sbindir@/bacula-dir + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + status) + status @sbindir@/bacula-dir + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/redhat/bacula-fd.in b/bacula/platforms/redhat/bacula-fd.in new file mode 100755 index 0000000000..19f04f028b --- /dev/null +++ b/bacula/platforms/redhat/bacula-fd.in @@ -0,0 +1,43 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula File daemon. +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +# Source function library +. /etc/rc.d/init.d/functions + +case "$1" in + start) + echo -n "Starting the Bacula File daemon: " + daemon @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd + ;; + stop) + echo -n "Stopping the Bacula File daemon: " + killproc @sbindir@/bacula-fd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + status) + status @sbindir@/bacula-fd + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/redhat/bacula-sd.in b/bacula/platforms/redhat/bacula-sd.in new file mode 100755 index 0000000000..a4bfdd4f5a --- /dev/null +++ b/bacula/platforms/redhat/bacula-sd.in @@ -0,0 +1,43 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Storage daemon. +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +# Source function library +. /etc/rc.d/init.d/functions + +case "$1" in + start) + echo -n "Starting the Bacula Storage daemon: " + daemon @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd + ;; + stop) + echo -n "Stopping the Bacula Storage daemon: " + killproc @sbindir@/bacula-sd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + status) + status @sbindir@/bacula-sd + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/solaris/Makefile.in b/bacula/platforms/solaris/Makefile.in new file mode 100644 index 0000000000..0d49463e9d --- /dev/null +++ b/bacula/platforms/solaris/Makefile.in @@ -0,0 +1,80 @@ +# +# This file is used as the template to create the +# Makefile for the Solaris specific installation. +# +# 15 November 2001 -- Kern Sibbald +# +# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +nothing: + +install: install-autostart + +install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir + + +install-autostart-fd: + @rm -f /etc/rc0.d/K20bacula-fd + @rm -f /etc/rc1.d/S99bacula-fd + @rm -f /etc/rc2.d/S99bacula-fd + @$(INSTALL_PROGRAM) -m 744 bacula-fd /etc/init.d/bacula-fd + # set symlinks for script at startup and shutdown + @ln -f -s /etc/init.d/bacula-fd /etc/rc0.d/K20bacula-fd + @ln -f -s /etc/init.d/bacula-fd /etc/rc1.d/S99bacula-fd + @ln -f -s /etc/init.d/bacula-fd /etc/rc2.d/S99bacula-fd + + +install-autostart-sd: + @rm -f /etc/rc0.d/K20bacula-sd + @rm -f /etc/rc1.d/S99bacula-sd + @rm -f /etc/rc2.d/S99bacula-sd + @$(INSTALL_PROGRAM) -m 744 bacula-sd /etc/rc.d/init.d/bacula-sd + # set symlinks for script at startup and shutdown + @ln -f -s /etc/init.d/bacula-sd /etc/rc0.d/K20bacula-sd + @ln -f -s /etc/init.d/bacula-sd /etc/rc1.d/S99bacula-sd + @ln -f -s /etc/init.d/bacula-sd /etc/rc2.d/S99bacula-sd + + +install-autostart-dir: + @rm -f /etc/rc0.d/K20bacula-dir + @rm -f /etc/rc1.d/S99bacula-dir + @rm -f /etc/rc2.d/S99bacula-dir + @$(INSTALL_PROGRAM) -m 744 bacula-dir /etc/rc.d/init.d/bacula-dir + # set symlinks for script at startup and shutdown + @ln -f -s /etc/init.d/bacula-dir /etc/rc0.d/K20bacula-dir + @ln -f -s /etc/init.d/bacula-dir /etc/rc1.d/S99bacula-dir + @ln -f -s /etc/init.d/bacula-dir /etc/rc2.d/S99bacula-dir + + +uninstall: uninstall-autostart + +uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir + +uninstall-autostart-fd: + @rm -f /etc/rc0.d/K20bacula-fd + @rm -f /etc/rc1.d/S99bacula-fd + @rm -f /etc/rc2.d/S99bacula-fd + @rm -f /etc/rc.d/init.d/bacula-fd + + +uninstall-autostart-sd: + @rm -f /etc/rc0.d/K20bacula-sd + @rm -f /etc/rc1.d/S99bacula-sd + @rm -f /etc/rc2.d/S99bacula-sd + @rm -f /etc/rc.d/init.d/bacula-sd + +uninstall-autostart-dir: + @rm -f /etc/rc0.d/K20bacula-dir + @rm -f /etc/rc1.d/S99bacula-dir + @rm -f /etc/rc2.d/S99bacula-dir + @rm -f /etc/rc.d/init.d/bacula-dir + +clean: + @rm -f bacula-sd bacula-fd bacula-dir + +distclean: clean + @rm -f Makefile bacula-*.spec diff --git a/bacula/platforms/solaris/bacula-dir.in b/bacula/platforms/solaris/bacula-dir.in new file mode 100755 index 0000000000..8ff091906e --- /dev/null +++ b/bacula/platforms/solaris/bacula-dir.in @@ -0,0 +1,38 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Director daemon +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +RETVAL=0 +case "$1" in + start) + echo "Starting the Bacula Director: " + @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir + ;; + stop) + echo "Stopping the Director daemon: " +# killproc @sbindir@/bacula-dir + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/solaris/bacula-fd.in b/bacula/platforms/solaris/bacula-fd.in new file mode 100755 index 0000000000..9f26adea5d --- /dev/null +++ b/bacula/platforms/solaris/bacula-fd.in @@ -0,0 +1,37 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula File daemon. +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +case "$1" in + start) + echo "Starting the Bacula File daemon: " + @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd + ;; + stop) + echo "Stopping the Bacula File daemon: " +# killproc @sbindir@/bacula-fd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/solaris/bacula-sd.in b/bacula/platforms/solaris/bacula-sd.in new file mode 100755 index 0000000000..79e1a91ee6 --- /dev/null +++ b/bacula/platforms/solaris/bacula-sd.in @@ -0,0 +1,37 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Storage daemon. +# +# chkconfig: 2345 20 99 +# description: It comes by night and sucks the vital essence from your computers. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +case "$1" in + start) + echo "Starting the Bacula Storage daemon: " + @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd + ;; + stop) + echo "Stopping the Bacula Storage daemon: " +# killproc @sbindir@/bacula-sd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd + ;; + restart) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/unknown/Makefile.in b/bacula/platforms/unknown/Makefile.in new file mode 100644 index 0000000000..f05b139d12 --- /dev/null +++ b/bacula/platforms/unknown/Makefile.in @@ -0,0 +1,43 @@ +# +# This file is used as the template to create the +# Makefile for the unknown specific installation. +# +# 15 November 2001 -- Kern Sibbald +# +# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +install: install-autostart + +all: install-autostart + +install-autostart: install-autostart-FD install-autostart-SD install-autostart-DIR + + +install-autostart-FD: + + +install-autostart-SD: + + +install-autostart-DIR: + + +uninstall: uninstall-autostart + +uninstall-autostart: uninstall-autostart-FD uninstall-autostart-SD uninstall-autostart-DIR + +uninstall-autostart-FD: + + +uninstall-autostart-SD: + +uninstall-autostart-DIR: + +clean: + +distclean: + @rm -f bacula-SD bacula-FD bacula-DIR Makefile bacula-*.spec diff --git a/bacula/po/ChangeLog b/bacula/po/ChangeLog new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bacula/po/Makefile.in b/bacula/po/Makefile.in new file mode 100644 index 0000000000..51e7a071c4 --- /dev/null +++ b/bacula/po/Makefile.in @@ -0,0 +1,250 @@ +# Generated automatically from Makefile.in.in by configure. +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +PACKAGE = bacula +VERSION = 0.1 + +SHELL = /bin/sh + + +srcdir = . +top_srcdir = .. + +prefix = /usr/local +exec_prefix = ${prefix} +datadir = $(prefix)/share +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(prefix)/share/gettext/po +subdir = po + +DESTDIR = + +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +MKINSTALLDIRS = $(top_srcdir)/./mkinstalldirs + +CC = gcc +GENCAT = +GMSGFMT = PATH=../src:$$PATH /usr/bin/msgfmt +MSGFMT = /usr/bin/msgfmt +XGETTEXT = PATH=../src:$$PATH /usr/bin/xgettext +MSGMERGE = PATH=../src:$$PATH msgmerge + +DEFS = -DHAVE_CONFIG_H +CFLAGS = -g -O2 -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations +CPPFLAGS = -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include + +INCLUDES = -I.. -I$(top_srcdir)/intl + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +SOURCES = cat-id-tbl.c +POFILES = +GMOFILES = +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ +stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) + +POTFILES = \ + +CATALOGS = +CATOBJEXT = .gmo +INSTOBJEXT = .mo + +.SUFFIXES: +.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat + +.c.o: + $(COMPILE) $< + +.po.pox: + $(MAKE) $(PACKAGE).pot + $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && $(GENCAT) $@ $*.msg + + +all: all-yes + +all-yes: cat-id-tbl.c $(CATALOGS) +all-no: + +$(srcdir)/$(PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(PACKAGE).po \ + || ( rm -f $(srcdir)/$(PACKAGE).pot \ + && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) + +$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: +$(srcdir)/stamp-cat-id: $(PACKAGE).pot + rm -f cat-id-tbl.tmp + sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ + | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp + if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ + rm cat-id-tbl.tmp; \ + else \ + echo cat-id-tbl.c changed; \ + rm -f $(srcdir)/cat-id-tbl.c; \ + mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ + fi + cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id + + +install: install-exec install-data +install-exec: +install-data: install-data-yes +install-data-no: all +install-data-yes: all + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ + fi + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + case "$$cat" in \ + *.gmo) destdir=$(DESTDIR)$(gnulocaledir);; \ + *) destdir=$(DESTDIR)$(localedir);; \ + esac; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + dir=$$destdir/$$lang/LC_MESSAGES; \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ + fi; \ + if test -r $$cat; then \ + $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + if test "$(PACKAGE)" = "gettext"; then \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ + fi; \ + $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ + $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + done + rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in + +check: all + +cat-id-tbl.o: ../intl/libgettext.h + +dvi info tags TAGS ID: + +mostlyclean: + rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: update-po $(DISTFILES) + dists="$(DISTFILES)"; \ + for file in $$dists; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(PACKAGE).pot + PATH=`pwd`/../src:$$PATH; \ + cd $(srcdir); \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done + +POTFILES: POTFILES.in + ( if test 'x$(srcdir)' != 'x.'; then \ + posrcprefix='$(top_srcdir)/'; \ + else \ + posrcprefix="../"; \ + fi; \ + rm -f $@-t $@ \ + && (sed -e '/^#/d' -e '/^[ ]*$$/d' \ + -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ + | sed -e '$$s/\\$$//') > $@-t \ + && chmod a-w $@-t \ + && mv $@-t $@ ) + +Makefile: Makefile.in.in ../config.status POTFILES + cd .. \ + && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bacula/po/Makefile.in.in b/bacula/po/Makefile.in.in new file mode 100644 index 0000000000..cf3aa8cb77 --- /dev/null +++ b/bacula/po/Makefile.in.in @@ -0,0 +1,250 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(prefix)/share/gettext/po +subdir = po + +DESTDIR = + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ + +CC = @CC@ +GENCAT = @GENCAT@ +GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ +MSGMERGE = PATH=../src:$$PATH msgmerge + +DEFS = @DEFS@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ + +INCLUDES = -I.. -I$(top_srcdir)/intl + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +SOURCES = cat-id-tbl.c +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ +stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) + +POTFILES = \ + +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +INSTOBJEXT = @INSTOBJEXT@ + +.SUFFIXES: +.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat + +.c.o: + $(COMPILE) $< + +.po.pox: + $(MAKE) $(PACKAGE).pot + $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && $(GENCAT) $@ $*.msg + + +all: all-@USE_NLS@ + +all-yes: cat-id-tbl.c $(CATALOGS) +all-no: + +$(srcdir)/$(PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(PACKAGE).po \ + || ( rm -f $(srcdir)/$(PACKAGE).pot \ + && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) + +$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: +$(srcdir)/stamp-cat-id: $(PACKAGE).pot + rm -f cat-id-tbl.tmp + sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ + | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp + if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ + rm cat-id-tbl.tmp; \ + else \ + echo cat-id-tbl.c changed; \ + rm -f $(srcdir)/cat-id-tbl.c; \ + mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ + fi + cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ + fi + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + case "$$cat" in \ + *.gmo) destdir=$(DESTDIR)$(gnulocaledir);; \ + *) destdir=$(DESTDIR)$(localedir);; \ + esac; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + dir=$$destdir/$$lang/LC_MESSAGES; \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ + fi; \ + if test -r $$cat; then \ + $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + if test "$(PACKAGE)" = "gettext"; then \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ + fi; \ + $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ + $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + done + rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in + +check: all + +cat-id-tbl.o: ../intl/libgettext.h + +dvi info tags TAGS ID: + +mostlyclean: + rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: update-po $(DISTFILES) + dists="$(DISTFILES)"; \ + for file in $$dists; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(PACKAGE).pot + PATH=`pwd`/../src:$$PATH; \ + cd $(srcdir); \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done + +POTFILES: POTFILES.in + ( if test 'x$(srcdir)' != 'x.'; then \ + posrcprefix='$(top_srcdir)/'; \ + else \ + posrcprefix="../"; \ + fi; \ + rm -f $@-t $@ \ + && (sed -e '/^#/d' -e '/^[ ]*$$/d' \ + -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ + | sed -e '$$s/\\$$//') > $@-t \ + && chmod a-w $@-t \ + && mv $@-t $@ ) + +Makefile: Makefile.in.in ../config.status POTFILES + cd .. \ + && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bacula/po/POTFILES.in b/bacula/po/POTFILES.in new file mode 100644 index 0000000000..ab2d29e603 --- /dev/null +++ b/bacula/po/POTFILES.in @@ -0,0 +1,6 @@ +# List of source files containing translatable strings. + +src/main.c +src/interface.c +src/callbacks.c +src/support.c diff --git a/bacula/po/bacula.pot b/bacula/po/bacula.pot new file mode 100644 index 0000000000..acc18f012d --- /dev/null +++ b/bacula/po/bacula.pot @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2002-03-17 12:43+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" + +#: src/interface.c:22 +msgid "_New File" +msgstr "" + +#: src/interface.c:88 +msgid "Bacula" +msgstr "" + +#: src/interface.c:211 +msgid "Connect" +msgstr "" + +#: src/interface.c:212 +msgid "New File" +msgstr "" + +#: src/interface.c:223 +msgid "Open" +msgstr "" + +#: src/interface.c:224 +msgid "Open File" +msgstr "" + +#: src/interface.c:235 +msgid "Save" +msgstr "" + +#: src/interface.c:236 +msgid "Save File" +msgstr "" + +#: src/interface.c:271 +msgid "label1" +msgstr "" + +#: src/interface.c:311 +msgid "Copyright (c) 1999 - 2002, Kern Sibbald and John Walker" +msgstr "" + +#: src/interface.c:313 +msgid "It comes by night and sucks the essence from your computers." +msgstr "" + +#: src/support.c:100 src/support.c:138 +#, c-format +msgid "Couldn't find pixmap file: %s" +msgstr "" + +#: src/support.c:116 +#, c-format +msgid "Couldn't create pixmap from file: %s" +msgstr "" diff --git a/bacula/po/cat-id-tbl.c b/bacula/po/cat-id-tbl.c new file mode 100644 index 0000000000..8011ec1b80 --- /dev/null +++ b/bacula/po/cat-id-tbl.c @@ -0,0 +1,26 @@ +/* Automatically generated by po2tbl.sed from bacula.pot. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "libgettext.h" + +const struct _msg_ent _msg_tbl[] = { + {"", 1}, + {"_New File", 2}, + {"Bacula", 3}, + {"Connect", 4}, + {"New File", 5}, + {"Open", 6}, + {"Open File", 7}, + {"Save", 8}, + {"Save File", 9}, + {"label1", 10}, + {"Copyright (c) 1999 - 2002, Kern Sibbald and John Walker", 11}, + {"It comes by night and sucks the essence from your computers.", 12}, + {"Couldn't find pixmap file: %s", 13}, + {"Couldn't create pixmap from file: %s", 14}, +}; + +int _msg_tbl_length = 14; diff --git a/bacula/po/stamp-cat-id b/bacula/po/stamp-cat-id new file mode 100644 index 0000000000..9788f70238 --- /dev/null +++ b/bacula/po/stamp-cat-id @@ -0,0 +1 @@ +timestamp diff --git a/bacula/src/.indent.pro b/bacula/src/.indent.pro new file mode 100644 index 0000000000..36fbed7f59 --- /dev/null +++ b/bacula/src/.indent.pro @@ -0,0 +1,27 @@ +--dont-format-comments +--procnames-start-lines +--parameter-indentation4 +--indent-level4 +--line-comments-indentation4 +--cuddle-else +--brace-indent0 +--start-left-side-of-comments +--no-blank-lines-after-commas +--blank-lines-after-declarations +--blank-lines-after-procedures +--comment-indentation33 +--declaration-comment-column33 +--no-comment-delimiters-on-blank-lines +--continuation-indentation4 +--case-indentation0 +--else-endif-column33 +--no-space-after-casts +--no-blank-before-sizeof +--declaration-indentation16 +--continue-at-parentheses +--no-space-after-function-call-names +--swallow-optional-blank-lines +--space-special-semicolon +--tab-size8 +--line-length79 +--braces-on-if-line diff --git a/bacula/src/Makefile.in b/bacula/src/Makefile.in new file mode 100644 index 0000000000..00e075d1b3 --- /dev/null +++ b/bacula/src/Makefile.in @@ -0,0 +1,65 @@ +# +# +@MCOMMON@ + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = .. +# this dir relative to top dir +thisdir = src + +DEBUG=-DDEBUG_STRICT @DEBUG@ + +first_rule: all +dummy: + +# +# these are the objects that are changed by the .configure process +EXTRAOBJS = @OBJLIST@ + +# it's ``be kind to gmake week'' +#EXTPROS = $(SRCS:S,.c,.extpro,) +EXTPROS = + +.SUFFIXES: .c .o +.PHONY: +.DONTCARE: + +# inference rules +.c.o: + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I. -I$(basedir) -I$(srcdir) $(DINCLUDE) $(CFLAGS) $< + +.cc.o: + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I. -I$(basedir) -I$(srcdir) $(DINCLUDE) $(CFLAGS) $< +#------------------------------------------------------------------------- +all: Makefile + + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +clean: + @$(RMF) core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3 + +realclean: clean + @$(RMF) tags + +distclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + @(cd $(srcdir); $(RMF) Makefile) + @$(RMF) config.h + +install: + + +uninstall: + + +depend: diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h new file mode 100644 index 0000000000..9051c75425 --- /dev/null +++ b/bacula/src/baconfig.h @@ -0,0 +1,271 @@ +/* + * General header file configurations that apply to + * all daemons. System dependent stuff goes here. + */ +/* + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _BACONFIG_H +#define _BACONFIG_H 1 + +/* Bacula common configuration defines */ + +#define DEBUG 1 /* turn on debug code */ + +#define TRUE 1 +#define FALSE 0 + +#ifdef PROTOTYPES +# define __PROTO(p) p +#else +# define __PROTO(p) () +#endif + +/* #define ASSERT(x) if (!(x)) Emsg1(M_ABORT, 0, "Failed ASSERT: %s\n", __STRING(x)) */ +#define ASSERT(x) if (!(x)) Emsg1(M_ABORT, 0, "Failed ASSERT: %s\n", #x) + + +#ifdef ENABLE_NLS +#include +#define _(s) gettext((s)) +#define N_(s) (s) +#else +#define _(s) (s) +#define N_(s) (s) +#define textdomain(x) +#endif + + +/* This should go away! ****FIXME***** */ +#define MAXSTRING 500 + +/* Maximum length to edit time/date */ +#define MAX_TIME_LENGTH 30 + +/* Maximum Name length including EOS */ +#define MAX_NAME_LENGTH 128 + +/* All tape operations MUST be a multiple of this */ +#define TAPE_BSIZE 1024 +#if !defined(DEV_BSIZE) && defined(BSIZE) +#define DEV_BSIZE BSIZE +#else +#define DEV_BSIZE 512 +#endif + +/* Maximum number of bytes that you can push into a + * socket. + */ +#define MAX_NETWORK_BUFFER_SIZE (32 * 1024) + +/* Stream definitions. Once defined these must NEVER + * change as they go on the storage media + */ +#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */ +#define STREAM_FILE_DATA 2 /* Standard uncompressed data */ +#define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */ +#define STREAM_GZIP_DATA 4 /* GZip compressed file data */ + + +/* This is for dumb compilers like Solaris. Linux GCC + * does it correctly, so it might be worthwhile + * to remove the isascii(c) with ifdefs on such + * "smart" systems. + */ +#undef ISSPACE +#undef ISALPHA +#undef ISUPPER +#undef ISDIGIT +#define ISSPACE(c) (isascii((int)(c)) && isspace((int)(c))) +#define ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c))) +#define ISUPPER(c) (isascii((int)(c)) && isupper((int)(c))) +#define ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c))) + + +typedef void (HANDLER)(); +typedef int (INTHANDLER)(); + +#ifdef SETPGRP_VOID +# define SETPGRP_ARGS(x, y) /* No arguments */ +#else +# define SETPGRP_ARGS(x, y) (x, y) +#endif + +#ifndef S_ISLNK +#define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK) +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE ((unsigned long) -1) +#endif + +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#ifndef MODE_RW +#define MODE_RW 0666 +#endif + +#ifdef DEBUG_MUTEX +extern void _p(char *file, int line, pthread_mutex_t *m); +extern void _v(char *file, int line, pthread_mutex_t *m); + +#define P(x) _p(__FILE__, __LINE__, &(x)) +#define V(x) _v(__FILE__, __LINE__, &(x)) + +#else + +/* These probably should be subroutines */ +#define P(x) \ + do { int errstat; if ((errstat=pthread_mutex_lock(&(x)))) \ + e_msg(__FILE__, __LINE__, M_ABORT, 0, "Mutex lock failure. ERR=%s\n",\ + strerror(errstat)); \ + } while(0) + +#define V(x) \ + do { int errstat; if ((errstat=pthread_mutex_unlock(&(x)))) \ + e_msg(__FILE__, __LINE__, M_ABORT, 0, "Mutex unlock failure. ERR=%s\n",\ + strerror(errstat)); \ + } while(0) + +#endif /* DEBUG_MUTEX */ + +/* + * The digit following Dmsg and Emsg indicates the number of substitutions in + * the message string. We need to do this kludge because non-GNU compilers + * do not handle varargs #defines. + */ +/* Debug Messages that are printed */ +#ifdef DEBUG +#define Dmsg0(lvl, msg) d_msg(__FILE__, __LINE__, lvl, msg) +#define Dmsg1(lvl, msg, a1) d_msg(__FILE__, __LINE__, lvl, msg, a1) +#define Dmsg2(lvl, msg, a1, a2) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2) +#define Dmsg3(lvl, msg, a1, a2, a3) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3) +#define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4) +#define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5) +#define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6) +#define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7) +#define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) +#define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) +#else +#define Dmsg0(lvl, msg) +#define Dmsg1(lvl, msg, a1) +#define Dmsg2(lvl, msg, a1, a2) +#define Dmsg3(lvl, msg, a1, a2, a3) +#define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) +#define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) +#define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) +#define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) +#define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) +#define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) +#endif /* DEBUG */ + +/* Daemon Error Messages that are delivered according to the message resource */ +#define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg) +#define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1) +#define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2) +#define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3) +#define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4) +#define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5) +#define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6) + +/* Job Error Messages that are delivered according to the message resource */ +#define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg) +#define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1) +#define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2) +#define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3) +#define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4) +#define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5) +#define Jmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) + + +/* Memory Messages that are edited into a Pool Memory buffer */ +#define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg) +#define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1) +#define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2) +#define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3) +#define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4) +#define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5) +#define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6) +#define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6) +#define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6) +#define Mmsg11(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) +#define Mmsg15(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) + +/* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */ +int Mmsg(char **msgbuf, char *fmt,...); + + +void d_msg(char *file, int line, int level, char *fmt,...); +void e_msg(char *file, int line, int type, int level, char *fmt,...); +void j_msg(char *file, int line, void *vjcr, int type, int level, char *fmt,...); +int m_msg(char *file, int line, char **msgbuf, char *fmt,...); + + +/* Use our strdup with smartalloc */ +#undef strdup +#define strdup(buf) bad_call_on_strdup_use_bstrdup(buf) + +#ifdef DEBUG +#define bstrdup(str) strcpy((char *) b_malloc(__FILE__,__LINE__,strlen((str))+1),(str)) +#else +#define bstrdup(str) strcpy((char *) bmalloc(strlen((str))+1),(str)) +#endif + +#ifdef DEBUG +#define bmalloc(size) b_malloc(__FILE__, __LINE__, (size)) +#endif + +#ifdef __alpha__ +#define OSF 1 +#endif + +#ifdef HAVE_SUN_OS + /* + * On Solaris 2.5, threads are not timesliced by default, so we need to + * explictly increase the conncurrency level. + */ +#include +#define set_thread_concurrency(x) thr_setconcurrency(x) +extern int thr_setconcurrency(int); +#define SunOS 1 + +#else + +/* Not needed on most systems */ +#define set_thread_concurrency(x) + +#endif + +#define ALIGN_SIZE (sizeof(double)) +#define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1)) + +#endif /* _BACONFIG_H */ diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h new file mode 100644 index 0000000000..fa0ea3fa73 --- /dev/null +++ b/bacula/src/bacula.h @@ -0,0 +1,90 @@ +/* + * bacula.h -- main header file to include in all Bacula source + * + */ + +/* + + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef _BACULA_H +#define _BACULA_H 1 + +#include "config.h" + +#define _REENTRANT 1 +#define _THREAD_SAFE 1 +#define _POSIX_PTHREAD_SEMANTICS 1 + +/* System includes */ +#include +#include +#if STDC_HEADERS +#include +#endif +#if HAVE_UNISTD_H +#include +#endif +#if HAVE_ALLOCA_H +#include +#endif +#include +#include + +#ifdef HAVE_GETOPT_LONG +#include +#else +#include "lib/getopt.h" +#endif + +#include +#include +#include +#include +#include +#if HAVE_LIMITS_H +#include +#endif +#include +#include +#include +#include +#ifdef HAVE_SYS_BITYPES_H +#include +#endif +#include +#include +#include +#include +#if HAVE_SYS_WAIT_H +#include +#endif +#include +#include +#include + +/* Local Bacula includes. Be sure to put all the system + * includes before these. + */ +#include "version.h" +#include "baconfig.h" +#include "bc_types.h" +#include "lib/lib.h" + +#endif diff --git a/bacula/src/bc_types.h b/bacula/src/bc_types.h new file mode 100644 index 0000000000..2ab537fd64 --- /dev/null +++ b/bacula/src/bc_types.h @@ -0,0 +1,173 @@ +/* + Integer types. These types should be be used in all + contexts in which the length of an integer stored on + removable media must be known regardless of the + architecture of the platform. + + Bacula types are: + + int8_t, int16_t, int32_t, int64_t + uint8_t, uint16_t, uint32_t, uint64_t + float32_t, float64_t + + Also, we define types such as file address lengths. + + */ +/* + + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef __bc_types_INCLUDED +#define __bc_types_INCLUDED + +/* ****FIXME***** implement 64 bit file addresses ! */ +#define faddr_t long + +/* Types */ + +/* If sys/types.h does not supply intXX_t, supply them ourselves */ +/* (or die trying) */ + +#ifndef HAVE_U_INT +typedef unsigned int u_int; +#endif + +#ifndef HAVE_INTXX_T +# if (SIZEOF_CHAR == 1) +typedef char int8_t; +# else +# error "8 bit int type not found." +# endif +# if (SIZEOF_SHORT_INT == 2) +typedef short int int16_t; +# else +# error "16 bit int type not found." +# endif +# if (SIZEOF_INT == 4) +typedef int int32_t; +# else +# error "32 bit int type not found." +# endif +#endif + +/* If sys/types.h does not supply u_intXX_t, supply them ourselves */ +#ifndef HAVE_U_INTXX_T +# ifdef HAVE_UINTXX_T +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +# define HAVE_U_INTXX_T 1 +# else +# if (SIZEOF_CHAR == 1) +typedef unsigned char u_int8_t; +# else +# error "8 bit int type not found." +# endif +# if (SIZEOF_SHORT_INT == 2) +typedef unsigned short int u_int16_t; +# else +# error "16 bit int type not found." +# endif +# if (SIZEOF_INT == 4) +typedef unsigned int u_int32_t; +# else +# error "32 bit int type not found." +# endif +# endif +#endif + +/* 64-bit types */ +#ifndef HAVE_INT64_T +# if (SIZEOF_LONG_LONG_INT == 8) +typedef long long int int64_t; +# define HAVE_INT64_T 1 +# else +# if (SIZEOF_LONG_INT == 8) +typedef long int int64_t; +# define HAVE_INT64_T 1 +# endif +# endif +#endif + +#ifndef HAVE_INTMAX_T +# ifdef HAVE_INT64_T +typedef int64_t intmax_t; +# else +typedef int32_t intmax_t; +# endif +#endif + +#ifndef HAVE_U_INT64_T +# if (SIZEOF_LONG_LONG_INT == 8) +typedef unsigned long long int u_int64_t; +# define HAVE_U_INT64_T 1 +# else +# if (SIZEOF_LONG_INT == 8) +typedef unsigned long int u_int64_t; +# define HAVE_U_INT64_T 1 +# endif +# endif +#endif + +#ifndef HAVE_U_INTMAX_T +# ifdef HAVE_U_INT64_T +typedef u_int64_t u_intmax_t; +# else +typedef u_int32_t u_intmax_t; +# endif +#endif + + +/* Limits for the above types. */ +#undef INT8_MIN +#undef INT8_MAX +#undef UINT8_MAX +#undef INT16_MIN +#undef INT16_MAX +#undef UINT16_MAX +#undef INT32_MIN +#undef INT32_MAX +#undef UINT32_MAX + +#define INT8_MIN (-127-1) +#define INT8_MAX (127) +#define UINT8_MAX (255u) +#define INT16_MIN (-32767-1) +#define INT16_MAX (32767) +#define UINT16_MAX (65535u) +#define INT32_MIN (-2147483647-1) +#define INT32_MAX (2147483647) +#define UINT32_MAX (4294967295u) + +typedef double float64_t; +typedef float float32_t; + +#endif /* __bc_types_INCLUDED */ + +/* Define the uint versions actually used in Bacula */ +#define uint8_t u_int8_t +#define uint16_t u_int16_t +#define uint32_t u_int32_t +#define uint64_t u_int64_t +#define uintmax_t u_intmax_t + +#ifdef HAVE_CYGWIN +#define socklen_t int +#endif diff --git a/bacula/src/c b/bacula/src/c new file mode 100644 index 0000000000..de15677c29 --- /dev/null +++ b/bacula/src/c @@ -0,0 +1,19 @@ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ diff --git a/bacula/src/c.scr b/bacula/src/c.scr new file mode 100644 index 0000000000..206188e78e --- /dev/null +++ b/bacula/src/c.scr @@ -0,0 +1,8 @@ +l Copyright (C) +-1 +mark +l */ +mark +db +inc /home/kern/bacula/k/src/c +e diff --git a/bacula/src/cats/Makefile.in b/bacula/src/cats/Makefile.in new file mode 100644 index 0000000000..4478ee95ae --- /dev/null +++ b/bacula/src/cats/Makefile.in @@ -0,0 +1,99 @@ +# +@MCOMMON@ + +srcdir = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = ../.. +# this dir relative to top dir +thisdir = src/cats + +DEBUG=@DEBUG@ + +SQL_INC=@SQL_INCLUDE@ + +first_rule: all +dummy: + +# +SVRSRCS = cats.c sql.c +SVROBJS = cats.o sql.o + +LIBSRCS = mysql.c bdb.c bdb_create.c bdb_get.c bdb_update.c \ + bdb_delete.c bdb_find.c bdb_list.c \ + sql.c sql_create.c sql_delete.c sql_find.c \ + sql_get.c sql_list.c sql_update.c sqlite.c +LIBOBJS = mysql.o bdb.o bdb_create.o bdb_get.o bdb_update.o \ + bdb_delete.o bdb_find.o bdb_list.o \ + sql.o sql_create.o sql_delete.o sql_find.o \ + sql_get.o sql_list.o sql_update.o sqlite.o + +.SUFFIXES: .c .o +.PHONY: +.DONTCARE: + +# inference rules +.c.o: + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(SQL_INC) $(DINCLUDE) $(CFLAGS) $< +#------------------------------------------------------------------------- +all: Makefile libsql.a + @echo "==== Make of cats is good ====" + @echo " " + +libsql.a: $(LIBOBJS) + $(AR) rcs $@ $(LIBOBJS) + $(RANLIB) $@ + +cats: $(SVROBJS) ../findlib/libfind.a + $(CC) $(LDFLAGS) -L../findlib -L../lib -o $@ $(SVROBJS) $(LIBS) $(DLIB) -lfind -lbac + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +clean: + $(RMF) cats core a.out *.o *.a *.bak *~ *.intpro *.extpro 1 2 3 + +realclean: clean + $(RMF) tags + $(RMF) make_mysql_tables grant_mysql_privileges drop_mysql_tables + $(RMF) create_mysql_database make_sqlite_tables sqlite + +distclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + (cd $(srcdir); $(RMF) Makefile) + +install: + $(INSTALL_SCRIPT) create_mysql_database $(DESTDIR)$(sysconfdir)/create_mysql_database + $(INSTALL_SCRIPT) drop_mysql_tables $(DESTDIR)$(sysconfdir)/drop_mysql_tables + $(INSTALL_SCRIPT) make_mysql_tables $(DESTDIR)$(sysconfdir)/make_mysql_tables + +uninstall: + (cd $(DESTDIR)$(sysconfdir); $(RMF) create_mysql_database) + (cd $(DESTDIR)$(sysconfdir); $(RMF) drop_mysql_tables) + (cd $(DESTDIR)$(sysconfdir); $(RMF) make_mysql_tables) + + +# Semi-automatic generation of dependencies: +# Use gcc -MM because X11 `makedepend' doesn't work on all systems +# and it also includes system headers. +# `semi'-automatic since dependencies are generated at distribution time. + +depend: + @$(MV) Makefile Makefile.bak + @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile + @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile + @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @if test -f Makefile ; then \ + $(RMF) Makefile.bak; \ + else \ + $(MV) Makefile.bak Makefile; \ + echo -e "Something went wrong\n\a"; \ + fi + +# ----------------------------------------------------------------------- +# DO NOT DELETE: nice dependency list follows diff --git a/bacula/src/cats/bdb.c b/bacula/src/cats/bdb.c new file mode 100644 index 0000000000..95ebf715fe --- /dev/null +++ b/bacula/src/cats/bdb.c @@ -0,0 +1,415 @@ +/* + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ + +extern char *working_directory; + +/* List of open databases */ +static BQUEUE db_list = {&db_list, &db_list}; +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + + +#define DB_CONTROL_FILENAME "control.db" +#define DB_JOBS_FILENAME "jobs.db" +#define DB_POOLS_FILENAME "pools.db" +#define DB_MEDIA_FILENAME "media.db" +#define DB_JOBMEDIA_FILENAME "jobmedia.db" +#define DB_CLIENT_FILENAME "client.db" +#define DB_FILESET_FILENAME "fileset.db" + +static char *make_filename(B_DB *mdb, char *name) +{ + char *dbf, sep; + + dbf = (char *) get_pool_memory(PM_FNAME); + if (working_directory[strlen(working_directory)-1] == '/') { + sep = 0; + } else { + sep = '/'; + } + Mmsg(&dbf, "%s%c%s-%s", working_directory, sep, mdb->db_name, name); + return dbf; +} + +int bdb_write_control_file(B_DB *mdb) +{ + mdb->control.time = time(NULL); + lseek(mdb->cfd, 0, SEEK_SET); + if (write(mdb->cfd, &mdb->control, sizeof(mdb->control)) != sizeof(mdb->control)) { + Mmsg1(&mdb->errmsg, "Error writing control file. ERR=%s\n", strerror(errno)); + Emsg0(M_FATAL, 0, mdb->errmsg); + return 0; + } + return 1; +} + +/* + * Initialize database data structure. In principal this should + * never have errors, or it is really fatal. + */ +B_DB * +db_init_database(char *db_name, char *db_user, char *db_password) +{ + B_DB *mdb; + P(mutex); /* lock DB queue */ + /* Look to see if DB already open */ + for (mdb=NULL; (mdb=(B_DB *)qnext(&db_list, &mdb->bq)); ) { + if (strcmp(mdb->db_name, db_name) == 0) { + Dmsg2(200, "DB REopen %d %s\n", mdb->ref_count, db_name); + mdb->ref_count++; + V(mutex); + return mdb; /* already open */ + } + } + Dmsg0(200, "db_open first time\n"); + mdb = (B_DB *) malloc(sizeof(B_DB)); + memset(mdb, 0, sizeof(B_DB)); + Dmsg0(200, "DB struct init\n"); + mdb->db_name = bstrdup(db_name); + mdb->errmsg = (char *) get_pool_memory(PM_EMSG); + *mdb->errmsg = 0; + mdb->cmd = (char *) get_pool_memory(PM_EMSG); /* command buffer */ + mdb->ref_count = 1; + qinsert(&db_list, &mdb->bq); /* put db in list */ + Dmsg0(200, "Done db_open_database()\n"); + mdb->cfd = -1; + V(mutex); + return mdb; +} + +/* + * Now actually open the database. This can generate errors, + * which are returned in the errmsg + */ +int +db_open_database(B_DB *mdb) +{ + char *dbf; + int fd, badctl; + int errstat; + off_t filend; + + Dmsg1(200, "db_open_database() %s\n", mdb->db_name); + + P(mutex); + if ((errstat = pthread_mutex_init(&(mdb->mutex), NULL)) != 0) { + Mmsg1(&mdb->errmsg, "Unable to initialize DB mutex. ERR=%s\n", strerror(errstat)); + V(mutex); + return 0; + } + P(mdb->mutex); /* test it once */ + V(mdb->mutex); + + Dmsg0(200, "make_filename\n"); + dbf = make_filename(mdb, DB_CONTROL_FILENAME); + mdb->cfd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + if (mdb->cfd < 0) { + Mmsg2(&mdb->errmsg, "Unable to open Catalog DB control file %s: ERR=%s\n", + dbf, strerror(errno)); + V(mutex); + return 0; + } + Dmsg0(200, "DB open\n"); + /* See if the file was previously written */ + filend = lseek(mdb->cfd, 0, SEEK_END); + if (filend == 0) { /* No, initialize everything */ + Dmsg0(200, "Init DB files\n"); + memset(&mdb->control, 0, sizeof(mdb->control)); + mdb->control.bdb_version = BDB_VERSION; + bdb_write_control_file(mdb); + + /* Create Jobs File */ + dbf = make_filename(mdb, DB_JOBS_FILENAME); + fd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + close(fd); + + /* Create Pools File */ + dbf = make_filename(mdb, DB_POOLS_FILENAME); + fd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + close(fd); + + /* Create Media File */ + dbf = make_filename(mdb, DB_MEDIA_FILENAME); + fd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + close(fd); + + /* Create JobMedia File */ + dbf = make_filename(mdb, DB_JOBMEDIA_FILENAME); + fd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + close(fd); + + /* Create Client File */ + dbf = make_filename(mdb, DB_CLIENT_FILENAME); + fd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + close(fd); + + /* Create FileSet File */ + dbf = make_filename(mdb, DB_FILESET_FILENAME); + fd = open(dbf, O_CREAT|O_RDWR, 0600); + free_memory(dbf); + close(fd); + } + + Dmsg0(200, "Read control file\n"); + badctl = 0; + lseek(mdb->cfd, 0, SEEK_SET); /* seek to begining of control file */ + if (read(mdb->cfd, &mdb->control, sizeof(mdb->control)) != sizeof(mdb->control)) { + Mmsg1(&mdb->errmsg, "Error reading catalog DB control file. ERR=%s\n", strerror(errno)); + badctl = 1; + } else if (mdb->control.bdb_version != BDB_VERSION) { + Mmsg2(&mdb->errmsg, "Error, catalog DB control file wrong version. \ +Wanted %d, got %d\n\ +Please reinitialize the working directory.\n", + BDB_VERSION, mdb->control.bdb_version); + badctl = 1; + } + if (badctl) { + V(mutex); + return 0; + } + V(mutex); + return 1; +} + +void db_close_database(B_DB *mdb) +{ + P(mutex); + mdb->ref_count--; + if (mdb->ref_count == 0) { + qdchain(&mdb->bq); + /* close file descriptors */ + if (mdb->cfd >= 0) { + close(mdb->cfd); + } + free(mdb->db_name); + if (mdb->jobfd) { + fclose(mdb->jobfd); + } + if (mdb->poolfd) { + fclose(mdb->poolfd); + } + if (mdb->mediafd) { + fclose(mdb->mediafd); + } + if (mdb->jobmediafd) { + fclose(mdb->jobmediafd); + } + if (mdb->clientfd) { + fclose(mdb->clientfd); + } + if (mdb->filesetfd) { + fclose(mdb->filesetfd); + } + pthread_mutex_destroy(&mdb->mutex); + free_pool_memory(mdb->errmsg); + free_pool_memory(mdb->cmd); + free(mdb); + } + V(mutex); +} + + +void db_escape_string(char *snew, char *old, int len) +{ + strcpy(snew, old); +} + +char *db_strerror(B_DB *mdb) +{ + return mdb->errmsg; +} + +int db_sql_query(B_DB *mdb, char *query, DB_RESULT_HANDLER *result_handler, void *ctx) +{ + return 1; +} + +/* + * Open the Jobs file for reading/writing + */ +int bdb_open_jobs_file(B_DB *mdb) +{ + char *dbf; + + if (!mdb->jobfd) { + dbf = make_filename(mdb, DB_JOBS_FILENAME); + mdb->jobfd = fopen(dbf, "r+"); + if (!mdb->jobfd) { + Mmsg2(&mdb->errmsg, "Error opening DB Jobs file %s: ERR=%s\n", + dbf, strerror(errno)); + Emsg0(M_FATAL, 0, mdb->errmsg); + free_memory(dbf); + return 0; + } + free_memory(dbf); + } + return 1; +} + +/* + * Open the JobMedia file for reading/writing + */ +int bdb_open_jobmedia_file(B_DB *mdb) +{ + char *dbf; + + if (!mdb->jobmediafd) { + dbf = make_filename(mdb, DB_JOBMEDIA_FILENAME); + mdb->jobmediafd = fopen(dbf, "r+"); + if (!mdb->jobmediafd) { + Mmsg2(&mdb->errmsg, "Error opening DB JobMedia file %s: ERR=%s\n", + dbf, strerror(errno)); + Emsg0(M_FATAL, 0, mdb->errmsg); + free_memory(dbf); + return 0; + } + free_memory(dbf); + } + return 1; +} + + +/* + * Open the Pools file for reading/writing + */ +int bdb_open_pools_file(B_DB *mdb) +{ + char *dbf; + + if (!mdb->poolfd) { + dbf = make_filename(mdb, DB_POOLS_FILENAME); + mdb->poolfd = fopen(dbf, "r+"); + if (!mdb->poolfd) { + Mmsg2(&mdb->errmsg, "Error opening DB Pools file %s: ERR=%s\n", + dbf, strerror(errno)); + Emsg0(M_FATAL, 0, mdb->errmsg); + free_memory(dbf); + return 0; + } + Dmsg1(200, "Opened pool file %s\n", dbf); + free_memory(dbf); + } + return 1; +} + +/* + * Open the Client file for reading/writing + */ +int bdb_open_client_file(B_DB *mdb) +{ + char *dbf; + + if (!mdb->clientfd) { + dbf = make_filename(mdb, DB_CLIENT_FILENAME); + mdb->clientfd = fopen(dbf, "r+"); + if (!mdb->clientfd) { + Mmsg2(&mdb->errmsg, "Error opening DB Clients file %s: ERR=%s\n", + dbf, strerror(errno)); + Emsg0(M_FATAL, 0, mdb->errmsg); + free_memory(dbf); + return 0; + } + free_memory(dbf); + } + return 1; +} + +/* + * Open the FileSet file for reading/writing + */ +int bdb_open_fileset_file(B_DB *mdb) +{ + char *dbf; + + if (!mdb->filesetfd) { + dbf = make_filename(mdb, DB_CLIENT_FILENAME); + mdb->filesetfd = fopen(dbf, "r+"); + if (!mdb->filesetfd) { + Mmsg2(&mdb->errmsg, "Error opening DB FileSet file %s: ERR=%s\n", + dbf, strerror(errno)); + Emsg0(M_FATAL, 0, mdb->errmsg); + free_memory(dbf); + return 0; + } + free_memory(dbf); + } + return 1; +} + + + +/* + * Open the Media file for reading/writing + */ +int bdb_open_media_file(B_DB *mdb) +{ + char *dbf; + + if (!mdb->mediafd) { + dbf = make_filename(mdb, DB_MEDIA_FILENAME); + mdb->mediafd = fopen(dbf, "r+"); + if (!mdb->mediafd) { + Mmsg2(&mdb->errmsg, "Error opening DB Media file %s: ERR=%s\n", + dbf, strerror(errno)); + free_memory(dbf); + return 0; + } + free_memory(dbf); + } + return 1; +} + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb.h b/bacula/src/cats/bdb.h new file mode 100644 index 0000000000..67bb3f5f84 --- /dev/null +++ b/bacula/src/cats/bdb.h @@ -0,0 +1,13 @@ +/* + * Definitions common to the Bacula Database Routines (bdb). + */ + +/* bdb.c */ +extern int bdb_open_jobs_file(B_DB *mdb); +extern int bdb_write_control_file(B_DB *mdb); +extern int bdb_open_jobmedia_file(B_DB *mdb); +extern int bdb_open_pools_file(B_DB *mdb); +extern int bdb_open_media_file(B_DB *mdb); +extern int bdb_open_client_file(B_DB *mdb); +extern int bdb_open_fileset_file(B_DB *mdb); +extern int db_get_media_record(B_DB *mdb, MEDIA_DBR *mr); diff --git a/bacula/src/cats/bdb_create.c b/bacula/src/cats/bdb_create.c new file mode 100644 index 0000000000..b415463048 --- /dev/null +++ b/bacula/src/cats/bdb_create.c @@ -0,0 +1,291 @@ +/* + * Bacula Catalog Database Create record routines + * + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" +#include "bdb.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ +int db_create_pool_record(B_DB *mdb, POOL_DBR *pr); + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + +int db_create_file_attributes_record(B_DB *mdb, ATTR_DBR *ar) +{ + /* *****FIXME***** implement this */ + return 1; +} + +int db_create_file_item(B_DB *mdb, ATTR_DBR *ar) +{ + /****FIXME***** not implemented */ + return 1; +} + + +/* + * Create a new record for the Job + * This record is created at the start of the Job, + * it is updated in bdb_update.c when the Job terminates. + * + * Returns: 0 on failure + * 1 on success + */ +int db_create_job_record(B_DB *mdb, JOB_DBR *jr) +{ + int len; + + P(mdb->mutex); + if (!bdb_open_jobs_file(mdb)) { + V(mdb->mutex); + return 0; + } + mdb->control.JobId++; + bdb_write_control_file(mdb); + + len = sizeof(JOB_DBR); + jr->JobId = mdb->control.JobId; + fseek(mdb->jobfd, 0L, SEEK_END); + if (fwrite(jr, len, 1, mdb->jobfd) != 1) { + Mmsg1(&mdb->errmsg, "Error writing DB Jobs file. ERR=%s\n", strerror(errno)); + V(mdb->mutex); + return 0; + } + fflush(mdb->jobfd); + V(mdb->mutex); + return 1; +} + +/* Create a JobMedia record for Volume used this job + * Returns: 0 on failure + * record-id on success + */ +int db_create_jobmedia_record(B_DB *mdb, JOBMEDIA_DBR *jm) +{ + int len; + + P(mdb->mutex); + if (!bdb_open_jobmedia_file(mdb)) { + V(mdb->mutex); + return 0; + } + mdb->control.JobMediaId++; + jm->JobMediaId = mdb->control.JobMediaId; + bdb_write_control_file(mdb); + + len = sizeof(JOBMEDIA_DBR); + + fseek(mdb->jobmediafd, 0L, SEEK_END); + if (fwrite(jm, len, 1, mdb->jobmediafd) != 1) { + Mmsg1(&mdb->errmsg, "Error writing DB JobMedia file. ERR=%s\n", strerror(errno)); + V(mdb->mutex); + return 0; + } + fflush(mdb->jobmediafd); + V(mdb->mutex); + return jm->JobMediaId; +} + + +/* + * Create a unique Pool record + * Returns: 0 on failure + * 1 on success + */ +int db_create_pool_record(B_DB *mdb, POOL_DBR *pr) +{ + int len; + POOL_DBR mpr; + + memset(&mpr, 0, sizeof(mpr)); + strcpy(mpr.Name, pr->Name); + if (db_get_pool_record(mdb, &mpr)) { + Mmsg1(&mdb->errmsg, "Pool record %s already exists\n", mpr.Name); + return 0; + } + + P(mdb->mutex); + if (!bdb_open_pools_file(mdb)) { + V(mdb->mutex); + return 0; + } + + mdb->control.PoolId++; + pr->PoolId = mdb->control.PoolId; + bdb_write_control_file(mdb); + + len = sizeof(mpr); + fseek(mdb->poolfd, 0L, SEEK_END); + if (fwrite(pr, len, 1, mdb->poolfd) != 1) { + Mmsg1(&mdb->errmsg, "Error writing DB Pools file. ERR=%s\n", strerror(errno)); + V(mdb->mutex); + return 0; + } + fflush(mdb->poolfd); + V(mdb->mutex); + return 1; +} + + +/* + * Create Unique Media record. This record + * contains all the data pertaining to a specific + * Volume. + * + * Returns: 0 on failure + * 1 on success + */ +int db_create_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + int len; + MEDIA_DBR mmr; + + memset(&mmr, 0, sizeof(mmr)); + strcpy(mmr.VolumeName, mr->VolumeName); + if (db_get_media_record(mdb, &mmr)) { + Mmsg1(&mdb->errmsg, "Media record %s already exists\n", mmr.VolumeName); + return 0; + } + + P(mdb->mutex); + + mdb->control.MediaId++; + mr->MediaId = mdb->control.MediaId; + bdb_write_control_file(mdb); + + len = sizeof(mmr); + fseek(mdb->mediafd, 0L, SEEK_END); + if (fwrite(mr, len, 1, mdb->mediafd) != 1) { + Mmsg1(&mdb->errmsg, "Error writing DB Media file. ERR=%s\n", strerror(errno)); + V(mdb->mutex); + return 0; + } + fflush(mdb->mediafd); + V(mdb->mutex); + return 1; +} + + +/* + * Create a unique Client record or return existing record + * Returns: 0 on failure + * 1 on success + */ +int db_create_client_record(B_DB *mdb, CLIENT_DBR *cr) +{ + int len; + CLIENT_DBR lcr; + + cr->ClientId = 0; + if (db_get_client_record(mdb, cr)) { + Mmsg1(&mdb->errmsg, "Client record %s already exists\n", cr->Name); + return 1; + } + + P(mdb->mutex); + if (!bdb_open_client_file(mdb)) { + V(mdb->mutex); + return 0; + } + + mdb->control.ClientId++; + cr->ClientId = mdb->control.ClientId; + bdb_write_control_file(mdb); + + fseek(mdb->clientfd, 0L, SEEK_END); + len = sizeof(lcr); + if (fwrite(cr, len, 1, mdb->clientfd) != 1) { + Mmsg1(&mdb->errmsg, "Error writing DB Client file. ERR=%s\n", strerror(errno)); + V(mdb->mutex); + return 0; + } + fflush(mdb->clientfd); + V(mdb->mutex); + return 1; +} + +/* + * Create a unique FileSet record or return existing record + * + * Note, here we write the FILESET_DBR structure + * + * Returns: 0 on failure + * 1 on success + */ +int db_create_fileset_record(B_DB *mdb, FILESET_DBR *fsr) +{ + int len; + FILESET_DBR lfsr; + + fsr->FileSetId = 0; + if (db_get_fileset_record(mdb, fsr)) { + Mmsg1(&mdb->errmsg, "FileSet record %s already exists\n", fsr->FileSet); + return 1; + } + + P(mdb->mutex); + if (!bdb_open_fileset_file(mdb)) { + V(mdb->mutex); + return 0; + } + + mdb->control.FileSetId++; + fsr->FileSetId = mdb->control.FileSetId; + bdb_write_control_file(mdb); + + fseek(mdb->clientfd, 0L, SEEK_END); + len = sizeof(lfsr); + if (fwrite(fsr, len, 1, mdb->filesetfd) != 1) { + Mmsg1(&mdb->errmsg, "Error writing DB FileSet file. ERR=%s\n", strerror(errno)); + V(mdb->mutex); + return 0; + } + fflush(mdb->filesetfd); + V(mdb->mutex); + return 1; +} + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb_delete.c b/bacula/src/cats/bdb_delete.c new file mode 100644 index 0000000000..3537ef34b1 --- /dev/null +++ b/bacula/src/cats/bdb_delete.c @@ -0,0 +1,97 @@ +/* + * Bacula Catalog Database Delete record interface routines + * + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" +#include "bdb.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + + +/* + * Delete a Pool record given the Name + * + * Returns: 0 on error + * the number of records deleted on success + */ +int db_delete_pool_record(B_DB *mdb, POOL_DBR *pr) +{ + int stat; + POOL_DBR opr; + + pr->PoolId = 0; /* Search on Pool Name */ + if (!db_get_pool_record(mdb, pr)) { + Mmsg1(&mdb->errmsg, "No pool record %s exists\n", pr->Name); + return 0; + } + P(mdb->mutex); + fseek(mdb->poolfd, pr->rec_addr, SEEK_SET); + memset(&opr, 0, sizeof(opr)); + stat = fwrite(&opr, sizeof(opr), 1, mdb->poolfd); + V(mdb->mutex); + return stat; +} + +int db_delete_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + int stat; + MEDIA_DBR omr; + + if (!db_get_media_record(mdb, mr)) { + Mmsg0(&mdb->errmsg, "Media record not found.\n"); + return 0; + } + P(mdb->mutex); + fseek(mdb->mediafd, mr->rec_addr, SEEK_SET); + memset(&omr, 0, sizeof(omr)); + stat = fwrite(&omr, sizeof(omr), 1, mdb->mediafd); + V(mdb->mutex); + return stat; +} + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb_find.c b/bacula/src/cats/bdb_find.c new file mode 100644 index 0000000000..71363d33bd --- /dev/null +++ b/bacula/src/cats/bdb_find.c @@ -0,0 +1,181 @@ +/* + * Bacula Catalog Database Find record interface routines + * + * Note, generally, these routines are more complicated + * that a simple search by name or id. Such simple + * request are in get.c + * + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" +#include "bdb.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ +int db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime); + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + + +/* + * Find job start time. Used to find last full save that terminated normally + * so we can do Incremental and Differential saves. + * + * Returns: 0 on failure + * 1 on success, jr unchanged, but stime set + */ +int db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime) +{ + char cmd[MAXSTRING], Name[MAX_NAME_LENGTH], StartTime[MAXSTRING]; + int Type, Level; + uint32_t JobId, EndId, ClientId; + char cType[10], cLevel[10], JobStatus[10]; + int stat = 0; + int found; + long addr; + + strcpy(stime, "0000-00-00 00:00:00"); /* default */ + P(mdb->mutex); + if (!bdb_open_jobs_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->jobfd, 0L, SEEK_SET); /* rewind file */ + /* Linear search through JobStart records + */ + + while (fgets(cmd, sizeof(cmd), mdb->jobfd)) { + if (sscanf(cmd, "JobStart JobId=%d Name=%127s Type=%1s Level=%1s \ +StartTime=%100s", &JobId, Name, cType, cLevel, StartTime) == 5) { + if (JobId < jr->JobId) { + continue; /* older not a candidate */ + } + Type = cType[0]; + Level = cLevel[0]; + unbash_spaces(Name); + unbash_spaces(StartTime); + Dmsg4(200, "Got Type=%c Level=%c Name=%s StartTime=%s\n", + Type, Level, Name, StartTime); + Dmsg3(200, "Want Type=%c Level=%c Name=%s\n", jr->Type, jr->Level, + jr->Name); + /* Differential is since last Full backup */ + /* Incremental is since last FULL or Incremental or Differential */ + if (((jr->Level == L_DIFFERENTIAL) && (Type == jr->Type && + Level == L_FULL && strcmp(Name, jr->Name) == 0)) || + ((jr->Level == L_INCREMENTAL) && (Type == jr->Type && + (Level == L_FULL || Level == L_INCREMENTAL || + Level == L_DIFFERENTIAL) && strcmp(Name, jr->Name) == 0))) { + addr = ftell(mdb->jobfd); /* save current location */ + JobStatus[0] = 0; + found = 0; + /* Search for matching JobEnd record */ + while (!found && fgets(cmd, sizeof(cmd), mdb->jobfd)) { + if (sscanf(cmd, "JobEnd JobId=%d JobStatus=%1s ClientId=%d", + &EndId, JobStatus, &ClientId) == 3) { + if (EndId == JobId && *JobStatus == 'T' && ClientId == jr->ClientId) { + Dmsg0(200, "====found EndJob matching Job\n"); + found = 1; + break; + } + } + } + /* Reset for next read */ + fseek(mdb->jobfd, addr, SEEK_SET); + if (found) { + strcpy(stime, StartTime); + stat = 1; /* Got a candidate */ + Dmsg5(200, "Got candidate JobId=%d Type=%c Level=%c Name=%s StartTime=%s\n", + JobId, Type, Level, Name, StartTime); + } + } + } + } + V(mdb->mutex); + return stat; +} + + +/* + * Find Available Media (Volume) for Pool + * + * Find a Volume for a given PoolId, MediaType, and VolStatus + * + * Returns: 0 on failure + * numrows on success + */ +int db_find_next_volume(B_DB *mdb, int item, MEDIA_DBR *mr) +{ + MEDIA_DBR omr; + int stat = 0; + int index = 0; + int len; + + P(mdb->mutex); + if (!bdb_open_media_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->mediafd, 0L, SEEK_SET); /* rewind file */ + len = sizeof(omr); + while (fread(&omr, len, 1, mdb->mediafd) > 0) { + if (mr->PoolId == omr.PoolId && strcmp(mr->VolStatus, omr.VolStatus) == 0 && + strcmp(mr->MediaType, omr.MediaType) == 0) { + if (!(++index == item)) { /* looking for item'th entry */ + Dmsg0(200, "Media record matches, but not index\n"); + continue; + } + Dmsg0(200, "Media record matches\n"); + memcpy(mr, &omr, len); + Dmsg1(200, "Findnextvol MediaId=%d\n", mr->MediaId); + stat = 1; + break; /* found it */ + } + } + V(mdb->mutex); + return stat; +} + +int db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr) { return 0; } + + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb_get.c b/bacula/src/cats/bdb_get.c new file mode 100644 index 0000000000..c94c3e73e9 --- /dev/null +++ b/bacula/src/cats/bdb_get.c @@ -0,0 +1,493 @@ +/* + * Bacula Catalog Database Get record interface routines + * Note, these routines generally get a record by id or + * by name. If more logic is involved, the routine + * should be in find.c + * + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" +#include "bdb.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ +int db_get_media_record(B_DB *mdb, MEDIA_DBR *mr); +int db_get_pool_record(B_DB *mdb, POOL_DBR *pr); + + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + + +/* + * Get Job record for given JobId + * Returns: 0 on failure + * 1 on success + */ + +int db_get_job_record(B_DB *mdb, JOB_DBR *jr) +{ + JOB_DBR ojr; + faddr_t rec_addr; + int found = 0; + int stat = 0; + int len; + + P(mdb->mutex); + if (jr->JobId == 0 && jr->Name[0] == 0) { /* he wants # of Job records */ + jr->JobId = mdb->control.JobId; + V(mdb->mutex); + return 1; + } + Dmsg0(200, "Open Jobs\n"); + if (!bdb_open_jobs_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->jobfd, 0L, SEEK_SET); /* rewind file */ + rec_addr = 0; + /* Linear search through Job records + */ + len = sizeof(ojr); + while (fread(&ojr, len, 1, mdb->jobfd) > 0) { + /* If id not zero, search by Id */ + if (jr->JobId != 0) { + if (jr->JobId == ojr.JobId) { + found = 1; + } + /* Search by Job */ + } else if (strcmp(jr->Job, ojr.Job) == 0) { + found = 1; + Dmsg1(200, "Found Job: %s\n", ojr.Job); + } + if (!found) { + rec_addr = ftell(mdb->jobfd); /* save start next record */ + continue; + } + /* Found desired record, now return it */ + memcpy(jr, &ojr, len); + jr->rec_addr = rec_addr; + stat = ojr.JobId; + Dmsg2(200, "Found job record: JobId=%d Job=%s", + ojr.JobId, ojr.Job); + break; + } + if (!found) { + strcpy(mdb->errmsg, "Job record not found.\n"); + } + V(mdb->mutex); + Dmsg1(200, "Return job stat=%d\n", stat); + return stat; +} + + +/* + * Get the number of pool records + * + * Returns: -1 on failure + * number on success + */ +int db_get_num_pool_records(B_DB *mdb) +{ + int stat = 0; + + P(mdb->mutex); + stat = mdb->control.PoolId; + V(mdb->mutex); + return stat; +} + +/* + * This function returns a list of all the Pool record ids. + * The caller must free ids if non-NULL. + * + * Returns 0: on failure + * 1: on success + */ +int db_get_pool_ids(B_DB *mdb, int *num_ids, uint32_t *ids[]) +{ + int i = 0; + uint32_t *id; + POOL_DBR opr; + int len; + + P(mdb->mutex); + *ids = NULL; + if (!bdb_open_pools_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->poolfd, 0L, SEEK_SET); /* rewind file */ + /* Linear search through Pool records + */ + len = sizeof(opr); + *num_ids = mdb->control.PoolId; + id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t)); + while (fread(&opr, len, 1, mdb->poolfd) > 0) { + id[i++] = opr.PoolId; + } + *ids = id; + V(mdb->mutex); + return 1; +} + + +/* + * Get Pool Record + * If the PoolId is non-zero, we get its record, + * otherwise, we search on the PoolName + * + * Returns: 0 on failure + * id on success + */ +int db_get_pool_record(B_DB *mdb, POOL_DBR *pr) +{ + POOL_DBR opr; + faddr_t rec_addr; + int found = 0; + int stat = 0; + int len; + + P(mdb->mutex); + Dmsg0(200, "Open pools\n"); + if (!bdb_open_pools_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->poolfd, 0L, SEEK_SET); /* rewind file */ + rec_addr = 0; + /* Linear search through Pool records + */ + len = sizeof(opr); + while (fread(&opr, len, 1, mdb->poolfd) > 0) { + /* If id not zero, search by Id */ + if (pr->PoolId != 0) { + if (pr->PoolId == opr.PoolId) { + found = 1; + } + /* Search by Name */ + } else if (strcmp(pr->Name, opr.Name) == 0) { + found = 1; + Dmsg1(200, "Found pool: %s\n", opr.Name); + } + if (!found) { + rec_addr = ftell(mdb->poolfd); /* save start next record */ + continue; + } + /* Found desired record, now return it */ + memcpy(pr, &opr, len); + pr->rec_addr = rec_addr; + stat = opr.PoolId; + Dmsg3(200, "Found pool record: PoolId=%d Name=%s PoolType=%s\n", + opr.PoolId, opr.Name, opr.PoolType); + break; + } + if (!found) { + strcpy(mdb->errmsg, "Pool record not found.\n"); + } + V(mdb->mutex); + Dmsg1(200, "Return pool stat=%d\n", stat); + return stat; +} + +/* + * Get the number of Media records + * + * Returns: -1 on failure + * number on success + */ +int db_get_num_media_records(B_DB *mdb) +{ + int stat = 0; + + P(mdb->mutex); + stat = mdb->control.MediaId; + V(mdb->mutex); + return stat; +} + +/* + * This function returns a list of all the Media record ids. + * The caller must free ids if non-NULL. + * + * Returns 0: on failure + * 1: on success + */ +int db_get_media_ids(B_DB *mdb, int *num_ids, uint32_t *ids[]) +{ + int i = 0; + uint32_t *id; + MEDIA_DBR omr; + int len; + + P(mdb->mutex); + *ids = NULL; + if (!bdb_open_media_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->mediafd, 0L, SEEK_SET); /* rewind file */ + /* Linear search through Pool records + */ + len = sizeof(omr); + *num_ids = mdb->control.MediaId; + id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t)); + while (fread(&omr, len, 1, mdb->mediafd) > 0) { + id[i++] = omr.MediaId; + } + *ids = id; + V(mdb->mutex); + return 1; +} + +/* + * Get Media Record + * If the MediaId is non-zero, we get its record, + * otherwise, we search on the MediaName + * + * Returns: 0 on failure + * id on success + */ +int db_get_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + faddr_t rec_addr; + int found = 0; + int stat = 0; + int len; + MEDIA_DBR omr; + + P(mdb->mutex); + if (!bdb_open_media_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->mediafd, 0L, SEEK_SET); /* rewind file */ + rec_addr = 0; + /* Linear search through Media records + */ + len = sizeof(omr); + while (fread(&omr, len, 1, mdb->mediafd) > 0) { + if (omr.MediaId == 0) { + continue; /* deleted record */ + } + Dmsg1(200, "VolName=%s\n", omr.VolumeName); + /* If id not zero, search by Id */ + if (mr->MediaId != 0) { + Dmsg1(200, "MediaId=%d\n", mr->MediaId); + if (mr->MediaId == omr.MediaId) { + found = 1; + } + /* Search by Name */ + } else if (strcmp(mr->VolumeName, omr.VolumeName) == 0) { + found = 1; + } + if (!found) { + rec_addr = ftell(mdb->mediafd); /* save start next record */ + continue; + } + /* Found desired record, now return it */ + memcpy(mr, &omr, len); + mr->rec_addr = rec_addr; + stat = omr.MediaId; + Dmsg3(200, "Found media record: MediaId=%d Name=%s MediaType=%s\n", + omr.MediaId, omr.VolumeName, mr->MediaType); + break; + } + if (stat == 0) { + strcpy(mdb->errmsg, "Could not find requested Media record.\n"); + } + V(mdb->mutex); + return stat; +} + +/* + * Find VolumeNames for a give JobId + * Returns: 0 on error or no Volumes found + * number of volumes on success + * Volumes are concatenated in VolumeNames + * separated by a vertical bar (|). + */ +int db_get_job_volume_names(B_DB *mdb, uint32_t JobId, char *VolumeNames) +{ + int found = 0; + JOBMEDIA_DBR jm; + MEDIA_DBR mr; + int jmlen, mrlen; + + P(mdb->mutex); + if (!bdb_open_jobmedia_file(mdb)) { + V(mdb->mutex); + return 0; + } + if (!bdb_open_media_file(mdb)) { + V(mdb->mutex); + return 0; + } + jmlen = sizeof(jm); + mrlen = sizeof(mr); + *VolumeNames = 0; + fseek(mdb->jobmediafd, 0L, SEEK_SET); /* rewind the file */ + while (fread(&jm, jmlen, 1, mdb->jobmediafd) > 0) { + if (jm.JobId == JobId) { + /* Now look up VolumeName in Media file given MediaId */ + fseek(mdb->mediafd, 0L, SEEK_SET); + while (fread(&mr, mrlen, 1, mdb->mediafd) > 0) { + if (jm.MediaId == mr.MediaId) { + if (*VolumeNames != 0) { /* if not first name, */ + strcat(VolumeNames, "|"); /* add separator */ + } + strcat(VolumeNames, mr.VolumeName); /* add Volume Name */ + found++; + } + } + } + } + if (!found) { + strcpy(mdb->errmsg, "No Volumes found.\n"); + } + V(mdb->mutex); + return found; +} + +/* + * Get Client Record + * If the ClientId is non-zero, we get its record, + * otherwise, we search on the Name + * + * Returns: 0 on failure + * id on success + */ +int db_get_client_record(B_DB *mdb, CLIENT_DBR *cr) +{ + CLIENT_DBR lcr; + int len; + int stat = 0; + + P(mdb->mutex); + if (!bdb_open_client_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->clientfd, 0L, SEEK_SET); /* rewind file */ + /* + * Linear search through Client records + */ + len = sizeof(lcr); + while (fread(&lcr, len, 1, mdb->clientfd)) { + /* If id not zero, search by Id */ + if (cr->ClientId != 0) { + if (cr->ClientId != lcr.ClientId) { + continue; + } + /* Search by Name */ + } else if (strcmp(cr->Name, lcr.Name) != 0) { + continue; /* not found */ + } + memcpy(cr, &lcr, len); + stat = lcr.ClientId; + Dmsg2(200, "Found Client record: ClientId=%d Name=%s\n", + lcr.ClientId, lcr.Name); + break; + } + if (!stat) { + strcpy(mdb->errmsg, "Client record not found.\n"); + } + V(mdb->mutex); + return stat; +} + +/* + * Get FileSet Record (We read the FILESET_DBR structure) + * If the FileSetId is non-zero, we get its record, + * otherwise, we search on the FileSet (its name). + * + * Returns: 0 on failure + * id on success + */ +int db_get_fileset_record(B_DB *mdb, FILESET_DBR *fsr) +{ + FILESET_DBR lfsr; + int stat = 0; + + P(mdb->mutex); + if (!bdb_open_fileset_file(mdb)) { + V(mdb->mutex); + return 0; + } + fseek(mdb->filesetfd, 0L, SEEK_SET); /* rewind file */ + /* + * Linear search through FileSet records + */ + while (fread(&lfsr, sizeof(lfsr), 1, mdb->filesetfd) > 0) { + /* If id not zero, search by Id */ + if (fsr->FileSetId != 0) { + if (fsr->FileSetId != lfsr.FileSetId) { + continue; + } + /* Search by Name & MD5 */ + } else if (strcmp(fsr->FileSet, lfsr.FileSet) != 0 || + strcmp(fsr->MD5, lfsr.MD5) != 0) { + continue; /* not found */ + } + /* Found desired record, now return it */ + memcpy(fsr, &lfsr, sizeof(lfsr)); + stat = fsr->FileSetId; + Dmsg2(200, "Found FileSet record: FileSetId=%d FileSet=%s\n", + lfsr.FileSetId, lfsr.FileSet); + break; + } + if (!stat) { + strcpy(mdb->errmsg, "FileSet record not found.\n"); + } + V(mdb->mutex); + return stat; +} + + + +int db_get_file_attributes_record(B_DB *mdb, char *fname, FILE_DBR *fdbr) +{ return 0; } + + + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb_list.c b/bacula/src/cats/bdb_list.c new file mode 100644 index 0000000000..6cf9512115 --- /dev/null +++ b/bacula/src/cats/bdb_list.c @@ -0,0 +1,269 @@ +/* + * Bacula Catalog Database List records interface routines + * + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" +#include "bdb.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + +/* + * Submit general SQL query + */ +int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx) +{ + sendit(ctx, "SQL Queries not implemented with internal database.\n"); + return 0; +} + + +/* + * List all the pool records + */ +void db_list_pool_records(B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx) +{ + int len; + POOL_DBR pr; + + Dmsg0(90, "Enter list_pool_records\n"); + P(mdb->mutex); + if (!bdb_open_pools_file(mdb)) { + V(mdb->mutex); + return; + } + sendit(ctx, " PoolId NumVols MaxVols Type PoolName\n"); + sendit(ctx, "===================================================\n"); + fseek(mdb->poolfd, 0L, SEEK_SET); /* rewind file */ + len = sizeof(pr); + while (fread(&pr, len, 1, mdb->poolfd) > 0) { + Mmsg(&mdb->cmd, " %7d %6d %6d %-10s %s\n", + pr.PoolId, pr.NumVols, pr.MaxVols, pr.PoolType, pr.Name); + sendit(ctx, mdb->cmd); + } + sendit(ctx, "===================================================\n"); + V(mdb->mutex); + Dmsg0(90, "Leave list_pool_records\n"); + return; +} + + +/* + * List Media records + */ +void db_list_media_records(B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx) +{ + char ewc[30]; + int len; + MEDIA_DBR mr; + + P(mdb->mutex); + if (!bdb_open_media_file(mdb)) { + V(mdb->mutex); + return; + } + sendit(ctx, " Status VolBytes MediaType VolumeName\n"); + sendit(ctx, "=============================================================\n"); + fseek(mdb->mediafd, 0L, SEEK_SET); /* rewind file */ + len = sizeof(mr); + while (fread(&mr, len, 1, mdb->mediafd) > 0) { + Mmsg(&mdb->cmd, " %-10s %17s %-15s %s\n", + mr.VolStatus, edit_uint_with_commas(mr.VolBytes, ewc), + mr.MediaType, mr.VolumeName); + sendit(ctx, mdb->cmd); + } + sendit(ctx, "====================================================================\n"); + V(mdb->mutex); + return; +} + +void db_list_jobmedia_records(B_DB *mdb, uint32_t JobId, DB_LIST_HANDLER *sendit, void *ctx) +{ + JOBMEDIA_DBR jm; + MEDIA_DBR mr; + int jmlen, mrlen; + + P(mdb->mutex); + if (!bdb_open_jobmedia_file(mdb)) { + V(mdb->mutex); + return; + } + if (!bdb_open_media_file(mdb)) { + V(mdb->mutex); + return; + } + sendit(ctx, " JobId VolumeName FirstIndex LastIndex\n"); + sendit(ctx, "============================================\n"); + jmlen = sizeof(jm); + mrlen = sizeof(mr); + fseek(mdb->jobmediafd, 0L, SEEK_SET); /* rewind the file */ + while (fread(&jm, jmlen, 1, mdb->jobmediafd) > 0) { + /* List by JobId */ + if (JobId != 0) { + if (jm.JobId == JobId) { + /* Now find VolumeName in corresponding Media record */ + fseek(mdb->mediafd, 0L, SEEK_SET); + while (fread(&mr, mrlen, 1, mdb->mediafd) > 0) { + if (mr.MediaId == jm.MediaId) { + Mmsg(&mdb->cmd, " %7d %-10s %10d %10d\n", + jm.JobId, mr.VolumeName, jm.FirstIndex, jm.LastIndex); + sendit(ctx, mdb->cmd); + break; + } + } + } + } else { + /* List all records */ + fseek(mdb->mediafd, 0L, SEEK_SET); + while (fread(&mr, mrlen, 1, mdb->mediafd) > 0) { + if (mr.MediaId == jm.MediaId) { + Mmsg(&mdb->cmd, " %7d %-10s %10d %10d\n", + jm.JobId, mr.VolumeName, jm.FirstIndex, jm.LastIndex); + sendit(ctx, mdb->cmd); + break; + } + } + } + } + + sendit(ctx, "============================================\n"); + V(mdb->mutex); + return; +} + + +/* + * List Job records + */ +void db_list_job_records(B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx) +{ + int jrlen; + JOB_DBR ojr; + int done = 0; + char ewc1[30], ewc2[30]; + char dt[MAX_TIME_LENGTH]; + struct tm tm; + + P(mdb->mutex); + if (!bdb_open_jobs_file(mdb)) { + V(mdb->mutex); + return; + } + fseek(mdb->jobfd, 0L, SEEK_SET); /* rewind file */ + /* + * Linear search through Job records + */ + sendit(ctx, " JobId StartTime Type Level Bytes Files Stat JobName\n"); + sendit(ctx, "==========================================================================\n"); + jrlen = sizeof(ojr); + while (!done && fread(&ojr, jrlen, 1, mdb->jobfd) > 0) { + if (jr->JobId != 0) { + if (jr->JobId == ojr.JobId) { + done = 1; + } else { + continue; + } + } + localtime_r(&ojr.StartTime, &tm); + strftime(dt, sizeof(dt), "%m-%d %H:%M", &tm); + Mmsg(&mdb->cmd, " %7d %-10s %c %c %14s %10s %c %s\n", + ojr.JobId, dt, (char)ojr.Type, (char)ojr.Level, + edit_uint_with_commas(ojr.JobBytes, ewc1), + edit_uint_with_commas(ojr.JobFiles, ewc2), + (char)ojr.JobStatus, ojr.Name); + sendit(ctx, mdb->cmd); + } + sendit(ctx, "============================================================================\n"); + V(mdb->mutex); + return; +} + + +/* + * List Job Totals + */ +void db_list_job_totals(B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx) +{ + char ewc1[30], ewc2[30], ewc3[30]; + int jrlen; + JOB_DBR ojr; + uint64_t total_bytes = 0; + uint64_t total_files = 0; + uint32_t total_jobs = 0; + + P(mdb->mutex); + if (!bdb_open_jobs_file(mdb)) { + V(mdb->mutex); + return; + } + fseek(mdb->jobfd, 0L, SEEK_SET); /* rewind file */ + /* + * Linear search through JobStart records + */ + sendit(ctx, " NumJobs NumFiles NumBytes\n"); + sendit(ctx, "=======================================\n"); + jrlen = sizeof(ojr); + while (fread(&ojr, jrlen, 1, mdb->jobfd) > 0) { + total_files += ojr.JobFiles; + total_bytes += ojr.JobBytes; + total_jobs++; + } + Mmsg(&mdb->cmd, " %7s %10s %15s\n", + edit_uint_with_commas(total_jobs, ewc1), + edit_uint_with_commas(total_files, ewc2), + edit_uint_with_commas(total_bytes, ewc3)); + sendit(ctx, mdb->cmd); + sendit(ctx, "=======================================\n"); + V(mdb->mutex); + return; +} + + + +void db_list_files_for_job(B_DB *mdb, uint32_t jobid, DB_LIST_HANDLER *sendit, void *ctx) {} + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb_update.c b/bacula/src/cats/bdb_update.c new file mode 100755 index 0000000000..e0eba75249 --- /dev/null +++ b/bacula/src/cats/bdb_update.c @@ -0,0 +1,203 @@ +/* + * Bacula Catalog Database Update record interface routines + * + * Bacula Catalog Database routines written specifically + * for Bacula. Note, these routines are VERY dumb and + * do not provide all the functionality of an SQL database. + * The purpose of these routines is to ensure that Bacula + * can limp along if no real database is loaded on the + * system. + * + * Kern Sibbald, January MMI + */ + +/* + Copyright (C) 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" +#include "bdb.h" + +#ifdef HAVE_BACULA_DB + +/* Forward referenced functions */ + +/* ----------------------------------------------------------------------- + * + * Bacula specific defines and subroutines + * + * ----------------------------------------------------------------------- + */ + + +/* + * This is called at Job start time to add the + * most current start fields to the job record. + * It is assumed that you did a db_create_job_record() already. + */ +int db_update_job_start_record(B_DB *mdb, JOB_DBR *jr) +{ + int len, stat; + JOB_DBR ojr; + + Dmsg0(200, "In db_update_job_start_record\n"); + len = sizeof(ojr); + memcpy(&ojr, jr, len); + + if (!db_get_job_record(mdb, &ojr)) { + return 0; + } + + P(mdb->mutex); + + fseek(mdb->jobfd, ojr.rec_addr, SEEK_SET); + if (fwrite(jr, len, 1, mdb->jobfd) != 1) { + Mmsg1(&mdb->errmsg, _("Error updating DB Job file. ERR=%s\n"), strerror(errno)); + stat = 0; + } + fflush(mdb->jobfd); + + V(mdb->mutex); + return stat; +} + +/* + * This is called at Job termination time to add all the + * other fields to the job record. + */ +int db_update_job_end_record(B_DB *mdb, JOB_DBR *jr) +{ + int len, stat; + JOB_DBR ojr; + + Dmsg0(200, "In db_update_job_start_record\n"); + len = sizeof(ojr); + memcpy(&ojr, jr, len); + + if (!db_get_job_record(mdb, &ojr)) { + return 0; + } + + P(mdb->mutex); + + fseek(mdb->jobfd, ojr.rec_addr, SEEK_SET); + if (fwrite(jr, len, 1, mdb->jobfd) != 1) { + Mmsg1(&mdb->errmsg, _("Error updating DB Job file. ERR=%s\n"), strerror(errno)); + stat = 0; + } + fflush(mdb->jobfd); + + V(mdb->mutex); + return stat; +} + + +int db_update_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + int stat = 1; + MEDIA_DBR omr; + int len; + + Dmsg0(200, "In db_update_media_record\n"); + mr->MediaId = 0; + len = sizeof(omr); + memcpy(&omr, mr, len); + + if (!db_get_media_record(mdb, &omr)) { + return 0; + } + + P(mdb->mutex); + + /* Don't allow some fields to change by copying from master record */ + strcpy(mr->VolumeName, omr.VolumeName); + strcpy(mr->MediaType, omr.MediaType); + mr->MediaId = omr.MediaId; + mr->PoolId = omr.PoolId; + mr->VolMaxBytes = omr.VolMaxBytes; + mr->VolCapacityBytes = omr.VolCapacityBytes; + strcpy(mr->Recycle, omr.Recycle); + + fseek(mdb->mediafd, omr.rec_addr, SEEK_SET); + if (fwrite(mr, len, 1, mdb->mediafd) != 1) { + Mmsg1(&mdb->errmsg, _("Error updating DB Media file. ERR=%s\n"), strerror(errno)); + stat = 0; + } + fflush(mdb->mediafd); + + V(mdb->mutex); + return stat; +} + +int db_update_pool_record(B_DB *mdb, POOL_DBR *pr) +{ + int stat = 1; + POOL_DBR opr; + int len; + + Dmsg0(200, "In db_update_pool_record\n"); + len = sizeof(opr); + memcpy(&opr, pr, len); + + if (!db_get_pool_record(mdb, &opr)) { + return 0; + } + + P(mdb->mutex); + + /* Update specific fields */ + opr.NumVols = pr->NumVols; + opr.MaxVols = pr->MaxVols; + opr.UseOnce = pr->UseOnce; + opr.UseCatalog = pr->UseCatalog; + opr.AcceptAnyVolume = pr->AcceptAnyVolume; + strcpy(opr.LabelFormat, pr->LabelFormat); + + fseek(mdb->poolfd, opr.rec_addr, SEEK_SET); + if (fwrite(&opr, len, 1, mdb->poolfd) != 1) { + Mmsg1(&mdb->errmsg, _("Error updating DB Media file. ERR=%s\n"), strerror(errno)); + stat = 0; + } else { + memcpy(pr, &opr, len); /* return record written */ + } + fflush(mdb->poolfd); + + V(mdb->mutex); + return stat; +} + +int db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5) +{ + return 1; +} + +int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId) +{ + return 1; +} + + +#endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h new file mode 100644 index 0000000000..55bfe85549 --- /dev/null +++ b/bacula/src/cats/cats.h @@ -0,0 +1,385 @@ +/* + * SQL header file + * + * Anyone who accesses the database will need to include + * this file. + * + * This file contains definitions common to sql.c and + * the external world, and definitions destined only + * for the external world. This is control with + * the define __SQL_C, which is defined only in sql.c + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#ifndef __SQL_H_ +#define __SQL_H_ 1 + + +typedef void (DB_LIST_HANDLER)(void *, char *); +typedef int (DB_RESULT_HANDLER)(void *, int, char **); + +#ifdef __SQL_C + +#ifdef HAVE_SQLITE + +#include + +/* Define opaque structure for sqlite */ +struct sqlite { + char dummy; +}; + +#define IS_NUM(x) ((x) == 1) +#define IS_NOT_NULL(x) ((x) == 1) + +typedef struct s_sql_field { + char *name; /* name of column */ + uint32_t length; /* length */ + uint32_t max_length; /* max length */ + uint32_t type; /* type */ + uint32_t flags; /* flags */ +} SQL_FIELD; + +/* + * This is the "real" definition that should only be + * used inside sql.c and associated database interface + * subroutines. + * S Q L I T E + */ +typedef struct s_db { + BQUEUE bq; /* queue control */ + pthread_mutex_t mutex; + struct sqlite *db; + char **result; + int nrow; /* nrow returned from sqlite */ + int ncolumn; /* ncolum returned from sqlite */ + int num_rows; /* used by code */ + int row; /* seek row */ + int have_insert_id; /* do not have insert id */ + int fields_defined; /* set when fields defined */ + int field; /* seek field */ + SQL_FIELD **fields; /* defined fields */ + int ref_count; + char *db_name; + char *db_user; + char *db_password; + int connected; + char *sqlite_errmsg; /* error message returned by sqlite */ + char *errmsg; /* nicely edited error message */ + char *cmd; /* SQL command string */ +} B_DB; + + +/* + * "Generic" names for easier conversion + * + * S Q L I T E + */ +#define sql_store_result(x) x->result +#define sql_free_result(x) my_sqlite_free_table(x) +#define sql_fetch_row(x) my_sqlite_fetch_row(x) +#define sql_query(x, y) my_sqlite_query(x, y) +#define sql_close(x) sqlite_close(x->db) +#define sql_strerror(x) x->sqlite_errmsg?x->sqlite_errmsg:"unknown" +#define sql_num_rows(x) x->nrow +#define sql_data_seek(x, i) x->row = i +#define sql_affected_rows(x) 1 +#define sql_insert_id(x) sqlite_last_insert_rowid(x->db) +#define sql_field_seek(x, y) my_sqlite_field_seek(x, y) +#define sql_fetch_field(x) my_sqlite_fetch_field(x) +#define sql_num_fields(x) (unsigned)((x)->ncolumn) +#define SQL_ROW char** + + + +/* In cats/sqlite.c */ +extern int my_sqlite_query(B_DB *mdb, char *cmd); +extern SQL_ROW my_sqlite_fetch_row(B_DB *mdb); +extern void my_sqlite_free_table(B_DB *mdb); + +#else + +#ifdef HAVE_MYSQL + +#include + +/* + * This is the "real" definition that should only be + * used inside sql.c and associated database interface + * subroutines. + * + * M Y S Q L + */ +typedef struct s_db { + BQUEUE bq; /* queue control */ + pthread_mutex_t mutex; + MYSQL mysql; + MYSQL *db; + MYSQL_RES *result; + my_ulonglong num_rows; + int ref_count; + char *db_name; + char *db_user; + char *db_password; + int have_insert_id; /* do have insert_id() */ + int connected; + char *errmsg; /* nicely edited error message */ + char *cmd; /* SQL command string */ +} B_DB; + + +/* "Generic" names for easier conversion */ +#define sql_store_result(x) mysql_store_result(x->db) +#define sql_free_result(x) mysql_free_result(x->result) +#define sql_fetch_row(x) mysql_fetch_row(x->result) +#define sql_query(x, y) mysql_query(x->db, y) +#define sql_close(x) mysql_close(x->db) +#define sql_strerror(x) mysql_error(x->db) +#define sql_num_rows(x) mysql_num_rows(x->result) +#define sql_data_seek(x, i) mysql_data_seek(x->result, i) +#define sql_affected_rows(x) mysql_affected_rows(x->db) +#define sql_insert_id(x) mysql_insert_id(x->db) +#define sql_field_seek(x, y) mysql_field_seek(x->result, y) +#define sql_fetch_field(x) mysql_fetch_field(x->result) +#define sql_num_fields(x) mysql_num_fields(x->result) +#define SQL_ROW MYSQL_ROW +#define SQL_FIELD MYSQL_FIELD + +#else /* USE BACULA DB routines */ + +#define HAVE_BACULA_DB 1 + +/* Change this each time there is some incompatible + * file format change!!!! + */ +#define BDB_VERSION 7 /* file version number */ + +struct s_control { + int bdb_version; /* Version number */ + uint32_t JobId; /* next Job Id */ + uint32_t PoolId; /* next Pool Id */ + uint32_t MediaId; /* next Media Id */ + uint32_t JobMediaId; /* next JobMedia Id */ + uint32_t ClientId; /* next Client Id */ + uint32_t FileSetId; /* nest FileSet Id */ + time_t time; /* time file written */ +}; + + +/* This is the REAL definition for using the + * Bacula internal DB + */ +typedef struct s_db { + BQUEUE bq; /* queue control */ + pthread_mutex_t mutex; /* single thread lock */ + int ref_count; /* number of times opened */ + struct s_control control; /* control file structure */ + int cfd; /* control file device */ + FILE *jobfd; /* Jobs records file descriptor */ + FILE *poolfd; /* Pool records fd */ + FILE *mediafd; /* Media records fd */ + FILE *jobmediafd; /* JobMedia records fd */ + FILE *clientfd; /* Client records fd */ + FILE *filesetfd; /* FileSet records fd */ + char *db_name; /* name of database */ + char *errmsg; /* nicely edited error message */ + char *cmd; /* Command string */ +} B_DB; + +#endif /* HAVE_MYSQL */ +#endif /* HAVE_SQLITE */ + +/* Use for better error location printing */ +#define UPDATE_DB(db, cmd) UpdateDB(__FILE__, __LINE__, db, cmd) +#define INSERT_DB(db, cmd) InsertDB(__FILE__, __LINE__, db, cmd) +#define QUERY_DB(db, cmd) QueryDB(__FILE__, __LINE__, db, cmd) +#define DELETE_DB(db, cmd) DeleteDB(__FILE__, __LINE__, db, cmd) + + +#else /* not __SQL_C */ + +/* This is a "dummy" definition for use outside of sql.c + */ +typedef struct s_db { + int dummy; /* for SunOS compiler */ +} B_DB; + +#endif /* __SQL_C */ + +/* ***FIXME*** FileId_t should be uint64_t */ +typedef uint32_t FileId_t; +typedef uint32_t DBId_t; /* general DB id type */ + + +/* Job information passed to create job record and update + * job record at end of job. Note, although this record + * contains all the fields found in the Job database record, + * it also contains fields found in the JobMedia record. + */ +/* Job record */ +typedef struct { + uint32_t JobId; + char Job[MAX_NAME_LENGTH]; /* Job unique name */ + char Name[MAX_NAME_LENGTH]; /* Job base name */ + int Type; /* actually char(1) */ + int Level; /* actually char(1) */ + int JobStatus; /* actually char(1) */ + uint32_t ClientId; /* Id of client */ + uint32_t PoolId; /* Id of pool */ + uint32_t FileSetId; /* Id of FileSet */ + time_t SchedTime; /* Time job scheduled */ + time_t StartTime; /* Job start time */ + time_t EndTime; /* Job termination time */ + uint32_t VolSessionId; + uint32_t VolSessionTime; + uint32_t JobFiles; + uint32_t JobErrors; + uint32_t JobMissingFiles; + uint64_t JobBytes; + + /* Note, FirstIndex, LastIndex, Start/End File and Block + * are only used in the JobMedia record. + */ + uint32_t FirstIndex; /* First index this Volume */ + uint32_t LastIndex; /* Last index this Volume */ + uint32_t StartFile; + uint32_t EndFile; + uint32_t StartBlock; + uint32_t EndBlock; + + char cSchedTime[MAX_NAME_LENGTH]; + char cStartTime[MAX_NAME_LENGTH]; + char cEndTime[MAX_NAME_LENGTH]; + /* Extra stuff not in DB */ + faddr_t rec_addr; +} JOB_DBR; + +/* Job Media information used to create the media records + * for each Volume used for the job. + */ +/* JobMedia record */ +typedef struct { + uint32_t JobMediaId; /* record id */ + uint32_t JobId; /* JobId */ + uint32_t MediaId; /* MediaId */ + uint32_t FirstIndex; /* First index this Volume */ + uint32_t LastIndex; /* Last index this Volume */ + uint32_t StartFile; /* File for start of data */ + uint32_t EndFile; /* End file on Volume */ + uint32_t StartBlock; /* start block on tape */ + uint32_t EndBlock; /* last block */ +} JOBMEDIA_DBR; + + + + +/* Attributes record -- NOT same as in database because + * in general, this "record" creates multiple database + * records (e.g. pathname, filename, fileattributes). + */ +typedef struct { + char *fname; /* full path & filename */ + char *link; /* link if any */ + char *attr; /* attributes statp */ + uint32_t FileIndex; + uint32_t Stream; + uint32_t JobId; + uint32_t ClientId; + uint32_t PathId; + uint32_t FilenameId; + FileId_t FileId; +} ATTR_DBR; + + +/* File record -- same format as database */ +typedef struct { + FileId_t FileId; + uint32_t FileIndex; + uint32_t JobId; + uint32_t FilenameId; + uint32_t PathId; + char LStat[256]; +/* int Status; */ + char MD5[50]; +} FILE_DBR; + +/* Pool record -- same format as database */ +typedef struct { + uint32_t PoolId; + char Name[MAX_NAME_LENGTH]; /* Pool name */ + uint32_t NumVols; /* total number of volumes */ + uint32_t MaxVols; /* max allowed volumes */ + int UseOnce; /* set to use once only */ + int UseCatalog; /* set to use catalog */ + int AcceptAnyVolume; /* set to accept any volume sequence */ + char PoolType[MAX_NAME_LENGTH]; + char LabelFormat[MAX_NAME_LENGTH]; + /* Extra stuff not in DB */ + faddr_t rec_addr; +} POOL_DBR; + +/* Media record -- same as the database */ +typedef struct { + uint32_t MediaId; /* Unique volume id */ + char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ + char MediaType[MAX_NAME_LENGTH]; /* Media type */ + uint32_t PoolId; /* Pool id */ + time_t FirstWritten; /* Time Volume first written */ + time_t LastWritten; /* Time Volume last written */ + time_t LabelDate; /* Date/Time Volume labelled */ + uint32_t VolJobs; /* number of jobs on this medium */ + uint32_t VolFiles; /* Number of files */ + uint32_t VolBlocks; /* Number of blocks */ + uint32_t VolMounts; /* Number of times mounted */ + uint32_t VolErrors; /* Number of read/write errors */ + uint32_t VolWrites; /* Number of writes */ + uint32_t VolReads; /* Number of reads */ + uint64_t VolBytes; /* Number of bytes written */ + uint64_t VolMaxBytes; /* max bytes to write */ + uint64_t VolCapacityBytes; /* capacity estimate */ + char VolStatus[20]; /* Volume status */ + char Recycle[20]; /* Recycle yes/no */ + /* Extra stuff not in DB */ + faddr_t rec_addr; /* found record address */ +} MEDIA_DBR; + +/* Client record -- same as the database */ +typedef struct { + uint32_t ClientId; /* Unique Client id */ + char Name[MAX_NAME_LENGTH]; /* Client name */ + char Uname[256]; /* Uname for client */ +} CLIENT_DBR; + +/* FileSet record -- same as the database */ +typedef struct { + uint32_t FileSetId; /* Unique FileSet id */ + char FileSet[MAX_NAME_LENGTH]; /* FileSet name */ + char MD5[50]; /* MD5 signature of include/exclude */ +} FILESET_DBR; + + + +#include "protos.h" + +#include "jcr.h" + +#endif /* __SQL_H_ */ diff --git a/bacula/src/cats/create_mysql_database.in b/bacula/src/cats/create_mysql_database.in new file mode 100644 index 0000000000..f0bae06f48 --- /dev/null +++ b/bacula/src/cats/create_mysql_database.in @@ -0,0 +1,16 @@ +#!/bin/sh +# +# shell script to create Bacula database(s) +# + +bindir=@SQL_BINDIR@ + +if $bindir/mysql -f <bq)); ) { + if (strcmp(mdb->db_name, db_name) == 0) { + Dmsg2(100, "DB REopen %d %s\n", mdb->ref_count, db_name); + mdb->ref_count++; + V(mutex); + return mdb; /* already open */ + } + } + Dmsg0(100, "db_open first time\n"); + mdb = (B_DB *) malloc(sizeof(B_DB)); + memset(mdb, 0, sizeof(B_DB)); + mdb->db_name = bstrdup(db_name); + mdb->db_user = bstrdup(db_user); + mdb->db_password = bstrdup(db_password); + mdb->have_insert_id = TRUE; + mdb->errmsg = (char *) get_pool_memory(PM_EMSG); /* get error message buffer */ + *mdb->errmsg = 0; + mdb->cmd = (char *) get_pool_memory(PM_EMSG); /* get command buffer */ + mdb->ref_count = 1; + qinsert(&db_list, &mdb->bq); /* put db in list */ + V(mutex); + return mdb; +} + +/* + * Now actually open the database. This can generate errors, + * which are returned in the errmsg + */ +int +db_open_database(B_DB *mdb) +{ + P(mutex); + if (mdb->connected) { + V(mutex); + return 1; + } + mdb->connected = FALSE; + if (pthread_mutex_init(&mdb->mutex, NULL) != 0) { + Mmsg1(&mdb->errmsg, "Unable to initialize DB mutex. ERR=%s\n", strerror(errno)); + V(mutex); + return 0; + } + + /* connect to the database */ + mysql_init(&(mdb->mysql)); + Dmsg0(50, "mysql_init done\n"); + mdb->db = mysql_real_connect( + &(mdb->mysql), /* db */ + NULL, /* default = localhost */ + mdb->db_user, /* login name */ + mdb->db_password, /* password */ + mdb->db_name, /* database name */ + 0, /* default port */ + NULL, /* default = socket */ + 0); /* flags = none */ + + /* If no connect, try once more incase it is a timing problem */ + if (mdb->db == NULL) { + mdb->db = mysql_real_connect( + &(mdb->mysql), /* db */ + NULL, /* default = localhost */ + mdb->db_user, /* login name */ + mdb->db_password, /* password */ + mdb->db_name, /* database name */ + 0, /* default port */ + NULL, /* default = socket */ + 0); /* flags = none */ + } + + Dmsg0(50, "mysql_real_connect done\n"); + Dmsg3(50, "db_user=%s db_name=%s db_password=%s\n", mdb->db_user, mdb->db_name, + mdb->db_password==NULL?"(NULL)":mdb->db_password); + + if (mdb->db == NULL) { + Mmsg2(&mdb->errmsg, _("Unable to connect to MySQL server. \n\ +Database=%s User=%s\n\ +It is probably not running or your password is incorrect.\n"), + mdb->db_name, mdb->db_user); + V(mutex); + return 0; + } + mdb->connected = TRUE; + V(mutex); + return 1; +} + +void +db_close_database(B_DB *mdb) +{ + P(mutex); + mdb->ref_count--; + if (mdb->ref_count == 0) { + qdchain(&mdb->bq); + if (mdb->connected && mdb->db) { + sql_close(mdb); + } + pthread_mutex_destroy(&mdb->mutex); + free_pool_memory(mdb->errmsg); + free_pool_memory(mdb->cmd); + if (mdb->db_name) { + free(mdb->db_name); + } + if (mdb->db_user) { + free(mdb->db_user); + } + if (mdb->db_password) { + free(mdb->db_password); + } + free(mdb); + } + V(mutex); +} + +/* + * Return the next unique index (auto-increment) for + * the given table. Return NULL on error. + * + * For MySQL, NULL causes the auto-increment value + * to be updated. + */ +char *db_next_index(B_DB *mdb, char *table) +{ + return "NULL"; +} + + + +void +db_escape_string(char *snew, char *old, int len) +{ + mysql_escape_string(snew, old, len); +} + +/* + * Submit a general SQL command (cmd), and for each row returned, + * the sqlite_handler is called with the ctx. + */ +int db_sql_query(B_DB *mdb, char *query, DB_RESULT_HANDLER *result_handler, void *ctx) +{ + SQL_ROW row; + + P(mdb->mutex); + if (sql_query(mdb, query) != 0) { + Mmsg(&mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb)); + V(mdb->mutex); + return 0; + } + if (result_handler != NULL) { + if ((mdb->result = sql_store_result(mdb)) != NULL) { + int num_fields = sql_num_fields(mdb); + + while ((row = sql_fetch_row(mdb)) != NULL) { + if (result_handler(ctx, num_fields, row)) + break; + } + + sql_free_result(mdb); + } + } + V(mdb->mutex); + return 1; + +} + + +static void +list_dashes(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx) +{ + SQL_FIELD *field; + unsigned int i, j; + + sql_field_seek(mdb, 0); + send(ctx, "+"); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + for (j = 0; j < field->max_length + 2; j++) + send(ctx, "-"); + send(ctx, "+"); + } + send(ctx, "\n"); +} + +void +list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx) +{ + SQL_FIELD *field; + SQL_ROW row; + unsigned int i, col_len; + char buf[2000], ewc[30]; + + if (mdb->result == NULL) { + return; + } + /* determine column display widths */ + sql_field_seek(mdb, 0); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + if (IS_NUM(field->type) && field->max_length > 0) { /* fixup for commas */ + field->max_length += (field->max_length - 1) / 3; + } + col_len = strlen(field->name); + if (col_len < field->max_length) + col_len = field->max_length; + if (col_len < 4 && !IS_NOT_NULL(field->flags)) + col_len = 4; /* 4 = length of the word "NULL" */ + field->max_length = col_len; /* reset column info */ + } + + list_dashes(mdb, send, ctx); + send(ctx, "|"); + sql_field_seek(mdb, 0); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + sprintf(buf, " %-*s |", field->max_length, field->name); + send(ctx, buf); + } + send(ctx, "\n"); + list_dashes(mdb, send, ctx); + + while ((row = sql_fetch_row(mdb)) != NULL) { + sql_field_seek(mdb, 0); + send(ctx, "|"); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + if (row[i] == NULL) { + sprintf(buf, " %-*s |", field->max_length, "NULL"); + } else if (IS_NUM(field->type)) { + sprintf(buf, " %*s |", field->max_length, + add_commas(row[i], ewc)); + } else { + sprintf(buf, " %-*s |", field->max_length, row[i]); + } + send(ctx, buf); + } + send(ctx, "\n"); + } + list_dashes(mdb, send, ctx); +} + + +#endif /* HAVE_MYSQL */ diff --git a/bacula/src/cats/protos.h b/bacula/src/cats/protos.h new file mode 100644 index 0000000000..59335b2edc --- /dev/null +++ b/bacula/src/cats/protos.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#ifndef __SQL_PROTOS_H +#define __SQL_PROTOS_H + +#include "cats.h" + +/* Database prototypes */ + +/* sql.c */ +B_DB *db_init_database(char *db_name, char *db_user, char *db_password); +int db_open_database(B_DB *db); +void db_close_database(B_DB *db); +void db_escape_string(char *snew, char *old, int len); +char *db_strerror(B_DB *mdb); +int get_sql_record_max(B_DB *mdb); +char *db_next_index(B_DB *mdb, char *table); +int db_sql_query(B_DB *mdb, char *cmd, DB_RESULT_HANDLER *result_handler, void *ctx); + +/* create.c */ +int db_create_file_attributes_record(B_DB *mdb, ATTR_DBR *ar); +int db_create_job_record(B_DB *db, JOB_DBR *jr); +int db_create_media_record(B_DB *db, MEDIA_DBR *media_dbr); +int db_create_client_record(B_DB *db, CLIENT_DBR *cr); +int db_create_fileset_record(B_DB *db, FILESET_DBR *fsr); +int db_create_pool_record(B_DB *db, POOL_DBR *pool_dbr); +int db_create_jobmedia_record(B_DB *mdb, JOBMEDIA_DBR *jr); + +/* delete.c */ +int db_delete_pool_record(B_DB *db, POOL_DBR *pool_dbr); +int db_delete_media_record(B_DB *mdb, MEDIA_DBR *mr); + +/* find.c */ +int db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime); +int db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr); +int db_find_next_volume(B_DB *mdb, int index, MEDIA_DBR *mr); + +/* get.c */ +int db_get_pool_record(B_DB *db, POOL_DBR *pdbr); +int db_get_client_record(B_DB *mdb, CLIENT_DBR *cr); +int db_get_job_record(B_DB *mdb, JOB_DBR *jr); +int db_get_job_volume_names(B_DB *mdb, uint32_t JobId, char *VolumeNames); +int db_get_file_attributes_record(B_DB *mdb, char *fname, FILE_DBR *fdbr); +int db_get_fileset_record(B_DB *mdb, FILESET_DBR *fsr); +int db_get_media_record(B_DB *mdb, MEDIA_DBR *mr); +int db_get_num_media_records(B_DB *mdb); +int db_get_num_pool_records(B_DB *mdb); +int db_get_pool_ids(B_DB *mdb, int *num_ids, uint32_t **ids); +int db_get_media_ids(B_DB *mdb, int *num_ids, uint32_t **ids); + + +/* list.c */ +void db_list_pool_records(B_DB *db, DB_LIST_HANDLER sendit, void *ctx); +void db_list_job_records(B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx); +void db_list_job_totals(B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx); +void db_list_files_for_job(B_DB *db, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx); +void db_list_media_records(B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx); +void db_list_jobmedia_records(B_DB *mdb, uint32_t JobId, DB_LIST_HANDLER *sendit, void *ctx); +int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx); + +/* update.c */ +int db_update_job_start_record(B_DB *db, JOB_DBR *jr); +int db_update_job_end_record(B_DB *db, JOB_DBR *jr); +int db_update_pool_record(B_DB *db, POOL_DBR *pr); +int db_update_media_record(B_DB *db, MEDIA_DBR *mr); +int db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5); +int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId); + +#endif /* __SQL_PROTOS_H */ diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c new file mode 100644 index 0000000000..c8436fa2d8 --- /dev/null +++ b/bacula/src/cats/sql.c @@ -0,0 +1,163 @@ +/* + * Bacula Catalog Database interface routines + * + * Almost generic set of SQL database interface routines + * (with a little more work) + * + * Kern Sibbald, March 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* The following is necessary so that we do not include + * the dummy external definition of B_DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#if HAVE_MYSQL | HAVE_SQLITE + +/* Forward referenced subroutines */ +void print_dashes(B_DB *mdb); +void print_result(B_DB *mdb); + + +/* NOTE!!! The following routines expect that the + * calling subroutine sets and clears the mutex + */ + +/* Utility routine for queries */ +int +QueryDB(char *file, int line, B_DB *mdb, char *cmd) +{ + if (sql_query(mdb, cmd)) { + m_msg(file, line, &mdb->errmsg, _("query %s failed:\n%s\n"), cmd, sql_strerror(mdb)); + e_msg(file, line, M_FATAL, 0, mdb->errmsg); + return 0; + } + mdb->result = sql_store_result(mdb); + + return mdb->result != NULL; +} + +/* + * Utility routine to do inserts + * Returns: 0 on failure + * 1 on success + */ +int +InsertDB(char *file, int line, B_DB *mdb, char *cmd) +{ + if (sql_query(mdb, cmd)) { + m_msg(file, line, &mdb->errmsg, _("insert %s failed:\n%s\n"), cmd, sql_strerror(mdb)); + e_msg(file, line, M_FATAL, 0, mdb->errmsg); + return 0; + } + if (mdb->have_insert_id) { + mdb->num_rows = sql_affected_rows(mdb); + } else { + mdb->num_rows = 1; + } + if (mdb->num_rows != 1) { + m_msg(file, line, &mdb->errmsg, _("Insertion problem: affect_rows=%" lld "\n"), mdb->num_rows); + e_msg(file, line, M_FATAL, 0, mdb->errmsg); /* ***FIXME*** remove me */ + return 0; + } + return 1; +} + +/* Utility routine for updates. + * Returns: 0 on failure + * 1 on success + */ +int +UpdateDB(char *file, int line, B_DB *mdb, char *cmd) +{ + + if (sql_query(mdb, cmd)) { + m_msg(file, line, &mdb->errmsg, _("update %s failed:\n%s\n"), cmd, sql_strerror(mdb)); + e_msg(file, line, M_ERROR, 0, mdb->errmsg); + e_msg(file, line, M_ERROR, 0, "%s\n", cmd); + return 0; + } + mdb->num_rows = sql_affected_rows(mdb); + if (mdb->num_rows != 1) { + m_msg(file, line, &mdb->errmsg, _("Update problem: affect_rows=%" lld "\n"), mdb->num_rows); + e_msg(file, line, M_ERROR, 0, mdb->errmsg); + e_msg(file, line, M_ERROR, 0, "%s\n", cmd); + return 0; + } + return 1; +} + +/* Utility routine for deletes + * + * Returns: -1 on error + * n number of rows affected + */ +int +DeleteDB(char *file, int line, B_DB *mdb, char *cmd) +{ + + if (sql_query(mdb, cmd)) { + m_msg(file, line, &mdb->errmsg, _("delete %s failed:\n%s\n"), cmd, sql_strerror(mdb)); + e_msg(file, line, M_ERROR, 0, mdb->errmsg); + return -1; + } + return sql_affected_rows(mdb); +} + + +/* + * Get record max. Query is already in mdb->cmd + * No locking done + * + * Returns: -1 on failure + * count on success + */ +int get_sql_record_max(B_DB *mdb) +{ + SQL_ROW row; + int stat = 0; + + if (QUERY_DB(mdb, mdb->cmd)) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + stat = -1; + } else { + stat = atoi(row[0]); + } + sql_free_result(mdb); + } else { + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + stat = -1; + } + return stat; +} + +char *db_strerror(B_DB *mdb) +{ + return mdb->errmsg; +} + +#endif /* HAVE_MYSQL | HAVE_SQLITE */ diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c new file mode 100644 index 0000000000..7ad6497cef --- /dev/null +++ b/bacula/src/cats/sql_create.c @@ -0,0 +1,656 @@ +/* + * Bacula Catalog Database Create record interface routines + * + * Kern Sibbald, March 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* *****FIXME**** fix fixed length of select_cmd[] and insert_cmd[] */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#if HAVE_MYSQL || HAVE_SQLITE + +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ + +/* Forward referenced subroutines */ +static int db_create_file_record(B_DB *mdb, ATTR_DBR *ar); +static int db_create_filename_record(B_DB *mdb, ATTR_DBR *ar, char *fname); +static int db_create_path_record(B_DB *mdb, ATTR_DBR *ar, char *path); + + +/* Imported subroutines */ +extern void print_dashes(B_DB *mdb); +extern void print_result(B_DB *mdb); +extern int QueryDB(char *file, int line, B_DB *db, char *select_cmd); +extern int InsertDB(char *file, int line, B_DB *db, char *select_cmd); + + +/* Create a new record for the Job + * Returns: 0 on failure + * 1 on success + */ +int +db_create_job_record(B_DB *mdb, JOB_DBR *jr) +{ + char dt[MAX_TIME_LENGTH]; + time_t stime; + struct tm tm; + int stat; + char *JobId; + int32_t StartDay; + + stime = jr->SchedTime; + + localtime_r(&stime, &tm); + strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm); + StartDay = (int32_t)(date_encode(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday) - + date_encode(2000, 1, 1)); + + P(mdb->mutex); + JobId = db_next_index(mdb, "Job"); + if (!JobId) { + jr->JobId = 0; + V(mdb->mutex); + return 0; + } + /* Must create it */ + Mmsg(&mdb->cmd, +"INSERT INTO Job (JobId, Job, Name, Type, Level, SchedTime, StartDay) VALUES \ +(%s, \"%s\", \"%s\", \"%c\", \"%c\", \"%s\", %d)", + JobId, jr->Job, jr->Name, (char)(jr->Type), (char)(jr->Level), dt, + StartDay); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create DB Job record %s failed. ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + jr->JobId = 0; + stat = 0; + } else { + jr->JobId = sql_insert_id(mdb); + stat = 1; + } + V(mdb->mutex); + return stat; +} + +/* Create a JobMedia record for medium used this job + * Returns: 0 on failure + * 1 on success + */ +int +db_create_jobmedia_record(B_DB *mdb, JOBMEDIA_DBR *jm) +{ + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT JobId, MediaId FROM JobMedia WHERE \ +JobId=%d AND MediaId=%d", jm->JobId, jm->MediaId); + + Dmsg0(30, mdb->cmd); + if (QUERY_DB(mdb, mdb->cmd)) { + mdb->num_rows = sql_num_rows(mdb); + if (mdb->num_rows > 0) { + Mmsg0(&mdb->errmsg, _("Create JobMedia failed. Record already exists.\n")); + sql_free_result(mdb); + V(mdb->mutex); + Dmsg0(0, "Already have JobMedia record\n"); + return 0; + } + sql_free_result(mdb); + } + + /* Must create it */ + Mmsg(&mdb->cmd, +"INSERT INTO JobMedia (JobId, MediaId, FirstIndex, LastIndex) \ +VALUES (%d, %d, %u, %u)", + jm->JobId, jm->MediaId, jm->FirstIndex, jm->LastIndex); + + Dmsg0(30, mdb->cmd); + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create db JobMedia record %s failed. ERR=%s\n"), mdb->cmd, + sql_strerror(mdb)); + stat = 0; + } else { + stat = 1; + } + V(mdb->mutex); + Dmsg0(30, "Return from JobMedia\n"); + return stat; +} + + + +/* Create Unique Pool record + * Returns: 0 on failure + * 1 on success + */ +int +db_create_pool_record(B_DB *mdb, POOL_DBR *pool_dbr) +{ + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT PoolId,Name FROM Pool WHERE Name=\"%s\"", pool_dbr->Name); + Dmsg1(20, "selectpool: %s\n", mdb->cmd); + + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + if (mdb->num_rows > 0) { + Mmsg1(&mdb->errmsg, _("pool record %s already exists\n"), pool_dbr->Name); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + sql_free_result(mdb); + } + + /* Must create it */ + Mmsg(&mdb->cmd, +"INSERT INTO Pool (Name, NumVols, MaxVols, UseOnce, UseCatalog, \ +AcceptAnyVolume, PoolType, LabelFormat) \ +VALUES (\"%s\", %d, %d, %d, %d, %d, \"%s\", \"%s\")", + pool_dbr->Name, + pool_dbr->NumVols, pool_dbr->MaxVols, + pool_dbr->UseOnce, pool_dbr->UseCatalog, + pool_dbr->AcceptAnyVolume, + pool_dbr->PoolType, pool_dbr->LabelFormat); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create db Pool record %s failed: ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + pool_dbr->PoolId = 0; + stat = 0; + } else { + pool_dbr->PoolId = sql_insert_id(mdb); + stat = 1; + } + V(mdb->mutex); + + return stat; +} + + +/* + * Create Unique Media record + * Returns: 0 on failure + * 1 on success + */ +int +db_create_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT MediaId FROM Media WHERE VolumeName=\"%s\"", + mr->VolumeName); + Dmsg1(110, "selectpool: %s\n", mdb->cmd); + + if (QUERY_DB(mdb, mdb->cmd)) { + mdb->num_rows = sql_num_rows(mdb); + if (mdb->num_rows > 0) { + Mmsg1(&mdb->errmsg, _("Media record %s already exists\n"), mr->VolumeName); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + sql_free_result(mdb); + } + + /* Must create it */ + Mmsg(&mdb->cmd, +"INSERT INTO Media (VolumeName, MediaType, PoolId, VolMaxBytes, VolCapacityBytes, \ +VolStatus, Recycle) VALUES (\"%s\", \"%s\", %d, %" lld ", %" lld ", \"%s\", \"%s\")", + mr->VolumeName, + mr->MediaType, mr->PoolId, + mr->VolMaxBytes, mr->VolCapacityBytes, + mr->VolStatus, mr->Recycle); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create DB Media record %s failed. ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + stat = 0; + } else { + mr->MediaId = sql_insert_id(mdb); + stat = 1; + } + V(mdb->mutex); + return stat; +} + + + +/* + * Create a Unique record for the client -- no duplicates + * Returns: 0 on failure + * 1 on success with id in cr->ClientId + */ +int db_create_client_record(B_DB *mdb, CLIENT_DBR *cr) +{ + SQL_ROW row; + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT ClientId FROM Client WHERE Name=\"%s\"", cr->Name); + + cr->ClientId = 0; + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + /* If more than one, report error, but return first row */ + if (mdb->num_rows > 1) { + Mmsg1(&mdb->errmsg, _("More than one Client!: %d\n"), (int)(mdb->num_rows)); + Emsg0(M_ERROR, 0, mdb->errmsg); + } + if (mdb->num_rows >= 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching Client row: %s\n"), sql_strerror(mdb)); + Emsg0(M_ERROR, 0, mdb->errmsg); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + sql_free_result(mdb); + cr->ClientId = atoi(row[0]); + V(mdb->mutex); + return 1; + } + sql_free_result(mdb); + } + + /* Must create it */ + Mmsg(&mdb->cmd, "INSERT INTO Client (Name, Uname) VALUES \ +(\"%s\", \"%s\")", cr->Name, cr->Uname); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create DB Client record %s failed. ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + cr->ClientId = 0; + stat = 0; + } else { + cr->ClientId = sql_insert_id(mdb); + stat = 1; + } + V(mdb->mutex); + return stat; +} + + +/* + * Create a FileSet record. This record is unique in the + * name and the MD5 signature of the include/exclude sets. + * Returns: 0 on failure + * 1 on success with FileSetId in record + */ +int db_create_fileset_record(B_DB *mdb, FILESET_DBR *fsr) +{ + SQL_ROW row; + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT FileSetId FROM FileSet WHERE \ +FileSet=\"%s\" and MD5=\"%s\"", fsr->FileSet, fsr->MD5); + + fsr->FileSetId = 0; + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + if (mdb->num_rows > 1) { + Mmsg1(&mdb->errmsg, _("More than one FileSet!: %d\n"), (int)(mdb->num_rows)); + Emsg0(M_ERROR, 0, mdb->errmsg); + } + if (mdb->num_rows >= 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching FileSet row: ERR=%s\n"), sql_strerror(mdb)); + Emsg0(M_ERROR, 0, mdb->errmsg); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + sql_free_result(mdb); + fsr->FileSetId = atoi(row[0]); + V(mdb->mutex); + return 1; + } + sql_free_result(mdb); + } + + /* Must create it */ + Mmsg(&mdb->cmd, "INSERT INTO FileSet (FileSet, MD5) VALUES \ +(\"%s\", \"%s\")", fsr->FileSet, fsr->MD5); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create DB FileSet record %s failed. ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + fsr->FileSetId = 0; + stat = 0; + } else { + fsr->FileSetId = sql_insert_id(mdb); + stat = 1; + } + + V(mdb->mutex); + return stat; +} + + +/* + * struct stat + * { + * dev_t st_dev; * device * + * ino_t st_ino; * inode * + * mode_t st_mode; * protection * + * nlink_t st_nlink; * number of hard links * + * uid_t st_uid; * user ID of owner * + * gid_t st_gid; * group ID of owner * + * dev_t st_rdev; * device type (if inode device) * + * off_t st_size; * total size, in bytes * + * unsigned long st_blksize; * blocksize for filesystem I/O * + * unsigned long st_blocks; * number of blocks allocated * + * time_t st_atime; * time of last access * + * time_t st_mtime; * time of last modification * + * time_t st_ctime; * time of last inode change * + * }; + */ + + + +/* + * Create File record in B_DB + * + * In order to reduce database size, we store the File attributes, + * the FileName, and the Path separately. In principle, there + * is a single FileName record and a single Path record, no matter + * how many times it occurs. This is this subroutine, we separate + * the file and the path and create three database records. + */ +int db_create_file_attributes_record(B_DB *mdb, ATTR_DBR *ar) +{ + int fnl, pnl; + char *l, *p; + /* ****FIXME***** malloc these */ + char file[MAXSTRING]; + char spath[MAXSTRING]; + char buf[MAXSTRING]; + + Dmsg1(100, "Fname=%s\n", ar->fname); + Dmsg0(50, "put_file_into_catalog\n"); + /* For the moment, we only handle Unix attributes. Note, we are + * also getting any MD5 signature that was computed. + */ + if (ar->Stream != STREAM_UNIX_ATTRIBUTES) { + Mmsg0(&mdb->errmsg, _("Attempt to put non-attributes into catalog\n")); + return 0; + } + + /* Find path without the filename. + * I.e. everything after the last / is a "filename". + * OK, maybe it is a directory name, but we treat it like + * a filename. If we don't find a / then the whole name + * must be a path name (e.g. c:). + */ + for (p=l=ar->fname; *p; p++) { + if (*p == '/') { + l = p; /* set pos of last slash */ + } + } + if (*l == '/') { /* did we find a slash? */ + l++; /* yes, point to filename */ + } else { /* no, whole thing must be path name */ + l = p; + } + + /* If filename doesn't exist (i.e. root directory), we + * simply create a blank name consisting of a single + * space. This makes handling zero length filenames + * easier. + */ + fnl = p - l; + if (fnl > 255) { + Emsg1(M_WARNING, 0, _("Filename truncated to 255 chars: %s\n"), l); + fnl = 255; + } + if (fnl > 0) { + strncpy(file, l, fnl); /* copy filename */ + file[fnl] = 0; + } else { + file[0] = ' '; /* blank filename */ + file[1] = 0; + } + + pnl = l - ar->fname; + if (pnl > 255) { + Emsg1(M_WARNING, 0, _("Path name truncated to 255 chars: %s\n"), ar->fname); + pnl = 255; + } + strncpy(spath, ar->fname, pnl); + spath[pnl] = 0; + + if (pnl == 0) { + Mmsg1(&mdb->errmsg, _("Path length is zero. File=%s\n"), ar->fname); + Emsg0(M_ERROR, 0, mdb->errmsg); + spath[0] = ' '; + spath[1] = 0; + } + + Dmsg1(100, "spath=%s\n", spath); + Dmsg1(100, "file=%s\n", file); + + db_escape_string(buf, file, fnl); + + if (!db_create_filename_record(mdb, ar, buf)) { + return 0; + } + Dmsg1(100, "db_create_filename_record: %s\n", buf); + + db_escape_string(buf, spath, pnl); + + if (!db_create_path_record(mdb, ar, buf)) { + return 0; + } + Dmsg1(100, "db_create_path_record\n", buf); + + if (!db_create_file_record(mdb, ar)) { + return 0; + } + Dmsg0(50, "db_create_file_record\n"); + + Dmsg3(100, "Path=%s File=%s FilenameId=%d\n", spath, file, ar->FilenameId); + + return 1; +} + +static int db_create_file_record(B_DB *mdb, ATTR_DBR *ar) +{ + int stat; + + P(mdb->mutex); + /* Must create it */ + Mmsg(&mdb->cmd, +"INSERT INTO File (FileIndex, JobId, PathId, FilenameId, \ +LStat, MD5) VALUES (%d, %d, %d, %d, \"%s\", \" \")", + (int)ar->FileIndex, ar->JobId, ar->PathId, ar->FilenameId, + ar->attr); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create db File record %s failed. ERR=%s"), + mdb->cmd, sql_strerror(mdb)); + Emsg1(M_ERROR, 0, "%s", mdb->errmsg); + ar->FileId = 0; + stat = 0; + } else { + ar->FileId = sql_insert_id(mdb); + stat = 1; + } + V(mdb->mutex); + return stat; +} + +/* Create a Unique record for the Path -- no duplicates */ +static int db_create_path_record(B_DB *mdb, ATTR_DBR *ar, char *path) +{ + SQL_ROW row; + static uint32_t cached_id = 0; + static char cached_path[MAXSTRING]; + int stat; + + if (*path == 0) { + Mmsg0(&mdb->errmsg, _("Null path given to db_create_path_record\n")); + Emsg0(M_ERROR, 0, mdb->errmsg); + ar->PathId = 0; + return 0; + } + + P(mdb->mutex); + + if (cached_id != 0 && strcmp(cached_path, path) == 0) { + ar->PathId = cached_id; + V(mdb->mutex); + return 1; + } + + Mmsg(&mdb->cmd, "SELECT PathId FROM Path WHERE Path=\"%s\"", path); + + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + if (mdb->num_rows > 1) { + Mmsg2(&mdb->errmsg, _("More than one Path!: %" lld " for Path=%s\n"), + mdb->num_rows, path); + Emsg1(M_ERROR, 0, "%s", mdb->errmsg); + Emsg1(M_ERROR, 0, "%s\n", mdb->cmd); + } + if (mdb->num_rows >= 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + V(mdb->mutex); + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + Emsg0(M_ERROR, 0, mdb->errmsg); + sql_free_result(mdb); + ar->PathId = 0; + return 0; + } + sql_free_result(mdb); + ar->PathId = atoi(row[0]); + if (ar->PathId != cached_id) { + cached_id = ar->PathId; + strncpy(cached_path, path, sizeof(cached_path)); + cached_path[sizeof(cached_path)-1] = 0; + } + V(mdb->mutex); + return 1; + } + + sql_free_result(mdb); + } + + Mmsg(&mdb->cmd, "INSERT INTO Path (Path) VALUES (\"%s\")", path); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create db Path record %s failed. ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + Emsg1(M_ERROR, 0, "%s", mdb->errmsg); + ar->PathId = 0; + stat = 0; + } else { + ar->PathId = sql_insert_id(mdb); + stat = 1; + } + + if (ar->PathId != cached_id) { + cached_id = ar->PathId; + strncpy(cached_path, path, sizeof(cached_path)); + cached_path[sizeof(cached_path)-1] = 0; + } + V(mdb->mutex); + return stat; +} + +/* Create a Unique record for the filename -- no duplicates */ +static int db_create_filename_record(B_DB *mdb, ATTR_DBR *ar, char *fname) +{ + SQL_ROW row; + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name=\"%s\"", fname); + + if (QUERY_DB(mdb, mdb->cmd)) { + mdb->num_rows = sql_num_rows(mdb); + if (mdb->num_rows > 1) { + Mmsg2(&mdb->errmsg, _("More than one Filename!: %d File=%s\n"), + (int)(mdb->num_rows), fname); + Emsg1(M_ERROR, 0, "%s", mdb->errmsg); + Emsg1(M_ERROR, 0, "%s\n", mdb->cmd); + } + if (mdb->num_rows >= 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg2(&mdb->errmsg, _("error fetching row for file=%s: ERR=%s\n"), + fname, sql_strerror(mdb)); + sql_free_result(mdb); + V(mdb->mutex); + Emsg0(M_ERROR, 0, mdb->errmsg); + ar->FilenameId = 0; + return 0; + } + sql_free_result(mdb); + ar->FilenameId = atoi(row[0]); + V(mdb->mutex); + return 1; + } + sql_free_result(mdb); + } + + Mmsg(&mdb->cmd, "INSERT INTO Filename (Name) \ +VALUES (\"%s\")", fname); + + if (!INSERT_DB(mdb, mdb->cmd)) { + Mmsg2(&mdb->errmsg, _("Create db Filename record %s failed. ERR=%s\n"), + mdb->cmd, sql_strerror(mdb)); + Emsg1(M_ERROR, 0, "%s", mdb->errmsg); + ar->FilenameId = 0; + stat = 0; + } else { + ar->FilenameId = sql_insert_id(mdb); + stat = 1; + } + + V(mdb->mutex); + return stat; +} + +#endif /* HAVE_MYSQL || HAVE_SQLITE */ diff --git a/bacula/src/cats/sql_delete.c b/bacula/src/cats/sql_delete.c new file mode 100644 index 0000000000..5fd896af9f --- /dev/null +++ b/bacula/src/cats/sql_delete.c @@ -0,0 +1,132 @@ +/* + * Bacula Catalog Database Delete record interface routines + * + * Kern Sibbald, December 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* *****FIXME**** fix fixed length of select_cmd[] and insert_cmd[] */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + + +#if HAVE_MYSQL || HAVE_SQLITE +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ + +/* Imported subroutines */ +extern void print_dashes(B_DB *mdb); +extern void print_result(B_DB *mdb); +extern int QueryDB(char *file, int line, B_DB *db, char *select_cmd); +extern int DeleteDB(char *file, int line, B_DB *db, char *delete_cmd); + +/* + * Delete Pool record, must also delete all associated + * Media records. + * + * Returns: 0 on error + * 1 on success + * PoolId = number of Pools deleted (should be 1) + * NumVols = number of Media records deleted + */ +int +db_delete_pool_record(B_DB *mdb, POOL_DBR *pr) +{ + SQL_ROW row; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT PoolId FROM Pool WHERE Name=\"%s\"", pr->Name); + Dmsg1(10, "selectpool: %s\n", mdb->cmd); + + pr->PoolId = pr->NumVols = 0; + + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + if (mdb->num_rows == 0) { + Mmsg(&mdb->errmsg, _("No pool record %s exists\n"), pr->Name); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } else if (mdb->num_rows != 1) { + Mmsg(&mdb->errmsg, _("Expecting one pool record, got %d\n"), mdb->num_rows); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + if ((row = sql_fetch_row(mdb)) == NULL) { + V(mdb->mutex); + Emsg1(M_ABORT, 0, _("Error fetching row %s\n"), sql_strerror(mdb)); + } + pr->PoolId = atoi(row[0]); + sql_free_result(mdb); + } + + /* Delete Media owned by this pool */ + Mmsg(&mdb->cmd, +"DELETE FROM Media WHERE Media.PoolId = %d", pr->PoolId); + + pr->NumVols = DELETE_DB(mdb, mdb->cmd); + Dmsg1(200, "Deleted %d Media records\n", pr->NumVols); + + /* Delete Pool */ + Mmsg(&mdb->cmd, +"DELETE FROM Pool WHERE Pool.PoolId = %d", pr->PoolId); + pr->PoolId = DELETE_DB(mdb, mdb->cmd); + Dmsg1(200, "Deleted %d Pool records\n", pr->PoolId); + + V(mdb->mutex); + return 1; +} + + +/* Delete Media record */ +int db_delete_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + + P(mdb->mutex); + if (mr->MediaId == 0) { + Mmsg(&mdb->cmd, "DELETE FROM Media WHERE VolumeName=\"%s\"", + mr->VolumeName); + } else { + Mmsg(&mdb->cmd, "DELETE FROM Media WHERE MediaId=%d", + mr->MediaId); + } + + mr->MediaId = DELETE_DB(mdb, mdb->cmd); + + V(mdb->mutex); + return 1; +} + +#endif /* HAVE_MYSQL || HAVE_SQLITE */ diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c new file mode 100644 index 0000000000..d49efab49a --- /dev/null +++ b/bacula/src/cats/sql_find.c @@ -0,0 +1,243 @@ +/* + * Bacula Catalog Database Find record interface routines + * + * Note, generally, these routines are more complicated + * that a simple search by name or id. Such simple + * request are in get.c + * + * Kern Sibbald, December 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* *****FIXME**** fix fixed length of select_cmd[] and insert_cmd[] */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#if HAVE_MYSQL || HAVE_SQLITE + +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ + +/* Imported subroutines */ +extern void print_result(B_DB *mdb); +extern int QueryDB(char *file, int line, B_DB *db, char *select_cmd); + + +/* Find job start time. Used to find last full save + * for Incremental and Differential saves. + * + * Returns: 0 on failure + * 1 on success, jr is unchanged, but stime is set + */ +int +db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime) +{ + SQL_ROW row; + int JobId; + + strcpy(stime, "0000-00-00 00:00:00"); /* default */ + P(mdb->mutex); + /* If no Id given, we must find corresponding job */ + if (jr->JobId == 0) { + /* Differential is since last Full backup */ + if (jr->Level == L_DIFFERENTIAL) { + Mmsg(&mdb->cmd, +"SELECT JobId from Job WHERE JobStatus='T' and Type='%c' and \ +Level='%c' and Name=\"%s\" and ClientId=%d and FileSetId=%d \ +ORDER by StartTime DESC LIMIT 1", + jr->Type, L_FULL, jr->Name, jr->ClientId, jr->FileSetId); + /* Incremental is since last Full, Incremental, or Differential */ + } else if (jr->Level == L_INCREMENTAL) { + Mmsg(&mdb->cmd, +"SELECT JobId from Job WHERE JobStatus='T' and Type='%c' and \ +(Level='%c' or Level='%c' or Level='%c') and Name=\"%s\" and ClientId=%d \ +ORDER by StartTime DESC LIMIT 1", + jr->Type, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name, + jr->ClientId); + } else { + Mmsg1(&mdb->errmsg, _("Unknown level=%d\n"), jr->Level); + Emsg0(M_ERROR, 0, mdb->errmsg); + V(mdb->mutex); + return 0; + } + Dmsg1(100, "Submitting: %s\n", mdb->cmd); + if (!QUERY_DB(mdb, mdb->cmd)) { + Emsg1(M_ERROR, 0, _("Query error for start time request: %s\n"), mdb->cmd); + V(mdb->mutex); + return 0; + } + if ((row = sql_fetch_row(mdb)) == NULL) { + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + JobId = atoi(row[0]); + sql_free_result(mdb); + } else { + JobId = jr->JobId; /* search for particular id */ + } + + Dmsg1(100, "Submitting: %s\n", mdb->cmd); + Mmsg(&mdb->cmd, "SELECT StartTime from Job WHERE Job.JobId=%d", JobId); + + if (!QUERY_DB(mdb, mdb->cmd)) { + Emsg1(M_ERROR, 0, _("Query error for start time request: %s\n"), mdb->cmd); + V(mdb->mutex); + return 0; + } + + if ((row = sql_fetch_row(mdb)) == NULL) { + *stime = 0; /* set EOS */ + Emsg2(M_ERROR, 0, _("No Job found for JobId=%d: %s\n"), JobId, sql_strerror(mdb)); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + Dmsg1(100, "Got start time: %s\n", row[0]); + strcpy(stime, row[0]); + + sql_free_result(mdb); + + V(mdb->mutex); + return 1; +} + +/* + * Find JobId of last full verify + * Returns: 1 on success + * 0 on failure + */ +int +db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr) +{ + SQL_ROW row; + + /* Find last full */ + P(mdb->mutex); + if (jr->Level != L_VERIFY_CATALOG) { + Emsg2(M_FATAL, 0, _("Expecting Level=%c, got %c\n"), L_VERIFY_CATALOG, jr->Level); + return 0; + } + Mmsg(&mdb->cmd, +"SELECT JobId from Job WHERE Type='%c' and Level='%c' and Name=\"%s\" and \ +ClientId=%d ORDER by StartTime DESC LIMIT 1", + JT_VERIFY, L_VERIFY_INIT, jr->Name, jr->ClientId); + + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return 0; + } + if ((row = sql_fetch_row(mdb)) == NULL) { + Emsg0(M_FATAL, 0, _("No Job found for last full verify.\n")); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + + jr->JobId = atoi(row[0]); + sql_free_result(mdb); + + Dmsg1(100, "db_get_last_full_verify: got JobId=%d\n", jr->JobId); + if (jr->JobId <= 0) { + Emsg1(M_FATAL, 0, _("No Verify Job found for: %s\n"), mdb->cmd); + V(mdb->mutex); + return 0; + } + + V(mdb->mutex); + return 1; +} + +/* + * Find Available Media (Volume) for Pool + * + * Find a Volume for a given PoolId, MediaType, and Status. + * + * Returns: 0 on failure + * numrows on success + */ +int +db_find_next_volume(B_DB *mdb, int item, MEDIA_DBR *mr) +{ + SQL_ROW row; + int numrows; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,\ +VolBytes,VolMounts,VolErrors,VolWrites,VolMaxBytes,VolCapacityBytes \ +FROM Media WHERE PoolId=%d AND MediaType=\"%s\" AND VolStatus=\"%s\" \ +ORDER BY MediaId", mr->PoolId, mr->MediaType, mr->VolStatus); + + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return 0; + } + + numrows = sql_num_rows(mdb); + if (item > numrows) { + V(mdb->mutex); + return 0; + } + + /* Seek to desired item + * Note, we use base 1; SQL uses base 0 + */ + sql_data_seek(mdb, item-1); + + if ((row = sql_fetch_row(mdb)) == NULL) { + Emsg1(M_ERROR, 0, _("No media record found for item %d.\n"), item); + sql_free_result(mdb); + V(mdb->mutex); + return 0; + } + + /* Return fields in Media Record */ + mr->MediaId = atoi(row[0]); + strcpy(mr->VolumeName, row[1]); + mr->VolJobs = atoi(row[2]); + mr->VolFiles = atoi(row[3]); + mr->VolBlocks = atoi(row[4]); + mr->VolBytes = (uint64_t)strtod(row[5], NULL); + mr->VolMounts = atoi(row[6]); + mr->VolErrors = atoi(row[7]); + mr->VolWrites = atoi(row[8]); + mr->VolMaxBytes = (uint64_t)strtod(row[9], NULL); + mr->VolCapacityBytes = (uint64_t)strtod(row[10], NULL); + + sql_free_result(mdb); + + V(mdb->mutex); + return numrows; +} + + +#endif /* HAVE_MYSQL || HAVE_SQLITE */ diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c new file mode 100644 index 0000000000..a50a179259 --- /dev/null +++ b/bacula/src/cats/sql_get.c @@ -0,0 +1,585 @@ +/* + * Bacula Catalog Database Get record interface routines + * Note, these routines generally get a record by id or + * by name. If more logic is involved, the routine + * should be in find.c + * + * Kern Sibbald, March 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* *****FIXME**** fix fixed length of select_cmd[] and insert_cmd[] */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#if HAVE_MYSQL || HAVE_SQLITE + +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ + +/* Forward referenced functions */ +static int db_get_file_record(B_DB *mdb, FILE_DBR *fdbr); +static int db_get_filename_record(B_DB *mdb, char *fname); +static int db_get_path_record(B_DB *mdb, char *path); + + +/* Imported subroutines */ +extern void print_result(B_DB *mdb); +extern int QueryDB(char *file, int line, B_DB *db, char *select_cmd); + + +/* + * Given a full filename (with path), look up the File record + * (with attributes) in the database. + * + * Returns: 0 on failure + * 1 on success with the File record in FILE_DBR + */ +int db_get_file_attributes_record(B_DB *mdb, char *fname, FILE_DBR *fdbr) +{ + int fnl, pnl; + char *l, *p; + uint64_t id; + char file[MAXSTRING]; + char spath[MAXSTRING]; + char buf[MAXSTRING]; + Dmsg0(20, "get_file_from_catalog\n"); + + /* Find path without the filename */ + for (p=l=fname; *p; p++) { + if (*p == '/') { + l = p; + } + } + if (*l == '/') { + l++; + } + + fnl = p - l; + strcpy(file, l); + + pnl = l - fname; + strncpy(spath, fname, pnl); + spath[l-fname] = 0; + + if (pnl == 0) { + return 0; + } + + strip_trailing_junk(spath); + Dmsg1(50, "spath=%s\n", spath); + + strip_trailing_junk(file); + Dmsg1(50, "file=%s\n", file); + + db_escape_string(buf, file, fnl); + fdbr->FilenameId = db_get_filename_record(mdb, buf); + Dmsg1(50, "db_get_filename_record FilenameId=%d\n", fdbr->FilenameId); + + db_escape_string(buf, spath, pnl); + fdbr->PathId = db_get_path_record(mdb, buf); + Dmsg1(50, "db_get_path_record PathId=%d\n", fdbr->PathId); + + id = db_get_file_record(mdb, fdbr); + + return id; +} + + + +/* Get a File record + * Returns: 0 on failure + * 1 on success + */ +static +int db_get_file_record(B_DB *mdb, FILE_DBR *fdbr) +{ + SQL_ROW row; + + P(mdb->mutex); + Mmsg(&mdb->cmd, +"SELECT FileId, LStat, MD5 from File where File.JobId=%d and File.PathId=%d and \ +File.FilenameId=%d", fdbr->JobId, fdbr->PathId, fdbr->FilenameId); + + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + /* + * Note, we can find more than one File record with the same + * filename if the file is linked. ???????? + */ + if (mdb->num_rows > 1) { + Emsg1(M_WARNING, 0, _("get_file_record want 1 got rows=%d\n"), mdb->num_rows); + Emsg1(M_WARNING, 0, "%s\n", mdb->cmd); + } + if (mdb->num_rows >= 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Emsg1(M_ERROR, 0, "Error fetching row: %s\n", sql_strerror(mdb)); + } else { + fdbr->FileId = (FileId_t)strtod(row[0], NULL); + strncpy(fdbr->LStat, row[1], sizeof(fdbr->LStat)); + fdbr->LStat[sizeof(fdbr->LStat)] = 0; + strncpy(fdbr->MD5, row[2], sizeof(fdbr->MD5)); + fdbr->MD5[sizeof(fdbr->MD5)] = 0; + sql_free_result(mdb); + V(mdb->mutex); + return 1; + } + } + + sql_free_result(mdb); + } + V(mdb->mutex); + return 0; /* failed */ + +} + +/* Get Filename record + * Returns: 0 on failure + * FilenameId on success + */ +static int db_get_filename_record(B_DB *mdb, char *fname) +{ + SQL_ROW row; + int FilenameId; + + if (*fname == 0) { + Mmsg0(&mdb->errmsg, _("Null name given to db_get_filename_record\n")); + Emsg0(M_ABORT, 0, mdb->errmsg); + } + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name=\"%s\"", fname); + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + if (mdb->num_rows > 1) { + Mmsg1(&mdb->errmsg, _("More than one Filename!: %d\n"), (int)(mdb->num_rows)); + Emsg0(M_FATAL, 0, mdb->errmsg); + } else if (mdb->num_rows == 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + Emsg0(M_FATAL, 0, mdb->errmsg); + } + FilenameId = atoi(row[0]); + if (FilenameId <= 0) { + Mmsg2(&mdb->errmsg, _("Create db Filename record %s found bad record: %d\n"), + mdb->cmd, FilenameId); + Emsg0(M_ERROR, 0, mdb->errmsg); + } + sql_free_result(mdb); + V(mdb->mutex); + return FilenameId; + + } + sql_free_result(mdb); + } + V(mdb->mutex); + return 0; /* failed */ +} + +/* Get path record + * Returns: 0 on failure + * PathId on success + */ +static int db_get_path_record(B_DB *mdb, char *path) +{ + SQL_ROW row; + int PathId; + /*******FIXME***** move into mdb record and allocate */ + static int cached_id = 0; + static char cached_path[MAXSTRING]; + + if (*path == 0) { + Emsg0(M_ABORT, 0, _("Null path given to db_get_path_record\n")); + } + if (cached_id != 0 && strcmp(cached_path, path) == 0) { + return cached_id; + } + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT PathId FROM Path WHERE Path=\"%s\"", path); + + if (QUERY_DB(mdb, mdb->cmd)) { + + mdb->num_rows = sql_num_rows(mdb); + + if (mdb->num_rows > 1) { + Mmsg1(&mdb->errmsg, _("More than one Path!: %" lld "\n"), mdb->num_rows); + Emsg0(M_FATAL, 0, mdb->errmsg); + } else if (mdb->num_rows == 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + Emsg0(M_FATAL, 0, mdb->errmsg); + } + PathId = atoi(row[0]); + if (PathId != cached_id) { + cached_id = PathId; + strcpy(cached_path, path); + } + sql_free_result(mdb); + V(mdb->mutex); + return PathId; + } + + sql_free_result(mdb); + } + V(mdb->mutex); + return 0; /* failed */ +} + + +/* + * Get Job record for given JobId or Job name + * Returns: 0 on failure + * 1 on success + */ +int db_get_job_record(B_DB *mdb, JOB_DBR *jr) +{ + SQL_ROW row; + + P(mdb->mutex); + if (jr->JobId == 0) { + Mmsg(&mdb->cmd, "SELECT VolSessionId, VolSessionTime, \ +PoolId, StartTime, EndTime, JobFiles, JobBytes, Job \ +FROM Job WHERE Job=\"%s\"", jr->Job); + } else { + Mmsg(&mdb->cmd, "SELECT VolSessionId, VolSessionTime, \ +PoolId, StartTime, EndTime, JobFiles, JobBytes, Job \ +FROM Job WHERE JobId=%d", jr->JobId); + } + + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return 0; /* failed */ + } + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("No Job found for JobId %d\n"), jr->JobId); + sql_free_result(mdb); + V(mdb->mutex); + return 0; /* failed */ + } + + jr->VolSessionId = atol(row[0]); + jr->VolSessionTime = atol(row[1]); + jr->PoolId = atoi(row[2]); + strcpy(jr->cStartTime, row[3]); + strcpy(jr->cEndTime, row[4]); + jr->JobFiles = atol(row[5]); + jr->JobBytes = (uint64_t)strtod(row[6], NULL); + strcpy(jr->Job, row[7]); + sql_free_result(mdb); + + V(mdb->mutex); + return 1; +} + +/* + * Find VolumeNames for a give JobId + * Returns: 0 on error or no Volumes found + * number of volumes on success + * Volumes are concatenated in VolumeNames + * separated by a vertical bar (|). + */ +int db_get_job_volume_names(B_DB *mdb, uint32_t JobId, char *VolumeNames) +{ + SQL_ROW row; + int stat = 0; + int i; + + P(mdb->mutex); + Mmsg(&mdb->cmd, +"SELECT VolumeName FROM JobMedia,Media WHERE JobMedia.JobId=%d \ +AND JobMedia.MediaId=Media.MediaId", JobId); + + Dmsg1(130, "VolNam=%s\n", mdb->cmd); + VolumeNames[0] = 0; + if (QUERY_DB(mdb, mdb->cmd)) { + mdb->num_rows = sql_num_rows(mdb); + Dmsg1(130, "Num rows=%d\n", mdb->num_rows); + if (mdb->num_rows <= 0) { + Mmsg1(&mdb->errmsg, _("No volumes found for JobId=%d"), JobId); + stat = 0; + } else { + stat = mdb->num_rows; + for (i=0; i < stat; i++) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg2(&mdb->errmsg, _("Error fetching row %d: ERR=%s\n"), i, sql_strerror(mdb)); + stat = 0; + break; + } else { + if (VolumeNames[0] != 0) { + strcat(VolumeNames, "|"); + } + strcat(VolumeNames, row[0]); + } + } + } + sql_free_result(mdb); + } + V(mdb->mutex); + return stat; +} + + +/* + * Get the number of pool records + * + * Returns: -1 on failure + * number on success + */ +int db_get_num_pool_records(B_DB *mdb) +{ + int stat = 0; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT count(*) from Pool"); + stat = get_sql_record_max(mdb); + V(mdb->mutex); + return stat; +} + +/* + * This function returns a list of all the Pool record ids. + * The caller must free ids if non-NULL. + * + * Returns 0: on failure + * 1: on success + */ +int db_get_pool_ids(B_DB *mdb, int *num_ids, uint32_t *ids[]) +{ + SQL_ROW row; + int stat = 0; + int i = 0; + uint32_t *id; + + P(mdb->mutex); + *ids = NULL; + Mmsg(&mdb->cmd, "SELECT PoolId FROM Pool"); + if (QUERY_DB(mdb, mdb->cmd)) { + *num_ids = sql_num_rows(mdb); + if (*num_ids > 0) { + id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t)); + while ((row = sql_fetch_row(mdb)) != NULL) { + id[i++] = (uint32_t)atoi(row[0]); + } + *ids = id; + } + sql_free_result(mdb); + stat = 1; + } else { + Mmsg(&mdb->errmsg, _("Pool id select failed: ERR=%s\n"), sql_strerror(mdb)); + stat = 0; + } + V(mdb->mutex); + return stat; +} + + +/* Get Pool Record + * If the PoolId is non-zero, we get its record, + * otherwise, we search on the PoolName + * + * Returns: 0 on failure + * id on success + */ +int db_get_pool_record(B_DB *mdb, POOL_DBR *pdbr) +{ + SQL_ROW row; + int stat = 0; + + P(mdb->mutex); + if (pdbr->PoolId != 0) { /* find by id */ + Mmsg(&mdb->cmd, +"SELECT PoolId, Name, NumVols, MaxVols, UseOnce, UseCatalog, AcceptAnyVolume, \ +PoolType, LabelFormat FROM Pool WHERE Pool.PoolId=%d", pdbr->PoolId); + } else { /* find by name */ + Mmsg(&mdb->cmd, +"SELECT PoolId, Name, NumVols, MaxVols, UseOnce, UseCatalog, AcceptAnyVolume, \ +PoolType, LabelFormat FROM Pool WHERE Pool.Name=\"%s\"", pdbr->Name); + } + + if (QUERY_DB(mdb, mdb->cmd)) { + mdb->num_rows = sql_num_rows(mdb); + if (mdb->num_rows > 1) { + Mmsg1(&mdb->errmsg, _("More than one Pool!: %" lld "\n"), mdb->num_rows); + Emsg0(M_ERROR, 0, mdb->errmsg); + } else if (mdb->num_rows == 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + Emsg0(M_ERROR, 0, mdb->errmsg); + } else { + pdbr->PoolId = atoi(row[0]); + strcpy(pdbr->Name, row[1]); + pdbr->NumVols = atoi(row[2]); + pdbr->MaxVols = atoi(row[3]); + pdbr->UseOnce = atoi(row[4]); + pdbr->UseCatalog = atoi(row[5]); + pdbr->AcceptAnyVolume = atoi(row[6]); + strcpy(pdbr->PoolType, row[7]); + if (row[8]) { + strcpy(pdbr->LabelFormat, row[8]); + } else { + pdbr->LabelFormat[0] = 0; + } + stat = pdbr->PoolId; + } + } + sql_free_result(mdb); + } + V(mdb->mutex); + return stat; +} + + +/* + * Get the number of Media records + * + * Returns: -1 on failure + * number on success + */ +int db_get_num_media_records(B_DB *mdb) +{ + int stat = 0; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "SELECT count(*) from Media"); + stat = get_sql_record_max(mdb); + V(mdb->mutex); + return stat; +} + + +/* + * This function returns a list of all the Media record ids. + * The caller must free ids if non-NULL. + * + * Returns 0: on failure + * 1: on success + */ +int db_get_media_ids(B_DB *mdb, int *num_ids, uint32_t *ids[]) +{ + SQL_ROW row; + int stat = 0; + int i = 0; + uint32_t *id; + + P(mdb->mutex); + *ids = NULL; + Mmsg(&mdb->cmd, "SELECT MediaId FROM Media"); + if (QUERY_DB(mdb, mdb->cmd)) { + *num_ids = sql_num_rows(mdb); + if (*num_ids > 0) { + id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t)); + while ((row = sql_fetch_row(mdb)) != NULL) { + id[i++] = (uint32_t)atoi(row[0]); + } + *ids = id; + } + sql_free_result(mdb); + stat = 1; + } else { + Mmsg(&mdb->errmsg, _("Media id select failed: ERR=%s\n"), sql_strerror(mdb)); + stat = 0; + } + V(mdb->mutex); + return stat; +} + + +/* Get Media Record + * + * Returns: 0 on failure + * id on success + */ +int db_get_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + SQL_ROW row; + int stat = 0; + + P(mdb->mutex); + if (mr->MediaId == 0 && mr->VolumeName[0] == 0) { + Mmsg(&mdb->cmd, "SELECT count(*) from Media"); + mr->MediaId = get_sql_record_max(mdb); + V(mdb->mutex); + return 1; + } + if (mr->MediaId != 0) { /* find by id */ + Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,\ +VolBytes,VolMounts,VolErrors,VolWrites,VolMaxBytes,VolCapacityBytes,\ +MediaType,VolStatus,PoolId \ +FROM Media WHERE MediaId=%d", mr->MediaId); + } else { /* find by name */ + Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,\ +VolBytes,VolMounts,VolErrors,VolWrites,VolMaxBytes,VolCapacityBytes,\ +MediaType,VolStatus,PoolId \ +FROM Media WHERE VolumeName=\"%s\"", mr->VolumeName); + } + + if (QUERY_DB(mdb, mdb->cmd)) { + mdb->num_rows = sql_num_rows(mdb); + if (mdb->num_rows > 1) { + Mmsg1(&mdb->errmsg, _("More than one Volume!: %" lld "\n"), mdb->num_rows); + Emsg0(M_ERROR, 0, mdb->errmsg); + } else if (mdb->num_rows == 1) { + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb)); + Emsg0(M_ERROR, 0, mdb->errmsg); + } else { + /* return values */ + mr->MediaId = atoi(row[0]); + strcpy(mr->VolumeName, row[1]); + mr->VolJobs = atoi(row[2]); + mr->VolFiles = atoi(row[3]); + mr->VolBlocks = atoi(row[4]); + mr->VolBytes = (uint64_t)strtod(row[5], NULL); + mr->VolMounts = atoi(row[6]); + mr->VolErrors = atoi(row[7]); + mr->VolWrites = atoi(row[8]); + mr->VolMaxBytes = (uint64_t)strtod(row[9], NULL); + mr->VolCapacityBytes = (uint64_t)strtod(row[10], NULL); + strcpy(mr->MediaType, row[11]); + strcpy(mr->VolStatus, row[12]); + mr->PoolId = atoi(row[13]); + stat = mr->MediaId; + } + } + sql_free_result(mdb); + } + V(mdb->mutex); + return stat; +} + + +#endif /* HAVE_MYSQL || HAVE_SQLITE */ diff --git a/bacula/src/cats/sql_list.c b/bacula/src/cats/sql_list.c new file mode 100644 index 0000000000..a6757a83b7 --- /dev/null +++ b/bacula/src/cats/sql_list.c @@ -0,0 +1,227 @@ +/* + * Bacula Catalog Database List records interface routines + * + * Kern Sibbald, March 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#if HAVE_MYSQL || HAVE_SQLITE + +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ + +/* Imported subroutines */ +extern void list_result(B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx); +extern int QueryDB(char *file, int line, B_DB *db, char *select_cmd); + + +/* + * Submit general SQL query + */ +int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx) +{ + P(mdb->mutex); + if (sql_query(mdb, query) != 0) { + Mmsg(&mdb->errmsg, _("Query failed: %s\n"), sql_strerror(mdb)); + sendit(ctx, mdb->errmsg); + V(mdb->mutex); + return 0; + } + + mdb->result = sql_store_result(mdb); + + if (mdb->result) { + list_result(mdb, sendit, ctx); + sql_free_result(mdb); + } + V(mdb->mutex); + return 1; +} + +void +db_list_pool_records(B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx) +{ + Mmsg(&mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat \ +FROM Pool"); + + P(mdb->mutex); + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + V(mdb->mutex); +} + +void +db_list_media_records(B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx) +{ + + Mmsg(&mdb->cmd, "SELECT VolumeName,MediaType,VolStatus,\ +VolBytes,LastWritten \ +FROM Media WHERE Media.PoolId=%d ORDER BY MediaId", mdbr->PoolId); + + P(mdb->mutex); + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + V(mdb->mutex); +} + +void db_list_jobmedia_records(B_DB *mdb, uint32_t JobId, DB_LIST_HANDLER *sendit, void *ctx) +{ + if (JobId > 0) { /* do by JobId */ + Mmsg(&mdb->cmd, "SELECT JobId, Media.VolumeName, FirstIndex, LastIndex \ +FROM JobMedia, Media WHERE Media.MediaId=JobMedia.MediaId and JobMedia.JobId=%d", + JobId); + } else { + Mmsg(&mdb->cmd, "SELECT JobId, Media.VolumeName, FirstIndex, LastIndex \ +FROM JobMedia, Media WHERE Media.MediaId=JobMedia.MediaId"); + } + + P(mdb->mutex); + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + V(mdb->mutex); +} + + + +/* + * List Job record(s) that match JOB_DBR + * + * Currently, we return all jobs or if jr->JobId is set, + * only the job with the specified id. + */ +void +db_list_job_records(B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx) +{ + + if (jr->JobId == 0 && jr->Job[0] == 0) { + Mmsg(&mdb->cmd, "SELECT JobId,Name,StartTime,Type,Level,\ +JobFiles,JobBytes,JobStatus FROM Job"); + } else { /* single record */ + Mmsg(&mdb->cmd, "SELECT JobId,Name,StartTime,Type,Level,\ +JobFiles,JobBytes,JobStatus FROM Job WHERE Job.JobId=%d", jr->JobId); + } + + P(mdb->mutex); + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + V(mdb->mutex); +} + +/* + * List Job totals + * + */ +void +db_list_job_totals(B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx) +{ + + + P(mdb->mutex); + + /* List by Job */ + Mmsg(&mdb->cmd, "SELECT count(*) AS Jobs, sum(JobFiles) \ +AS Files, sum(JobBytes) AS Bytes, Name AS Job FROM Job GROUP BY Name"); + + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + + /* Do Grand Total */ + Mmsg(&mdb->cmd, "SELECT count(*) AS Jobs,sum(JobFiles) \ +AS Files,sum(JobBytes) As Bytes FROM Job"); + + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + V(mdb->mutex); +} + + +void +db_list_files_for_job(B_DB *mdb, uint32_t jobid, DB_LIST_HANDLER *sendit, void *ctx) +{ + + Mmsg(&mdb->cmd, "SELECT Path.Path,Filename.Name FROM File,\ +Filename,Path WHERE File.JobId=%d and Filename.FilenameId=File.FilenameId \ +and Path.PathId=File.PathId", + jobid); + + P(mdb->mutex); + if (!QUERY_DB(mdb, mdb->cmd)) { + V(mdb->mutex); + return; + } + + list_result(mdb, sendit, ctx); + + sql_free_result(mdb); + V(mdb->mutex); +} + + +#endif /* HAVE_MYSQL || HAVE_SQLITE */ diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c new file mode 100644 index 0000000000..4a2183a63c --- /dev/null +++ b/bacula/src/cats/sql_update.c @@ -0,0 +1,214 @@ +/* + * Bacula Catalog Database Update record interface routines + * + * Kern Sibbald, March 2000 + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* *****FIXME**** fix fixed length of select_cmd[] and insert_cmd[] */ + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#if HAVE_MYSQL || HAVE_SQLITE + +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ + +/* Imported subroutines */ +extern void print_result(B_DB *mdb); +extern int UpdateDB(char *file, int line, B_DB *db, char *update_cmd); + +static int do_update(B_DB *mdb, char *cmd) +{ + int stat; + + stat = UPDATE_DB(mdb, cmd); + return stat; +} + +/* ----------------------------------------------------------------------- + * + * Generic Routines (or almost generic) + * + * ----------------------------------------------------------------------- + */ +/* Update the attributes record by adding the MD5 signature */ +int +db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5) +{ + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "UPDATE File SET MD5=\"%s\" WHERE FileId=%d", MD5, FileId); + stat = UPDATE_DB(mdb, mdb->cmd); + V(mdb->mutex); + return stat; +} + +/* Mark the file record as being visited during database + * verify compare. Stuff JobId into FileIndex field + */ +int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId) +{ + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, "UPDATE File SET FileIndex=%d WHERE FileId=%d", JobId, FileId); + stat = UPDATE_DB(mdb, mdb->cmd); + V(mdb->mutex); + return stat; +} + +/* + * Update the Job record at end of Job + * + * Returns: 0 on failure + * 1 on success + */ +int +db_update_job_start_record(B_DB *mdb, JOB_DBR *jr) +{ + char dt[MAX_TIME_LENGTH]; + time_t stime; + struct tm tm; + int32_t StartDay; + int stat; + + stime = jr->StartTime; + localtime_r(&stime, &tm); + strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm); + StartDay = (int32_t)(date_encode(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday) - + date_encode(2000, 1, 1)); + + P(mdb->mutex); + Mmsg(&mdb->cmd, "UPDATE Job SET Level='%c', StartTime=\"%s\", \ +ClientId=%d, StartDay=%d WHERE JobId=%d", + (char)(jr->Level), dt, jr->ClientId, StartDay, jr->JobId); + stat = UPDATE_DB(mdb, mdb->cmd); + V(mdb->mutex); + return stat; +} + + + +/* + * Update the Job record at end of Job + * + * Returns: 0 on failure + * 1 on success + */ +int +db_update_job_end_record(B_DB *mdb, JOB_DBR *jr) +{ + char dt[MAX_TIME_LENGTH]; + time_t ttime; + struct tm tm; + int stat; + + ttime = jr->EndTime; + localtime_r(&ttime, &tm); + strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm); + + P(mdb->mutex); + Mmsg(&mdb->cmd, + "UPDATE Job SET JobStatus='%c', EndTime='%s', \ +ClientId=%d, JobBytes=%" lld ", JobFiles=%d, JobErrors=%d, VolSessionId=%d, \ +VolSessionTime=%d, PoolId=%d, FileSetId=%d WHERE JobId=%d", + (char)(jr->JobStatus), dt, jr->ClientId, jr->JobBytes, jr->JobFiles, + jr->JobErrors, jr->VolSessionId, jr->VolSessionTime, + jr->PoolId, jr->FileSetId, jr->JobId); + + stat = UPDATE_DB(mdb, mdb->cmd); + V(mdb->mutex); + return stat; +} + + +int +db_update_pool_record(B_DB *mdb, POOL_DBR *pr) +{ + int stat; + + P(mdb->mutex); + Mmsg(&mdb->cmd, +"UPDATE Pool SET NumVols=%d, MaxVols=%d, UseOnce=%d, UseCatalog=%d, \ +AcceptAnyVolume=%d, LabelFormat=\"%s\" WHERE PoolId=%d", + pr->NumVols, pr->MaxVols, pr->UseOnce, pr->UseCatalog, + pr->AcceptAnyVolume, pr->LabelFormat, pr->PoolId); + + stat = UPDATE_DB(mdb, mdb->cmd); + V(mdb->mutex); + return stat; +} + +/* + * Update the Media Record at end of Session + * + * Returns: 0 on failure + * numrows on success + */ +int +db_update_media_record(B_DB *mdb, MEDIA_DBR *mr) +{ + char dt[MAX_TIME_LENGTH]; + time_t ttime; + struct tm tm; + int stat; + + ttime = mr->LastWritten; + localtime_r(&ttime, &tm); + strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm); + + P(mdb->mutex); + if (mr->VolMounts == 1) { + Mmsg(&mdb->cmd, "UPDATE Media SET FirstWritten=\"%s\" WHERE \ + VolumeName=\"%s\"", dt, mr->VolumeName); + if (do_update(mdb, mdb->cmd) == 0) { + V(mdb->mutex); + return 0; + } + } + + Mmsg(&mdb->cmd, "UPDATE Media SET VolJobs=%d,\ + VolFiles=%d, VolBlocks=%d, VolBytes=%" lld ", VolMounts=%d, VolErrors=%d,\ + VolWrites=%d, VolMaxBytes=%" lld ", LastWritten=\"%s\", VolStatus=\"%s\" \ + WHERE VolumeName=\"%s\"", + mr->VolJobs, mr->VolFiles, mr->VolBlocks, mr->VolBytes, mr->VolMounts, + mr->VolErrors, mr->VolWrites, mr->VolMaxBytes, dt, mr->VolStatus, + mr->VolumeName); + + stat = UPDATE_DB(mdb, mdb->cmd); + V(mdb->mutex); + return stat; +} + +#endif /* HAVE_MYSQL || HAVE_SQLITE */ diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c new file mode 100644 index 0000000000..b9a43ce64d --- /dev/null +++ b/bacula/src/cats/sqlite.c @@ -0,0 +1,445 @@ +/* + * Bacula Catalog Database routines specific to SQLite + * + * Kern Sibbald, January 2002 + */ + +/* + Copyright (C) 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +/* The following is necessary so that we do not include + * the dummy external definition of DB. + */ +#define __SQL_C /* indicate that this is sql.c */ + +#include "bacula.h" +#include "cats.h" + +#ifdef HAVE_SQLITE + +/* ----------------------------------------------------------------------- + * + * SQLite dependent defines and subroutines + * + * ----------------------------------------------------------------------- + */ + +extern char *working_directory; + +/* List of open databases */ +static BQUEUE db_list = {&db_list, &db_list}; + +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +int QueryDB(char *file, int line, B_DB *db, char *select_cmd); + + +/* + * Initialize database data structure. In principal this should + * never have errors, or it is really fatal. + */ +B_DB * +db_init_database(char *db_name, char *db_user, char *db_password) +{ + B_DB *mdb; + + P(mutex); /* lock DB queue */ + /* Look to see if DB already open */ + for (mdb=NULL; (mdb=(B_DB *)qnext(&db_list, &mdb->bq)); ) { + if (strcmp(mdb->db_name, db_name) == 0) { + Dmsg2(100, "DB REopen %d %s\n", mdb->ref_count, db_name); + mdb->ref_count++; + V(mutex); + return mdb; /* already open */ + } + } + Dmsg0(100, "db_open first time\n"); + mdb = (B_DB *) malloc(sizeof(B_DB)); + memset(mdb, 0, sizeof(B_DB)); + mdb->db_name = bstrdup(db_name); + mdb->have_insert_id = TRUE; + mdb->errmsg = (char *) get_pool_memory(PM_EMSG); /* get error message buffer */ + *mdb->errmsg = 0; + mdb->cmd = (char *) get_pool_memory(PM_EMSG); /* get command buffer */ + mdb->ref_count = 1; + qinsert(&db_list, &mdb->bq); /* put db in list */ + V(mutex); + return mdb; +} + +/* + * Now actually open the database. This can generate errors, + * which are returned in the errmsg + */ +int +db_open_database(B_DB *mdb) +{ + char *db_name; + int len; + struct stat statbuf; + + P(mutex); + if (mdb->connected) { + V(mutex); + return 1; + } + mdb->connected = FALSE; + if (pthread_mutex_init(&mdb->mutex, NULL) != 0) { + Mmsg1(&mdb->errmsg, _("Unable to initialize DB mutex. ERR=%s\n"), strerror(errno)); + V(mutex); + return 0; + } + + /* open the database */ + len = strlen(working_directory) + strlen(mdb->db_name) + 5; + db_name = (char *)malloc(len); + strcpy(db_name, working_directory); + strcat(db_name, "/"); + strcat(db_name, mdb->db_name); + strcat(db_name, ".db"); + if (stat(db_name, &statbuf) != 0) { + Mmsg1(&mdb->errmsg, _("Database %s does not exist, please create it.\n"), + db_name); + free(db_name); + V(mutex); + return 0; + } + mdb->db = sqlite_open( + db_name, /* database name */ + 644, /* mode */ + &mdb->sqlite_errmsg); /* error message */ + + Dmsg0(50, "sqlite_open\n"); + + if (mdb->db == NULL) { + Mmsg2(&mdb->errmsg, _("Unable to open Database=%s. ERR=%s\n"), + db_name, mdb->sqlite_errmsg ? mdb->sqlite_errmsg : _("unknown")); + free(db_name); + V(mutex); + return 0; + } + free(db_name); + mdb->connected = TRUE; + V(mutex); + return 1; +} + +void +db_close_database(B_DB *mdb) +{ + P(mutex); + mdb->ref_count--; + if (mdb->ref_count == 0) { + qdchain(&mdb->bq); + if (mdb->connected && mdb->db) { + sqlite_close(mdb->db); + } + pthread_mutex_destroy(&mdb->mutex); + free_pool_memory(mdb->errmsg); + free_pool_memory(mdb->cmd); + if (mdb->db_name) { + free(mdb->db_name); + } + free(mdb); + } + V(mutex); +} + +/* + * Return the next unique index (auto-increment) for + * the given table. Return NULL on error. + */ +char *db_next_index(B_DB *mdb, char *table) +{ + SQL_ROW row; + static char id[20]; + + QUERY_DB(mdb, "BEGIN TRANSACTION"); + sql_free_result(mdb); + + Mmsg(&mdb->cmd, +"SELECT id FROM NextId WHERE TableName=\"%s\"", table); + if (!QUERY_DB(mdb, mdb->cmd)) { + Mmsg(&mdb->errmsg, _("next_index query error: ERR=%s\n"), sql_strerror(mdb)); + QUERY_DB(mdb, "ROLLBACK"); + return NULL; + } + if ((row = sql_fetch_row(mdb)) == NULL) { + Mmsg(&mdb->errmsg, _("Error fetching index: ERR=%s\n"), sql_strerror(mdb)); + QUERY_DB(mdb, "ROLLBACK"); + return NULL; + } + strncpy(id, row[0], sizeof(id)); + id[sizeof(id)-1] = 0; + sql_free_result(mdb); + + Mmsg(&mdb->cmd, +"UPDATE NextId SET id=id+1 WHERE TableName=\"%s\"", table); + if (!QUERY_DB(mdb, mdb->cmd)) { + Mmsg(&mdb->errmsg, _("next_index update error: ERR=%s\n"), sql_strerror(mdb)); + QUERY_DB(mdb, "ROLLBACK"); + return NULL; + } + sql_free_result(mdb); + + QUERY_DB(mdb, "COMMIT"); + sql_free_result(mdb); + return id; +} + + + +void +db_escape_string(char *snew, char *old, int len) +{ + char *n, *o; + + n = snew; + o = old; + while (len--) { + switch (*o) { + case '\'': + *n++ = '\\'; + *n++ = '\''; + o++; + break; + case '"': + *n++ = '\\'; + *n++ = '"'; + o++; + break; + case 0: + *n++ = '\\'; + *n++ = 0; + o++; + break; + default: + *n++ = *o++; + break; + } + } + *n = 0; +} + +struct rh_data { + DB_RESULT_HANDLER *result_handler; + void *ctx; +}; + +/* + * Convert SQLite's callback into Bacula DB callback + */ +static int sqlite_result(void *arh_data, int num_fields, char **rows, char **col_names) +{ + struct rh_data *rh_data = (struct rh_data *)arh_data; + + if (rh_data->result_handler) { + (*(rh_data->result_handler))(rh_data->ctx, num_fields, rows); + } + return 0; +} + +/* + * Submit a general SQL command (cmd), and for each row returned, + * the sqlite_handler is called with the ctx. + */ +int db_sql_query(B_DB *mdb, char *query, DB_RESULT_HANDLER *result_handler, void *ctx) +{ + struct rh_data rh_data; + int stat; + + P(mdb->mutex); + if (mdb->sqlite_errmsg) { + actuallyfree(mdb->sqlite_errmsg); + mdb->sqlite_errmsg = NULL; + } + rh_data.result_handler = result_handler; + rh_data.ctx = ctx; + stat = sqlite_exec(mdb->db, query, sqlite_result, (void *)&rh_data, &mdb->sqlite_errmsg); + if (stat != 0) { + Mmsg(&mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb)); + V(mdb->mutex); + return 0; + } + V(mdb->mutex); + return 1; +} + +/* + * Submit a sqlite query and retrieve all the data + */ +int my_sqlite_query(B_DB *mdb, char *cmd) +{ + int stat; + + if (mdb->sqlite_errmsg) { + actuallyfree(mdb->sqlite_errmsg); + mdb->sqlite_errmsg = NULL; + } + stat = sqlite_get_table(mdb->db, cmd, &mdb->result, &mdb->nrow, &mdb->ncolumn, + &mdb->sqlite_errmsg); + mdb->row = 0; /* row fetched */ + return stat; +} + +/* Fetch one row at a time */ +SQL_ROW my_sqlite_fetch_row(B_DB *mdb) +{ + if (mdb->row >= mdb->nrow) { + return NULL; + } + mdb->row++; + return &mdb->result[mdb->ncolumn * mdb->row]; +} + +void my_sqlite_free_table(B_DB *mdb) +{ + unsigned int i; + + if (mdb->fields_defined) { + for (i=0; i < sql_num_fields(mdb); i++) { + free(mdb->fields[i]); + } + free(mdb->fields); + mdb->fields_defined = FALSE; + } + sqlite_free_table(mdb->result); + mdb->nrow = mdb->ncolumn = 0; +} + +void my_sqlite_field_seek(B_DB *mdb, int field) +{ + unsigned int i, j; + if (mdb->result == NULL) { + return; + } + /* On first call, set up the fields */ + if (!mdb->fields_defined && sql_num_fields(mdb) > 0) { + mdb->fields = (SQL_FIELD **)malloc(sizeof(SQL_FIELD) * mdb->ncolumn); + for (i=0; i < sql_num_fields(mdb); i++) { + mdb->fields[i] = (SQL_FIELD *)malloc(sizeof(SQL_FIELD)); + mdb->fields[i]->name = mdb->result[i]; + mdb->fields[i]->length = strlen(mdb->fields[i]->name); + mdb->fields[i]->max_length = mdb->fields[i]->length; + for (j=1; j <= (unsigned)mdb->nrow; j++) { + uint32_t len; + if (mdb->result[i + mdb->ncolumn *j]) { + len = (uint32_t)strlen(mdb->result[i + mdb->ncolumn * j]); + } else { + len = 0; + } + if (len > mdb->fields[i]->max_length) { + mdb->fields[i]->max_length = len; + } + } + mdb->fields[i]->type = 0; + mdb->fields[i]->flags = 1; /* not null */ + } + mdb->fields_defined = TRUE; + } + if (field > (int)sql_num_fields(mdb)) { + field = (int)sql_num_fields(mdb); + } + mdb->field = field; + +} + +SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb) +{ + return mdb->fields[mdb->field++]; +} + +static void +list_dashes(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx) +{ + SQL_FIELD *field; + unsigned int i, j; + + sql_field_seek(mdb, 0); + send(ctx, "+"); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + for (j = 0; j < field->max_length + 2; j++) + send(ctx, "-"); + send(ctx, "+"); + } + send(ctx, "\n"); +} + +void +list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx) +{ + SQL_FIELD *field; + SQL_ROW row; + unsigned int i, col_len; + char buf[2000], ewc[30]; + + if (mdb->result == NULL || mdb->nrow == 0) { + return; + } + /* determine column display widths */ + sql_field_seek(mdb, 0); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + if (IS_NUM(field->type) && field->max_length > 0) { /* fixup for commas */ + field->max_length += (field->max_length - 1) / 3; + } + col_len = strlen(field->name); + if (col_len < field->max_length) + col_len = field->max_length; + if (col_len < 4 && !IS_NOT_NULL(field->flags)) + col_len = 4; /* 4 = length of the word "NULL" */ + field->max_length = col_len; /* reset column info */ + } + + list_dashes(mdb, send, ctx); + send(ctx, "|"); + sql_field_seek(mdb, 0); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + sprintf(buf, " %-*s |", field->max_length, field->name); + send(ctx, buf); + } + send(ctx, "\n"); + list_dashes(mdb, send, ctx); + + while ((row = sql_fetch_row(mdb)) != NULL) { + sql_field_seek(mdb, 0); + send(ctx, "|"); + for (i = 0; i < sql_num_fields(mdb); i++) { + field = sql_fetch_field(mdb); + if (row[i] == NULL) { + sprintf(buf, " %-*s |", field->max_length, "NULL"); + } else if (IS_NUM(field->type)) { + sprintf(buf, " %*s |", field->max_length, + add_commas(row[i], ewc)); + } else { + sprintf(buf, " %-*s |", field->max_length, row[i]); + } + send(ctx, buf); + } + send(ctx, "\n"); + } + list_dashes(mdb, send, ctx); +} + + +#endif /* HAVE_SQLITE */ diff --git a/bacula/src/cats/sqlite.in b/bacula/src/cats/sqlite.in new file mode 100644 index 0000000000..63c2ba27d1 --- /dev/null +++ b/bacula/src/cats/sqlite.in @@ -0,0 +1,5 @@ +#!/bin/sh +# +# shell script to invoke SQLite on Bacula database + +@bindir@/sqlite @working_dir@/bacula.db diff --git a/bacula/src/console.glade b/bacula/src/console.glade new file mode 100644 index 0000000000..e0ba071194 --- /dev/null +++ b/bacula/src/console.glade @@ -0,0 +1,1271 @@ + + + + + Console + gnome-console + + gnome-console + + C + True + True + False + False + False + + + + GnomeAbout + about + False + True + Copyright (c) 1999 - 2002, Kern Sibbald and John Walker + Kern Sibbald and John Walker + + It comes by night and sucks the essence from your computers. + + + + GnomeMessageBox + messagebox1 + GNOME_MESSAGE_BOX_INFO + Message + Information + GTK_WIN_POS_NONE + False + False + False + False + True + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button4 + True + True + GNOME_STOCK_BUTTON_OK + + + + + + + GnomeDialog + SelectDirectorDialog + Select Director + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox2 + False + 1 + + 0 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button11 + True + True + + clicked + on_select_director_clicked + Sun, 17 Mar 2002 21:07:26 GMT + + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button13 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkVBox + vbox4 + False + 0 + + 0 + True + True + + + + GtkLabel + label20 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkHBox + hbox10 + False + 0 + + 0 + True + True + + + + GtkCombo + combo1 + False + True + False + True + False + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + combo-entry9 + True + True + True + 0 + + + + + + + + + + GnomeDialog + RunDialog + Run a Job + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox4 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area4 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button17 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button19 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkVBox + vbox5 + False + 0 + + 0 + True + True + + + + GtkLabel + label24 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 9 + + 2 + False + False + + + + + GtkHBox + hbox11 + False + 0 + + 2 + False + False + + + + GtkHBox + hbox12 + False + 0 + + 0 + True + True + + + + GtkLabel + label25 + 70 + + GTK_JUSTIFY_RIGHT + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo9 + False + True + False + True + False + + + 1 + True + True + + + + GtkEntry + GtkCombo:entry + entry2 + True + True + True + 0 + + + + + + GtkLabel + label26 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo10 + 131 + False + True + False + True + False + + + 6 + False + False + + + + GtkEntry + GtkCombo:entry + entry3 + 127 + True + True + True + 0 + + + + + + + GtkLabel + label27 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 30 + False + False + + + + + + GtkHBox + hbox13 + False + 0 + + 0 + True + True + + + + GtkLabel + label28 + 70 + + GTK_JUSTIFY_RIGHT + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo11 + 236 + False + True + False + True + False + + + 1 + True + True + + + + GtkEntry + GtkCombo:entry + entry4 + True + True + True + 0 + + + + + + GtkLabel + label29 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 123 + False + False + + + + + + GtkHBox + hbox14 + False + 0 + + 2 + True + True + + + + GtkLabel + label30 + 70 + + GTK_JUSTIFY_RIGHT + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo12 + False + True + False + True + False + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + entry5 + True + True + True + 0 + + + + + + GtkButton + button20 + 12 + True + + GTK_RELIEF_NORMAL + + 10 + False + True + + + + + GtkLabel + label31 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 65 + False + False + + + + + + GtkHBox + hbox15 + False + 0 + + 2 + True + True + + + + GtkLabel + label32 + 70 + + GTK_JUSTIFY_RIGHT + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo13 + False + True + False + True + False + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + entry6 + True + True + True + 0 + + + + + + GtkLabel + label33 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 100 + False + False + + + + + + GtkHBox + hbox16 + False + 0 + + 2 + True + True + + + + GtkLabel + label34 + 70 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo14 + False + True + False + True + False + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + entry7 + True + True + True + 0 + + + + + + GtkLabel + label35 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 120 + False + False + + + + + + GtkHBox + hbox17 + False + 0 + + 2 + True + True + + + + GtkLabel + label36 + 70 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + combo15 + False + True + False + True + False + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + entry8 + True + True + True + 0 + + + + + + GtkLabel + label37 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 114 + False + False + + + + + + + + + GtkWindow + app1 + + delete_event + on_app1_delete_event + Mon, 01 Apr 2002 07:29:22 GMT + + + show + on_app1_show + Mon, 01 Apr 2002 07:29:16 GMT + + Bacula Console + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + + + GtkVBox + vbox6 + False + 0 + + + GtkHandleBox + handlebox1 + 1 + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + 0 + False + True + + + + GtkMenuBar + menubar1 + GTK_SHADOW_NONE + + + GtkMenuItem + file1 + GNOMEUIINFO_MENU_FILE_TREE + + + GtkMenu + file1_menu + + + GtkMenuItem + connect1 + Connect to Director + + activate + on_connect_activate + Wed, 20 Mar 2002 10:21:09 GMT + + + False + + + + GtkMenuItem + disconnect1 + Disconnect from Director + + activate + on_disconnect_activate + Wed, 20 Mar 2002 10:15:45 GMT + + + False + + + + GtkMenuItem + menuitem4 + False + + + + GtkPixmapMenuItem + exit1 + + activate + on_exit_activate + Wed, 20 Mar 2002 10:24:55 GMT + + GNOMEUIINFO_MENU_EXIT_ITEM + + + + + + GtkMenuItem + edit1 + GNOMEUIINFO_MENU_EDIT_TREE + + + GtkMenu + edit1_menu + + + GtkPixmapMenuItem + cut1 + + activate + on_cut1_activate + Sat, 16 Mar 2002 21:48:15 GMT + + GNOMEUIINFO_MENU_CUT_ITEM + + + + GtkPixmapMenuItem + copy1 + + activate + on_copy1_activate + Sat, 16 Mar 2002 21:48:15 GMT + + GNOMEUIINFO_MENU_COPY_ITEM + + + + GtkPixmapMenuItem + paste1 + + activate + on_paste1_activate + Sat, 16 Mar 2002 21:48:15 GMT + + GNOMEUIINFO_MENU_PASTE_ITEM + + + + GtkPixmapMenuItem + clear1 + + activate + on_clear1_activate + Sat, 16 Mar 2002 21:48:15 GMT + + GNOMEUIINFO_MENU_CLEAR_ITEM + + + + GtkMenuItem + separator1 + False + + + + + + GtkMenuItem + item1 + Display Messages + GNOMEUIINFO_MENU_VIEW_TREE + + + GtkMenu + item1_menu + + + GtkMenuItem + msgs + + activate + on_msgs_activate + Wed, 20 Mar 2002 09:57:22 GMT + + + False + + + + + + GtkMenuItem + settings1 + GNOMEUIINFO_MENU_SETTINGS_TREE + + + GtkMenu + settings1_menu + + + GtkPixmapMenuItem + preferences1 + + activate + on_preferences1_activate + Sat, 16 Mar 2002 21:48:15 GMT + + GNOMEUIINFO_MENU_PREFERENCES_ITEM + + + + + + GtkMenuItem + help1 + GNOMEUIINFO_MENU_HELP_TREE + + + GtkMenu + help1_menu + + + GtkPixmapMenuItem + about1 + + activate + on_about_activate + Wed, 20 Mar 2002 10:19:17 GMT + + GNOMEUIINFO_MENU_ABOUT_ITEM + + + + + + + + GtkHandleBox + handlebox2 + 1 + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + 0 + False + True + + + + GtkToolbar + toolbar2 + 1 + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + 16 + GTK_TOOLBAR_SPACE_LINE + GTK_RELIEF_NONE + True + + + GtkButton + Toolbar:button + connect_button1 + Connect to Director + + clicked + on_connect_button_clicked + Wed, 20 Mar 2002 10:18:40 GMT + + + GNOME_STOCK_PIXMAP_NEW + + + + GtkButton + Toolbar:button + run_button1 + Run a Job + + clicked + on_run_button_clicked + Wed, 20 Mar 2002 10:13:42 GMT + + + GNOME_STOCK_PIXMAP_EXEC + + + + GtkButton + Toolbar:button + msgs_button + Display Messages + + clicked + on_msgs_button_clicked + Tue, 19 Mar 2002 20:32:44 GMT + + + GNOME_STOCK_PIXMAP_SEARCH + + + + + + GtkVBox + vbox7 + False + 0 + + 0 + True + True + + + + GtkScrolledWindow + scrolledwindow3 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkText + text1 + False + + + + + + GtkHBox + hbox18 + False + 0 + + 0 + False + True + + + + GtkLabel + label38 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + True + + + + + GtkEntry + entry1 + Enter Commands Here + True + True + True + True + + key_press_event + on_entry1_key_press_event + Mon, 01 Apr 2002 07:32:11 GMT + + True + True + 0 + + + 0 + True + True + + + + + + GtkHBox + hbox19 + False + 0 + + 0 + False + True + + + + GtkFrame + frame1 + 66 + 0 + GTK_SHADOW_IN + + 0 + False + True + + + + GtkLabel + label39 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + GtkFrame + frame2 + 0 + GTK_SHADOW_IN + + 0 + True + True + + + + GtkLabel + status1 + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + + + + + + + diff --git a/bacula/src/console/Makefile.in b/bacula/src/console/Makefile.in new file mode 100644 index 0000000000..f061bcd5ab --- /dev/null +++ b/bacula/src/console/Makefile.in @@ -0,0 +1,97 @@ +@MCOMMON@ + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = ../.. +# this dir relative to top dir +thisdir = src/console + +DEBUG=@DEBUG@ + +first_rule: all +dummy: + +# +CONSSRCS = console.c console_conf.c authenticate.c +CONSOBJS = console.o console_conf.o authenticate.o + +# these are the objects that are changed by the .configure process +EXTRAOBJS = @OBJLIST@ + +CONS_INC=@CONS_INC@ +CONS_LIBS=@CONS_LIBS@ +CONS_LDFLAGS=@CONS_LDFLAGS@ + +.SUFFIXES: .c .o +.PHONY: +.DONTCARE: + +# inference rules +.c.o: + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< +#------------------------------------------------------------------------- +all: Makefile console + @echo "==== Make of console is good ====" + @echo " " + + +console: $(CONSOBJS) ../lib/libbac.a ../cats/libsql.a + $(CXX) $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \ + $(LIBS) $(DLIB) $(CONS_LIBS) -lbac -lsql -lm -ltermcap + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +clean: + $(RMF) console core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3 + +realclean: clean + $(RMF) tags console.conf + +distclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + (cd $(srcdir); $(RMF) Makefile) + +install: all + $(INSTALL_SCRIPT) console $(DESTDIR)$(sbindir)/console + @srcconf=console.conf; \ + if test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \ + destconf=$$srcconf.new; \ + echo " ==> Found existing $$srcconf, installing new conf file as $$destconf"; \ + else \ + destconf=$$srcconf; \ + fi; \ + echo "${INSTALL_DATA} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \ + ${INSTALL_DATA} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf + +uninstall: + (cd $(DESTDIR)$(sbindir); $(RMF) console) + (cd $(DESTDIR)$(sysconfdir); $(RMF) console.conf + + + +# Semi-automatic generation of dependencies: +# Use gcc -MM because X11 `makedepend' doesn't work on all systems +# and it also includes system headers. +# `semi'-automatic since dependencies are generated at distribution time. + +depend: + @$(MV) Makefile Makefile.bak + @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile + @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile + @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @if test -f Makefile ; then \ + $(RMF) Makefile.bak; \ + else \ + $(MV) Makefile.bak Makefile; \ + echo -e "Something went wrong\n\a"; \ + fi + +# ----------------------------------------------------------------------- +# DO NOT DELETE: nice dependency list follows diff --git a/bacula/src/console/authenticate.c b/bacula/src/console/authenticate.c new file mode 100644 index 0000000000..72a065145d --- /dev/null +++ b/bacula/src/console/authenticate.c @@ -0,0 +1,77 @@ +/* + * + * Bacula UA authentication. Provides authentication with + * the Director. + * + * Kern Sibbald, June MMI + * + * This routine runs as a thread and must be thread reentrant. + * + * Basic tasks done here: + * + */ +/* + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "bacula.h" +#include "console_conf.h" +#include "jcr.h" + + +/* Commands sent to Director */ +static char hello[] = "Hello %s calling\n"; + +/* Response from Director */ +static char OKhello[] = "1000 OK:"; + +/* Forward referenced functions */ + +/* + * Authenticate Director + */ +int authenticate_director(JCR *jcr, DIRRES *director) +{ + BSOCK *dir = jcr->dir_bsock; + + /* + * Send my name to the Director then do authentication + */ + bnet_fsend(dir, hello, "UserAgent"); + + if (!cram_md5_get_auth(dir, director->password) || + !cram_md5_auth(dir, director->password)) { + Dmsg0(-1, "Director authorization problem.\n"); + return 0; + } + + Dmsg1(6, ">dird: %s", dir->msg); + if (bnet_recv(dir) <= 0) { + Dmsg1(-1, "Bad response to Hello command: ERR=%s\n", + bnet_strerror(dir)); + Dmsg0(-1, "The Director is probably not running.\n"); + return 0; + } + Dmsg1(10, "msg); + if (strncmp(dir->msg, OKhello, sizeof(OKhello)-1) != 0) { + Dmsg0(-1, "Director rejected Hello command\n"); + return 0; + } else { + Dmsg1(-1, "%s", dir->msg); + } + return 1; +} diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c new file mode 100644 index 0000000000..8929df66bd --- /dev/null +++ b/bacula/src/console/console.c @@ -0,0 +1,355 @@ +/* + * + * Bacula Console interface to the Director + * + * Kern Sibbald, September MM + */ + +/* + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include "bacula.h" +#include "console_conf.h" +#include "jcr.h" + +/* Imported functions */ +int authenticate_director(JCR *jcr, DIRRES *director); + + +/* Exported variables */ + + +#ifdef HAVE_CYGWIN +int rl_catch_signals; +#else +extern int rl_catch_signals; +#endif + +/* Forward referenced functions */ +static void terminate_console(int sig); +int get_cmd(char *prompt, BSOCK *sock, int sec); + +/* Static variables */ +static char *configfile = NULL; +static BSOCK *UA_sock = NULL; +static DIRRES *dir; + +#define CONFIG_FILE "./console.conf" /* default configuration file */ + +static void usage() +{ + fprintf(stderr, +"\nVersion: " VERSION " (" DATE ")\n\n" +"Usage: console [-s] [-c config_file] [-d debug_level] [config_file]\n" +" -c set configuration file to file\n" +" -dnn set debug level to nn\n" +" -s no signals\n" +" -t test - read configuration and exit\n" +" -? print this message.\n" +"\n"); + + exit(1); +} + + +/********************************************************************* + * + * Main Bacula Console -- User Interface Program + * + */ +int main(int argc, char *argv[]) +{ + int ch, stat, i, ndir, item; + int no_signals = FALSE; + int test_config = FALSE; + JCR jcr; + char *prompt = "*"; + int at_prompt = FALSE; + + init_stack_dump(); + my_name_is(argc, argv, "console"); + working_directory = "/tmp"; + + /* + * Ensure that every message is always printed + */ + for (i=1; i<=M_MAX; i++) { + add_msg_dest(MD_STDOUT, i, NULL, NULL); + } + + + while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) { + switch (ch) { + case 'c': /* configuration file */ + if (configfile != NULL) + free(configfile); + configfile = bstrdup(optarg); + break; + + case 'd': + debug_level = atoi(optarg); + if (debug_level <= 0) + debug_level = 1; + break; + + case 's': /* turn off signals */ + no_signals = TRUE; + break; + + case 't': + test_config = TRUE; + break; + + case '?': + default: + usage(); + + } + } + argc -= optind; + argv += optind; + + if (!no_signals) { + init_signals(terminate_console); + } + signal(SIGCHLD, SIG_IGN); + + if (argc) { + usage(); + } + + if (configfile == NULL) { + configfile = bstrdup(CONFIG_FILE); + } + + parse_config(configfile); + + LockRes(); + ndir = 0; + for (dir=NULL; (dir = (DIRRES *)GetNextRes(R_DIRECTOR, (RES *)dir)); ) { + ndir++; + } + UnlockRes(); + if (ndir == 0) { + Emsg1(M_ABORT, 0, "No director resource defined in %s\n\ +Without that I don't how to speak to the Director :-(\n", configfile); + } + + if (test_config) { + terminate_console(0); + exit(0); + } + + memset(&jcr, 0, sizeof(jcr)); + + if (ndir > 1) { + UA_sock = init_bsock(0, "", "", 0); +try_again: + printf("Available Directors:\n"); + LockRes(); + ndir = 0; + for (dir = NULL; (dir = (DIRRES *)GetNextRes(R_DIRECTOR, (RES *)dir)); ) { + printf("%d %s at %s:%d\n", 1+ndir++, dir->hdr.name, dir->address, + dir->DIRport); + } + UnlockRes(); + if (get_cmd("Select Director: ", UA_sock, 600) < 0) { + return 1; + } + item = atoi(UA_sock->msg); + if (item < 0 || item > ndir) { + printf("You must enter a number between 1 and %d\n", ndir); + goto try_again; + } + LockRes(); + dir = NULL; + for (i=0; iaddress,dir->DIRport); + UA_sock = bnet_connect(&jcr, 5, 15, "Director daemon", dir->address, + NULL, dir->DIRport, 0); + if (UA_sock == NULL) { + terminate_console(0); + return 1; + } + jcr.dir_bsock = UA_sock; + if (!authenticate_director(&jcr, dir)) { + printf("ERR: %s", UA_sock->msg); + terminate_console(0); + return 1; + } + + Dmsg0(40, "Opened connection with Director daemon\n"); + + for ( ;; ) { + if (at_prompt) { /* don't prompt multiple times */ + prompt = ""; + } else { + prompt = "*"; + at_prompt = TRUE; + } + stat = get_cmd(prompt, UA_sock, 30); + if (stat < 0) { + break; /* error */ + } else if (stat == 0) { /* timeout */ + bnet_fsend(UA_sock, ".messages"); + } else { + at_prompt = FALSE; + if (!bnet_send(UA_sock)) { /* send command */ + break; /* error */ + } + } + if (strcmp(UA_sock->msg, "quit") == 0 || strcmp(UA_sock->msg, "exit") == 0) { + break; + } + while ((stat = bnet_recv(UA_sock)) > 0) { + if (at_prompt) { + printf("\n"); + at_prompt = FALSE; + } + printf("%s", UA_sock->msg); + } + fflush(stdout); + if (stat < 0) { + break; /* error */ + } else if (stat == 0) { + if (UA_sock->msglen == BNET_PROMPT) { + at_prompt = TRUE; + } + Dmsg1(100, "Got poll %s\n", bnet_sig_to_ascii(UA_sock)); + } + } + if (UA_sock) { + bnet_sig(UA_sock, BNET_TERMINATE); /* send EOF */ + bnet_close(UA_sock); + } + + terminate_console(0); + return 0; +} + + +/* Cleanup and then exit */ +static void terminate_console(int sig) +{ + static int already_here = FALSE; + + if (already_here) /* avoid recursive temination problems */ + exit(1); + already_here = TRUE; + exit(0); +} + +#ifdef HAVE_READLINE +#undef free +#include "readline/readline.h" +#include "readline/history.h" + +int +get_cmd(char *prompt, BSOCK *sock, int sec) +{ + char *line; + + rl_catch_signals = 1; + line = readline(prompt); + + if (!line) { + exit(1); + } + strcpy(sock->msg, line); + strip_trailing_junk(sock->msg); + sock->msglen = strlen(sock->msg); + if (sock->msglen) { + add_history(sock->msg); + } + free(line); + return 1; +} + +#else /* no readline, do it ourselves */ + +/* + * Returns: 1 if data available + * 0 if timeout + * -1 if error + */ +static int +wait_for_data(int fd, int sec) +{ + fd_set fdset; + struct timeval tv; + + FD_ZERO(&fdset); + FD_SET(fd, &fdset); + tv.tv_sec = sec; + tv.tv_usec = 0; + for ( ;; ) { + switch(select(fd + 1, &fdset, NULL, NULL, &tv)) { + case 0: /* timeout */ + return 0; + case -1: + if (errno == EINTR || errno == EAGAIN) { + continue; + } + return -1; /* error return */ + default: + return 1; + } + } +} + +/* + * Get next input command from terminal. + * + * Returns: 1 if got input + * 0 if timeout + * -1 if EOF or error + */ +int +get_cmd(char *prompt, BSOCK *sock, int sec) +{ + fprintf(stdout, prompt); + fflush(stdout); + switch (wait_for_data(fileno(stdin), sec)) { + case 0: + return 0; /* timeout */ + case -1: + return -1; /* error */ + default: + if (fgets(sock->msg, 200, stdin) == NULL) { + return -1; + } + break; + } + strip_trailing_junk(sock->msg); + sock->msglen = strlen(sock->msg); + return 1; +} + +#endif diff --git a/bacula/src/console/console_conf.c b/bacula/src/console/console_conf.c new file mode 100644 index 0000000000..fc5284ce70 --- /dev/null +++ b/bacula/src/console/console_conf.c @@ -0,0 +1,224 @@ +/* + * Main configuration file parser for Bacula User Agent + * some parts may be split into separate files such as + * the schedule configuration (sch_config.c). + * + * Note, the configuration file parser consists of three parts + * + * 1. The generic lexical scanner in lib/lex.c and lib/lex.h + * + * 2. The generic config scanner in lib/parse_config.c and + * lib/parse_config.h. + * These files contain the parser code, some utility + * routines, and the common store routines (name, int, + * string). + * + * 3. The daemon specific file, which contains the Resource + * definitions as well as any specific store routines + * for the resource records. + * + * Kern Sibbald, January MM, September MM + */ + +/* + Copyright (C) 2000, 2001 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "bacula.h" +#include "console_conf.h" + +/* Define the first and last resource ID record + * types. Note, these should be unique for each + * daemon though not a requirement. + */ +int r_first = R_FIRST; +int r_last = R_LAST; +pthread_mutex_t res_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* Forward referenced subroutines */ + + +/* We build the current resource here as we are + * scanning the resource configuration definition, + * then move it to allocated memory when the resource + * scan is complete. + */ +URES res_all; +int res_all_size = sizeof(res_all); + +/* Definition of records permitted within each + * resource with the routine to process the record + * information. + */ +static struct res_items dir_items[] = { + {"name", store_name, ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0}, + {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_REQUIRED, 0}, + {"address", store_str, ITEM(res_dir.address), 0, ITEM_REQUIRED, 0}, + {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* + * This is the master resource definition. + * It must have one item for each of the resources. + */ +struct s_res resources[] = { + {"director", dir_items, R_DIRECTOR, NULL}, + {NULL, NULL, 0, NULL} +}; + + +/* Dump contents of resource */ +void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ...), void *sock) +{ + URES *res = (URES *)reshdr; + int recurse = 1; + + if (res == NULL) { + printf("No record for %d %s\n", type, res_to_str(type)); + return; + } + if (type < 0) { /* no recursion */ + type = - type; + recurse = 0; + } + switch (type) { + case R_DIRECTOR: + printf("Director: name=%s address=%s DIRport=%d\n", reshdr->name, + res->res_dir.address, res->res_dir.DIRport); + break; + default: + printf("Unknown resource type %d\n", type); + } + if (recurse && res->res_dir.hdr.next) { + dump_resource(type, res->res_dir.hdr.next, sendit, sock); + } +} + +/* + * Free memory of resource. + * NB, we don't need to worry about freeing any references + * to other resources as they will be freed when that + * resource chain is traversed. Mainly we worry about freeing + * allocated strings (names). + */ +void free_resource(int type) +{ + URES *res; + RES *nres; + int rindex = type - r_first; + + res = (URES *)resources[rindex].res_head; + + if (res == NULL) + return; + + /* common stuff -- free the resource name */ + nres = (RES *)res->res_dir.hdr.next; + if (res->res_dir.hdr.name) + free(res->res_dir.hdr.name); + if (res->res_dir.hdr.desc) + free(res->res_dir.hdr.desc); + + switch (type) { + case R_DIRECTOR: + if (res->res_dir.address) + free(res->res_dir.address); + break; + default: + printf("Unknown resource type %d\n", type); + } + /* Common stuff again -- free the resource, recurse to next one */ + free(res); + resources[rindex].res_head = nres; + if (nres) + free_resource(type); +} + +/* Save the new resource by chaining it into the head list for + * the resource. If this is pass 2, we update any resource + * pointers (currently only in the Job resource). + */ +void save_resource(int type, struct res_items *items, int pass) +{ + URES *res; + int rindex = type - r_first; + int i, size; + int error = 0; + + /* + * Ensure that all required items are present + */ + for (i=0; items[i].name; i++) { + if (items[i].flags & ITEM_REQUIRED) { + if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) { + Emsg2(M_ABORT, 0, "%s item is required in %s resource, but not found.\n", + items[i].name, resources[rindex]); + } + } + } + + /* During pass 2, we looked up pointers to all the resources + * referrenced in the current resource, , now we + * must copy their address from the static record to the allocated + * record. + */ + if (pass == 2) { + switch (type) { + /* Resources not containing a resource */ + case R_DIRECTOR: + break; + + default: + Emsg1(M_ERROR, 0, "Unknown resource type %d\n", type); + error = 1; + break; + } + /* Note, the resoure name was already saved during pass 1, + * so here, we can just release it. + */ + if (res_all.res_dir.hdr.name) { + free(res_all.res_dir.hdr.name); + res_all.res_dir.hdr.name = NULL; + } + if (res_all.res_dir.hdr.desc) { + free(res_all.res_dir.hdr.desc); + res_all.res_dir.hdr.desc = NULL; + } + return; + } + + switch (type) { + case R_DIRECTOR: + size = sizeof(DIRRES); + break; + default: + printf("Unknown resource type %d\n", type); + error = 1; + break; + } + /* Common */ + if (!error) { + res = (URES *) malloc(size); + memcpy(res, &res_all, size); + res->res_dir.hdr.next = resources[rindex].res_head; + resources[rindex].res_head = (RES *)res; + Dmsg1(90, "dir_conf: inserting res: %s\n", res->res_dir.hdr.name); + } + +} diff --git a/bacula/src/console/console_conf.h b/bacula/src/console/console_conf.h new file mode 100644 index 0000000000..04fdc7b85f --- /dev/null +++ b/bacula/src/console/console_conf.h @@ -0,0 +1,44 @@ +/* + * Bacula User Agent specific configuration and defines + * + * Kern Sibbald, Sep MM + */ + +/* + * Resource codes -- they must be sequential for indexing + */ +#define R_FIRST 1001 + +#define R_DIRECTOR 1001 + +#define R_LAST R_DIRECTOR + +/* + * Some resource attributes + */ +#define R_NAME 1020 +#define R_ADDRESS 1021 +#define R_PASSWORD 1022 +#define R_TYPE 1023 +#define R_BACKUP 1024 + + +/* Definition of the contents of each Resource */ +struct s_res_dir { + RES hdr; + int DIRport; /* UA server port */ + char *address; /* UA server address */ + char *password; /* UA server password */ +}; +typedef struct s_res_dir DIRRES; + + +/* Define the Union of all the above + * resource structure definitions. + */ +union u_res { + struct s_res_dir res_dir; + RES hdr; +}; + +typedef union u_res URES; diff --git a/bacula/src/count-doc b/bacula/src/count-doc new file mode 100755 index 0000000000..94a93ec9d2 --- /dev/null +++ b/bacula/src/count-doc @@ -0,0 +1,8 @@ +#!/bin/sh +rm -f 1 +touch 1 +for i in ../doc/html-manual; do + ls -1 $i/*.html >>1 +done +cat 1 | lines +rm -f 1 diff --git a/bacula/src/count-lines b/bacula/src/count-lines new file mode 100755 index 0000000000..5f545b0a8f --- /dev/null +++ b/bacula/src/count-lines @@ -0,0 +1,8 @@ +#!/bin/sh +rm -f 1 +touch 1 +for i in . console gnome-console cats dird filed findlib lib stored; do + ls -1 $i/*.c $i/*.h $i/*.in >>1 +done +cat 1 | lines +# rm -f 1 diff --git a/bacula/src/dird/Makefile.in b/bacula/src/dird/Makefile.in new file mode 100644 index 0000000000..699d0a8e06 --- /dev/null +++ b/bacula/src/dird/Makefile.in @@ -0,0 +1,121 @@ +# +# Bacula Director Makefile +# +@MCOMMON@ + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = ../.. +# this dir relative to top dir +thisdir = src/dird + +DEBUG=@DEBUG@ + +first_rule: all +dummy: + +# +SVRSRCS = dird.c authenticate.c backup.c catreq.c dird_conf.c \ + fd_cmds.c getmsg.c job.c \ + mountreq.c msgchan.c newvol.c run_conf.c restore.c \ + scheduler.c ua_cmds.c \ + ua_dotcmds.c \ + ua_db_query.c ua_retention.c \ + ua_input.c ua_output.c ua_run.c \ + ua_select.c ua_server.c \ + ua_status.c verify.c +SVROBJS = dird.o authenticate.o backup.o catreq.o dird_conf.o \ + fd_cmds.o getmsg.o job.o \ + mountreq.o msgchan.o newvol.o run_conf.o restore.o \ + scheduler.o ua_cmds.o \ + ua_dotcmds.o \ + ua_db_query.o ua_retention.o \ + ua_input.o ua_output.o ua_run.o \ + ua_select.o ua_server.o \ + ua_status.o verify.o + +# these are the objects that are changed by the .configure process +EXTRAOBJS = @OBJLIST@ + +.SUFFIXES: .c .o +.PHONY: +.DONTCARE: + +# inference rules +.c.o: + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< +#------------------------------------------------------------------------- +all: Makefile bacula-dir + @echo "==== Make of dird is good ====" + @echo " " + +bacula-dir: $(SVROBJS) ../lib/libbac.a ../cats/libsql.a + $(CXX) $(LDFLAGS) -L../lib -L../cats -o $@ $(SVROBJS) \ + -lsql $(LIBS) $(DLIB) -lbac -lm + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +clean: + @$(RMF) dird bacula-dir core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3 + +realclean: clean + @$(RMF) tags bacula-dir.conf + +distclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + (cd $(srcdir); $(RMF) Makefile) + +install: all + $(INSTALL_PROGRAM) bacula-dir $(DESTDIR)$(sbindir)/bacula-dir + @srcconf=bacula-dir.conf; \ + if test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \ + destconf=$$srcconf.new; \ + echo " ==> Found existing $$srcconf, installing new conf file as $$destconf"; \ + else \ + destconf=$$srcconf; \ + fi; \ + echo "${INSTALL_DATA} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \ + ${INSTALL_DATA} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf + @srcconf=query.sql; \ + if test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \ + destconf=$$srcconf.new; \ + echo " ==> Found existing $$srcconf, installing new conf file as $$destconf"; \ + else \ + destconf=$$srcconf; \ + fi; \ + echo "${INSTALL_DATA} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \ + ${INSTALL_DATA} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf + + +uninstall: + (cd $(DESTDIR)$(sbindir); $(RMF) bacula-dir) + (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-dir.conf) + + + +# Semi-automatic generation of dependencies: +# Use gcc -MM because X11 `makedepend' doesn't work on all systems +# and it also includes system headers. +# `semi'-automatic since dependencies are generated at distribution time. + +depend: + @$(MV) Makefile Makefile.bak + @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile + @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile + @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @if test -f Makefile ; then \ + $(RMF) Makefile.bak; \ + else \ + $(MV) Makefile.bak Makefile; \ + echo -e "Something went wrong\n\a"; \ + fi + +# ----------------------------------------------------------------------- +# DO NOT DELETE: nice dependency list follows diff --git a/bacula/src/dird/README-config b/bacula/src/dird/README-config new file mode 100644 index 0000000000..b3ae34fbc1 --- /dev/null +++ b/bacula/src/dird/README-config @@ -0,0 +1,134 @@ + +To add a new resource -- as an example, the BAZ resource, + which will have foo record which is an integer, + a storage record, which is the name of a storage + resource, and a special time field. + + 1. Define the Resource type (R_xxx) in dir_config.h + Be sure to update the R_LAST define. + #define R_BAZ 1011 + update R_LAST to be R_BAZ + + 2. Add a new definition of the resource in dir_config.h + The first three are mandatory (will soon be changed + to a header structure). + struct s_res_baz { + char * name; + int rcode + struct s_res_baz *next; + + int foo; + struct res_store *storage; + int time; + }; + + 3. In dir_config.c add the new resource to the table + of resources (resources[]) + + {"baz", baz_items, R_BAZ, NULL}, + + 4. Create a baz_items, which defines the records that + can appear within the BAZ resource: + + static struct res_items bas_items[] = { + name, store sub, where to store, extra info + {"name", store_name, ITEM(res_baz.name), 0}, /* manditory */ + {"foo", store_int, ITEM(res_baz.foo), 0}, + {"storage", stor_res, ITEM(res_baz.storage), 0}, + {"time", store_time, ITME(res_baz.time), 0}, + }; + + 5. Update the dump_resource() subroutine to handle printing + your resource. + + 6. Update the free_resource() subroutine to handle releasing + any allocated memory. + + 7. Check for any special initialization in init_resource(). + Normally, everything is just zeroed. + + 8. Update the new_resource() subroutine to handle the two + passes of the configurator to be able to create your + resource. Pass 2 is used only for finding a reference + to a resource and stuffing its address. In the above example, + you will need to include the storage resource. See the + example for the Job Resource. + + Add an entry so that the correct size of your resource is + allocated for pass one. + + 9. Write any new store routines that you may need. In this case, + we used the store_int and store_res, which are already defined, + but we need to add the new special routine store_time(). + Note, the store subroutine gets control when the parser has + identified the record. Everything after the record name + must be scanned in the store routine. + + +To add a new resource record: + + 1. Add the new record definition to the resource structure definition. + See step 2 above. In this case, however, we only add a new field + to the existing structure. + + 2. Add the new record to the existing res_items structure. See + step 4 above. In this case, however, we only add a new record + definition to the exising structure. + + 3. Update the dump_resource() routine to dump the new record. + + 4. Update the free_resource() routine if you allocated any memory. + + 5. Update init_resource() if you have any special requirements (not + normally the case). + + 6. Update the new_resource() routine if necessary (not normally the + case). + + 7. Write any new store routine that you may have created to store + your record. + Note, the store subroutine gets control when the parser has + identified the record. Everything after the record name + must be scanned in the store routine. See the examples of + store routines that exist. + +Note, the core parsing code is in lib/parse_config.c and lib/parse_config.h. +lib/parse_config.c provides the following store routines: + + store_name stores a resource name + store_str stores a string + store_res stores a resource + store_int stores an integer + +and the following utilities: + + scan_to_eol causes the lexical scanner to scan to the end of the line + scan_error prints an error message + GetResWithName returns the resource of a specified type and name + GetNextRes returns the next resource of a specified type + parse_config parses the configuration file + free_config_resources frees all the resources allocated. + +Note: when your store routine gets control, the parser will have already +scanned the record name (i.e. "baz =") before calling your routine. +The lexical scanner is by default in a mode where spaces will be +compressed out of unquoted strings. Consequently if you want to scan + + baz = full backup every sunday + +and you do not want to get "full backup every sunday" as a single token +"fullbackupeverysunday", you must set the no identifier option in the +lexical scanner options field: + + int options = lc->options; + + lc->options |= LOPT_NO_IDENT; /* don't eat spaces */ + + get_token(lc) ... + ... + + lc->options = options; + return; + + + diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c new file mode 100644 index 0000000000..f6ffa208f5 --- /dev/null +++ b/bacula/src/dird/authenticate.c @@ -0,0 +1,138 @@ +/* + * + * Bacula Director -- authorize.c -- handles authorization of + * Storage and File daemons. + * + * Kern Sibbald, May MMI + * + * This routine runs as a thread and must be thread reentrant. + * + * Basic tasks done here: + * + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "dird.h" + +extern DIRRES *director; +extern char my_name[]; + +/* Commands sent to Storage daemon and File daemon and received + * from the User Agent */ +static char hello[] = "Hello Director %s calling\n"; + +/* Response from Storage daemon */ +static char OKhello[] = "3000 OK Hello\n"; +static char FDOKhello[] = "2000 OK Hello\n"; + +/* Sent to User Agent */ +static char Dir_sorry[] = N_("1999 You are not authorized.\n"); + +/* Forward referenced functions */ + +/* + * Authenticate Storage daemon connection + */ +int authenticate_storage_daemon(JCR *jcr) +{ + BSOCK *sd = jcr->store_bsock; + + /* + * Send my name to the Storage daemon then do authentication + */ + if (!bnet_fsend(sd, hello, director->hdr.name)) { + Emsg1(M_FATAL, 0, _("Auth send error. ERR=%s\n"), bnet_strerror(sd)); + } + if (!cram_md5_get_auth(sd, jcr->store->password) || + !cram_md5_auth(sd, jcr->store->password)) { + Emsg0(M_FATAL, 0, _("Storage daemon authorization failed.\n")); + return 0; + } + Dmsg1(6, ">stored: %s", sd->msg); + if (bnet_recv(sd) <= 0) { + Emsg1(M_FATAL, 0, _("bdirdmsg); + if (strncmp(sd->msg, OKhello, sizeof(OKhello)) != 0) { + Emsg0(M_FATAL, 0, _("Storage daemon rejected Hello command\n")); + return 0; + } + return 1; +} + +/* + * Authenticate File daemon connection + */ +int authenticate_file_daemon(JCR *jcr) +{ + BSOCK *fd = jcr->file_bsock; + + /* + * Send my name to the File daemon then do authentication + */ + bnet_fsend(fd, hello, director->hdr.name); + if (!cram_md5_get_auth(fd, jcr->client->password) || + !cram_md5_auth(fd, jcr->client->password)) { + Emsg0(M_FATAL, 0, _("File daemon authentication failed.\n")); + return 0; + } + Dmsg1(6, ">filed: %s", fd->msg); + if (bnet_recv(fd) <= 0) { + Emsg1(M_FATAL, 0, _("bdirdmsg); + if (strncmp(fd->msg, FDOKhello, sizeof(FDOKhello)) != 0) { + Emsg0(M_FATAL, 0, _("File daemon rejected Hello command\n")); + return 0; + } + return 1; +} + +/********************************************************************* + * + */ +int authenticate_user_agent(BSOCK *ua) +{ + char name[128]; + int ok = 0; + + + if (sscanf(ua->msg, "Hello %127s calling\n", name) != 1) { + Emsg1(M_FATAL, 0, _("Authentication failure: %s"), ua->msg); + return 0; + } + + ok = cram_md5_auth(ua, director->password) && + cram_md5_get_auth(ua, director->password); + + if (!ok) { + bnet_fsend(ua, "%s", _(Dir_sorry)); + Emsg0(M_WARNING, 0, _("Unable to authenticate User Agent\n")); + return 0; + } + bnet_fsend(ua, "1000 OK: %s Version: " VERSION " (" DATE ")\n", my_name); + return 1; +} diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c new file mode 100644 index 0000000000..3d5c4c239c --- /dev/null +++ b/bacula/src/dird/backup.c @@ -0,0 +1,444 @@ +/* + * + * Bacula Director -- backup.c -- responsible for doing backup jobs + * + * Kern Sibbald, March MM + * + * This routine is called as a thread. It may not yet be totally + * thread reentrant!!! + * + * Basic tasks done here: + * Open DB and create records for this job. + * Open Message Channel with Storage daemon to tell him a job will be starting. + * Open connection with File daemon and pass him commands + * to do the backup. + * When the File daemon finishes the job, update the DB. + * + */ + +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "dird.h" + +/* Commands sent to File daemon */ +static char backupcmd[] = "backup\n"; +static char storaddr[] = "storage address=%s port=%d\n"; +static char levelcmd[] = "level = %s%s\n"; + +/* Responses received from File daemon */ +static char OKbackup[] = "2000 OK backup\n"; +static char OKstore[] = "2000 OK storage\n"; +static char OKlevel[] = "2000 OK level\n"; + +/* Forward referenced functions */ +static void backup_cleanup(JCR *jcr, int TermCode, char *since); +static int wait_for_job_termination(JCR *jcr); + +/* External functions */ + +/* + * Do a backup of the specified FileSet + * + * Returns: 0 on failure + * 1 on success + */ +int do_backup(JCR *jcr) +{ + char since[MAXSTRING]; + int stat; + BSOCK *fd; + POOL_DBR pr; +#ifdef needed + MEDIA_DBR mr; +#endif + CLIENT_DBR cr; + FILESET_DBR fsr; + + since[0] = 0; + /* + * Get or Create client record + */ + memset(&cr, 0, sizeof(cr)); + strcpy(cr.Name, jcr->client->hdr.name); + if (jcr->client_name) { + free(jcr->client_name); + } + jcr->client_name = bstrdup(jcr->client->hdr.name); + if (!db_create_client_record(jcr->db, &cr)) { + Jmsg(jcr, M_ERROR, 0, _("Could not create Client record. %s"), + db_strerror(jcr->db)); + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + jcr->jr.ClientId = cr.ClientId; + Dmsg2(9, "Created Client %s record %d\n", jcr->client->hdr.name, + jcr->jr.ClientId); + + /* + * Get or Create FileSet record + */ + memset(&fsr, 0, sizeof(fsr)); + strcpy(fsr.FileSet, jcr->fileset->hdr.name); + if (jcr->fileset->have_MD5) { + struct MD5Context md5c; + unsigned char signature[16]; + memcpy(&md5c, &jcr->fileset->md5c, sizeof(md5c)); + MD5Final(signature, &md5c); + bin_to_base64(fsr.MD5, (char *)signature, 16); /* encode 16 bytes */ + } else { + Jmsg(jcr, M_WARNING, 0, _("FileSet MD5 signature not found.\n")); + } + if (!db_create_fileset_record(jcr->db, &fsr)) { + Jmsg(jcr, M_ERROR, 0, _("Could not create FileSet record. %s"), + db_strerror(jcr->db)); + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + jcr->jr.FileSetId = fsr.FileSetId; + Dmsg2(9, "Created FileSet %s record %d\n", jcr->fileset->hdr.name, + jcr->jr.FileSetId); + + + /* Look up the last + * FULL backup job to get the time/date for a + * differential or incremental save. + */ + jcr->stime = (char *) get_pool_memory(PM_MESSAGE); + jcr->stime[0] = 0; + since[0] = 0; + switch (jcr->level) { + case L_DIFFERENTIAL: + case L_INCREMENTAL: + /* Look up start time of last job */ + jcr->jr.JobId = 0; + if (!db_find_job_start_time(jcr->db, &jcr->jr, jcr->stime)) { + Jmsg(jcr, M_INFO, 0, _("Last FULL backup time not found. Doing FULL backup.\n")); + jcr->level = L_FULL; + jcr->jr.Level = L_FULL; + } else { + strcpy(since, ", since="); + strcat(since, jcr->stime); + } + Dmsg1(15, "Last start time = %s\n", jcr->stime); + break; + } + + jcr->jr.JobId = jcr->JobId; + jcr->jr.StartTime = jcr->start_time; + if (!db_update_job_start_record(jcr->db, &jcr->jr)) { + Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db)); + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + jcr->fname = (char *) get_pool_memory(PM_FNAME); + + /* Print Job Start message */ + Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %d, Job=%s\n"), + jcr->JobId, jcr->Job); + + /* + * Get the Pool record + */ + memset(&pr, 0, sizeof(pr)); + strcpy(pr.Name, jcr->pool->hdr.name); + while (!db_get_pool_record(jcr->db, &pr)) { /* get by Name */ + /* Try to create the pool */ + if (create_pool(jcr->db, jcr->pool) < 0) { + Jmsg(jcr, M_FATAL, 0, _("Pool %s not in database. %s"), pr.Name, + db_strerror(jcr->db)); + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } else { + Jmsg(jcr, M_INFO, 0, _("Pool %s created in database.\n"), pr.Name); + } + } + jcr->PoolId = pr.PoolId; /****FIXME**** this can go away */ + jcr->jr.PoolId = pr.PoolId; + +#ifdef needed + /* NOTE, THIS IS NOW DONE BY THE STORAGE DAEMON + * + * Find at least one Volume associated with this Pool + * It must be marked Append, and be of the correct Media Type + * for the storage type. + */ + memset(&mr, 0, sizeof(mr)); + mr.PoolId = pr.PoolId; + strcpy(mr.VolStatus, "Append"); + strcpy(mr.MediaType, jcr->store->media_type); + if (!db_find_next_volume(jcr->db, 1, &mr)) { + if (!newVolume(jcr)) { + Jmsg(jcr, M_FATAL, 0, _("No writable %s media in Pool %s.\n\ + Please use the Console program to add available Volumes.\n"), mr.MediaType, pr.Name); + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + } +#endif + + /* + * Open a message channel connection with the Storage + * daemon. This is to let him know that our client + * will be contacting him for a backup session. + * + */ + Dmsg0(10, "Open connection with storage daemon\n"); + jcr->JobStatus = JS_Blocked; + /* + * Start conversation with Storage daemon + */ + if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + /* + * Now start a job with the Storage daemon + */ + if (!start_storage_daemon_job(jcr)) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + /* + * Now start a Storage daemon message thread + */ + if (!start_storage_daemon_message_thread(jcr)) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + Dmsg0(50, "Storage daemon connection OK\n"); + + if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + jcr->JobStatus = JS_Running; + fd = jcr->file_bsock; + + if (!send_include_list(jcr)) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + if (!send_exclude_list(jcr)) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + /* + * send Storage daemon address to the File daemon + */ + if (jcr->store->SDDport == 0) { + jcr->store->SDDport = jcr->store->SDport; + } + bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport); + if (!response(fd, OKstore, "Storage")) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + /* + * Send Level command to File daemon + */ + switch (jcr->level) { + case L_FULL: + bnet_fsend(fd, levelcmd, "full", " "); + break; + case L_DIFFERENTIAL: + case L_INCREMENTAL: + bnet_fsend(fd, levelcmd, "since ", jcr->stime); + free_pool_memory(jcr->stime); + jcr->stime = NULL; + break; + case L_SINCE: + default: + Emsg1(M_FATAL, 0, _("Unimplemented backup level %d\n"), jcr->level); + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + Dmsg1(20, ">filed: %s", fd->msg); + if (!response(fd, OKlevel, "Level")) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + /* Send backup command */ + bnet_fsend(fd, backupcmd); + if (!response(fd, OKbackup, "backup")) { + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } + + /* Pickup Job termination data */ + stat = wait_for_job_termination(jcr); + backup_cleanup(jcr, stat, since); + return 1; +} + +/* + * NOTE! This is no longer really needed as the Storage + * daemon now passes this information directly + * back to us. + */ +static int wait_for_job_termination(JCR *jcr) +{ + int32_t n = 0; + BSOCK *fd = jcr->file_bsock; + + jcr->JobStatus = JS_WaitFD; + /* Wait for Client to terminate */ + while ((n = bget_msg(fd, 0)) > 0 && !job_cancelled(jcr)) { + /* get and discard Client output */ + } + bnet_sig(fd, BNET_TERMINATE); /* tell Client we are terminating */ + if (n < 0) { + Jmsg(jcr, M_FATAL, 0, _("mutex); + jcr->JobStatus = JS_WaitSD; + while (!jcr->msg_thread_done && !job_cancelled(jcr)) { + struct timeval tv; + struct timezone tz; + struct timespec timeout; + + gettimeofday(&tv, &tz); + timeout.tv_nsec = 0; + timeout.tv_sec = tv.tv_sec + 10; /* wait 10 seconds */ + Dmsg0(300, "I'm waiting for message thread termination.\n"); + pthread_cond_timedwait(&jcr->term_wait, &jcr->mutex, &timeout); + } + V(jcr->mutex); + if (n < 0) { + return JS_ErrorTerminated; + } + return jcr->SDJobStatus; +} + +/* + * Release resources allocated during backup. + */ +static void backup_cleanup(JCR *jcr, int TermCode, char *since) +{ + char sdt[50], edt[50]; + char ec1[30], ec2[30], ec3[30]; + char term_code[100]; + char *term_msg; + int msg_type; + MEDIA_DBR mr; + + memset(&mr, 0, sizeof(mr)); + Dmsg0(100, "Enter backup_cleanup()\n"); + if (jcr->jr.EndTime == 0) { + jcr->jr.EndTime = time(NULL); + } + jcr->end_time = jcr->jr.EndTime; + jcr->jr.JobId = jcr->JobId; + jcr->jr.JobStatus = jcr->JobStatus = TermCode; + jcr->jr.JobFiles = jcr->JobFiles; + jcr->jr.JobBytes = jcr->JobBytes; + jcr->jr.VolSessionId = jcr->VolSessionId; + jcr->jr.VolSessionTime = jcr->VolSessionTime; + if (!db_update_job_end_record(jcr->db, &jcr->jr)) { + Jmsg(jcr, M_WARNING, 0, _("Error updating job record. %s"), + db_strerror(jcr->db)); + } + if (!db_get_job_record(jcr->db, &jcr->jr)) { + Jmsg(jcr, M_WARNING, 0, _("Error getting job record for stats: %s"), + db_strerror(jcr->db)); + } + + strcpy(mr.VolumeName, jcr->VolumeName); + if (!db_get_media_record(jcr->db, &mr)) { + Jmsg(jcr, M_WARNING, 0, _("Error getting Media record for stats: %s"), + db_strerror(jcr->db)); + } + + + msg_type = M_INFO; /* by default INFO message */ + switch (TermCode) { + case JS_Terminated: + term_msg = _("Backup OK"); + break; + case JS_Errored: + term_msg = _("*** Backup Error ***"); + msg_type = M_ERROR; /* Generate error message */ + if (jcr->store_bsock) { + bnet_sig(jcr->store_bsock, BNET_TERMINATE); + pthread_cancel(jcr->SD_msg_chan); + } + break; + case JS_Cancelled: + term_msg = _("Backup Cancelled"); + if (jcr->store_bsock) { + bnet_sig(jcr->store_bsock, BNET_TERMINATE); + pthread_cancel(jcr->SD_msg_chan); + } + break; + default: + term_msg = term_code; + sprintf(term_code, _("Inappropriate term code: %c\n"), TermCode); + break; + } + bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime); + bstrftime(edt, sizeof(edt), jcr->jr.EndTime); + if (!db_get_job_volume_names(jcr->db, jcr->jr.JobId, jcr->VolumeName)) { + jcr->VolumeName[0] = 0; /* none */ + } + + Jmsg(jcr, msg_type, 0, _("%s\n\ +JobId: %d\n\ +Job: %s\n\ +FileSet: %s\n\ +Backup Level: %s%s\n\ +Client: %s\n\ +Start time: %s\n\ +End time: %s\n\ +Bytes Written: %s\n\ +Files Written: %s\n\ +Volume names(s): %s\n\ +Volume Session Id: %d\n\ +Volume Session Time: %d\n\ +Volume Bytes: %s\n\ +Termination: %s\n"), + edt, + jcr->jr.JobId, + jcr->jr.Job, + jcr->fileset->hdr.name, + level_to_str(jcr->level), since, + jcr->client->hdr.name, + sdt, + edt, + edit_uint_with_commas(jcr->jr.JobBytes, ec1), + edit_uint_with_commas(jcr->jr.JobFiles, ec2), + jcr->VolumeName, + jcr->VolSessionId, + jcr->VolSessionTime, + edit_uint_with_commas(mr.VolBytes, ec3), + term_msg); + + Dmsg0(100, "Leave backup_cleanup()\n"); +} diff --git a/bacula/src/dird/bacula-dir.conf.in b/bacula/src/dird/bacula-dir.conf.in new file mode 100644 index 0000000000..ee60d0d15b --- /dev/null +++ b/bacula/src/dird/bacula-dir.conf.in @@ -0,0 +1,133 @@ +# +# Default Bacula Director Configuration file +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ @DISTVER@ +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @hostname@-dir + DIRport = @dir_port@ # where we listen for UA connections + QueryFile = "@sysconfdir@/query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@piddir@" + SubSysDirectory = "@subsysdir@" + Maximum Concurrent Jobs = 1 + Password = "@dir_password@" # Console password +} + +# Define the backup Job +Job { + Name = "NightlySave" + Backup = Client=@hostname@-fd FileSet="Full Set" + Schedule = "WeeklyCycle" + Storage = DLTDrive + Messages = Standard + Pool = Default +} + +# List of files to be backed up +FileSet { + Name = "Full Set" + Include = signature=MD5 { +# +# Put your list of files here, one per line or include an +# external list with: +# +# @file-name +# +# Note: / backs up everything + + / + + } + Exclude = { } +} + +# When to do the backups +Schedule { + Name = "WeeklyCycle" + Run = Full sun at 1:05 + Run = Incremental mon-sat at 1:05 +} + +# Client (File Services) to backup +Client { + Name = @hostname@-fd + Address = @hostname@ + FDPort = @fd_port@ + Catalog = MyCatalog + Password = "@fd_password@" # password for FileDaemon +} + + +# Definition of DLT tape storage device +Storage { + Name = DLTDrive + Address = @hostname@ + SDPort = @sd_port@ + Password = "@sd_password@" # password for Storage daemon + Device = "HP DLT 80" # must be same as Device in Storage daemon + Media Type = DLT8000 # must be same as MediaType in Storage daemon +} + +# Definition of DDS tape storage device +Storage { + Name = SDT-10000 + Address = @hostname@ + SDPort = @sd_port@ + Password = "@sd_password@" # password for Storage daemon + Device = SDT-10000 # must be same as Device in Storage daemon + Media Type = DDS-4 # must be same as MediaType in Storage daemon +} + +# Definition of 8mm tape storage device +Storage { + Name = "8mmDrive" + Address = @hostname@ + SDPort = @sd_port@ + Password = "@sd_password@" + Device = "Exabyte 8mm" + MediaType = "8mm" +} + +# Definiton of file storage device +Storage { + Name = File + Address = @hostname@ + SDPort = @sd_port@ + Password = "@sd_password@" + Device = FileStorage + Media Type = File +} + + +# Generic catalog service +Catalog { + Name = MyCatalog + dbname = bacula; user = bacula; password = "" +} + +# Reasonable message delivery -- send most everything to email address +# and to the console +Messages { + Name = Standard + mailcommand = "@sbindir@/smtp -h @smtp_host@ -f \"Bacula <%r>\" -s \"Bacula: %t %e of %c %l\" %r" + operatorcommand = "@sbindir@/smtp -h @smtp_host@ -f \"Bacula <%r>\" -s \"Bacula: Intervention needed for %j\" %r" + mail = @job_email@ = all, !skipped, !terminate + operator = @job_email@ = mount + console = all, !skipped, !saved +} + +# Default pool definition +Pool { + Name = Default + Pool Type = Backup +} diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c new file mode 100644 index 0000000000..f4e82ce0f5 --- /dev/null +++ b/bacula/src/dird/catreq.c @@ -0,0 +1,283 @@ +/* + * + * Bacula Director -- catreq.c -- handles the message channel + * catalog request from the Storage daemon. + * + * Kern Sibbald, March MMI + * + * This routine runs as a thread and must be thread reentrant. + * + * Basic tasks done here: + * Handle Catalog services. + * + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "dird.h" + +/* + * Handle catalog request + * For now, we simply return next Volume to be used + */ + +/* Requests from the Storage daemon */ +static char Find_media[] = "CatReq Job=%127s FindMedia=%d\n"; +static char Find_Vol_Info[] = "CatReq Job=%127s GetVolInfo VolName=%127s\n"; + +static char Update_media[] = "CatReq Job=%127s UpdateMedia VolName=%s\ + VolJobs=%d VolFiles=%d VolBlocks=%d VolBytes=%" lld " VolMounts=%d\ + VolErrors=%d VolWrites=%d VolMaxBytes=%" lld " EndTime=%d VolStatus=%10s\ + FirstIndex=%d LastIndex=%d StartFile=%d EndFile=%d \ + StartBlock=%d EndBlock=%d\n"; + +/* Responses sent to Storage daemon */ +static char OK_media[] = "1000 OK VolName=%s VolJobs=%d VolFiles=%d\ + VolBlocks=%d VolBytes=%" lld " VolMounts=%d VolErrors=%d VolWrites=%d\ + VolMaxBytes=%" lld " VolCapacityBytes=%" lld "\n"; + +static char OK_update[] = "1000 OK UpdateMedia\n"; + +/* static char FileAttributes[] = "UpdCat Job=%127s FileAttributes "; */ + + +void catalog_request(JCR *jcr, BSOCK *bs, char *msg) +{ + MEDIA_DBR mr; + JOBMEDIA_DBR jm; + char Job[MAX_NAME_LENGTH]; + int index, ok; + char *omsg; + + memset(&mr, 0, sizeof(mr)); + memset(&jm, 0, sizeof(jm)); + + /* + * Request to find next appendable Volume for this Job + */ + Dmsg1(20, "catreq %s", bs->msg); + if (sscanf(bs->msg, Find_media, &Job, &index) == 2) { + mr.PoolId = jcr->PoolId; + strcpy(mr.MediaType, jcr->store->media_type); + strcpy(mr.VolStatus, "Append"); + Dmsg3(120, "CatReq FindMedia: Id=%d, MediaType=%s, Status=%s\n", + mr.PoolId, mr.MediaType, mr.VolStatus); + /* + * Find the Volume + */ + ok = FALSE; + if (db_find_next_volume(jcr->db, index, &mr)) { + jcr->MediaId = mr.MediaId; + Dmsg1(20, "Find_next_vol MediaId=%d\n", jcr->MediaId); + strcpy(jcr->VolumeName, mr.VolumeName); + + ok = TRUE; + } else { + /* See if we can create a new Volume */ + ok = newVolume(jcr); + } + /* + * Send Find Media response to Storage daemon + */ + if (ok) { + bash_spaces(mr.VolumeName); + bnet_fsend(bs, OK_media, mr.VolumeName, mr.VolJobs, + mr.VolFiles, mr.VolBlocks, mr.VolBytes, mr.VolMounts, mr.VolErrors, + mr.VolWrites, mr.VolMaxBytes, mr.VolCapacityBytes); + } else { + bnet_fsend(bs, "1999 No Media\n"); + } + + /* + * Request to find specific volume information + */ + } else if (sscanf(bs->msg, Find_Vol_Info, &Job, &mr.VolumeName) == 2) { + Dmsg1(120, "CatReq GetVolInfo Vol=%s\n", mr.VolumeName); + /* + * Find the Volume + */ + unbash_spaces(mr.VolumeName); + if (db_get_media_record(jcr->db, &mr)) { + jcr->MediaId = mr.MediaId; + Dmsg1(20, "VolumeInfo MediaId=%d\n", jcr->MediaId); + strcpy(jcr->VolumeName, mr.VolumeName); + /* + * Make sure this volume is suitable for this job + */ + if (mr.PoolId == jcr->PoolId && + strcmp(mr.VolStatus, "Append") == 0 && + strcmp(mr.MediaType, jcr->store->media_type) == 0) { + /* + * Send Find Media response to Storage daemon + */ + bash_spaces(mr.VolumeName); + bnet_fsend(bs, OK_media, mr.VolumeName, mr.VolJobs, + mr.VolFiles, mr.VolBlocks, mr.VolBytes, mr.VolMounts, mr.VolErrors, + mr.VolWrites, mr.VolMaxBytes, mr.VolCapacityBytes); + } else { + Dmsg4(000, "get_media_record PoolId=%d wanted %d, Status=%s, \ +MediaType=%s\n", mr.PoolId, jcr->PoolId, mr.VolStatus, mr.MediaType); + /* Not suitable volume */ + bnet_fsend(bs, "1998 Volume not appropriate.\n"); + } + + } else { + bnet_fsend(bs, "1999 Volume Not Found.\n"); + } + + + /* + * Request to update Media record. Comes typically at the end + * of a Storage daemon Job Session + */ + } else if (sscanf(bs->msg, Update_media, &Job, &mr.VolumeName, &mr.VolJobs, + &mr.VolFiles, &mr.VolBlocks, &mr.VolBytes, &mr.VolMounts, &mr.VolErrors, + &mr.VolWrites, &mr.VolMaxBytes, &mr.LastWritten, &mr.VolStatus, + &jm.FirstIndex, &jm.LastIndex, &jm.StartFile, &jm.EndFile, + &jm.StartBlock, &jm.EndBlock) == 18) { + /* + * Update Media Record + */ + if ((mr.VolMaxBytes > 0 && mr.VolBytes >= mr.VolMaxBytes) || + (mr.VolBytes > 0 && jcr->pool->use_volume_once)) { + strcpy(mr.VolStatus, "Full"); + } + + jm.JobId = jcr->JobId; + jm.MediaId = jcr->MediaId; + /* + * A single write means we just labeled the tape, + * so no need to create a jobmedia record. + * Otherwise, record the fact that this job used this Volume + */ + if (mr.VolWrites > 1) { + Dmsg4(20, "create_jobmedia JobId=%d MediaId=%d FI=%d LI=%d\n", + jm.JobId, jm.MediaId, jm.FirstIndex, jm.LastIndex); + if(!db_create_jobmedia_record(jcr->db, &jm)) { + Jmsg(jcr, M_ERROR, 0, _("Catalog error creating JobMedia record. %s"), + db_strerror(jcr->db)); + bnet_fsend(bs, "1991 Update JobMedia error\n"); + } else { + Dmsg0(20, "JobMedia record created\n"); + } + } + + Dmsg0(20, "db_update_media_record\n"); + if (db_update_media_record(jcr->db, &mr)) { + bnet_fsend(bs, OK_update); + Dmsg0(90, "send OK\n"); + } else { + Jmsg(jcr, M_ERROR, 0, _("Catalog error updating Media record. %s"), + db_strerror(jcr->db)); + bnet_fsend(bs, "1992 Update Media error\n"); + Dmsg0(90, "send error\n"); + } + } else { + omsg = (char *) get_memory(bs->msglen+1); + strcpy(omsg, bs->msg); + bnet_fsend(bs, "1990 Invalid Catalog Request: %s", omsg); + free_memory(omsg); + } + Dmsg1(20, ">CatReq response: %s", bs->msg); + return; +} + +/* + * Update File Attributes in the catalog with data + * sent by the Storage daemon. + */ +void catalog_update(JCR *jcr, BSOCK *bs, char *msg) +{ + unser_declare; + uint32_t VolSessionId, VolSessionTime; + int32_t Stream; + uint32_t FileIndex; + uint32_t data_len; + char *p = bs->msg; + int len; + char *fname, *attr; + ATTR_DBR ar; + + if (!jcr->pool->catalog_files) { + return; + } + skip_nonspaces(&p); /* UpdCat */ + skip_spaces(&p); + skip_nonspaces(&p); /* Job=nnn */ + skip_spaces(&p); + skip_nonspaces(&p); /* FileAttributes */ + p += 1; + unser_begin(p, 0); + unser_uint32(VolSessionId); + unser_uint32(VolSessionTime); + unser_int32(FileIndex); + unser_int32(Stream); + unser_uint32(data_len); + p += unser_length(p); + + Dmsg1(99, "UpdCat msg=%s\n", bs->msg); + Dmsg5(99, "UpdCat VolSessId=%d VolSessT=%d FI=%d Strm=%d data_len=%d\n", + VolSessionId, VolSessionTime, FileIndex, Stream, data_len); + + if (Stream == STREAM_UNIX_ATTRIBUTES) { + skip_nonspaces(&p); /* skip FileIndex */ + skip_spaces(&p); + skip_nonspaces(&p); /* skip FileType */ + skip_spaces(&p); + fname = p; + len = strlen(fname); /* length before attributes */ + attr = &fname[len+1]; + + Dmsg2(99, "dirdJobId; + + Dmsg2(11, "dirddb, &ar)) { + Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db)); + } + /* Save values for MD5 update */ + jcr->FileId = ar.FileId; + jcr->FileIndex = FileIndex; + } else if (Stream == STREAM_MD5_SIGNATURE) { + fname = p; + if (jcr->FileIndex != FileIndex) { + Jmsg(jcr, M_WARNING, 0, "Got MD5 but not same block as attributes\n"); + } else { + /* Update MD5 signature in catalog */ + char MD5buf[50]; /* 24 bytes should be enough */ + bin_to_base64(MD5buf, fname, 16); + Dmsg2(90, "MD5len=%d MD5=%s\n", strlen(MD5buf), MD5buf); + if (!db_add_MD5_to_file_record(jcr->db, jcr->FileId, MD5buf)) { + Jmsg(jcr, M_ERROR, 0, _("Catalog error updating MD5. %s"), + db_strerror(jcr->db)); + } + } + } +} diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c new file mode 100644 index 0000000000..bc1607d367 --- /dev/null +++ b/bacula/src/dird/dird.c @@ -0,0 +1,352 @@ +/* + * + * Bacula Director daemon -- this is the main program + * + * Kern Sibbald, March MM + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "dird.h" + +/* Forward referenced subroutines */ +static void terminate_dird(int sig); +static int check_resources(); +static void reload_config(int sig); + +/* Exported subroutines */ + + +/* Imported subroutines */ +extern JCR *wait_for_next_job(char *runjob); +extern void term_scheduler(); +extern void term_ua_server(); +extern int do_backup(JCR *jcr); +extern void backup_cleanup(void); +extern void start_UA_server(int port); +extern void run_job(JCR *jcr); +extern void init_job_server(int max_workers); + +static char *configfile = NULL; +static char *runjob = NULL; + +static int background = 1; + +/* Globals Exported */ +DIRRES *director; /* Director resource */ +int FDConnectTimeout; +int SDConnectTimeout; + +#define CONFIG_FILE "./bacula-dir.conf" /* default configuration file */ + +static void usage() +{ + fprintf(stderr, _( +"\nVersion: " VERSION " (" DATE ")\n\n" +"Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n" +" -c set configuration file to file\n" +" -dnn set debug level to nn\n" +" -f run in foreground (for debugging)\n" +" -r run now\n" +" -s no signals\n" +" -t test - read configuration and exit\n" +" -? print this message.\n" +"\n")); + + exit(1); +} + + +/********************************************************************* + * + * Main Bacula Server program + * + */ +int main (int argc, char *argv[]) +{ + int ch; + JCR *jcr; + int no_signals = FALSE; + int test_config = FALSE; + + init_stack_dump(); + my_name_is(argc, argv, "bacula-dir"); + daemon_start_time = time(NULL); + memset(&last_job, 0, sizeof(last_job)); + + while ((ch = getopt(argc, argv, "c:d:fr:st?")) != -1) { + switch (ch) { + case 'c': /* specify config file */ + if (configfile != NULL) { + free(configfile); + } + configfile = bstrdup(optarg); + break; + + case 'd': /* set debug level */ + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + Dmsg1(0, "Debug level = %d\n", debug_level); + break; + + case 'f': /* run in foreground */ + background = FALSE; + break; + + case 'r': /* run job */ + if (runjob != NULL) { + free(runjob); + } + if (optarg) { + runjob = bstrdup(optarg); + } + break; + + case 's': /* turn off signals */ + no_signals = TRUE; + break; + + case 't': /* test config */ + test_config = TRUE; + break; + + case '?': + default: + usage(); + + } + } + argc -= optind; + argv += optind; + + if (!no_signals) { + init_signals(terminate_dird); + } + signal(SIGCHLD, SIG_IGN); + + if (argc) { + if (configfile != NULL) { + free(configfile); + } + configfile = bstrdup(*argv); + argc--; + argv++; + } + if (argc) { + usage(); + } + + if (configfile == NULL) { + configfile = bstrdup(CONFIG_FILE); + } + + init_msg(NULL); /* initialize message handler */ + parse_config(configfile); + + if (!check_resources()) { + Emsg1(M_ABORT, 0, "Please correct configuration file: %s\n", configfile); + } + + my_name_is(0, (char **)NULL, director->hdr.name); /* set user defined name */ + + FDConnectTimeout = director->FDConnectTimeout; + SDConnectTimeout = director->SDConnectTimeout; + + + if (test_config) { + terminate_dird(0); + exit(0); + } + + if (background) { + daemon_start(); + init_stack_dump(); /* grab new pid */ + } + + signal(SIGHUP, reload_config); + + init_console_msg(working_directory); + + Dmsg0(200, "Start UA server\n"); + start_UA_server(director->DIRport); + + init_watchdog(); /* start network watchdog thread */ + + init_job_server(director->MaxConcurrentJobs); + + Dmsg0(200, "wait for next job\n"); + /* Main loop -- call scheduler to get next job to run */ + while ((jcr = wait_for_next_job(runjob))) { + run_job(jcr); /* run job */ + if (runjob) /* command line, run a single job? */ + break; /* yes, terminate */ + } + + terminate_dird(0); + exit(0); /* for compiler */ +} + +/* Cleanup and then exit */ +static void terminate_dird(int sig) +{ + static int already_here = FALSE; + + if (already_here) { /* avoid recursive temination problems */ + exit(1); + } + already_here = TRUE; + term_watchdog(); + signal(SIGCHLD, SIG_IGN); /* don't worry about children now */ + term_scheduler(); + if (runjob) { + free(runjob); + } + if (configfile != NULL) { + free(configfile); + } + if (debug_level > 5) { + print_memory_pool_stats(); + } + free_config_resources(); + term_ua_server(); + close_memory_pool(); /* free memory in pool */ + term_msg(); /* terminate message handler */ + sm_dump(False); + exit(0); +} + +/* + * If we get here, we have received a SIGHUP, which means to + * reread our configuration file. + * + * ***FIXME*** Check that there are no jobs running before + * doing this. + */ +static void reload_config(int sig) +{ + static int already_here = FALSE; + sigset_t set; + + if (already_here) { + abort(); /* Oops, recursion -> die */ + } + already_here = TRUE; + sigfillset(&set); + sigprocmask(SIG_BLOCK, &set, NULL); + + free_config_resources(); + + parse_config(configfile); + + Dmsg0(200, "check_resources()\n"); + if (!check_resources()) { + Emsg1(M_ABORT, 0, _("Please correct configuration file: %s\n"), configfile); + } + + /* Reset globals */ + working_directory = director->working_directory; + FDConnectTimeout = director->FDConnectTimeout; + SDConnectTimeout = director->SDConnectTimeout; + + sigprocmask(SIG_UNBLOCK, &set, NULL); + signal(SIGHUP, reload_config); + already_here = FALSE; + Dmsg0(0, "Director's configuration file reread.\n"); +} + +/* + * Make a quick check to see that we have all the + * resources needed. + * + * **** FIXME **** this routine could be a lot more + * intelligent and comprehensive. + */ +static int check_resources() +{ + int OK = TRUE; + JOB *job; + + LockRes(); + + job = (JOB *)GetNextRes(R_JOB, NULL); + director = (DIRRES *)GetNextRes(R_DIRECTOR, NULL); + if (!director) { + Emsg1(M_WARNING, 0, _("No Director resource defined in %s\n\ +Without that I don't know who I am :-(\n"), configfile); + OK = FALSE; + } + if (GetNextRes(R_DIRECTOR, (RES *)director) != NULL) { + Emsg1(M_WARNING, 0, _("Only one Director resource permitted in %s\n"), + configfile); + OK = FALSE; + } + if (!director->working_directory) { + Emsg0(M_WARNING, 0, _("No working directory specified. Cannot continue.\n")); + OK = FALSE; + } + working_directory = director->working_directory; + if (!job) { + Emsg1(M_WARNING, 0, _("No Job records defined in %s\n"), configfile); + OK = FALSE; + } + for (job=NULL; (job = (JOB *)GetNextRes(R_JOB, (RES *)job)); ) { + if (!job->client) { + Emsg1(M_WARNING, 0, _("No Client record defined for job %s\n"), job->hdr.name); + OK = FALSE; + } + if (!job->fs) { + Emsg1(M_WARNING, 0, _("No FileSet record defined for job %s\n"), job->hdr.name); + OK = FALSE; + } + if (!job->storage && job->JobType != JT_VERIFY) { + Emsg1(M_WARNING, 0, _("No Storage resource defined for job %s\n"), job->hdr.name); + OK = FALSE; + } + if (!job->pool) { + Emsg1(M_WARNING, 0, _("No Pool resource defined for job %s\n"), job->hdr.name); + OK = FALSE; + } + if (job->client->catalog) { + CAT *catalog = job->client->catalog; + B_DB *db; + + /* + * Make sure we can open catalog, otherwise print a warning + * message because the server is probably not running. + */ + db = db_init_database(catalog->db_name, catalog->db_user, + catalog->db_password); + if (!db_open_database(db)) { + Emsg1(M_WARNING, 0, "%s", db_strerror(db)); + } + db_close_database(db); + } else { + Emsg1(M_WARNING, 0, _("No Catalog resource defined for client %s\n"), + job->client->hdr.name); + OK = FALSE; + } + } + + UnlockRes(); + return OK; +} diff --git a/bacula/src/dird/dird.h b/bacula/src/dird/dird.h new file mode 100644 index 0000000000..28d8caeb87 --- /dev/null +++ b/bacula/src/dird/dird.h @@ -0,0 +1,51 @@ +/* + * Includes specific to the Director + * + * Kern Sibbald, December MM + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "dird_conf.h" + +#define DIRECTOR_DAEMON 1 + +/* The following includes are at the bottom of + * this file rather than at the top because the + * #include "jcr.h" uses the definition of JOB + * as supplied above. + */ + +#include "cats/cats.h" + +#include "jcr.h" + +#include "protos.h" + +/* Globals that dird.c exports */ +extern int debug_level; +extern time_t start_time; +extern DIRRES *director; /* Director resource */ +extern char *working_directory; /* export our working directory */ +extern int FDConnectTimeout; +extern int SDConnectTimeout; + +/* From job.c */ +void dird_free_jcr(JCR *jcr); diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c new file mode 100644 index 0000000000..aea47de80e --- /dev/null +++ b/bacula/src/dird/dird_conf.c @@ -0,0 +1,1077 @@ +/* + * Main configuration file parser for Bacula Directors, + * some parts may be split into separate files such as + * the schedule configuration (sch_config.c). + * + * Note, the configuration file parser consists of three parts + * + * 1. The generic lexical scanner in lib/lex.c and lib/lex.h + * + * 2. The generic config scanner in lib/parse_config.c and + * lib/parse_config.h. + * These files contain the parser code, some utility + * routines, and the common store routines (name, int, + * string). + * + * 3. The daemon specific file, which contains the Resource + * definitions as well as any specific store routines + * for the resource records. + * + * Kern Sibbald, January MM + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "dird.h" + +/* Define the first and last resource ID record + * types. Note, these should be unique for each + * daemon though not a requirement. + */ +int r_first = R_FIRST; +int r_last = R_LAST; +pthread_mutex_t res_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* Imported subroutines */ +extern void store_run(LEX *lc, struct res_items *item, int index, int pass); + + +/* Forward referenced subroutines */ + +static void store_inc(LEX *lc, struct res_items *item, int index, int pass); +static void store_backup(LEX *lc, struct res_items *item, int index, int pass); +static void store_restore(LEX *lc, struct res_items *item, int index, int pass); + + +/* We build the current resource here as we are + * scanning the resource configuration definition, + * then move it to allocated memory when the resource + * scan is complete. + */ +URES res_all; +int res_all_size = sizeof(res_all); + + +/* Definition of records permitted within each + * resource with the routine to process the record + * information. NOTE! quoted names must be in lower case. + */ +/* + * Director Resource + * + * name handler value code flags default_value + */ +static struct res_items dir_items[] = { + {"name", store_name, ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0}, + {"messages", store_res, ITEM(res_dir.messages), R_MSGS, 0, 0}, + {"dirport", store_pint, ITEM(res_dir.DIRport), 0, ITEM_REQUIRED, 0}, + {"queryfile", store_dir, ITEM(res_dir.query_file), 0, 0, 0}, + {"workingdirectory", store_dir, ITEM(res_dir.working_directory), 0, ITEM_REQUIRED, 0}, + {"piddirectory", store_dir, ITEM(res_dir.pid_directory), 0, ITEM_REQUIRED, 0}, + {"subsysdirectory", store_dir, ITEM(res_dir.subsys_directory), 0, ITEM_REQUIRED, 0}, + {"maximumconcurrentjobs", store_pint, ITEM(res_dir.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1}, + {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0}, + {"fdconnecttimeout", store_time,ITEM(res_dir.FDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30}, + {"sdconnecttimeout", store_time,ITEM(res_dir.SDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30}, + + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* + * Client or File daemon resource + * + * name handler value code flags default_value + */ + +static struct res_items cli_items[] = { + {"name", store_name, ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_client.hdr.desc), 0, 0, 0}, + {"address", store_str, ITEM(res_client.address), 0, ITEM_REQUIRED, 0}, + {"fdport", store_pint, ITEM(res_client.FDport), 0, ITEM_REQUIRED, 0}, + {"password", store_password, ITEM(res_client.password), 0, ITEM_REQUIRED, 0}, + {"catalog", store_res, ITEM(res_client.catalog), R_CATALOG, 0, 0}, + {"catalogretentionperiod", store_time, + ITEM(res_client.cat_ret_period), 0, ITEM_DEFAULT, 60}, + {"mediaretentionperiod", store_time, + ITEM(res_client.media_ret_period), 0, ITEM_DEFAULT, 60}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* Storage daemon resource + * + * name handler value code flags default_value + */ +static struct res_items store_items[] = { + {"name", store_name, ITEM(res_store.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_store.hdr.desc), 0, 0, 0}, + {"sdport", store_pint, ITEM(res_store.SDport), 0, ITEM_REQUIRED, 0}, + {"sddport", store_pint, ITEM(res_store.SDDport), 0, 0, 0}, /* deprecated */ + {"address", store_str, ITEM(res_store.address), 0, ITEM_REQUIRED, 0}, + {"password", store_password, ITEM(res_store.password), 0, ITEM_REQUIRED, 0}, + {"device", store_strname, ITEM(res_store.dev_name), 0, ITEM_REQUIRED, 0}, + {"mediatype", store_strname, ITEM(res_store.media_type), 0, ITEM_REQUIRED, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* + * Catalog Resource Directives + * + * name handler value code flags default_value + */ +static struct res_items cat_items[] = { + {"name", store_name, ITEM(res_cat.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_cat.hdr.desc), 0, 0, 0}, + {"address", store_str, ITEM(res_cat.address), 0, 0, 0}, + {"dbport", store_pint, ITEM(res_cat.DBport), 0, 0, 0}, + /* keep this password as store_str for the moment */ + {"password", store_str, ITEM(res_cat.db_password), 0, 0, 0}, + {"user", store_str, ITEM(res_cat.db_user), 0, 0, 0}, + {"dbname", store_str, ITEM(res_cat.db_name), 0, ITEM_REQUIRED, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* + * Job Resource Directives + * + * name handler value code flags default_value + */ +static struct res_items job_items[] = { + {"name", store_name, ITEM(res_job.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_job.hdr.desc), 0, 0, 0}, + {"backup", store_backup, ITEM(res_job), JT_BACKUP, 0, 0}, + {"verify", store_backup, ITEM(res_job), JT_VERIFY, 0, 0}, + {"restore", store_restore, ITEM(res_job), JT_RESTORE, 0, 0}, + {"schedule", store_res, ITEM(res_job.schedule), R_SCHEDULE, 0, 0}, + {"messages", store_res, ITEM(res_job.messages), R_MSGS, 0, 0}, + {"storage", store_res, ITEM(res_job.storage), R_STORAGE, 0, 0}, + {"pool", store_res, ITEM(res_job.pool), R_POOL, 0, 0}, + {"maxruntime", store_time, ITEM(res_job.MaxRunTime), 0, 0, 0}, + {"maxstartdelay", store_time, ITEM(res_job.MaxStartDelay), 0, 0, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* FileSet resource + * + * name handler value code flags default_value + */ +static struct res_items fs_items[] = { + {"name", store_name, ITEM(res_fs.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_fs.hdr.desc), 0, 0, 0}, + {"include", store_inc, NULL, 0, 0, 0}, + {"exclude", store_inc, NULL, 1, 0, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* Schedule -- see run_conf.c */ +/* Schedule + * + * name handler value code flags default_value + */ +static struct res_items sch_items[] = { + {"name", store_name, ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_sch.hdr.desc), 0, 0, 0}, + {"run", store_run, ITEM(res_sch.run), 0, 0, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* Group resource -- not implemented + * + * name handler value code flags default_value + */ +static struct res_items group_items[] = { + {"name", store_name, ITEM(res_group.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_group.hdr.desc), 0, 0, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* Pool resource + * + * name handler value code flags default_value + */ +static struct res_items pool_items[] = { + {"name", store_name, ITEM(res_pool.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_pool.hdr.desc), 0, 0, 0}, + {"pooltype", store_strname, ITEM(res_pool.pool_type), 0, ITEM_REQUIRED, 0}, + {"labelformat", store_strname, ITEM(res_pool.label_format), 0, 0, 0}, + {"usecatalog", store_yesno, ITEM(res_pool.use_catalog), 1, ITEM_DEFAULT, 1}, + {"usevolumeonce", store_yesno, ITEM(res_pool.use_volume_once), 1, 0, 0}, + {"maximumvolumes", store_pint, ITEM(res_pool.max_volumes), 0, 0, 0}, + {"acceptanyvolume", store_yesno, ITEM(res_pool.accept_any_volume), 1, 0, 0}, + {"catalogfiles", store_yesno, ITEM(res_pool.catalog_files), 1, ITEM_DEFAULT, 1}, + {NULL, NULL, NULL, 0, 0, 0} +}; + +/* Message resource */ +extern struct res_items msgs_items[]; + +/* + * This is the master resource definition. + * It must have one item for each of the resources. + * + * name items rcode res_head + */ +struct s_res resources[] = { + {"director", dir_items, R_DIRECTOR, NULL}, + {"client", cli_items, R_CLIENT, NULL}, + {"job", job_items, R_JOB, NULL}, + {"storage", store_items, R_STORAGE, NULL}, + {"catalog", cat_items, R_CATALOG, NULL}, + {"schedule", sch_items, R_SCHEDULE, NULL}, + {"fileset", fs_items, R_FILESET, NULL}, + {"group", group_items, R_GROUP, NULL}, + {"pool", pool_items, R_POOL, NULL}, + {"messages", msgs_items, R_MSGS, NULL}, + {NULL, NULL, 0, NULL} +}; + + +/* Keywords (RHS) permitted in Job Level records + * + * level_name level level_class + */ +struct s_jl joblevels[] = { + {"full", L_FULL, JT_BACKUP}, + {"incremental", L_INCREMENTAL, JT_BACKUP}, + {"differential", L_DIFFERENTIAL, JT_BACKUP}, + {"level", L_LEVEL, JT_BACKUP}, + {"since", L_SINCE, JT_BACKUP}, + {"catalog", L_VERIFY_CATALOG, JT_VERIFY}, + {"initcatalog", L_VERIFY_INIT, JT_VERIFY}, + {"volume", L_VERIFY_VOLUME, JT_VERIFY}, + {"data", L_VERIFY_DATA, JT_VERIFY}, + {NULL, 0} +}; + +/* Keywords (RHS) permitted in Backup and Verify records */ +static struct s_kw BakVerFields[] = { + {"client", 'C'}, + {"fileset", 'F'}, + {"level", 'L'}, + {NULL, 0} +}; + +/* Keywords (RHS) permitted in Restore records */ +static struct s_kw RestoreFields[] = { + {"client", 'C'}, + {"fileset", 'F'}, + {"jobid", 'J'}, /* JobId to restore */ + {"where", 'W'}, /* root of restore */ + {"replace", 'R'}, /* replacement options */ + {NULL, 0} +}; + +/* Options permitted in Restore replace= */ +static struct s_kw ReplaceOptions[] = { + {"always", 'A'}, /* always */ + {"ifnewer", 'W'}, + {"never", 'N'}, + {NULL, 0} +}; + + + +/* Define FileSet KeyWord values */ + +#define FS_KW_NONE 0 +#define FS_KW_COMPRESSION 1 +#define FS_KW_SIGNATURE 2 +#define FS_KW_ENCRYPTION 3 +#define FS_KW_VERIFY 4 + +/* FileSet keywords */ +static struct s_kw FS_option_kw[] = { + {"compression", FS_KW_COMPRESSION}, + {"signature", FS_KW_SIGNATURE}, + {"encryption", FS_KW_ENCRYPTION}, + {"verify", FS_KW_VERIFY}, + {NULL, 0} +}; + +/* Options for FileSet keywords */ + +struct s_fs_opt { + char *name; + int keyword; + char option; +}; + +/* Options permitted for each keyword and resulting value */ +static struct s_fs_opt FS_options[] = { + {"md5", FS_KW_SIGNATURE, 'M'}, + {"gzip", FS_KW_COMPRESSION, 'Z'}, + {"blowfish", FS_KW_ENCRYPTION, 'B'}, /* ***FIXME*** not implemented */ + {"3des", FS_KW_ENCRYPTION, '3'}, /* ***FIXME*** not implemented */ + {NULL, 0, 0} +}; + +char *level_to_str(int level) +{ + int i; + static char level_no[30]; + char *str = level_no; + + sprintf(level_no, "%d", level); /* default if not found */ + for (i=0; joblevels[i].level_name; i++) { + if (level == joblevels[i].level) { + str = joblevels[i].level_name; + break; + } + } + return str; +} + + + +/* Dump contents of resource */ +void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ...), void *sock) +{ + int i; + URES *res = (URES *)reshdr; + int recurse = 1; + + if (res == NULL) { + sendit(sock, "No %s resource defined\n", res_to_str(type)); + return; + } + if (type < 0) { /* no recursion */ + type = - type; + recurse = 0; + } + switch (type) { + case R_DIRECTOR: + sendit(sock, "Director: name=%s maxjobs=%d FDtimeout=%d SDtimeout=%d\n", + reshdr->name, res->res_dir.MaxConcurrentJobs, + res->res_dir.FDConnectTimeout, + res->res_dir.SDConnectTimeout); + if (res->res_dir.query_file) { + sendit(sock, " query_file=%s\n", res->res_dir.query_file); + } + if (res->res_dir.messages) { + sendit(sock, " --> "); + dump_resource(-R_MSGS, (RES *)res->res_dir.messages, sendit, sock); + } + break; + case R_CLIENT: + sendit(sock, "Client: name=%s address=%s FDport=%d\n", + res->res_client.hdr.name, res->res_client.address, res->res_client.FDport); + sendit(sock, "CatRetPeriod=%d MediaRetPeriod=%d\n", + res->res_client.cat_ret_period, res->res_client.media_ret_period); + if (res->res_client.catalog) { + sendit(sock, " --> "); + dump_resource(-R_CATALOG, (RES *)res->res_client.catalog, sendit, sock); + } + break; + case R_STORAGE: + sendit(sock, "Storage: name=%s address=%s SDport=%d\n\ + DeviceName=%s MediaType=%s\n", + res->res_store.hdr.name, res->res_store.address, res->res_store.SDport, + res->res_store.dev_name, res->res_store.media_type); + break; + case R_CATALOG: + sendit(sock, "Catalog: name=%s address=%s DBport=%d db_name=%s\n\ + db_user=%s\n", + res->res_cat.hdr.name, res->res_cat.address, res->res_cat.DBport, + res->res_cat.db_name, res->res_cat.db_user); + break; + case R_JOB: + sendit(sock, "Job: name=%s JobType=%d level=%s\n", res->res_job.hdr.name, + res->res_job.JobType, level_to_str(res->res_job.level)); + if (res->res_job.client) { + sendit(sock, " --> "); + dump_resource(-R_CLIENT, (RES *)res->res_job.client, sendit, sock); + } + if (res->res_job.fs) { + sendit(sock, " --> "); + dump_resource(-R_FILESET, (RES *)res->res_job.fs, sendit, sock); + } + if (res->res_job.schedule) { + sendit(sock, " --> "); + dump_resource(-R_SCHEDULE, (RES *)res->res_job.schedule, sendit, sock); + } + if (res->res_job.RestoreWhere) { + sendit(sock, " --> Where=%s\n", res->res_job.RestoreWhere); + } + if (res->res_job.storage) { + sendit(sock, " --> "); + dump_resource(-R_STORAGE, (RES *)res->res_job.storage, sendit, sock); + } + if (res->res_job.pool) { + sendit(sock, " --> "); + dump_resource(-R_POOL, (RES *)res->res_job.pool, sendit, sock); + } else { + sendit(sock, "!!! No Pool resource\n"); + } + if (res->res_job.messages) { + sendit(sock, " --> "); + dump_resource(-R_MSGS, (RES *)res->res_job.messages, sendit, sock); + } + break; + case R_FILESET: + sendit(sock, "FileSet: name=%s\n", res->res_fs.hdr.name); + for (i=0; ires_fs.num_includes; i++) + sendit(sock, " Inc: %s\n", res->res_fs.include_array[i]); + for (i=0; ires_fs.num_excludes; i++) + sendit(sock, " Exc: %s\n", res->res_fs.exclude_array[i]); + break; + case R_SCHEDULE: + if (res->res_sch.run) + sendit(sock, "Schedule: name=%s Level=%s\n", res->res_sch.hdr.name, + level_to_str(res->res_sch.run->level)); + else + sendit(sock, "Schedule: name=%s\n", res->res_sch.hdr.name); + break; + case R_GROUP: + sendit(sock, "Group: name=%s\n", res->res_group.hdr.name); + break; + case R_POOL: + sendit(sock, "Pool: name=%s PoolType=%s\n", res->res_pool.hdr.name, + res->res_pool.pool_type); + sendit(sock, " use_cat=%d use_once=%d acpt_any=%d\n", + res->res_pool.use_catalog, res->res_pool.use_volume_once, + res->res_pool.accept_any_volume); + sendit(sock, " cat_files=%d max_vols=%d\n", + res->res_pool.catalog_files, res->res_pool.max_volumes); + sendit(sock, " LabelFormat=%s\n", res->res_pool.label_format? + res->res_pool.label_format:"NONE"); + break; + case R_MSGS: + sendit(sock, "Messages: name=%s\n", res->res_msgs.hdr.name); + if (res->res_msgs.mail_cmd) + sendit(sock, " mailcmd=%s\n", res->res_msgs.mail_cmd); + if (res->res_msgs.operator_cmd) + sendit(sock, " opcmd=%s\n", res->res_msgs.operator_cmd); + break; + default: + sendit(sock, "Unknown resource type %d\n", type); + break; + } + if (recurse && res->res_dir.hdr.next) { + dump_resource(type, res->res_dir.hdr.next, sendit, sock); + } +} + +/* + * Free memory of resource. + * NB, we don't need to worry about freeing any references + * to other resources as they will be freed when that + * resource chain is traversed. Mainly we worry about freeing + * allocated strings (names). + */ +void free_resource(int type) +{ + int num; + URES *res; + RES *nres; + int rindex = type - r_first; + + res = (URES *)resources[rindex].res_head; + + if (res == NULL) + return; + + /* common stuff -- free the resource name and description */ + nres = (RES *)res->res_dir.hdr.next; + if (res->res_dir.hdr.name) { + free(res->res_dir.hdr.name); + } + if (res->res_dir.hdr.desc) { + free(res->res_dir.hdr.desc); + } + + switch (type) { + case R_DIRECTOR: + if (res->res_dir.working_directory) + free(res->res_dir.working_directory); + if (res->res_dir.pid_directory) + free(res->res_dir.pid_directory); + if (res->res_dir.subsys_directory) + free(res->res_dir.subsys_directory); + if (res->res_dir.password) + free(res->res_dir.password); + if (res->res_dir.query_file) + free(res->res_dir.query_file); + break; + case R_CLIENT: + if (res->res_client.address) + free(res->res_client.address); + if (res->res_client.password) + free(res->res_client.password); + break; + case R_STORAGE: + if (res->res_store.address) + free(res->res_store.address); + if (res->res_store.password) + free(res->res_store.password); + if (res->res_store.media_type) + free(res->res_store.media_type); + if (res->res_store.dev_name) + free(res->res_store.dev_name); + break; + case R_CATALOG: + if (res->res_cat.address) + free(res->res_cat.address); + if (res->res_cat.db_user) + free(res->res_cat.db_user); + if (res->res_cat.db_name) + free(res->res_cat.db_name); + if (res->res_cat.db_password) + free(res->res_cat.db_password); + break; + case R_FILESET: + if ((num=res->res_fs.num_includes)) { + while (--num >= 0) + free(res->res_fs.include_array[num]); + free(res->res_fs.include_array); + } + if ((num=res->res_fs.num_excludes)) { + while (--num >= 0) + free(res->res_fs.exclude_array[num]); + free(res->res_fs.exclude_array); + } + break; + case R_POOL: + if (res->res_pool.pool_type) { + free(res->res_pool.pool_type); + } + if (res->res_pool.label_format) { + free(res->res_pool.label_format); + } + break; + case R_SCHEDULE: + if (res->res_sch.run) { + RUN *nrun, *next; + nrun = res->res_sch.run; + while (nrun) { + next = nrun->next; + free(nrun); + nrun = next; + } + } + break; + case R_JOB: + if (res->res_job.RestoreWhere) { + free(res->res_job.RestoreWhere); + } + break; + case R_MSGS: + if (res->res_msgs.mail_cmd) + free(res->res_msgs.mail_cmd); + if (res->res_msgs.operator_cmd) + free(res->res_msgs.operator_cmd); + + break; + case R_GROUP: + break; + default: + printf("Unknown resource type %d\n", type); + } + /* Common stuff again -- free the resource, recurse to next one */ + free(res); + resources[rindex].res_head = nres; + if (nres) + free_resource(type); +} + +/* Save the new resource by chaining it into the head list for + * the resource. If this is pass 2, we update any resource + * pointers (currently only in the Job resource). + */ +void save_resource(int type, struct res_items *items, int pass) +{ + URES *res; + int rindex = type - r_first; + int i, size; + int error = 0; + + /* + * Ensure that all required items are present + */ + for (i=0; items[i].name; i++) { + if (items[i].flags & ITEM_REQUIRED) { + if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) { + Emsg2(M_ABORT, 0, "%s item is required in %s resource, but not found.\n", + items[i].name, resources[rindex]); + } + } + /* If this triggers, take a look at lib/parse_conf.h */ + if (i >= MAX_RES_ITEMS) { + Emsg1(M_ABORT, 0, "Too many items in %s resource\n", resources[rindex]); + } + } + + /* During pass 2, we looked up pointers to all the resources + * referrenced in the current resource, , now we + * must copy their address from the static record to the allocated + * record. + */ + if (pass == 2) { + switch (type) { + /* Resources not containing a resource */ + case R_CATALOG: + case R_STORAGE: + case R_FILESET: + case R_SCHEDULE: + case R_GROUP: + case R_POOL: + case R_MSGS: + break; + + /* Resources containing another resource */ + case R_DIRECTOR: + if ((res = (URES *)GetResWithName(R_DIRECTOR, res_all.res_dir.hdr.name)) == NULL) { + Emsg1(M_ABORT, 0, "Cannot find Director resource %s\n", res_all.res_dir.hdr.name); + } + res->res_dir.messages = res_all.res_dir.messages; + break; + case R_JOB: + if ((res = (URES *)GetResWithName(R_JOB, res_all.res_dir.hdr.name)) == NULL) { + Emsg1(M_ABORT, 0, "Cannot find Job resource %s\n", res_all.res_dir.hdr.name); + } + res->res_job.messages = res_all.res_job.messages; + res->res_job.schedule = res_all.res_job.schedule; + res->res_job.client = res_all.res_job.client; + res->res_job.fs = res_all.res_job.fs; + res->res_job.storage = res_all.res_job.storage; + res->res_job.pool = res_all.res_job.pool; + break; + case R_CLIENT: + if ((res = (URES *)GetResWithName(R_CLIENT, res_all.res_client.hdr.name)) == NULL) { + Emsg1(M_ABORT, 0, "Cannot find Client resource %s\n", res_all.res_client.hdr.name); + } + res->res_client.catalog = res_all.res_client.catalog; + break; + default: + Emsg1(M_ERROR, 0, "Unknown resource type %d\n", type); + error = 1; + break; + } + /* Note, the resource name was already saved during pass 1, + * so here, we can just release it. + */ + if (res_all.res_dir.hdr.name) { + free(res_all.res_dir.hdr.name); + res_all.res_dir.hdr.name = NULL; + } + return; + } + + switch (type) { + case R_DIRECTOR: + size = sizeof(DIRRES); + break; + case R_CLIENT: + size =sizeof(CLIENT); + break; + case R_STORAGE: + size = sizeof(STORE); + break; + case R_CATALOG: + size = sizeof(CAT); + break; + case R_JOB: + size = sizeof(JOB); + break; + case R_FILESET: + size = sizeof(FILESET); + break; + case R_SCHEDULE: + size = sizeof(SCHED); + break; + case R_GROUP: + size = sizeof(GROUP); + break; + case R_POOL: + size = sizeof(POOL); + break; + case R_MSGS: + size = sizeof(MSGS); + break; + default: + printf("Unknown resource type %d\n", type); + error = 1; + break; + } + /* Common */ + if (!error) { + res = (URES *) malloc(size); + memcpy(res, &res_all, size); + res->res_dir.hdr.next = resources[rindex].res_head; + resources[rindex].res_head = (RES *)res; + Dmsg2(90, "dir_conf: inserting %s res: %s\n", res_to_str(type), + res->res_dir.hdr.name); + } + +} + +/* + * Store backup/verify info for Job record + * + * Note, this code is used for both BACKUP and VERIFY jobs + * + * Backup = Client= FileSet= Level= + */ +static void store_backup(LEX *lc, struct res_items *item, int index, int pass) +{ + int token, i; + RES *res; + int options = lc->options; + + lc->options |= LOPT_NO_IDENT; /* make spaces significant */ + + + ((JOB *)(item->value))->JobType = item->code; + while ((token = lex_get_token(lc)) != T_EOL) { + int found; + + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a backup/verify keyword, got: %s", lc->str); + } else { + lcase(lc->str); + Dmsg1(190, "Got keyword: %s\n", lc->str); + found = FALSE; + for (i=0; BakVerFields[i].name; i++) { + if (strcmp(lc->str, BakVerFields[i].name) == 0) { + found = TRUE; + if (lex_get_token(lc) != T_EQUALS) { + scan_err1(lc, "Expected an equals, got: %s", lc->str); + } + token = lex_get_token(lc); + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a keyword name, got: %s", lc->str); + } + Dmsg1(190, "Got value: %s\n", lc->str); + switch (BakVerFields[i].token) { + case 'C': + /* Find Client Resource */ + if (pass == 2) { + res = GetResWithName(R_CLIENT, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified Client Resource: %s", + lc->str); + } + res_all.res_job.client = (CLIENT *)res; + } + break; + case 'F': + /* Find FileSet Resource */ + if (pass == 2) { + res = GetResWithName(R_FILESET, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified FileSet Resource: %s\n", + lc->str); + } + res_all.res_job.fs = (FILESET *)res; + } + break; + case 'L': + /* Get level */ + lcase(lc->str); + for (i=0; joblevels[i].level_name; i++) { + if (joblevels[i].job_class == item->code && + strcmp(lc->str, joblevels[i].level_name) == 0) { + ((JOB *)(item->value))->level = joblevels[i].level; + i = 0; + break; + } + } + if (i != 0) { + scan_err1(lc, "Expected a Job Level keyword, got: %s", lc->str); + } + break; + } /* end switch */ + break; + } /* end if strcmp() */ + } /* end for */ + if (!found) { + scan_err1(lc, "%s not a valid Backup/verify keyword", lc->str); + } + } + } /* end while */ + lc->options = options; /* reset original options */ + set_bit(index, res_all.hdr.item_present); +} + +/* + * Store restore info for Job record + * + * Restore = JobId= Where= Replace= + * + */ +static void store_restore(LEX *lc, struct res_items *item, int index, int pass) +{ + int token, i; + RES *res; + int options = lc->options; + + lc->options |= LOPT_NO_IDENT; /* make spaces significant */ + + Dmsg0(190, "Enter store_restore()\n"); + + ((JOB *)(item->value))->JobType = item->code; + while ((token = lex_get_token(lc)) != T_EOL) { + int found; + + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a Restore keyword, got: %s", lc->str); + } else { + lcase(lc->str); + found = FALSE; + for (i=0; RestoreFields[i].name; i++) { + Dmsg1(190, "Restore kw=%s\n", lc->str); + if (strcmp(lc->str, RestoreFields[i].name) == 0) { + found = TRUE; + if (lex_get_token(lc) != T_EQUALS) { + scan_err1(lc, "Expected an equals, got: %s", lc->str); + } + token = lex_get_token(lc); + Dmsg1(190, "Restore value=%s\n", lc->str); + switch (RestoreFields[i].token) { + case 'C': + /* Find Client Resource */ + if (pass == 2) { + res = GetResWithName(R_CLIENT, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified Client Resource: %s", + lc->str); + } + res_all.res_job.client = (CLIENT *)res; + } + break; + case 'F': + /* Find FileSet Resource */ + if (pass == 2) { + res = GetResWithName(R_FILESET, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified FileSet Resource: %s\n", + lc->str); + } + res_all.res_job.fs = (FILESET *)res; + } + break; + case 'J': + /* JobId */ + if (token != T_NUMBER) { + scan_err1(lc, "expected an integer number, got: %s", lc->str); + } + errno = 0; + res_all.res_job.RestoreJobId = strtol(lc->str, NULL, 0); + Dmsg1(190, "RestorJobId=%d\n", res_all.res_job.RestoreJobId); + if (errno != 0) { + scan_err1(lc, "expected an integer number, got: %s", lc->str); + } + break; + case 'W': + /* Where */ + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a Restore root directory, got: %s", lc->str); + } + if (pass == 1) { + res_all.res_job.RestoreWhere = bstrdup(lc->str); + } + break; + case 'R': + /* Replacement options */ + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a keyword name, got: %s", lc->str); + } + lcase(lc->str); + /* Fix to scan Replacement options */ + for (i=0; ReplaceOptions[i].name; i++) { + if (strcmp(lc->str, ReplaceOptions[i].name) == 0) { + ((JOB *)(item->value))->RestoreOptions = ReplaceOptions[i].token; + i = 0; + break; + } + } + if (i != 0) { + scan_err1(lc, "Expected a Restore replacement option, got: %s", lc->str); + } + break; + } /* end switch */ + break; + } /* end if strcmp() */ + } /* end for */ + if (!found) { + scan_err1(lc, "%s not a valid Restore keyword", lc->str); + } + } + } /* end while */ + lc->options = options; /* reset original options */ + set_bit(index, res_all.hdr.item_present); +} + + + +/* + * Scan for FileSet options + */ +static char *scan_fs_options(LEX *lc, int keyword) +{ + int token, i; + static char opts[100]; + char option[2]; + + option[0] = 0; /* default option = none */ + opts[0] = option[1] = 0; /* terminate options */ + for (;;) { + token = lex_get_token(lc); /* expect at least one option */ + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "expected a FileSet option, got: %s", lc->str); + } + lcase(lc->str); + if (keyword == FS_KW_VERIFY) { /* special case */ + /* ***FIXME**** ensure these are in permitted set */ + strcpy(option, "V"); /* indicate Verify */ + strcat(option, lc->str); + strcat(option, ":"); /* terminate it */ + } else { + for (i=0; FS_options[i].name; i++) { + if (strcmp(lc->str, FS_options[i].name) == 0 && FS_options[i].keyword == keyword) { + option[0] = FS_options[i].option; + i = 0; + break; + } + } + if (i != 0) { + scan_err1(lc, "Expected a FileSet option keyword, got: %s", lc->str); + } + } + strcat(opts, option); + + /* check if more options are specified */ + if (lc->ch != ',') { + break; /* no, get out */ + } + token = lex_get_token(lc); /* yes, eat comma */ + } + + return opts; +} + + +/* Store FileSet Include/Exclude info */ +static void store_inc(LEX *lc, struct res_items *item, int index, int pass) +{ + int token, i; + int options = lc->options; + int keyword; + char *fname; + char inc_opts[100]; + int inc_opts_len; + + lc->options |= LOPT_NO_IDENT; /* make spaces significant */ + + /* Get include options */ + strcpy(inc_opts, "0"); /* set no options */ + while ((token=lex_get_token(lc)) != T_BOB) { + if (token != T_STRING) { + scan_err1(lc, "expected a FileSet option keyword, got: %s", lc->str); + } else { + keyword = FS_KW_NONE; + lcase(lc->str); + for (i=0; FS_option_kw[i].name; i++) { + if (strcmp(lc->str, FS_option_kw[i].name) == 0) { + keyword = FS_option_kw[i].token; + break; + } + } + if (keyword == FS_KW_NONE) { + scan_err1(lc, "Expected a FileSet keyword, got: %s", lc->str); + } + } + /* Option keyword should be following by =