diff options
author | pixel <pixel> | 2002-11-29 20:39:44 +0000 |
---|---|---|
committer | pixel <pixel> | 2002-11-29 20:39:44 +0000 |
commit | ed0ed93bc9a64412c04a73938b04079cad95c4af (patch) | |
tree | 985cbfc9e800d0ee6d28ebb542d6ee79c9a4cc96 | |
parent | a69ef2131749e05bb43106d48139638de0144f69 (diff) |
Yeah... reworking on it!
68 files changed, 3143 insertions, 768 deletions
@@ -1 +1,12 @@ +2002-11-28 gettextize <bug-gnu-gettext@gnu.org> + + * Makefile.am (SUBDIRS): Add intl. + * configure.in (AC_OUTPUT): Add intl/Makefile. + +2002-11-28 gettextize <bug-gnu-gettext@gnu.org> + + * Makefile.am (ACLOCAL_AMFLAGS): New variable. + (EXTRA_DIST): New variable. + * configure.in (AC_OUTPUT): Add po/Makefile.in. + First release. And I hate writing changelogs. Especially when I start a project. diff --git a/Makefile.am b/Makefile.am index 75d62d1..fa2672c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,9 @@ localedir = $(datadir)/locale -SUBDIRS = lib include doc po intl src m4 +SUBDIRS = intl lib include doc po src m4 AM_CFLAGS = -Wall -Wstrict-prototypes -g INCLUDES = -I$(includedir) + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = config.rpath mkinstalldirs diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 62df7e4..0000000 --- a/acconfig.h +++ /dev/null @@ -1,31 +0,0 @@ -#undef HAVE_WD_ZLIB -#undef HAVE_LIBINTL_H - -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have catgets and don't want to use GNU gettext. */ -#undef HAVE_CATGETS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define as 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -#if ENABLE_NLS -# ifndef HAVE_LIBINTL_H -# define HAVE_LIBINTL_H 1 -# endif -# include <libintl.h> -# define _(Text) gettext (Text) -#else -# define bindtextdomain(Domain, Directory) -# define textdomain(Domain) -# define _(Text) Text -# define gettext(z) z -#endif -#define N_(Text) Text @@ -1,7 +1,7 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. echo Running gettextize... -gettextize -c +gettextize -c --intl --no-changelog echo Running libtoolize... libtoolize -c --automake echo Running aclocal... diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..972279b --- /dev/null +++ b/configure.ac @@ -0,0 +1,138 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.56) + +PACKAGE=Baltisot +VERSION=0.1.0 + +AC_SUBST(PACKAGE, [Baltisot]) +AC_SUBST(VERSION, [0.1.0]) + +AC_INIT([Baltisot], [0.1.0], [pixel@nobis-crew.org]) +AC_CONFIG_SRCDIR(src/Main.cc) +AM_CONFIG_HEADER(config.h) + +AM_MAINTAINER_MODE + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_RANLIB +AC_PROG_YACC +AM_PROG_LIBTOOL +AC_ARG_PROGRAM + +# Checks for libraries. +AC_CHECK_LIB([c], [printf]) + +# Checks for header files. +AC_FUNC_ALLOCA +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([argz.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM +AC_C_VOLATILE + +# Checks for library functions. +AM_GNU_GETTEXT() +AC_SUBST(USE_INCLUDED_LIBINTL) +ALL_LINGUAS="fr" +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_MMAP +AC_FUNC_REALLOC +AC_TYPE_SIGNAL +AC_FUNC_STRFTIME +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify getcwd gethostbyname memmove mempcpy memset munmap nl_langinfo regcomp setlocale socket stpcpy strcasecmp strchr strcspn strdup strerror strrchr strstr strtoul]) + +AC_SEARCH_LIBS(socket, socket) +AC_SEARCH_LIBS(gethostbyname, nsl) +AC_SEARCH_LIBS(deflate, z) + +if test x$ac_cv_search_deflate != xno ; then + AC_DEFINE([HAVE_ZLIB], 1, [Have the ZLIB]) + OLDCPPFLAGS=$CPPFLAGS + CPPFLAGS="-Werror" + AC_CACHE_CHECK([for well defined gzwrite in zlib.h], ac_cv_wd_gzwrite, + AC_TRY_COMPILE( + [#include <zlib.h>], + [const char * buf = "Poide"; gzwrite(NULL, buf, 10);], + [AC_DEFINE([HAVE_WD_ZLIB], 1, [Have a well structured ZLIB]) + ac_cv_wd_gzwrite="yes"], + [ac_cv_wd_gzwrite="no"] + AC_WARNING([You have a broken zconf.h. You should] + [patch this using the zconf.h-patch file.] + [Enabling workaround]) + ) + ) + CPPFLAGS=$OLDCPPFLAGS +fi + +AC_CACHE_CHECK([usable long long], ac_cv_use_longlong, + AC_TRY_COMPILE( + [], + [unsigned long long t;], + [AC_DEFINE([USE_LONG_LONG], 1, [Can use Long Long]) + ac_cv_use_longlong="yes"], + [ac_cv_use_longlong="no"] + ) +) + +AC_CHECK_FUNCS(gethostbyname) +AC_CHECK_FUNCS(regcomp) +AC_CHECK_FUNCS(socket) + +AC_PATH_PROG(gmakepath, gmake) +AC_PATH_PROG(unamepath, uname) +if test "x$unamepath" = x; then + system="unknown" +else + AC_MSG_CHECKING(system type) + system=`$unamepath -s` + AC_MSG_RESULT($system) +fi + + + +AC_CONFIG_FILES([Makefile + doc/Makefile + include/Makefile + intl/Makefile + lib/Makefile + m4/Makefile + po/Makefile.in + src/Makefile + src/datas/Makefile]) +AC_OUTPUT + + +echo +echo \-\-\= $PACKAGE $VERSION \=\-\- +echo + +echo Build System .................... : $system +echo Build Host ...................... : $host +echo Install Prefix .................. : $prefix +echo + +if test _"$gmakepath" = _; then + echo configure complete, now type \'make\' +else + echo configure complete, now type \'gmake\' +fi +
\ No newline at end of file diff --git a/configure.in b/configure.in deleted file mode 100644 index 15d876b..0000000 --- a/configure.in +++ /dev/null @@ -1,152 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(src/Main.cc) - -dnl Creating versions info. - -Baltisot_MAJOR_VERSION=0 -Baltisot_MINOR_VERSION=1 -Baltisot_MICRO_VERSION=0 -Baltisot_VERSION=$Baltisot_MAJOR_VERSION.$Baltisot_MINOR_VERSION.$Baltisot_MICRO_VERSION - -dnl set version info for Baltisot.so to package rev - $MAJOR . $MINOR : $MICRO -Baltisot_VERSION_INFO=$Baltisot_MAJOR_VERSION.$Baltisot_MINOR_VERSION.$Baltisot_MICRO_VERSION - -AC_SUBST(Baltisot_MAJOR_VERSION) -AC_SUBST(Baltisot_MINOR_VERSION) -AC_SUBST(Baltisot_MICRO_VERSION) -AC_SUBST(Baltisot_VERSION) -AC_SUBST(Baltisot_VERSION_INFO) - -VERSION=$Baltisot_VERSION -PACKAGE=Baltisot - -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) - -AM_CONFIG_HEADER(config.h) - -AM_MAINTAINER_MODE - -dnl Checks for classical programs. -AC_PROG_CXX -AC_PROG_AWK -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_CANONICAL_HOST -AM_PROG_LIBTOOL -AC_PROG_YACC -AM_PROG_GCJ - -dnl Setting up environnement. -ALL_LINGUAS="fr" -AM_GNU_GETTEXT -if test x$USE_INCLUDED_LIBINTL = xyes; then - LINK_SRC="$LINK_SRC intl/libgettext.h" - LINK_DST="$LINK_DST include/libintl.h" -fi -test "$MSGFMT" = "no" && MSGFMT ="$missing_dir/missing msgfmt" -test "$GMSGFMT" = "no" && GMSGFMT ="$missing_dir/missing msgfmt" -test "$XGETTEXT" = ":" && XGETTEXT="$missing_dir/missing xgettext" - -if test x$gt_cv_func_gettext_libintl = xyes; then - case "$LIBS" in - *-lintl*) ;; - *) LIBS="$LIBS -lintl";; - esac -fi - -dnl Checks for classical header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(libintl.h fcntl.h limits.h malloc.h strings.h unistd.h langinfo.h) -AC_CHECK_HEADERS(alloca.h errno.h netdb.h netinet/in.h sys/socket.h stddef.h) -AC_HEADER_SYS_WAIT -AC_STRUCT_TM -AC_HEADER_TIME -AC_CHECK_HEADERS([sys/time.h]) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_C_BIGENDIAN -AC_TYPE_SIGNAL - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_FUNC_MMAP -AC_CHECK_FUNCS(getcwd getwd putenv strdup memmove memset select poll) -AC_CHECK_FUNCS(strerror strrchr strstr mempcpy nl_langinfo strcspn) -AC_SEARCH_LIBS(socket,socket) -AC_SEARCH_LIBS(gethostbyname,nsl) -AC_SEARCH_LIBS(deflate,z) -if test x$ac_cv_search_deflate != xno ; then - OLDCPPFLAGS=$CPPFLAGS - CPPFLAGS="-Werror" - AC_CACHE_CHECK([for well defined gzwrite in zlib.h], ac_cv_wd_gzwrite, - AC_TRY_COMPILE( - [#include <zlib.h>], - [const char * buf = "Poide"; gzwrite(NULL, buf, 10);], - [AC_DEFINE(HAVE_WD_ZLIB) - ac_cv_wd_gzwrite="yes"], - [ac_cv_wd_gzwrite="no"] - AC_ERROR([You have a broken zconf.h and compiler pair. You] - [should patch this using the zconf.h-patch file.]) - ) - ) - CPPFLAGS=$OLDCPPFLAGS -else - AC_ERROR([This library needs the zlib library. You can find] - [it at the url: http://www.zlib.org]) -fi - -AC_FUNC_FORK -AC_FUNC_MALLOC -AC_FUNC_VPRINTF -AC_FUNC_STRFTIME -AC_CHECK_FUNCS(gethostbyname) -AC_CHECK_FUNCS(regcomp) -AC_CHECK_FUNCS(socket) - -AC_PATH_PROG(gmakepath, gmake) -AC_PATH_PROG(unamepath, uname) -if test "x$unamepath" = x; then - system="unknown" -else - AC_MSG_CHECKING(system type) - system=`$unamepath -s` - AC_MSG_RESULT($system) -fi - -AC_SUBST(bindir) - -AC_OUTPUT([ - Makefile - include/Makefile - lib/Makefile - doc/Makefile - src/Makefile - src/datas/Makefile - po/Makefile.in - po/Makefile - intl/Makefile - m4/Makefile -]) - -echo -echo \-\-\= $PACKAGE $VERSION \=\-\- -echo - -echo Build System .................... : $system -echo Build Host ...................... : $host -echo Install Prefix .................. : $prefix -echo - -if test _"$gmakepath" = _; then - echo configure complete, now type \'make\' -else - echo configure complete, now type \'gmake\' -fi - -echo diff --git a/include/Buffer.h b/include/Buffer.h index 79d0e02..dc4d768 100644 --- a/include/Buffer.h +++ b/include/Buffer.h @@ -17,12 +17,12 @@ class Buffer : public Handle { virtual ~Buffer(); virtual ssize_t write(const void *buf, size_t count) throw(GeneralException); virtual ssize_t read(void *buf, size_t count) throw (GeneralException); - virtual bool CanRead(); - virtual bool CanWrite(); - virtual String GetName(); + virtual bool CanRead() const; + virtual bool CanWrite() const; + virtual String GetName() const; virtual Buffer operator=(const Buffer &); - virtual bool CanWatch(); - virtual ssize_t GetSize(); + virtual bool CanWatch() const; + virtual ssize_t GetSize() const; char operator[](size_t) const; char & operator[](size_t); diff --git a/include/Color.h b/include/Color.h new file mode 100644 index 0000000..293c55c --- /dev/null +++ b/include/Color.h @@ -0,0 +1,10 @@ +#ifndef __COLOR_H__ +#define __COLOR_H__ + +struct Color { + Color(unsigned char aR, unsigned char aG, unsigned char aB, unsigned char aA = 255) : + R(aR), G(aG), B(aB), A(aA) { } + unsigned char R, G, B, A; +}; + +#endif diff --git a/include/Exceptions.h b/include/Exceptions.h index ef697e7..74ad938 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -21,8 +21,10 @@ class Base { void operator delete(void * p); static void free(void *& p); static void free(char *& p); + static void free(unsigned char *& p); static int pipe(int * p, int flag = 0); static pid_t fork(); + static void exit(int); }; class String; @@ -32,7 +34,7 @@ class GeneralException : public Base { GeneralException(String); GeneralException(const GeneralException &); ~GeneralException(); - char * GetMsg(); + const char * GetMsg() const; protected: GeneralException(); @@ -44,9 +46,11 @@ char * xstrdup(const char *); void * xmalloc(size_t) throw (GeneralException); void xfree(void *&); void xfree(char *&); +void xfree(unsigned char *&); void * xrealloc(void *, size_t); int xpipe(int *, int = 0) throw (GeneralException); pid_t xfork() throw (GeneralException); +void xexit(int) throw (GeneralException); INLINE char * Base::strdup(const char * s) { return xstrdup(s); @@ -84,6 +88,10 @@ INLINE void Base::free(char *& p) { xfree(p); } +INLINE void Base::free(unsigned char *& p) { + xfree(p); +} + INLINE int Base::pipe(int * p, int flag) { return xpipe(p, flag); } @@ -92,6 +100,10 @@ INLINE pid_t Base::fork() { return xfork(); } +INLINE void Base::exit(int status) { + xexit(status); +} + class MemoryException : public GeneralException { public: MemoryException(ssize_t); @@ -129,6 +141,14 @@ class TaskSwitch : public GeneralException { TaskSwitch(); }; +class Exit : public GeneralException { + public: + Exit(int); + int GetCode(); + private: + int code; +}; + #include <String.h> #else diff --git a/include/General.h b/include/General.h index 6f423ed..2b645c9 100644 --- a/include/General.h +++ b/include/General.h @@ -4,4 +4,9 @@ #define MAX(__a,__b) ((__a)<(__b)?(__b):(__a)) #define MIN(__a,__b) ((__a)>(__b)?(__b):(__a)) +#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) +#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ + - (((x)>>2)&0x33333333) \ + - (((x)>>3)&0x11111111)) + #endif diff --git a/include/Handle.h b/include/Handle.h index 6e26e9c..9744b7e 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -2,48 +2,61 @@ #define __HANDLE_H__ #ifdef __cplusplus +#include <sys/types.h> +#include <time.h> + +#ifdef HAVE_ZLIB #include <zlib.h> +#endif #include <unistd.h> #include <iostream> #include <String.h> #include <Exceptions.h> -#include <sys/types.h> -#include <time.h> - class Handle : public Base { public: Handle(const Handle &); virtual ~Handle(); virtual ssize_t read(void *buf, size_t count) throw (GeneralException); virtual ssize_t write(const void *buf, size_t count) throw (GeneralException); - bool IsClosed(void); - bool IsNonBlock(void); + bool IsClosed(void) const; + bool IsNonBlock(void) const; void SetNonBlock(void); - virtual bool CanRead(); - virtual bool CanWrite(); - virtual String GetName(); - virtual ssize_t GetSize(); - virtual time_t GetModif(); + virtual bool CanRead() const; + virtual bool CanWrite() const; + virtual bool CanSeek() const; + virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); + virtual off_t tell() const; + virtual String GetName() const; + virtual ssize_t GetSize() const; + virtual time_t GetModif() const; void close() throw (GeneralException); int GetHandle(); - virtual bool CanWatch(); + virtual bool CanWatch() const; virtual void Dup(const Handle &); - virtual void SetZ(int) throw (GeneralException); +#ifdef HAVE_ZLIB + virtual void SetZ(int = 9) throw (GeneralException); +#endif protected: Handle(int h); + int GetHandle() const; + off_t itell; private: ssize_t uwrite(const void *, size_t) throw (GeneralException); ssize_t uread(void *, size_t); int h; bool closed, nonblock; +#ifdef HAVE_ZLIB gzFile zfile; int z; +#endif }; Handle & operator<<(Handle &, const String &); Handle & operator>>(Handle &, String &); +void copy(Handle *, Handle *, ssize_t = -1); + #else #error This only works with a C++ compiler #endif diff --git a/include/Image.h b/include/Image.h index 8fd719c..87a8ddd 100644 --- a/include/Image.h +++ b/include/Image.h @@ -3,27 +3,23 @@ #ifdef __cplusplus #include <Buffer.h> +#include <generic.h> +#include <Color.h> enum { - FORMAT_TGA_BASIC, -} format_t; - -struct Color { - Color(unsigned char aR, unsigned char aG, unsigned char aB, unsigned char aA = 255) : - R(aR), G(aG), B(aB), A(aA) { } - unsigned char R, G, B, A; + FORMAT_TGA_BASIC }; class Image : public Buffer { public: Image(unsigned int, unsigned int); virtual ~Image(); - Color GetPixel(unsigned int, unsigned int); + Color GetPixel(unsigned int, unsigned int) const; void SetPixel(unsigned int, unsigned int, Color); bool Prepare(unsigned int = FORMAT_TGA_BASIC); void Fill(Color = Color(0, 0, 0)); - virtual String GetName(); - virtual bool CanWrite(); + virtual String GetName() const; + virtual bool CanWrite() const; private: typedef unsigned char Byte; @@ -42,13 +38,13 @@ class Image : public Buffer { Word IS_Height; Byte IS_Depth; Byte IS_Descriptor; - } __attribute__((packed)); + } PACKED; struct TGAFooter { DWord ExtOffset; DWord DevOffset; char Sig[18]; - } __attribute__((packed)); + } PACKED; unsigned int x, y; bool r; diff --git a/include/Input.h b/include/Input.h index 7091258..cb1428f 100644 --- a/include/Input.h +++ b/include/Input.h @@ -9,14 +9,16 @@ class Input : public Handle { public: - Input(String = "") throw (GeneralException); + Input(const String & = "") throw (GeneralException); Input(const Input &); virtual ~Input() {} - virtual bool CanWrite(); - virtual bool CanRead(); - virtual String GetName(); - virtual ssize_t GetSize(); - virtual time_t GetModif(); + virtual bool CanWrite() const; + virtual bool CanRead() const; + virtual bool CanSeek() const; + virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); + virtual String GetName() const; + virtual ssize_t GetSize() const; + virtual time_t GetModif() const; protected: String n; @@ -24,13 +26,12 @@ class Input : public Handle { time_t date_modif; }; -class Stdin_t : public Handle { +class Stdin_t : public Input { public: Stdin_t(); virtual ~Stdin_t() {} - virtual bool CanWrite(); - virtual bool CanRead(); - virtual String GetName(); + virtual bool CanSeek() const; + virtual String GetName() const; }; extern Stdin_t Stdin; diff --git a/include/Output.h b/include/Output.h index 32d4e66..eb7b8a6 100644 --- a/include/Output.h +++ b/include/Output.h @@ -2,38 +2,44 @@ #define __OUTPUT_H__ #ifdef __cplusplus +#include <sys/types.h> +#include <time.h> #include <String.h> #include <Handle.h> class Output : public Handle { public: - Output(String = "", int trunc = 1) throw (GeneralException); + Output(String = "", int create = 1, int trunc = 1) throw (GeneralException); Output(const Output &); virtual ~Output() {} - virtual bool CanWrite(); - virtual bool CanRead(); - virtual String GetName(); + virtual bool CanWrite() const; + virtual bool CanRead() const; + virtual bool CanSeek() const; + virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); + virtual String GetName() const; protected: String n; + off_t size; + time_t date_modif; }; -class Stdout_t : public Handle { +class Stdout_t : public Output { public: Stdout_t(); virtual ~Stdout_t() {} - virtual bool CanWrite(); - virtual bool CanRead(); - virtual String GetName(); + virtual bool CanSeek() const; + virtual String GetName() const; }; class Stderr_t : public Handle { public: Stderr_t(); virtual ~Stderr_t() {} - virtual bool CanWrite(); - virtual bool CanRead(); - virtual String GetName(); + virtual bool CanWrite() const; + virtual bool CanRead() const; + virtual bool CanSeek() const; + virtual String GetName() const; }; extern Stdout_t Stdout; diff --git a/include/String.h b/include/String.h index f8db2c7..27a7f2c 100644 --- a/include/String.h +++ b/include/String.h @@ -10,11 +10,16 @@ class String : public Base { public: String(const String &); String(const char * = ""); +#if 0 + String(const char * = "", ...); +#endif String(char); String(int); String(unsigned int); +#ifdef USE_LONG_LONG String(long long); String(unsigned long long); +#endif String(double); ~String(); const char * set(const char *, ...); @@ -48,6 +53,8 @@ class String : public Base { bool operator<(const String &) const; bool operator>(const String &) const; char operator[](size_t i) const; + String & toupper(); + String & tolower(); private: String(int hs, const char *); @@ -59,6 +66,8 @@ class String : public Base { std::ostream & operator<<(std::ostream &, const String &); std::istream & operator>>(std::istream &, String &); +String operator+(const char *, const String &); + #else #error This only works with a C++ compiler #endif diff --git a/include/generic.h b/include/generic.h new file mode 100644 index 0000000..62a9942 --- /dev/null +++ b/include/generic.h @@ -0,0 +1,128 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002 Nicolas "Pixel" Noble + * + * 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 __GENERIC_H__ +#define __GENERIC_H__ +#ifdef __cplusplus +#include "String.h" +#endif + +#define M_BARE -1 +#define M_ERROR 0 +#define M_STATUS 1 +#define M_WARNING 2 +#define M_INFO 3 + +#ifndef bcopy +#define bcopy(x,y,z) memcpy((y),(x),(z)) +#endif + +#ifndef MAX +#define MIN(a,b) ((a)<(b)?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a,b) ((a)<(b)?(b):(a) +#endif + +#ifndef SDL_VERSIONNUM +typedef unsigned long int Uint32; +#endif + +#ifndef int32 +typedef signed long int int32; +#endif + +#ifndef Uint16 +typedef unsigned short int Uint16; +#endif + +#ifndef int16 +typedef signed short int int16; +#endif + +#ifndef Uint8 +typedef unsigned char Uint8; +#endif + +#ifndef int8 +typedef signed char int8; +#endif + +#ifndef Byte +typedef Uint8 Byte; +#endif + +#ifndef Word +typedef Uint16 Word; +#endif + +#ifndef DWord +typedef Uint32 DWord; +#endif + +#if defined __linux__ || defined __CYGWIN32__ +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + +extern char verbosity; +char ** split(char * s, char t); + +#ifdef __cplusplus +void printm(int level, String fmt, ...); + +#ifndef MAX +template<class T> +inline T MAX(T a, T b) { + return a < b ? b : a; +} +#endif + +#ifndef MIN +template<class T> +inline T MIN(T a, T b) { + return a > b ? b : a; +} +#endif + +#else +#ifndef MAX +#define MAX(__a,__b) ((__a)<(__b)?(__b):(__a)) +#endif + +#ifndef MIN +#define MIN(__a,__b) ((__a)>(__b)?(__b):(__a)) +#endif + +#endif + +#include <sys/types.h> +#include <sys/stat.h> + +#if defined __linux__ || defined __CYGWIN32__ +#define MKDIR(name) mkdir(name, 0777) +#elif defined __WIN32__ +#define MKDIR mkdir +#else +#error Unknow compiler/platform +#endif + +#endif diff --git a/include/gettext.h b/include/gettext.h new file mode 100644 index 0000000..ab2d962 --- /dev/null +++ b/include/gettext.h @@ -0,0 +1,72 @@ +/* Convenience header for conditional use of GNU <libintl.h>. + Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library 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 _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include <libintl.h> + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of <locale.h> a NOP. We don't include <libintl.h> + as well because people using "gettext.h" will not include <libintl.h>, + and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> + is OK. */ +#if defined(__sun) +# include <locale.h> +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +#define _(Text) gettext (Text) +#define N_(Text) Text + +#endif /* _LIBGETTEXT_H */ diff --git a/lib/Action.cc b/lib/Action.cc index d7e8314..72b6800 100644 --- a/lib/Action.cc +++ b/lib/Action.cc @@ -1,7 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "String.h" #include "Action.h" #include "HttpServ.h" -#include "config.h" Action * Action::start = 0; diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 905090e..db8b3ee 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -1,7 +1,9 @@ #include <string.h> -#include "Buffer.h" -#include "General.h" +#ifdef HAVE_CONFIG_H #include "config.h" +#endif +#include "Buffer.h" +#include "generic.h" Buffer::Buffer() : Handle(-1), buffer(0), zero(0), realsiz(0), bufsiz(0), ptr(0) { } @@ -50,15 +52,15 @@ ssize_t Buffer::read(void *buf, size_t count) throw (GeneralException) { return count; } -bool Buffer::CanRead() { +bool Buffer::CanRead() const { return true; } -bool Buffer::CanWrite() { +bool Buffer::CanWrite() const { return true; } -String Buffer::GetName() { +String Buffer::GetName() const { return "Buffer"; } @@ -77,11 +79,11 @@ Buffer Buffer::operator=(const Buffer & b) { return *this; } -bool Buffer::CanWatch() { +bool Buffer::CanWatch() const { return false; } -ssize_t Buffer::GetSize() { +ssize_t Buffer::GetSize() const { return realsiz; } diff --git a/lib/Confirm.cc b/lib/Confirm.cc index 1176db1..18e56e6 100644 --- a/lib/Confirm.cc +++ b/lib/Confirm.cc @@ -1,8 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "HttpServ.h" #include "Confirm.h" #include "Buffer.h" #include "CopyJob.h" -#include "config.h" Confirm::Confirm(const String & t, const String & m, const String & U, Action * y, Action * n) : Action(U), tit(t), msg(m), NYes(y), NNo(n) { } diff --git a/lib/CopyJob.cc b/lib/CopyJob.cc index 7acc7c5..3e6180d 100644 --- a/lib/CopyJob.cc +++ b/lib/CopyJob.cc @@ -1,6 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "gettext.h" #include "CopyJob.h" #include "General.h" -#include "config.h" CopyJob::CopyJob(Handle * as, Handle * ad, ssize_t asiz, bool ads, bool add) : s(as), d(ad), ds(ads), dd(add), siz(asiz), cursiz(0), r(0), w(0), tw(0) { s->SetNonBlock(); diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index fa9c6da..b183b55 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -3,10 +3,19 @@ #include <string.h> #include <errno.h> #include <stddef.h> +#ifdef HAVE_GLIB +#include <glib.h> +#endif +#ifdef DEBUG +#include <iostream> +#endif +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "String.h" #include "Exceptions.h" -#include "General.h" -#include "config.h" +#include "generic.h" +#include "gettext.h" char GeneralException::t[BUFSIZ]; @@ -32,17 +41,17 @@ GeneralException::~GeneralException() { TaskNotFound::TaskNotFound() : GeneralException("Task not found") { } -char * GeneralException::GetMsg() { +const char * GeneralException::GetMsg() const { return msg; } MemoryException::MemoryException(ssize_t s) { - sprintf(t, _("Failed allocating %ld bytes."), s); + sprintf(t, _("Failed allocating %u bytes."), s); msg = strdup(t); } IOException::IOException(String fn, op_t op, ssize_t s) { - sprintf(t, _("An error has occured while %s %ld bytes on %s: %s"), op == IO_WRITE ? _("writing") : _("reading"), + sprintf(t, _("An error has occured while %s %u bytes on %s: %s"), op == IO_WRITE ? _("writing") : _("reading"), s, fn.to_charp(), strerror(errno)); msg = strdup(t); } @@ -63,6 +72,16 @@ TaskSwitch::TaskSwitch() : GeneralException(_("Switching task in a non-tasked en #endif } +Exit::Exit(int a_code) : GeneralException(_("Exitting with code " + a_code)), code(a_code) { +#ifdef DEBUG + cerr << "Generating an Exit exception: '" << GetMsg() << "'.\n"; +#endif +} + +int Exit::GetCode() { + return code; +} + char * xstrdup(const char * s) { char * r; @@ -78,51 +97,42 @@ void * xmalloc(size_t s) throw (GeneralException) { return 0; } - if (!(r = (char *) ::malloc(s + sizeof(size_t)))) { - throw MemoryException(s + sizeof(size_t)); + if (!(r = (char *) ::malloc(s))) { + throw MemoryException(s); } +#ifdef DEBUG + fprintf(stderr, "Allocating %i bytes of memory, got it at %p\n", s, r); +#endif - memset(r, 0, s + sizeof(size_t)); + memset(r, 0, s); - *((size_t *)r) = s; - - return (void *)(r + sizeof(size_t)); + return (void *)(r); } void * xrealloc(void * ptr, size_t s) { - char * r; - size_t os; - - if (!ptr) { - return xmalloc(s); - } - - os = *(((size_t *) ptr) - 1); - - r = (char *) xmalloc(s); - - if (s) { - memcpy(r, ptr, MIN(s, os)); - } - - xfree(ptr); +#ifdef DEBUG + void * r = realloc(ptr, s); + fprintf(stderr, "Reallocating pointer at %p for %i bytes, now at %p\n", ptr, s, r); return r; +#else + return realloc(ptr, s); +#endif } -#ifdef OVER_FREE -#undef free -#endif +void xfree(unsigned char *& p) { + xfree(((char *)p)); +} void xfree(void *& p) { - if (p) { - ::free(((char *)p) - sizeof(size_t)); - p = 0; - } + xfree(((char *)p)); } void xfree(char *& p) { +#ifdef DEBUG + fprintf(stderr, "Freeing pointer at %p\n", p); +#endif if (p) { - ::free(p - sizeof(size_t)); + ::free(p); p = 0; } } @@ -146,3 +156,7 @@ pid_t xfork() throw (GeneralException) { return p; } + +void xexit(int status) throw (GeneralException) { + throw Exit(status); +} diff --git a/lib/Form.cc b/lib/Form.cc index 464dec3..fedfc3e 100644 --- a/lib/Form.cc +++ b/lib/Form.cc @@ -1,8 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Form.h" #include "HttpServ.h" #include "Buffer.h" #include "CopyJob.h" -#include "config.h" Form::Form(const String & titre, const String & url, const String & inv, String * names, String * invs, String * defaults, String ** lists, String ** descs, int nb, Action * na) : diff --git a/lib/Handle.cc b/lib/Handle.cc index da29a51..0470929 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -3,14 +3,23 @@ #include <string.h> #include <errno.h> #include <fcntl.h> -#include "Handle.h" +#ifdef HAVE_CONFIG_H #include "config.h" +#endif +#include "Handle.h" +#include "gettext.h" -Handle::Handle(const Handle & nh) : h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0) { +Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed) +#ifdef HAVE_ZLIB +, zfile(0), z(0) +#endif +{ // cerr << "Duplication of handle " << nh.h << " to " << h << endl; +#ifdef HAVE_ZLIB if ((h >= 0) && (nh.z)) { SetZ(nh.z); } +#endif } Handle::~Handle() { @@ -18,7 +27,11 @@ Handle::~Handle() { close(); } -Handle::Handle(int nh) : h(nh), closed(false), nonblock(false), zfile(0), z(0) { +Handle::Handle(int nh) : h(nh), closed(false), nonblock(false) +#ifdef HAVE_ZLIB +, zfile(0), z(0) +#endif +{ // cerr << "Initialising handle " << h << endl; } @@ -26,6 +39,10 @@ int Handle::GetHandle() { return h; } +int Handle::GetHandle() const { + return h; +} + ssize_t Handle::write(const void *buf, size_t count) throw (GeneralException) { ssize_t r, tr = 0; bool done, full = false; @@ -92,11 +109,11 @@ ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { return r; } -bool Handle::IsClosed(void) { +bool Handle::IsClosed(void) const { return closed; } -bool Handle::IsNonBlock(void) { +bool Handle::IsNonBlock(void) const { return nonblock; } @@ -145,6 +162,7 @@ void Handle::close() throw (GeneralException) { } if (h >= 0) { +#ifdef HAVE_ZLIB if (z) { // cerr << "Performing gzclose on handle " << h << endl; int err = gzclose(zfile); @@ -157,6 +175,9 @@ void Handle::close() throw (GeneralException) { } } } else { +#else + { +#endif int err = ::close(h); if (err) { throw GeneralException(String(_("Error during close: ")) + strerror(errno)); @@ -169,27 +190,27 @@ void Handle::close() throw (GeneralException) { closed = 1; } -bool Handle::CanRead(void) { +bool Handle::CanRead(void) const { return false; } -bool Handle::CanWrite(void) { +bool Handle::CanWrite(void) const { return false; } -String Handle::GetName(void) { +String Handle::GetName(void) const { return _("Bare Handle - should not happend"); } -ssize_t Handle::GetSize(void) { +ssize_t Handle::GetSize(void) const { return -1; } -time_t Handle::GetModif(void) { +time_t Handle::GetModif(void) const { return -1; } -bool Handle::CanWatch(void) { +bool Handle::CanWatch(void) const { return true; } @@ -200,6 +221,7 @@ void Handle::Dup(const Handle & H) { } } +#ifdef HAVE_ZLIB void Handle::SetZ(int az) throw (GeneralException) { if (z) { throw GeneralException(_("Can't SetZ a Handle twice.")); @@ -225,11 +247,18 @@ void Handle::SetZ(int az) throw (GeneralException) { z = az; } } +#endif ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) { +#ifdef HAVE_ZLIB if (z) { + itell += count; // cerr << "Performing gzwrite of " << count << " byte for handle " << h << endl; +#ifdef HAVE_CLEAN_ZLIB int err = gzwrite(zfile, buf, count); +#else + int err = gzwrite(zfile, (char *) buf, count); +#endif // cerr << "gzwrite returned " << err << endl; if (err == 0) { const char * m = gzerror(zfile, &err); @@ -241,12 +270,18 @@ ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) } return err; } else { - return ::write(h, buf, count); +#else + { +#endif + itell += count = ::write(h, buf, count); + return count; } } ssize_t Handle::uread(void * buf, size_t count) { +#ifdef HAVE_ZLIB if (z) { + itell += count; // cerr << "Performing gzread of " << count << " byte for handle " << h << endl; int err = gzread(zfile, buf, count); // cerr << "gzwrite returned " << err << endl; @@ -260,6 +295,36 @@ ssize_t Handle::uread(void * buf, size_t count) { } return err; } else { - return ::read(h, buf, count); +#else + { +#endif + itell += count = ::read(h, buf, count); + return count; + } +} + +off_t Handle::tell() const { + return itell; +} + +bool Handle::CanSeek() const { + return 0; +} + +off_t Handle::seek(off_t, int) throw(GeneralException) { + throw IOGeneral("Handle " + GetName() + " can't seek"); +} + +void copy(Handle * s, Handle * d, ssize_t size) { + long i; + unsigned char c; + long r; + + for (i = 0; (i < size) || (size < 0); i++) { + r = s->read(&c, 1); + if (r == 0) { + break; + } + d->write(&c, 1); } } diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index f649a78..e258fd6 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Socket.h" #include "Action.h" #include "HttpServ.h" @@ -5,7 +8,6 @@ #include "ReadJob.h" #include "CopyJob.h" #include "Task.h" -#include "config.h" String endhl = "\r\n", endnl = "\n"; @@ -1,7 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "String.h" #include "IRC.h" #include "HttpServ.h" -#include "config.h" ircmsg_t ircmsgs[MSG_COUNT] = diff --git a/lib/Image.cc b/lib/Image.cc index fedee9e..ad986f6 100644 --- a/lib/Image.cc +++ b/lib/Image.cc @@ -1,5 +1,8 @@ -#include "Image.h" +#ifdef HAVE_CONFIG_H #include "config.h" +#endif +#include "Image.h" +#include "gettext.h" Image::Image(unsigned int ax, unsigned int ay) : x(ax), y(ay), img((Color *) malloc(x * y * sizeof(Color))) { Fill(); @@ -9,11 +12,11 @@ Image::~Image() { free((void *)img); } -bool Image::CanWrite() { +bool Image::CanWrite() const { return false; } -String Image::GetName() { +String Image::GetName() const { return String(_("Image ")) + x + "x" + y; } @@ -23,7 +26,7 @@ void Image::Fill(Color c) { } } -Color Image::GetPixel(unsigned int px, unsigned int py) { +Color Image::GetPixel(unsigned int px, unsigned int py) const { if ((px >= x) || (py >= y)) { return Color(0, 0, 0, 0); } diff --git a/lib/InPipe.cc b/lib/InPipe.cc index c61005f..2048fae 100644 --- a/lib/InPipe.cc +++ b/lib/InPipe.cc @@ -1,6 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "InPipe.h" #include "Output.h" -#include "config.h" +#include "gettext.h" InPipe::InPipe() : Handle(pipe(p, 0)), hooked(0) { } diff --git a/lib/Input.cc b/lib/Input.cc index 5652c57..5109d2a 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -5,61 +5,85 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Input.h" #include "Exceptions.h" -#include "config.h" +#include "gettext.h" -Input::Input(String no) throw (GeneralException) : +Input::Input(const String & no) throw (GeneralException) : Handle(no.strlen() ? open(no.to_charp(), O_RDONLY) : dup(0)), n(no) { + +#ifdef DEBUG + fprintf(stderr, "Opening file %s, Input at %p\n", no.to_charp(), this); +#endif + if (GetHandle() < 0) { throw IOGeneral(String(_("Error opening file ")) + no + _(" for reading: ") + strerror(errno)); } - size = lseek(GetHandle(), 0, SEEK_END); - lseek(GetHandle(), 0, SEEK_SET); - struct stat s; - fstat(GetHandle(), &s); - date_modif = s.st_mtime; + + if (S_ISREG(s.st_mode)) { + size = seek(0, SEEK_END); + seek(0, SEEK_SET); + } } Input::Input(const Input & i) : Handle(i), n(i.n), size(i.size), date_modif(i.date_modif) { } -bool Input::CanWrite() { +bool Input::CanWrite() const { return 0; } -bool Input::CanRead() { +bool Input::CanRead() const { return 1; } -String Input::GetName() { +bool Input::CanSeek() const { + struct stat s; + + fstat(GetHandle(), &s); + + return S_ISREG(s.st_mode); +} + +String Input::GetName() const { return n; } -ssize_t Input::GetSize() { +ssize_t Input::GetSize() const { return size; } -time_t Input::GetModif() { +time_t Input::GetModif() const { return date_modif; } -Stdin_t::Stdin_t() : Handle(dup(0)) { } - -bool Stdin_t::CanWrite() { - return 0; +off_t Input::seek(off_t offset, int whence) throw (GeneralException) { + if ((itell = lseek(GetHandle(), offset, whence)) < 0) { + throw IOGeneral(String(_("Error seeking file ")) + GetName() + _(": ") + strerror(errno)); + } +#ifdef PARANOID_SEEK + if (itell != lseek(GetHandle(), 0, SEEK_CUR)) { + throw IOGeneral(String(_("Error seeking file ")) + GetName() + _(": the position does not match")); + } +#endif + return itell; } -bool Stdin_t::CanRead() { - return 1; +Stdin_t::Stdin_t() { } + +bool Stdin_t::CanSeek() const { + return 0; } -String Stdin_t::GetName() { +String Stdin_t::GetName() const { return "Stdin"; } diff --git a/lib/Makefile.am b/lib/Makefile.am index eb8f82e..3560bdc 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,12 +2,11 @@ localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ AM_CFLAGS = -O3 -Wall -Wstrict-prototypes AM_CXXFLAGS = -O3 -Wall -Wstrict-prototypes -INCLUDES = -I../include -I$(includedir) +INCLUDES = -I.. -I../include -I$(includedir) lib_LTLIBRARIES = libBaltisot.la libBaltisot_la_SOURCES = Action.cc Buffer.cc checkargs.c Confirm.cc CopyJob.cc \ datecalc.c Exceptions.cc Form.cc Handle.cc HttpServ.cc Image.cc InPipe.cc \ Input.cc IRC.cc Menu.cc Message.cc OutPipe.cc Output.cc ReadJob.cc Regex.cc \ -Socket.cc String.cc Table.cc Task.cc TaskMan.cc Variables.cc - -libBaltisot_la_LDFLAGS = -release $(Baltisot_VERSION_INFO) +Socket.cc String.cc Table.cc Task.cc TaskMan.cc Variables.cc generic.cc \ +fileutils.cc diff --git a/lib/Menu.cc b/lib/Menu.cc index 05d7088..361189f 100644 --- a/lib/Menu.cc +++ b/lib/Menu.cc @@ -1,8 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Menu.h" #include "HttpServ.h" #include "CopyJob.h" #include "Buffer.h" -#include "config.h" Menu::Menu(const String & t, const String & U, String * ts, Action ** as, int nb) : Action(U), tit(t), lt(ts), la(as), nba(nb) { } diff --git a/lib/Message.cc b/lib/Message.cc index 572b0a0..5cb8859 100644 --- a/lib/Message.cc +++ b/lib/Message.cc @@ -1,8 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "HttpServ.h" #include "Message.h" #include "Buffer.h" #include "CopyJob.h" -#include "config.h" Message::Message(const String & t, const String & m, const String & U, Action * n) : Action(U), tit(t), msg(m), Next(n) { } diff --git a/lib/OutPipe.cc b/lib/OutPipe.cc index eb4b67e..a5404d6 100644 --- a/lib/OutPipe.cc +++ b/lib/OutPipe.cc @@ -1,6 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "OutPipe.h" #include "Input.h" -#include "config.h" +#include "gettext.h" OutPipe::OutPipe() : Handle(pipe(p, 1)), hooked(0) { } diff --git a/lib/Output.cc b/lib/Output.cc index e0a37ba..1ebf6db 100644 --- a/lib/Output.cc +++ b/lib/Output.cc @@ -5,58 +5,94 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Output.h" #include "Exceptions.h" -#include "config.h" +#include "gettext.h" -Output::Output(String no, int trunc) throw (GeneralException) : - Handle(no.strlen() ? open(no.to_charp(), O_WRONLY | O_CREAT | (trunc ? O_TRUNC : O_APPEND), 00666) : dup(1)), +Output::Output(String no, int create, int trunc) throw (GeneralException) : + Handle(no.strlen() ? open(no.to_charp(), O_WRONLY | (O_CREAT * (create ? 1 : 0)) | (O_TRUNC * (trunc ? 1 : 0)) +#if defined __linux__ || defined __CYGWIN32__ +, 00666 +#endif +) : dup(1)), n(no) { if (GetHandle() < 0) { throw IOGeneral(String(_("Error opening file ")) + no + _(" for writing: ") + strerror(errno)); } + + size = lseek(GetHandle(), 0, SEEK_END); + lseek(GetHandle(), 0, SEEK_SET); + + struct stat s; + + fstat(GetHandle(), &s); + + date_modif = s.st_mtime; } Output::Output(const Output & o) : Handle(o), n(o.n) { } -bool Output::CanWrite() { +bool Output::CanWrite() const { return 1; } -bool Output::CanRead() { +bool Output::CanRead() const { return 0; } -String Output::GetName() { - return n; +bool Output::CanSeek() const { + struct stat s; + + fstat(GetHandle(), &s); + + return S_ISREG(s.st_mode); } -Stdout_t::Stdout_t() : Handle(dup(1)) {} +off_t Output::seek(off_t offset, int whence) throw (GeneralException) { + if ((itell = lseek(GetHandle(), offset, whence)) < 0) { + throw IOGeneral(String(_("Error seeking file ")) + n + _(": ") + strerror(errno)); + } +#ifdef PARANOID_SEEK + if (itell != lseek(GetHandle(), 0, SEEK_CUR)) { + throw IOGeneral(String(_("Error seeking file ")) + n + _(": the position does not match")); + } +#endif + return itell; +} -bool Stdout_t::CanWrite() { - return 1; +String Output::GetName() const { + return n; } -bool Stdout_t::CanRead() { +Stdout_t::Stdout_t() {} + +bool Stdout_t::CanSeek() const { return 0; } -String Stdout_t::GetName() { +String Stdout_t::GetName() const { return "Stdout"; } Stderr_t::Stderr_t() : Handle(dup(2)) {} -bool Stderr_t::CanWrite() { +bool Stderr_t::CanWrite() const { return 1; } -bool Stderr_t::CanRead() { +bool Stderr_t::CanRead() const { + return 0; +} + +bool Stderr_t::CanSeek() const { return 0; } -String Stderr_t::GetName() { +String Stderr_t::GetName() const { return "Stderr"; } diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc index 8df4863..c31b894 100644 --- a/lib/ReadJob.cc +++ b/lib/ReadJob.cc @@ -1,7 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ReadJob.h" #include "HttpServ.h" #include "Regex.h" -#include "config.h" +#include "gettext.h" ReadJob::ReadJob(Handle * as, Handle * ad, const Regex & aregex) : s(as), d(ad), regex(&aregex) { s->SetNonBlock(); diff --git a/lib/Regex.cc b/lib/Regex.cc index 41f303c..7fd9741 100644 --- a/lib/Regex.cc +++ b/lib/Regex.cc @@ -1,5 +1,8 @@ -#include "Regex.h" +#ifdef HAVE_CONFIG_H #include "config.h" +#endif +#include "Regex.h" +#include "gettext.h" char t[1024]; diff --git a/lib/Socket.cc b/lib/Socket.cc index c5a43ab..5d09a1a 100644 --- a/lib/Socket.cc +++ b/lib/Socket.cc @@ -6,12 +6,15 @@ #include <string.h> #include <strings.h> #include <errno.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "String.h" #include "Socket.h" #include "Exceptions.h" #include "Input.h" #include "Output.h" -#include "config.h" +#include "gettext.h" Socket::Socket() throw (GeneralException) : Handle(socket(AF_INET, SOCK_STREAM, 0)), connected(false), listening(false), writeclosed(false), readclosed(false) { // cerr << "Socket(): connected = " << connected << "; readclosed = " << readclosed << "; writeclosed = " << writeclosed << endl; diff --git a/lib/String.cc b/lib/String.cc index 786c623..c7cfce6 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -1,18 +1,27 @@ #include <iostream> #include <string.h> #include <stdarg.h> +#include <ctype.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "String.h" #include "Exceptions.h" -#include "config.h" +#ifdef USE_DATE extern "C" { double dateCalc(char *, char *); int isDateArgument(char *); } +#endif char String::t[BUFSIZ + 1]; -String::String(const String & s) : str(Base::strdup(s.str)), siz(s.siz) { } +String::String(const String & s) : str(Base::strdup(s.str)), siz(s.siz) { +#ifdef DEBUG + fprintf(stderr, "Duplicating string `%s', from %p to %p\n", str, s.str, str); +#endif +} String::String(char c) : siz(1) { char * t = (char *) malloc(2); @@ -21,9 +30,27 @@ String::String(char c) : siz(1) { str = t; } -String::String(const char * s) : str(s ? Base::strdup(s) : Base::strdup("")) { +String::String(const char * s) : str(Base::strdup(s)), siz(::strlen(str)) { +#ifdef DEBUG + fprintf(stderr, "Creating a string with `%s' at %p\n", str, str); +#endif +} + +#if 0 +String::String(const char * s, ...) { + va_list ap; + +#ifdef DEBUG + fprintf(stderr, "Creating a String with s = '%s'\n", s); +#endif + + va_start(ap, s); + vsnprintf(t, BUFSIZ, s, ap); + str = Base::strdup(t); + va_end(ap); siz = ::strlen(str); -} +} +#endif String::String(int hs, const char * s) : str(s ? Base::strdup(s) : Base::strdup("")), siz(hs) { } @@ -43,6 +70,7 @@ String::String(unsigned int i) { siz = ::strlen(str); } +#ifdef USE_LONG_LONG String::String(long long l) { char t[40]; @@ -58,6 +86,7 @@ String::String(unsigned long long l) { str = Base::strdup(t); siz = ::strlen(str); } +#endif String::String(double d) { char t[30]; @@ -74,6 +103,13 @@ String::~String() { const char * String::set(const char * s, ...) { va_list ap; + if (!s) { + free(str); + str = Base::strdup(""); + t[0] = 0; + return t; + } + /* This causes a warning: cannot pass objects of type `const String' through `...' but it is not really a problem. */ va_start(ap, s); @@ -268,10 +304,12 @@ int String::strchrcnt(char c) const { return cnt; } +#ifdef USE_DATE String String::to_sqldate(void) const { /* DD/MM/YYYY ==> YYYYMMMDD */ return (is_date() ? extract(6, 9) + extract(3, 4) + extract(0, 1) : ""); } +#endif String String::to_sqltime(void) const { /* h:m ==> h * 60 + m */ @@ -279,10 +317,12 @@ String String::to_sqltime(void) const { return (is_time() ? String(extract(0, p - 1).to_int() * 60 + extract(p + 1).to_int()) : ""); } +#ifdef USE_DATE String String::from_sqldate(void) const { /* YYYYMMDD ==> DD/MM/YYYY */ return ((strlen() == 8) && is_number() ? extract(6, 7) + '/' + extract(4, 5) + '/' + extract(0, 3) : ""); } +#endif String String::from_sqltime(void) const { /* t ==> (t / 60):(t % 60) */ @@ -290,6 +330,7 @@ String String::from_sqltime(void) const { return (is_number() ? String((int) (t / 60)) + ':' + (t % 60) : ""); } +#ifdef USE_DATE bool String::is_date(void) const { /* 'DD/MM/YYYY' 0123456789 */ @@ -314,6 +355,7 @@ double String::datedif(const String & s) const { return -1; } +#endif bool String::is_number(void) const { for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { @@ -350,3 +392,23 @@ bool String::is_time(void) const { return (extract(p + 1).to_int() < 60) ? true : false; } + +String operator+(const char * a, const String & b) { + return String(a) + b; +} + +String & String::toupper() { + for (int i = 0; i < strlen(); i++) { + str[i] = ::toupper(str[i]); + } + + return *this; +} + +String & String::tolower() { + for (int i = 0; i < strlen(); i++) { + str[i] = ::tolower(str[i]); + } + + return *this; +} diff --git a/lib/Table.cc b/lib/Table.cc index f2b7bad..2509e4e 100644 --- a/lib/Table.cc +++ b/lib/Table.cc @@ -1,8 +1,10 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Table.h" #include "HttpServ.h" #include "CopyJob.h" #include "Buffer.h" -#include "config.h" Table::Table(const String & titre, const String & url, String * heads, String * cells, int nbc, int nbl, Action * na) : Action(url), tit(titre), hds(heads), cls(cells), nc(nbc), nl(nbl), Next(na) { } diff --git a/lib/Task.cc b/lib/Task.cc index d554000..88f17fa 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -1,9 +1,12 @@ #include <sys/time.h> #include <iostream> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "TaskMan.h" #include "Task.h" #include "String.h" -#include "config.h" +#include "gettext.h" Task::Task() : current(0), state(TASK_ON_HOLD), stopped(false), suspended(false), wbta(0) { TaskMan::AddTask(this); diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 8cb2e8e..c1c60ae 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -7,8 +7,11 @@ #include <sys/types.h> #include <unistd.h> #include <vector> -#include "TaskMan.h" +#ifdef HAVE_CONFIG_H #include "config.h" +#endif +#include "TaskMan.h" +#include "gettext.h" #define USE_POLL 1 @@ -267,7 +270,7 @@ void TaskMan::MainLoop() throw (GeneralException) { event = E_TIMEOUT; if (!w4to.empty()) { - time_t curtime = time(); + time_t curtime = time(NULL); for (std::vector<w4to_t>::iterator p = w4to.begin(); p != w4to.end(); p++) { int cur_to; cur_to = (p->to.tv_sec - curtime) * 1000 + p->to.tv_usec; diff --git a/lib/Variables.cc b/lib/Variables.cc index 8ba5374..cc67396 100644 --- a/lib/Variables.cc +++ b/lib/Variables.cc @@ -1,7 +1,9 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "Variables.h" #include "HttpServ.h" #include "String.h" -#include "config.h" Variables::Variables(int nb) : Vars(nb), nbvars(nb) { } diff --git a/lib/fileutils.cc b/lib/fileutils.cc new file mode 100644 index 0000000..b04a414 --- /dev/null +++ b/lib/fileutils.cc @@ -0,0 +1,74 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002 Nicolas "Pixel" Noble + * + * 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 <string.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include "generic.h" + +unsigned long filesize(int f_iso) +{ + long curpos, length; + + curpos = lseek(f_iso, 0, SEEK_CUR); + length = lseek(f_iso, 0, SEEK_END); + lseek(f_iso, curpos, SEEK_SET); + return length; +} + +void copy(int s, int d, long size) { + long i; + unsigned char c; + long r; + + for (i = 0; (i < size) || (size < 0); i++) { + r = read(s, &c, 1); + if (r == 0) { + break; + } + write(d, &c, 1); + } +} + +unsigned long filesize(FILE * f_iso) +{ + long curpos, length; + + curpos = ftell(f_iso); + fseek(f_iso, 0, SEEK_END); + length = ftell(f_iso); + fseek(f_iso, curpos, SEEK_SET); + return length; +} + +void copy(FILE * s, FILE * d, long size) { + long i; + unsigned char c; + long r; + + for (i = 0; (i < size) || (size < 0); i++) { + r = fread(&c, 1, 1, s); + if (r == 0) { + break; + } + fwrite(&c, 1, 1, d); + } +} diff --git a/lib/generic.cc b/lib/generic.cc new file mode 100644 index 0000000..bade101 --- /dev/null +++ b/lib/generic.cc @@ -0,0 +1,58 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002 Nicolas "Pixel" Noble + * + * 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 <stdio.h> +#include <stdarg.h> + +#include "String.h" + +char verbosity = 0; + +char * heads[] = {"EE", "--", "WW", "II"}; + +void printm(int level, String m, ...) { + va_list ap; + + if (verbosity < level) { + return; + } + + if (level >= 0) { + fprintf(stderr, "(%s) ", heads[level]); + } + + va_start(ap, m); + vfprintf(stderr, m.to_charp(), ap); + va_end(ap); +} + +char ** split(char * s, char t) { + static char * p[100]; + int i; + + for (i = 1, p[0] = s; *s; s++) { + if (*s == t) { + *s = 0; + p[i++] = s + 1; + } + } + p[i] = 0; + + return p; +} diff --git a/m4/ChangeLog b/m4/ChangeLog new file mode 100644 index 0000000..c793723 --- /dev/null +++ b/m4/ChangeLog @@ -0,0 +1,21 @@ +2002-11-28 gettextize <bug-gnu-gettext@gnu.org> + + * codeset.m4: Upgrade to gettext-0.11.5. + * gettext.m4: Upgrade to gettext-0.11.5. + * glibc21.m4: Upgrade to gettext-0.11.5. + * iconv.m4: Upgrade to gettext-0.11.5. + * intdiv0.m4: New file, from gettext-0.11.5. + * inttypes.m4: New file, from gettext-0.11.5. + * inttypes_h.m4: New file, from gettext-0.11.5. + * inttypes-pri.m4: New file, from gettext-0.11.5. + * isc-posix.m4: Upgrade to gettext-0.11.5. + * lcmessage.m4: Upgrade to gettext-0.11.5. + * lib-ld.m4: New file, from gettext-0.11.5. + * lib-link.m4: New file, from gettext-0.11.5. + * lib-prefix.m4: New file, from gettext-0.11.5. + * progtest.m4: Upgrade to gettext-0.11.5. + * stdint_h.m4: New file, from gettext-0.11.5. + * uintmax_t.m4: New file, from gettext-0.11.5. + * ulonglong.m4: New file, from gettext-0.11.5. + * Makefile.am (EXTRA_DIST): Add the new files. + diff --git a/m4/Makefile b/m4/Makefile new file mode 100644 index 0000000..6b12467 --- /dev/null +++ b/m4/Makefile @@ -0,0 +1,212 @@ +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 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)/ +pkglibdir = $(libdir)/ +pkgincludedir = $(includedir)/ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +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} +transform = s,x,x, + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = +host_triplet = i686-pc-linux-gnu +AS = @AS@ +BUILD_INCLUDED_LIBINTL = no +CATOBJEXT = .gmo +CC = gcc +CPP = gcc -E +CXX = g++ +DATADIRNAME = share +DLLTOOL = @DLLTOOL@ +ECHO = echo +EXEEXT = +GENCAT = gencat +GLIBC21 = yes +GMSGFMT = /usr/bin/msgfmt +HAVE_LIB = @HAVE_LIB@ +INSTOBJEXT = .mo +INTLBISON = bison +INTLLIBS = +INTLOBJS = +INTL_LIBTOOL_SUFFIX_PREFIX = +LIB = @LIB@ +LIBICONV = +LIBINTL = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIB = @LTLIB@ +LTLIBICONV = +LTLIBINTL = +MAINT = # +MKINSTALLDIRS = ./mkinstalldirs +OBJDUMP = @OBJDUMP@ +OBJEXT = o +PACKAGE = +POSUB = po +RANLIB = ranlib +STRIP = strip +USE_INCLUDED_LIBINTL = no +USE_NLS = yes +VERSION = +YACC = bison -y +gmakepath = +unamepath = /bin/uname + +EXTRA_DIST = intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = ChangeLog Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: # Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = m4 + +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 m4/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-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +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: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +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: 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 + + +# 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/m4/Makefile.am b/m4/Makefile.am index bfef46a..7deaf67 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 +EXTRA_DIST = intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in new file mode 100644 index 0000000..ac2e992 --- /dev/null +++ b/m4/Makefile.in @@ -0,0 +1,212 @@ +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 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 = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +DATADIRNAME = @DATADIRNAME@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GLIBC21 = @GLIBC21@ +GMSGFMT = @GMSGFMT@ +HAVE_LIB = @HAVE_LIB@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LIB = @LIB@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIB = @LTLIB@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +MAINT = @MAINT@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +YACC = @YACC@ +gmakepath = @gmakepath@ +unamepath = @unamepath@ + +EXTRA_DIST = intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = ChangeLog Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = m4 + +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 m4/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-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +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: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +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: 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 + + +# 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/m4/codeset.m4 b/m4/codeset.m4 index 863c9cf..59535eb 100644 --- a/m4/codeset.m4 +++ b/m4/codeset.m4 @@ -1,4 +1,10 @@ -#serial AM1 +# codeset.m4 serial AM1 (gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. diff --git a/m4/gettext.m4 b/m4/gettext.m4 index e4d524c..45cad85 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,27 +1,42 @@ -# Macro to add for using GNU gettext. -# Ulrich Drepper <drepper@cygnus.com>, 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. - -# serial 10 - -dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). -dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library +# gettext.m4 serial 17 (gettext-0.11.5) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. +dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). Otherwise, a static library +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. -dnl LIBDIR is used to find the intl libraries. If empty, +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: @@ -35,29 +50,68 @@ dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl -AC_DEFUN([AM_WITH_NLS], - [AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no - INTLLIBS= - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], @@ -67,214 +121,177 @@ AC_DEFUN([AM_WITH_NLS], nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. - CATOBJEXT=NONE dnl Add a version number to the cache macros. - define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) - define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) - - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include <libintl.h> -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - AC_TRY_LINK([#include <libintl.h> -extern int _nl_msg_cat_cntr;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - dnl If iconv() is in a separate libiconv library, then anyone - dnl linking with libintl{.a,.so} also needs to link with - dnl libiconv. - INTLLIBS="-lintl $LIBICONV" - fi - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - AC_CHECK_FUNCS(dcgettext) - LIBS="$gt_save_LIBS" - - dnl Search for GNU msgfmt in the PATH. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext in the PATH. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - - CATOBJEXT=.gmo - fi - ]) - - if test "$CATOBJEXT" = "NONE"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on GNU gettext library. - nls_cv_use_gnu_gettext=yes + define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include <libintl.h> +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include <libintl.h> +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + dnl Now see whether libintl exists and depends on libiconv. + if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include <libintl.h> +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext_libintl=yes + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. INTLOBJS="\$(GETTOBJS)" - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) - AC_SUBST(MSGFMT) - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found msgfmt program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo fi + ]) + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi - dnl We need to process the po/ directory. - POSUB=po + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) fi - AC_OUTPUT_COMMANDS( - [for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - fi - ;; - esac - done]) + dnl We need to process the po/ directory. + POSUB=po + fi + ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext; then BUILD_INCLUDED_LIBINTL=yes fi - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi - - dnl These rules are solely for the distribution goal. While doing this - dnl we only have to keep exactly one list of the available catalogs - dnl in configure.in. - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) - AC_SUBST(GMOFILES) - AC_SUBST(INTLLIBS) AC_SUBST(INTLOBJS) - AC_SUBST(POFILES) - AC_SUBST(POSUB) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= @@ -291,80 +308,280 @@ changequote([,])dnl dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) -dnl Usage: Just like AM_WITH_NLS, which see. -AC_DEFUN([AM_GNU_GETTEXT], - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([jm_GLIBC21])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl Checks for all prerequisites of the po subdirectory, +dnl except for USE_NLS. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext 0.11 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + AC_MSG_RESULT( + [found $GMSGFMT program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + + +dnl Checks for all prerequisites of the intl subdirectory, +dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, +dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. +AC_DEFUN([AM_INTL_SUBDIR], +[ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + AC_REQUIRE([gt_INTDIV0])dnl + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl + AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl + AC_REQUIRE([gt_INTTYPES_PRI])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ -strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) - - AM_ICONV - AM_LANGINFO_CODESET - AM_LC_MESSAGES - AM_WITH_NLS([$1],[$2],[$3]) - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - AC_MSG_CHECKING(for catalogs to be installed) - NEW_LINGUAS= - for presentlang in $ALL_LINGUAS; do - useit=no - for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - NEW_LINGUAS="$NEW_LINGUAS $presentlang" - fi - done - LINGUAS=$NEW_LINGUAS - AC_MSG_RESULT($LINGUAS) - fi - - dnl Construct list of names of catalog files to be constructed. - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) - - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) - ]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) + + AM_ICONV + AM_LANGINFO_CODESET + if test $ac_cv_header_locale_h = yes; then + AM_LC_MESSAGES + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +AC_DEFUN([AM_MKINSTALLDIRS], +[ + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 index 5b88ef2..9c9f3db 100644 --- a/m4/glibc21.m4 +++ b/m4/glibc21.m4 @@ -1,4 +1,10 @@ -#serial 2 +# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 1723734..c5f3579 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -1,19 +1,39 @@ -#serial AM2 +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. -AC_DEFUN([AM_ICONV], +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). - AC_ARG_WITH([libiconv-prefix], -[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - ]) + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" @@ -26,7 +46,7 @@ AC_DEFUN([AM_ICONV], am_cv_func_iconv=yes) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" + LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include <stdlib.h> #include <iconv.h>], [iconv_t cd = iconv_open("",""); @@ -39,6 +59,25 @@ AC_DEFUN([AM_ICONV], ]) if test "$am_cv_func_iconv" = yes; then AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ @@ -61,9 +100,4 @@ size_t iconv(); AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi - LIBICONV= - if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" - fi - AC_SUBST(LIBICONV) ]) diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 new file mode 100644 index 0000000..55dddcf --- /dev/null +++ b/m4/intdiv0.m4 @@ -0,0 +1,72 @@ +# intdiv0.m4 serial 1 (gettext-0.11.3) +dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gt_INTDIV0], +[ + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + + AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], + gt_cv_int_divbyzero_sigfpe, + [ + AC_TRY_RUN([ +#include <stdlib.h> +#include <signal.h> + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} +], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, + [ + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i[34567]86 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + ]) + ]) + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + [Define if integer division by zero raises signal SIGFPE.]) +]) diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 new file mode 100644 index 0000000..fd007c3 --- /dev/null +++ b/m4/inttypes-pri.m4 @@ -0,0 +1,32 @@ +# inttypes-pri.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_REQUIRE([gt_HEADER_INTTYPES_H]) + if test $gt_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include <inttypes.h> +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if <inttypes.h> exists and defines unusable PRI* macros.]) + fi +]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 new file mode 100644 index 0000000..ab370ff --- /dev/null +++ b/m4/inttypes.m4 @@ -0,0 +1,27 @@ +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with +# <sys/types.h>. + +AC_DEFUN([gt_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, + [ + AC_TRY_COMPILE( + [#include <sys/types.h> +#include <inttypes.h>], + [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) + ]) + if test $gt_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, + [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.]) + fi +]) diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 new file mode 100644 index 0000000..400a111 --- /dev/null +++ b/m4/inttypes_h.m4 @@ -0,0 +1,28 @@ +# inttypes_h.m4 serial 4 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, +# doesn't clash with <sys/types.h>, and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include <sys/types.h> +#include <inttypes.h>], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, +[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, + and declares uintmax_t. ]) + fi +]) diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4 index 99c899c..1319dd1 100644 --- a/m4/isc-posix.m4 +++ b/m4/isc-posix.m4 @@ -1,4 +1,13 @@ -#serial 1 +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + # This test replaces the one in autoconf. # Currently this macro should have the same name as the autoconf macro # because gettext's gettext.m4 (distributed in the automake package) diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 index 18d47a9..ffd4008 100644 --- a/m4/lcmessage.m4 +++ b/m4/lcmessage.m4 @@ -1,24 +1,32 @@ -# Check whether LC_MESSAGES is available in <locale.h>. -# Ulrich Drepper <drepper@cygnus.com>, 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. +# lcmessage.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper <drepper@cygnus.com>, 1995. -# serial 2 +# Check whether LC_MESSAGES is available in <locale.h>. AC_DEFUN([AM_LC_MESSAGES], - [if test $ac_cv_header_locale_h = yes; then - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, - [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], +[ + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) - if test $am_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES, 1, - [Define if your <locale.h> file defines LC_MESSAGES.]) - fi - fi]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your <locale.h> file defines LC_MESSAGES.]) + fi +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..ddb5732 --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,97 @@ +# lib-ld.m4 serial 1 (gettext-0.11) +dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$acl_cv_prog_gnu_ld +]) + +dnl From libtool-1.4. Sets the variable LD. +AC_DEFUN([AC_LIB_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 new file mode 100644 index 0000000..6b94251 --- /dev/null +++ b/m4/lib-link.m4 @@ -0,0 +1,554 @@ +# lib-link.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L, +dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..b8b79ab --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,148 @@ +# lib-prefix.m4 serial 1 (gettext-0.11) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 index 35dc3da..443c8e3 100644 --- a/m4/progtest.m4 +++ b/m4/progtest.m4 @@ -1,16 +1,24 @@ -# Search path for a program which passes the given test. -# Ulrich Drepper <drepper@cygnus.com>, 1996. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License or the GNU Library General Public License but which still want -# to provide support for the GNU gettext functionality. -# Please note that the actual code of the GNU gettext library is covered -# by the GNU Library General Public License, and the rest of the GNU -# gettext package package is covered by the GNU General Public License. -# They are *not* in the public domain. +# progtest.m4 serial 2 (gettext-0.10.40) +dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper <drepper@cygnus.com>, 1996. -# serial 2 +# Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 new file mode 100644 index 0000000..4b5a4ac --- /dev/null +++ b/m4/stdint_h.m4 @@ -0,0 +1,28 @@ +# stdint_h.m4 serial 2 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, +# doesn't clash with <sys/types.h>, and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_STDINT_H], +[ + AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, + [AC_TRY_COMPILE( + [#include <sys/types.h> +#include <stdint.h>], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_stdint_h=yes, + jm_ac_cv_header_stdint_h=no)]) + if test $jm_ac_cv_header_stdint_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, +[Define if <stdint.h> exists, doesn't clash with <sys/types.h>, + and declares uintmax_t. ]) + fi +]) diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 new file mode 100644 index 0000000..ec3a8b9 --- /dev/null +++ b/m4/uintmax_t.m4 @@ -0,0 +1,29 @@ +# uintmax_t.m4 serial 6 (gettext-0.11) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to `unsigned long' or `unsigned long long' +# if <inttypes.h> does not exist. + +AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + [Define to unsigned long or unsigned long long + if <inttypes.h> and <stdint.h> don't define.]) + fi +]) diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 new file mode 100644 index 0000000..c375e47 --- /dev/null +++ b/m4/ulonglong.m4 @@ -0,0 +1,23 @@ +# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) +dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the unsigned long long type.]) + fi +]) diff --git a/po/POTFILES.in b/po/POTFILES.in index d78166c..1cf525b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -24,7 +24,4 @@ lib/datecalc.c lib/InPipe.cc lib/OutPipe.cc src/Main.cc -src/datas/style.css -src/datas/TestApplet.class -src/datas/HelloSwingApplet.class src/misc.cc @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Baltisot 1.0.0\n" -"POT-Creation-Date: 2002-01-08 10:14+0100\n" +"POT-Creation-Date: 2002-11-29 02:12+0100\n" "PO-Revision-Date: 2001-10-29 08:26GMT\n" "Last-Translator: Nicolas Noble <nicolas@nobis-crew.org>\n" "Language-Team: French <fr@li.org>\n" @@ -14,183 +14,181 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 0.8\n" -#: lib/CopyJob.cc:68 +#: lib/CopyJob.cc:71 msgid "CopyJob from " msgstr "CopyJob depuis " -#: lib/CopyJob.cc:68 lib/ReadJob.cc:48 +#: lib/CopyJob.cc:71 lib/ReadJob.cc:51 msgid " to " msgstr " vers " -#: lib/Exceptions.cc:15 lib/Exceptions.cc:20 lib/Exceptions.cc:25 +#: lib/Exceptions.cc:24 lib/Exceptions.cc:29 lib/Exceptions.cc:34 msgid "Generating a General Exception error: '" msgstr "Génération d'une Exception Générale: '" -#: lib/Exceptions.cc:38 +#: lib/Exceptions.cc:49 #, c-format -msgid "Failed allocating %ld bytes." -msgstr "N'a pu allouer %ld octets." +msgid "Failed allocating %u bytes." +msgstr "N'a pu allouer %u octets." -#: lib/Exceptions.cc:43 +#: lib/Exceptions.cc:54 #, c-format -msgid "An error has occured while %s %ld bytes on %s: %s" -msgstr "Une erreur est survenue en %s %ld octets depuis %s: %s" +msgid "An error has occured while %s %u bytes on %s: %s" +msgstr "Une erreur est survenue en %s %u octets depuis %s: %s" -#: lib/Exceptions.cc:43 +#: lib/Exceptions.cc:54 msgid "writing" msgstr "écrivant" -#: lib/Exceptions.cc:43 +#: lib/Exceptions.cc:54 msgid "reading" msgstr "lisant" -#: lib/Exceptions.cc:52 +#: lib/Exceptions.cc:63 msgid "No more bytes for reading or writing." msgstr "Plus d'octets à lire ou écrire" -#: lib/Exceptions.cc:58 +#: lib/Exceptions.cc:69 msgid "Switching task in a non-tasked environnement" msgstr "Basculement de tâche dans un environnement non multi-tâches" -#: lib/Exceptions.cc:123 +#: lib/Exceptions.cc:75 +msgid "Exitting with code " +msgstr "Sortie avec le code " + +#: lib/Exceptions.cc:142 msgid "Error creating pipe: " msgstr "Erreur en créant un tube: " -#: lib/Exceptions.cc:135 +#: lib/Exceptions.cc:154 msgid "Was not able to fork().\n" msgstr "N'a pu faire de fork().\n" -#: lib/Handle.cc:154 lib/Handle.cc:162 -#, fuzzy +#: lib/Handle.cc:172 lib/Handle.cc:183 msgid "Error during close: " -msgstr "Erreur pendant poll: " +msgstr "Erreur pendant close: " -#: lib/Handle.cc:156 +#: lib/Handle.cc:174 msgid "Error in zlib during gzclose." -msgstr "" +msgstr "Erreur dans la zlib pendant gzclose." -#: lib/Handle.cc:181 +#: lib/Handle.cc:202 msgid "Bare Handle - should not happend" msgstr "Handle pur - ne devrait pas arriver" -#: lib/Handle.cc:205 +#: lib/Handle.cc:227 msgid "Can't SetZ a Handle twice." -msgstr "" +msgstr "Ne peut faire SetZ sur un Handle deux fois." -#: lib/Handle.cc:208 +#: lib/Handle.cc:230 msgid "Can't SetZ a virtual Handle." -msgstr "" +msgstr "Ne peut SetZ sur un Handle virtuel." -#: lib/Handle.cc:223 +#: lib/Handle.cc:245 #, fuzzy msgid "Was not able to gzdopen." -msgstr "N'a pu faire de fork().\n" +msgstr "N'a pu faire de gzdopen.\n" -#: lib/Handle.cc:239 -#, fuzzy +#: lib/Handle.cc:268 msgid "Error in zlib during gzwrite: " -msgstr "Erreur pendant poll: " +msgstr "Erreur dans la zlib pendant gzwrite: " -#: lib/Input.cc:16 lib/Output.cc:16 -#, fuzzy +#: lib/Input.cc:24 lib/Output.cc:23 msgid "Error opening file " -msgstr "Erreur en ouvrant le fichier" +msgstr "Erreur en ouvrant le fichier " -#: lib/Input.cc:16 +#: lib/Input.cc:24 msgid " for reading: " msgstr " en lecture: " -#: lib/Output.cc:16 +#: lib/Input.cc:70 lib/Input.cc:74 lib/Output.cc:57 lib/Output.cc:61 +msgid "Error seeking file " +msgstr "Erreur en avançant dans le fichier" + +#: lib/Input.cc:70 lib/Output.cc:57 +msgid ": " +msgstr ": " + +#: lib/Input.cc:74 lib/Output.cc:61 +msgid ": the position does not match" +msgstr ": la position ne correspond pas" + +#: lib/Output.cc:23 msgid " for writing: " msgstr " en écriture: " -#: lib/ReadJob.cc:48 +#: lib/ReadJob.cc:51 msgid "ReadJob from " msgstr "ReadJob depuis " -#: lib/Regex.cc:12 +#: lib/Regex.cc:15 msgid "Error in regcomp:" msgstr "Erreur dans regcomp:" -#: lib/Regex.cc:15 lib/Regex.cc:26 +#: lib/Regex.cc:18 lib/Regex.cc:29 msgid "Regex \"" msgstr "Regex \"" -#: lib/Regex.cc:15 lib/Regex.cc:26 +#: lib/Regex.cc:18 lib/Regex.cc:29 msgid "\" failed to compile: " msgstr "\" n'a pu compiler: " -#: lib/Socket.cc:18 +#: lib/Socket.cc:22 msgid "Error creating socket." msgstr "Erreur en créeant un socket." -#: lib/Socket.cc:133 +#: lib/Socket.cc:144 msgid "Failed accepting." msgstr "N'a pu accepter." -#: lib/Task.cc:28 lib/Task.cc:44 +#: lib/Task.cc:31 lib/Task.cc:47 msgid "Task " msgstr "La tache " -#: lib/Task.cc:28 +#: lib/Task.cc:31 msgid " caused an unexpected exception: \"" msgstr " a causée une exception innatendue: \"" -#: lib/Task.cc:28 lib/Task.cc:44 +#: lib/Task.cc:31 lib/Task.cc:47 msgid "\". Terminating.\n" msgstr "\". Terminaison.\n" -#: lib/Task.cc:44 -#, fuzzy +#: lib/Task.cc:47 msgid " caused an unexpected exception during dry-run: \"" -msgstr " a causée une exception innatendue: \"" +msgstr " a causée une exception innatendue pendant l'exécution rapide: \"" -#: lib/Task.cc:57 +#: lib/Task.cc:60 msgid "Unknow Task" msgstr "Tache inconnue" -#: lib/TaskMan.cc:68 +#: lib/TaskMan.cc:72 msgid "Task Manager already initialised." msgstr "Le gestionnaire de tache est déjà initialisé." -#: lib/TaskMan.cc:205 +#: lib/TaskMan.cc:222 msgid "TaskMan: No more task to manage." msgstr "Plus de taches à gérer." -#: lib/TaskMan.cc:316 +#: lib/TaskMan.cc:328 msgid "Error during poll: " msgstr "Erreur pendant poll: " -#: lib/TaskMan.cc:329 +#: lib/TaskMan.cc:340 msgid "Error with poll, handle " msgstr "Erreur avec poll, handle " -#: lib/TaskMan.cc:329 +#: lib/TaskMan.cc:340 msgid " invalid." msgstr " invalide." -#: lib/TaskMan.cc:414 -#, fuzzy -msgid "TaskMan: internal error (task not found) -- SHOULD NOT HAPPEN!!" -msgstr "TaskMan: erreur interne (tache non trouvée)" - -#: lib/InPipe.cc:32 +#: lib/InPipe.cc:40 msgid "Input pipe from stdout (" msgstr "Tube d'entrée depuis stdout (" -#: lib/InPipe.cc:32 lib/OutPipe.cc:32 +#: lib/InPipe.cc:40 lib/OutPipe.cc:40 msgid "not " msgstr "non " -#: lib/InPipe.cc:32 lib/OutPipe.cc:32 +#: lib/InPipe.cc:40 lib/OutPipe.cc:40 msgid "hooked)" msgstr "détourné)" - -#~ msgid "Error condition with poll, handle " -#~ msgstr "Condition d'erreur avec poll, handle " - -#~ msgid "Handle " -#~ msgstr "Le handle " - -#~ msgid " hung up.\n" -#~ msgstr " a raccroché.\n" diff --git a/src/Makefile.am b/src/Makefile.am index 4ff7f55..4e790cf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,13 +4,13 @@ localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ AM_CFLAGS = -O3 -Wall -Wstrict-prototypes AM_CXXFLAGS = -O3 -Wall -Wstrict-prototypes -INCLUDES = -I../include -I$(includedir) +INCLUDES = -I.. -I../include -I$(includedir) bin_PROGRAMS = Baltisot -noinst_JAVA = TestApplet.java +#noinst_JAVA = TestApplet.java -JAVAROOT = datas +#JAVAROOT = datas Baltisot_SOURCES = Main.cc |