diff options
-rw-r--r-- | Makefile.sol.mingw | 4 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | include/Action.h | 4 | ||||
-rw-r--r-- | include/Buffer.h | 4 | ||||
-rw-r--r-- | include/Confirm.h | 4 | ||||
-rw-r--r-- | include/CopyJob.h | 4 | ||||
-rw-r--r-- | include/Exceptions.h | 5 | ||||
-rw-r--r-- | include/Form.h | 4 | ||||
-rw-r--r-- | include/Handle.h | 4 | ||||
-rw-r--r-- | include/HttpServ.h | 4 | ||||
-rw-r--r-- | include/IRC.h | 4 | ||||
-rw-r--r-- | include/Image.h | 4 | ||||
-rw-r--r-- | include/InPipe.h | 4 | ||||
-rw-r--r-- | include/Input.h | 4 | ||||
-rw-r--r-- | include/Menu.h | 4 | ||||
-rw-r--r-- | include/Message.h | 4 | ||||
-rw-r--r-- | include/OutPipe.h | 4 | ||||
-rw-r--r-- | include/Output.h | 4 | ||||
-rw-r--r-- | include/ReadJob.h | 4 | ||||
-rw-r--r-- | include/Regex.h | 4 | ||||
-rw-r--r-- | include/Socket.h | 4 | ||||
-rw-r--r-- | include/String.h | 4 | ||||
-rw-r--r-- | include/Table.h | 4 | ||||
-rw-r--r-- | include/Task.h | 4 | ||||
-rw-r--r-- | include/TaskMan.h | 4 | ||||
-rw-r--r-- | include/Variables.h | 4 | ||||
-rw-r--r-- | include/generic.h | 20 | ||||
-rw-r--r-- | include/template.h | 5 | ||||
-rw-r--r-- | lib/Exceptions.cc | 12 | ||||
-rw-r--r-- | lib/Handle.cc | 4 | ||||
-rw-r--r-- | lib/Makefile.sol.mingw | 14 | ||||
-rw-r--r-- | m4/Makefile.am | 2 | ||||
-rw-r--r-- | m4/ssize_t.m4 | 12 |
33 files changed, 58 insertions, 115 deletions
diff --git a/Makefile.sol.mingw b/Makefile.sol.mingw new file mode 100644 index 0000000..168a4fc --- /dev/null +++ b/Makefile.sol.mingw @@ -0,0 +1,4 @@ +all: + $(MAKE) -C lib -f Makefile.sol.mingw + + diff --git a/configure.ac b/configure.ac index 91ea624..ab5cdbe 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,7 @@ AC_C_INLINE AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_C_VOLATILE @@ -51,7 +52,7 @@ 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_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 pipe sleep fcntl]) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyname, nsl) diff --git a/include/Action.h b/include/Action.h index d11162f..2a4c75a 100644 --- a/include/Action.h +++ b/include/Action.h @@ -1,6 +1,5 @@ #ifndef __ACTION_H__ #define __ACTION_H__ -#ifdef __cplusplus #include <Task.h> #include <Handle.h> @@ -30,7 +29,4 @@ class Action : public Base { bool hastoclean, accessed; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Buffer.h b/include/Buffer.h index dc4d768..316af13 100644 --- a/include/Buffer.h +++ b/include/Buffer.h @@ -1,6 +1,5 @@ #ifndef __BUFFER_H__ #define __BUFFER_H__ -#ifdef __cplusplus #include <zlib.h> #include <Exceptions.h> @@ -31,7 +30,4 @@ class Buffer : public Handle { size_t realsiz, bufsiz, ptr; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Confirm.h b/include/Confirm.h index da0365d..3e215d3 100644 --- a/include/Confirm.h +++ b/include/Confirm.h @@ -1,6 +1,5 @@ #ifndef __CONFIRM_H__ #define __CONFIRM_H__ -#ifdef __cplusplus #include <Action.h> #include <String.h> @@ -18,7 +17,4 @@ class Confirm : public Action { Action * NYes, * NNo; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/CopyJob.h b/include/CopyJob.h index 4351570..8e4135c 100644 --- a/include/CopyJob.h +++ b/include/CopyJob.h @@ -1,6 +1,5 @@ #ifndef __COPYJOB_H__ #define __COPYJOB_H__ -#ifdef __cplusplus #include <Task.h> #include <Handle.h> @@ -22,7 +21,4 @@ class CopyJob : public Task { int r, w, tw; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Exceptions.h b/include/Exceptions.h index a3fad9e..b1ca63f 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -1,12 +1,12 @@ #ifndef __EXCEPTIONS_H__ #define __EXCEPTIONS_H__ -#ifdef __cplusplus #include <stdio.h> #include <unistd.h> #include <stddef.h> #include <string.h> #include <stdlib.h> +#include <generic.h> class String; @@ -100,7 +100,4 @@ class Exit : public GeneralException { #include <String.h> -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Form.h b/include/Form.h index 9e77967..b12e2b5 100644 --- a/include/Form.h +++ b/include/Form.h @@ -1,6 +1,5 @@ #ifndef __FORM_H__ #define __FORM_H__ -#ifdef __cplusplus #include <Action.h> #include <String.h> @@ -21,7 +20,4 @@ class Form : public Action { Action * Next; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Handle.h b/include/Handle.h index e545109..581d9d0 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -1,6 +1,5 @@ #ifndef __HANDLE_H__ #define __HANDLE_H__ -#ifdef __cplusplus #include <sys/types.h> #include <time.h> @@ -51,7 +50,4 @@ Handle & operator>>(Handle &, String &); void copy(Handle *, Handle *, ssize_t = -1); -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/HttpServ.h b/include/HttpServ.h index 7d63517..a0dd958 100644 --- a/include/HttpServ.h +++ b/include/HttpServ.h @@ -1,6 +1,5 @@ #ifndef __HTTPSERV_H__ #define __HTTPSERV_H__ -#ifdef __cplusplus #include <Socket.h> #include <String.h> @@ -28,7 +27,4 @@ class HttpServ : public Task { extern String endhl, endnl; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/IRC.h b/include/IRC.h index 457c199..285d9bf 100644 --- a/include/IRC.h +++ b/include/IRC.h @@ -1,6 +1,5 @@ #ifndef __IRC_H__ #define __IRC_H__ -#ifdef __cplusplus #include <Socket.h> #include <Exceptions.h> @@ -198,7 +197,4 @@ class IRC : public Base { int loginsequence; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Image.h b/include/Image.h index 87a8ddd..633ab55 100644 --- a/include/Image.h +++ b/include/Image.h @@ -1,6 +1,5 @@ #ifndef __IMAGE_H__ #define __IMAGE_H__ -#ifdef __cplusplus #include <Buffer.h> #include <generic.h> @@ -51,7 +50,4 @@ class Image : public Buffer { Color * img; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/InPipe.h b/include/InPipe.h index fa14868..2828da3 100644 --- a/include/InPipe.h +++ b/include/InPipe.h @@ -1,6 +1,5 @@ #ifndef __INPIPE_H__ #define __INPIPE_H__ -#ifdef __cplusplus #include <Handle.h> @@ -17,7 +16,4 @@ class InPipe : public Handle { int p[2], hooked; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Input.h b/include/Input.h index cb1428f..80bd73e 100644 --- a/include/Input.h +++ b/include/Input.h @@ -1,6 +1,5 @@ #ifndef __INPUT_H__ #define __INPUT_H__ -#ifdef __cplusplus #include <sys/types.h> #include <time.h> @@ -36,7 +35,4 @@ class Stdin_t : public Input { extern Stdin_t Stdin; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Menu.h b/include/Menu.h index 2558920..461f5e2 100644 --- a/include/Menu.h +++ b/include/Menu.h @@ -1,6 +1,5 @@ #ifndef __MENU_H__ #define __MENU_H__ -#ifdef __cplusplus #include <Action.h> #include <String.h> @@ -20,7 +19,4 @@ class Menu : public Action { int nba; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Message.h b/include/Message.h index 35437bd..2ee28e3 100644 --- a/include/Message.h +++ b/include/Message.h @@ -1,6 +1,5 @@ #ifndef __MESSAGE_H__ #define __MESSAGE_H__ -#ifdef __cplusplus #include <Action.h> #include <String.h> @@ -18,7 +17,4 @@ class Message : public Action { Action * Next; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/OutPipe.h b/include/OutPipe.h index 4a9befe..467a89b 100644 --- a/include/OutPipe.h +++ b/include/OutPipe.h @@ -1,6 +1,5 @@ #ifndef __OUTPIPE_H__ #define __OUTPIPE_H__ -#ifdef __cplusplus #include <Handle.h> @@ -17,7 +16,4 @@ class OutPipe : public Handle { int p[2], hooked; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Output.h b/include/Output.h index eb7b8a6..9e83845 100644 --- a/include/Output.h +++ b/include/Output.h @@ -1,6 +1,5 @@ #ifndef __OUTPUT_H__ #define __OUTPUT_H__ -#ifdef __cplusplus #include <sys/types.h> #include <time.h> @@ -45,7 +44,4 @@ class Stderr_t : public Handle { extern Stdout_t Stdout; extern Stderr_t Stderr; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/ReadJob.h b/include/ReadJob.h index 7d4bfc7..d861aff 100644 --- a/include/ReadJob.h +++ b/include/ReadJob.h @@ -1,6 +1,5 @@ #ifndef __READJOB_H__ #define __READJOB_H__ -#ifdef __cplusplus #include <Task.h> #include <Handle.h> @@ -18,7 +17,4 @@ class ReadJob : public Task { const Regex * regex; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Regex.h b/include/Regex.h index 9c8d466..ce62028 100644 --- a/include/Regex.h +++ b/include/Regex.h @@ -1,6 +1,5 @@ #ifndef __REGEX_H__ #define __REGEX_H__ -#ifdef __cplusplus #include <Exceptions.h> #include <String.h> @@ -20,7 +19,4 @@ class Regex : public Base { extern Regex empty, any; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Socket.h b/include/Socket.h index 203b399..055e512 100644 --- a/include/Socket.h +++ b/include/Socket.h @@ -1,6 +1,5 @@ #ifndef __SOCKET_H__ #define __SOCKET_H__ -#ifdef __cplusplus #include <Handle.h> #include <String.h> @@ -31,7 +30,4 @@ class Socket : public Handle { bool connected, listening, writeclosed, readclosed; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/String.h b/include/String.h index f477998..948534e 100644 --- a/include/String.h +++ b/include/String.h @@ -1,6 +1,5 @@ #ifndef __STRING_H__ #define __STRING_H__ -#ifdef __cplusplus #include <string.h> #include <iostream> @@ -67,7 +66,4 @@ std::istream & operator>>(std::istream &, String &); String operator+(const char *, const String &); -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Table.h b/include/Table.h index c616e7e..58336d0 100644 --- a/include/Table.h +++ b/include/Table.h @@ -1,6 +1,5 @@ #ifndef __TABLE_H__ #define __TABLE_H__ -#ifdef __cplusplus #include <Action.h> #include <String.h> @@ -19,7 +18,4 @@ class Table : public Action { Action * Next; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Task.h b/include/Task.h index 17df72e..9c966a3 100644 --- a/include/Task.h +++ b/include/Task.h @@ -1,6 +1,5 @@ #ifndef __TASK_H__ #define __TASK_H__ -#ifdef __cplusplus #include <unistd.h> #include <sys/time.h> @@ -53,7 +52,4 @@ class Task : public Base { Task * wbta; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/TaskMan.h b/include/TaskMan.h index a3b03ab..128339f 100644 --- a/include/TaskMan.h +++ b/include/TaskMan.h @@ -1,6 +1,5 @@ #ifndef __TASKMAN_H__ #define __TASKMAN_H__ -#ifdef __cplusplus #include <signal.h> #include <Task.h> @@ -72,7 +71,4 @@ class TaskMan : public Base { static sigset_t sigchildset; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/Variables.h b/include/Variables.h index c82ad87..2bbc406 100644 --- a/include/Variables.h +++ b/include/Variables.h @@ -1,6 +1,5 @@ #ifndef __VARIABLES_H__ #define __VARIABLES_H__ -#ifdef __cplusplus #include <vector> #include <String.h> @@ -26,7 +25,4 @@ class Variables : public Base { int nbvars; }; -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/include/generic.h b/include/generic.h index 4b9c455..28a3baf 100644 --- a/include/generic.h +++ b/include/generic.h @@ -57,7 +57,11 @@ typedef Uint16 Word; typedef Uint32 DWord; #endif -#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ +#ifndef HAVE_SSIZE_T +typedef int32 ssize_t; +#endif + +#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ || defined FORCE64 typedef long long int64; typedef unsigned long long uint64; #elif defined _WIN32 @@ -67,16 +71,18 @@ typedef unsigned _int64 int64; #error Unsupported platform (need 64 bits ints definition) #endif +#ifndef PACKED #if defined __linux__ || defined __CYGWIN32__ #define PACKED __attribute__((packed)) #else #define PACKED #endif +#endif extern char verbosity; char ** split(char * s, char t); -#ifdef __cplusplus +#if defined __cplusplus || defined __WIN32__ #ifndef MAX template<class T> @@ -119,14 +125,4 @@ inline T MIN(T a, T b) { #error Unknow compiler/platform #endif -#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ -typedef long long int64; -typedef unsigned long long uint64; -#elif defined _WIN32 -typedef _int64 int64; -typedef unsigned _int64 int64; -#else -#error Unsupported platform (need 64 bits ints definition) -#endif - #endif diff --git a/include/template.h b/include/template.h index f18662f..591bfcb 100644 --- a/include/template.h +++ b/include/template.h @@ -1,8 +1,3 @@ #ifndef ___H__ #define ___H__ -#ifdef __cplusplus - -#else -#error This only works with a C++ compiler -#endif #endif diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index a647f16..110ffaa 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -137,6 +137,7 @@ void xfree(char *& p) { } } +#ifdef HAVE_PIPE int xpipe(int * p, int flag) throw (GeneralException) { if (pipe(p)) { throw GeneralException(String(_("Error creating pipe: ")) + strerror(errno)); @@ -144,7 +145,13 @@ int xpipe(int * p, int flag) throw (GeneralException) { return p[flag]; } +#else +int xpipe(int *, int) throw (GeneralException) { + throw GeneralException(_("Function pipe() not supported by this system.\n")); +} +#endif +#ifdef HAVE_FORK pid_t xfork() throw (GeneralException) { pid_t p; @@ -156,6 +163,11 @@ pid_t xfork() throw (GeneralException) { return p; } +#else +pid_t xfork() throw (GeneralException) { + throw GeneralException(_("Function fork() not supported by this system.\n")); +} +#endif void xexit(int status) throw (GeneralException) { throw Exit(status); diff --git a/lib/Handle.cc b/lib/Handle.cc index 27426ab..013b749 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -58,7 +58,9 @@ ssize_t Handle::write(const void *buf, size_t count) throw (GeneralException) { // cerr << "write: throwing IOAgain for handle " << GetName() << endl; throw IOAgain(); } else { +#ifdef HAVE_SLEEP sleep(1); +#endif } } } else { @@ -110,10 +112,12 @@ bool Handle::IsNonBlock(void) const { } void Handle::SetNonBlock(void) { +#ifdef HAVE_FCNTL if ((h >= 0) || !nonblock) { fcntl(h, F_SETFL, O_NONBLOCK); } nonblock = true; +#endif } Handle & operator<<(Handle & h, const String & s) { diff --git a/lib/Makefile.sol.mingw b/lib/Makefile.sol.mingw new file mode 100644 index 0000000..8f15e9e --- /dev/null +++ b/lib/Makefile.sol.mingw @@ -0,0 +1,14 @@ +CC = i586-mingw32msvc-gcc +CXX = i586-mingw32msvc-g++ +LD = i586-mingw32msvc-ld +CPPFLAGS = -I../include -DFORCE64 +OBJECTS = Exceptions.o Handle.o Image.o Input.o Main.o Output.o String.o \ + checkargs.o datecalc.o fileutils.o generic.o + +all: Baltisot-sol.dll + +Baltisot-sol.dll: $(OBJECTS) + $(CXX) -o Baltisot-sol.dll -shared $(OBJECTS) -lz + +clean: + rm -f *.o diff --git a/m4/Makefile.am b/m4/Makefile.am index 7deaf67..d6c271d 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1 +1 @@ -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 +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 ssize_t.m4 diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4 new file mode 100644 index 0000000..a92f61a --- /dev/null +++ b/m4/ssize_t.m4 @@ -0,0 +1,12 @@ +dnl Checks for type ssize_t +dnl Defines HAVE_SSIZE_T on success. +AC_DEFUN(AC_TYPE_SSIZE_T, +[AC_CACHE_CHECK([for type ssize_t], ac_cv_type_ssize_t, + [AC_TRY_COMPILE([#include <sys/types.h>], [ssize_t s;], + [ac_cv_type_ssize_t=yes], + [ac_cv_type_ssize_t=no])]) +if test $ac_cv_type_ssize_t = yes; then + AC_DEFINE(HAVE_SSIZE_T, 1, [Define if you have ssize_t]) +else + AC_DEFINE(NO_SSIZE_T, 1, [Define if you don't have ssize_t]) +fi]) |