From 4ed874500c66aeb60cb11a0acc081dbc113eec51 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 16 Jul 2010 09:58:26 +0200 Subject: Windows fixes and CMake scripts to build under Windows --- .bzrignore | 4 ++ CMakeLists.txt | 112 ++++++++++++++++++++++++++++++++++++++++++++++++ VERSION | 2 +- config.h.cmake | 30 +++++++++++++ configure.in | 2 +- examples/CMakeLists.txt | 12 ++++++ release | 9 +++- src/CMakeLists.txt | 70 ++++++++++++++++++++++++++++++ src/engine.c | 3 ++ src/fs.c | 6 +++ src/librcc.c | 7 ++- src/lng.c | 3 ++ src/lngconfig.c | 4 ++ src/rccconfig.c | 6 ++- src/rccexternal.c | 40 ++++++++++++++--- src/rcciconv.c | 6 ++- src/rcclocale.c | 15 ++++++- src/rccmutex.c | 17 ++++++++ src/rccstring.c | 4 ++ src/rcctranslate.c | 4 ++ src/rccxml.c | 9 +++- src/recode.c | 4 ++ 22 files changed, 353 insertions(+), 16 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 config.h.cmake create mode 100644 examples/CMakeLists.txt create mode 100644 src/CMakeLists.txt diff --git a/.bzrignore b/.bzrignore index c27d485..c0c022b 100644 --- a/.bzrignore +++ b/.bzrignore @@ -37,3 +37,7 @@ example1 example2 rcc-gtk-config rcc-gtk2-config +CMakeFiles +cmake_install.cmake +cmake_install.cmake +CMakeCache.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..01cc4ce --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.6.3) +project(librcc) + +set(CMAKE_VERBOSE_MAKEFILE YES) +set(CMAKE_BUILD_TYPE RELEASE) + +if (WIN32) + SET(USR_FOLDER "C:/DEVEL/UNIX" CACHE PATH "Path to libraries and includes") + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${USR_FOLDER}/include) + INCLUDE_DIRECTORIES(${USR_FOLDER}/include) + + find_library(ZLIB_LIBRARY NAMES zlib PATHS ${USR_FOLDER} PATH_SUFFIXES "lib") + if (NOT ZLIB_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find zlib") + endif() + + find_library(LIBXML2_LIBRARY NAMES libxml2 PATHS ${USR_FOLDER} PATH_SUFFIXES "lib") + if (NOT LIBXML2_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find LibXML2") + endif() + + find_library(ICONV_LIBRARY NAMES libiconv PATHS ${USR_FOLDER} PATH_SUFFIXES "lib") + if (NOT ICONV_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find iconv") + endif () + + find_library(ENCA_LIBRARY NAMES libenca PATHS ${USR_FOLDER} PATH_SUFFIXES "lib") + if (ENCA_LIBRARY) + SET(HAVE_ENCA TRUE) + endif() + + find_library(LIBRCD_LIBRARY NAMES rcd PATHS ${USR_FOLDER} PATH_SUFFIXES "lib") + if (LIBRCD_LIBRARY) + SET(HAVE_RCD TRUE) + endif() + + find_library(WSOCK_LIBRARY NAMES wsock32) + if (NOT WSOCK_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find wsock library") + endif() + +else (WIN32) + MESSAGE(FATAL_ERROR "Windows build only, use autoconf for POSIX-compliant systems") +endif (WIN32) + + + +INCLUDE(CheckIncludeFiles) +CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILES (sys/file.h HAVE_SYS_FILE_H) +CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H) +CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILES (sys/wait.h HAVE_SYS_WAIT_H) +CHECK_INCLUDE_FILES (signal.h HAVE_SIGNAL_H) +CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H) +CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H) +CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H) +CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H) +CHECK_INCLUDE_FILES (iconv.h HAVE_ICONV_H) +CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H) +CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) + +INCLUDE (CheckTypeSize) +CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T) +IF(NOT HAVE_SIZEOF_SIZE_T) + SET(size_t "unsigned int") +ENDIF(NOT HAVE_SIZEOF_SIZE_T) + +CHECK_TYPE_SIZE(ssize_t SIZEOF_SSIZE_T) +IF(NOT HAVE_SIZEOF_SSIZE_T) + CHECK_TYPE_SIZE("long" SIZEOF_LONG) + CHECK_TYPE_SIZE("__int64" SIZEOF___INT64) + IF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) + SET(ssize_t long) + ENDIF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) + IF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) + SET(ssize_t __int64) + ENDIF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) +ENDIF(NOT HAVE_SIZEOF_SSIZE_T) + +INCLUDE (CheckFunctionExists) +CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP) +CHECK_FUNCTION_EXISTS(usleep HAVE_USLEEP) +CHECK_FUNCTION_EXISTS(flock HAVE_FLOCK) +CHECK_FUNCTION_EXISTS(lockf HAVE_LOCKF) +CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC) +CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) +CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) +CHECK_FUNCTION_EXISTS(ftruncate HAVE_FTRUNCATE) + +IF(NOT HAVE_STRCASECMP AND WIN32) + SET(strcasecmp _stricmp) +endif(NOT HAVE_STRCASECMP AND WIN32) + +IF(NOT HAVE_STRNCASECMP AND WIN32) + SET(strncasecmp _strnicmp) +endif(NOT HAVE_STRNCASECMP AND WIN32) + +IF(NOT HAVE_FTRUNCATE AND WIN32) + SET(ftruncate _chsize) +endif(NOT HAVE_FTRUNCATE AND WIN32) + +INCLUDE (CheckLibraryExists) +INCLUDE (CheckSymbolExists) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +add_subdirectory(src) +add_subdirectory(examples) diff --git a/VERSION b/VERSION index 1866a36..62f067f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.9 +0.2.10CVS diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..2cf76bf --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,30 @@ +#cmakedefine HAVE_SYS_TYPES_H +#cmakedefine HAVE_SYS_STAT_H +#cmakedefine HAVE_SYS_FILE_H +#cmakedefine HAVE_UNISTD_H +#cmakedefine HAVE_PWD_H +#cmakedefine HAVE_DLFCN_H +#cmakedefine HAVE_FCNTL_H +#cmakedefine HAVE_ICONV_H +#cmakedefine HAVE_INTTYPES_H +#cmakedefine HAVE_SYS_TIME_H +#cmakedefine HAVE_SYS_SELECT_H +#cmakedefine HAVE_SYS_SOCKET_H +#cmakedefine HAVE_SYS_WAIT_H +#cmakedefine HAVE_SYS_UN_H +#cmakedefine HAVE_SIGNAL_H +#cmakedefine HAVE_STRINGS_H +#cmakedefine size_t ${size_t} +#cmakedefine ssize_t ${ssize_t} +#cmakedefine strcasecmp ${strcasecmp} +#cmakedefine strncasecmp ${strncasecmp} +#cmakedefine ftruncate ${ftruncate} +#cmakedefine HAVE_NANOSLEEP +#cmakedefine HAVE_USLEEP +#cmakedefine HAVE_FLOCK +#cmakedefine HAVE_LOCKF +#cmakedefine HAVE_FSYNC + +#cmakedefine HAVE_ENCA +#cmakedefine HAVE_RCD + diff --git a/configure.in b/configure.in index a430e3c..8817d6b 100644 --- a/configure.in +++ b/configure.in @@ -374,7 +374,7 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. -AC_CHECK_FUNCS(strcasecmp strncasecmp strdup strnlen flock lockf) +AC_CHECK_FUNCS(strcasecmp strncasecmp strdup strnlen flock lockf nanosleep usleep fsync ftruncate) AC_OUTPUT(src/Makefile engines/Makefile external/Makefile ui/Makefile examples/Makefile Makefile librcc.spec) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..d9fe1cc --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,12 @@ +SET(CMAKE_INCLUDE_CURRENT_DIR ON) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../src) +LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../src) + +ADD_EXECUTABLE(example1 example1.c) +ADD_EXECUTABLE(example2 example1.c) + +TARGET_LINK_LIBRARIES(example1 rcc) +TARGET_LINK_LIBRARIES(example2 rcc) + +#TARGET_LINK_LIBRARIES(librcc ${LIBXML2_LIBRARY} ${ICONV_LIBRARY} ${ENCA_LIBRARY} ${LIBRCD_LIBRARY}) diff --git a/release b/release index 6318745..74c9759 100755 --- a/release +++ b/release @@ -38,6 +38,9 @@ cp -a * $RDIR/$rname ./configure make clean distclean distclean-am -C examples make clean distclean distclean-am + find . -name CMakeFiles -print0 | xargs -0 rm -rf + find . -name CMakeCache.txt -print0 | xargs -0 rm -rf + find . -name cmake_install.cmake -print0 | xargs -0 rm -rf rm -rf autom4te*.cache rm -rf "{arch}" rm -rf `find . -name .arch-ids` @@ -51,6 +54,8 @@ cp -a * $RDIR/$rname tar cjf $rname.tar.bz2 $rname rm -rf $rname - scp $rname.tar.bz2 csa@dside.dyndns.org:/home/csa/public_html/files/rusxmms/ - ssh csa@dside.dyndns.org ln -sf $rname.tar.bz2 /home/csa/public_html/files/rusxmms/$NAME-latest.tar.bz2 + if [ ! "$cvs" == "cvs" ]; then + scp $rname.tar.bz2 csa@dside.dyndns.org:/home/csa/public_html/files/rusxmms/ + ssh csa@dside.dyndns.org ln -sf $rname.tar.bz2 /home/csa/public_html/files/rusxmms/$NAME-latest.tar.bz2 + fi ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..7477fd9 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,70 @@ +if (NOT WIN32) +# SET(BUILD_SHARED_LIBS ON) +endif (NOT WIN32) + +SET(CMAKE_INCLUDE_CURRENT_DIR ON) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + +SET(HEADERS + librcc.h +) + +SET(INTERNAL_HEADERS + internal.h + curconfig.h + engine.h + fs.h + lng.h + lngconfig.h + lngrecode.h + opt.h + plugin.h + rccconfig.h + rccdb4.h + rccenca.h + rccexternal.h + rcchome.h + rcciconv.h + rcclist.h + rcclocale.h + rcclock.h + rccmutex.h + rccspell.h + rccstring.h + rcctranslate.h + rccxml.h + recode.h +) + +SET(rcc_SRCS + librcc.c + curconfig.c + engine.c + fs.c + lng.c + lngconfig.c + lngrecode.c + opt.c + plugin.c + rccconfig.c + rccdb4.c + rccenca.c + rccexternal.c + rcchome.c + rcciconv.c + rcclist.c + rcclocale.c + rcclock.c + rccmutex.c + rccspell.c + rccstring.c + rcctranslate.c + rccxml.c + recode.c + ${INTERNAL_HEADERS} + ${HEADERS} +) + +ADD_LIBRARY(rcc ${rcc_SRCS}) +TARGET_LINK_LIBRARIES(rcc ${LIBXML2_LIBRARY} ${ICONV_LIBRARY} ${ENCA_LIBRARY} ${LIBRCD_LIBRARY} ${ZLIB_LIBRARY} ${WSOCK_LIBRARY}) diff --git a/src/engine.c b/src/engine.c index caa1376..4d0add5 100644 --- a/src/engine.c +++ b/src/engine.c @@ -19,6 +19,9 @@ #include #include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "internal.h" #include "plugin.h" diff --git a/src/fs.c b/src/fs.c index 182a217..2a63302 100644 --- a/src/fs.c +++ b/src/fs.c @@ -83,7 +83,13 @@ static char *rccCreateFullName(const char *path, const char *filename) { static int rccIsFile(const char *filename) { struct stat st; +#ifdef HAVE_SYS_STAT_H +# ifdef S_ISREG if ((!stat(filename,&st))&&(S_ISREG(st.st_mode))) return 1; +# else /* S_ISREG */ + if (!stat(filename,&st)) return 1; +# endif /* S_ISREG */ +#endif /* HAVE_SYS_STAT_H */ return 0; } diff --git a/src/librcc.c b/src/librcc.c index c501b16..ec6aeb4 100644 --- a/src/librcc.c +++ b/src/librcc.c @@ -18,11 +18,16 @@ */ #include -#include #include #include #include +#include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ + + #include "../config.h" #ifdef HAVE_UNISTD_H diff --git a/src/lng.c b/src/lng.c index e1c5ea0..df9b2e9 100644 --- a/src/lng.c +++ b/src/lng.c @@ -19,6 +19,9 @@ #include #include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "internal.h" #include "rccconfig.h" diff --git a/src/lngconfig.c b/src/lngconfig.c index ce7a7fb..aeb9636 100644 --- a/src/lngconfig.c +++ b/src/lngconfig.c @@ -20,7 +20,11 @@ #include #include + #include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "../config.h" diff --git a/src/rccconfig.c b/src/rccconfig.c index 5934e56..1f52ac3 100644 --- a/src/rccconfig.c +++ b/src/rccconfig.c @@ -18,7 +18,11 @@ */ #include -#include + +#include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "internal.h" #include "rccconfig.h" diff --git a/src/rccexternal.c b/src/rccexternal.c index f1e8fba..aee6797 100644 --- a/src/rccexternal.c +++ b/src/rccexternal.c @@ -64,14 +64,19 @@ #define RCC_EXT_PROG_NAME "rccexternal" #define RCC_EXTERNAL_TIMEOUT 250 /* 100us */ +#ifdef HAVE_UNISTD_H static pid_t pid = (pid_t)-1; static char *addr = NULL; +#endif /* HAVE_UNISTD_H */ int rccExternalInit() { -#ifdef HAVE_SIGNAL_H +#ifdef HAVE_UNISTD_H +# ifdef HAVE_SIGNAL_H struct sigaction act; +# endif /* HAVE_SIGNAL_H */ +# ifdef HAVE_SYS_STAT_H struct stat st; -#endif /* HAVE_SIGNAL_H */ +# endif /* HAVE_SYS_STAT_H */ if (pid != (pid_t)-1) return 0; @@ -85,25 +90,32 @@ int rccExternalInit() { if (pid == (pid_t)-1) return -1; sprintf(addr,"%s/.rcc/comm/%lu.sock", rcc_home_dir, (unsigned long)pid); -#ifdef HAVE_SIGNAL_H +# ifdef HAVE_SIGNAL_H act.sa_handler = SIG_IGN; sigemptyset(&act.sa_mask); act.sa_flags = 0; sigaction(SIGPIPE,&act,NULL); -#endif /* HAVE_SIGNAL_H */ +# endif /* HAVE_SIGNAL_H */ return 0; } /*if ((!stat("../external/" RCC_EXT_PROG_NAME, &st))&&(st.st_mode&S_IXOTH)) { execl ("../external/" RCC_EXT_PROG_NAME, RCC_EXT_PROG_NAME, NULL); - } else*/ if ((!stat(LIBRCC_DATA_DIR "/" RCC_EXT_PROG_NAME, &st))&&(st.st_mode&S_IXOTH)) { + } else*/ +# ifdef HAVE_SYS_STAT_H + if ((!stat(LIBRCC_DATA_DIR "/" RCC_EXT_PROG_NAME, &st))&&(st.st_mode&S_IXOTH)) { +# endif /* HAVE_SYS_STAT_H */ execl(LIBRCC_DATA_DIR "/" RCC_EXT_PROG_NAME, RCC_EXT_PROG_NAME, NULL); +# ifdef HAVE_SYS_STAT_H } +# endif /* HAVE_SYS_STAT_H */ +#endif /* HAVE_UNISTD_H */ exit(1); } void rccExternalFree() { +#ifdef HAVE_UNISTD_H int retry; pid_t res; struct timespec timeout = { 0, 5000000 }; @@ -122,9 +134,10 @@ void rccExternalFree() { pid = (pid_t)-1; if (addr) free(addr); - +#endif /* HAVE_UNISTD_H */ } +#ifdef HAVE_SYS_SELECT_H static int rccExternalSetDeadline(struct timeval *tv, unsigned long timeout) { /* gettimeofday(tv, NULL); @@ -135,8 +148,10 @@ static int rccExternalSetDeadline(struct timeval *tv, unsigned long timeout) { tv->tv_usec = (timeout + RCC_EXTERNAL_TIMEOUT) % 1000000; return 0; } +#endif /* HAVE_SYS_SELECT_H */ size_t rccExternalWrite(int s, const char *buffer, ssize_t size, unsigned long timeout) { +#ifdef HAVE_SYS_SELECT_H int err; unsigned char connected = 1; ssize_t writed, res = 0; @@ -158,9 +173,13 @@ size_t rccExternalWrite(int s, const char *buffer, ssize_t size, unsigned long t } return size - writed; +#else /* HAVE_SYS_SELECT_H */ + return -1; +#endif /* HAVE_SYS_SELECT_H */ } size_t rccExternalRead(int s, char *buffer, ssize_t size, unsigned long timeout) { +#ifdef HAVE_SYS_SELECT_H int err; unsigned char connected = 1; ssize_t readed, res = 0; @@ -182,9 +201,13 @@ size_t rccExternalRead(int s, char *buffer, ssize_t size, unsigned long timeout) } return size - readed; +#else /* HAVE_SYS_SELECT_H */ + return -1; +#endif /* HAVE_SYS_SELECT_H */ } int rccExternalConnect(unsigned char module) { +#ifdef HAVE_SYS_SOCKET_H int err; int retries = 10; int sock; @@ -241,14 +264,19 @@ again: } return sock; +#else /* HAVE_SYS_SOCKET_H */ + return -1; +#endif /* HAVE_SYS_SOCKET_H */ } void rccExternalClose(int s) { +#ifdef HAVE_SYS_SOCKET_H unsigned char cmd = 0; if (s != -1) { write(s, &cmd, 1); close(s); } +#endif /* HAVE_SYS_SOCKET_H */ } int rccExternalAllowOfflineMode() { diff --git a/src/rcciconv.c b/src/rcciconv.c index 28713fb..40c5b11 100644 --- a/src/rcciconv.c +++ b/src/rcciconv.c @@ -19,10 +19,14 @@ #include #include -#include #include #include +#include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ + #include "internal.h" #include "rcciconv.h" diff --git a/src/rcclocale.c b/src/rcclocale.c index fcd9a6d..b514e80 100644 --- a/src/rcclocale.c +++ b/src/rcclocale.c @@ -19,9 +19,14 @@ #include #include -#include #include +#include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ + + #include "../config.h" #ifdef HAVE_LIBCHARSET @@ -35,11 +40,17 @@ #include "rccconfig.h" int rccLocaleGetClassByName(const char *locale) { +#ifdef LC_CTYPE if (!locale) return LC_CTYPE; - + if (!strcmp(locale, "LC_CTYPE")) return LC_CTYPE; +#endif /* LC_CTYPE */ +#ifdef LC_MESSAGES if (!strcmp(locale, "LC_MESSAGES")) return LC_MESSAGES; +#endif /* LC_MESSAGES */ +#ifdef LC_COLLATE if (!strcmp(locale, "LC_COLLATE")) return LC_COLLATE; +#endif /* LC_COLLATE */ /* if (!strcmp(locale, "LC_ALL")) return LC_ALL; if (!strcmp(locale, "LC_NUMERIC")) return LC_NUMERIC; diff --git a/src/rccmutex.c b/src/rccmutex.c index dce817a..5df962a 100644 --- a/src/rccmutex.c +++ b/src/rccmutex.c @@ -20,8 +20,17 @@ #include #include +#ifdef HAVE_UNISTD_H +# include +#endif /* HAVE_UNISTD_H */ + +#ifdef WIN32 +# include +#endif /* WIN32 */ + #include "rccmutex.h" + #define RCC_MUTEX_SLEEP 500 rcc_mutex rccMutexCreate() { @@ -49,7 +58,9 @@ void rccMutexFree(rcc_mutex mutex) { int rccMutexLock(rcc_mutex mutex) { #ifndef HAVE_PTHREAD +# ifdef HAVE_NANOSLEEP struct timespec ts; +# endif /* HAVE_NANOSLEEP */ #endif /* !HAVE_PTHREAD */ if (!mutex) return -1; @@ -58,9 +69,15 @@ int rccMutexLock(rcc_mutex mutex) { return pthread_mutex_lock(&mutex->mutex); #else while (mutex->mutex) { +# if defined(HAVE_NANOSLEEP) ts.tv_sec = RCC_MUTEX_SLEEP / 1000000; ts.tv_nsec = (RCC_MUTEX_SLEEP % 1000000)*1000; nanosleep(&ts, NULL); +# elif defined (HAVE_USLEEP) + usleep(RCC_MUTEX_SLEEP); +# elif defined (WIN32) + Sleep((RCC_MUTEX_SLEEP<1000)?1:RCC_MUTEX_SLEEP/1000); +# endif /* HAVE_NANOSLEEP */ } mutex->mutex = 1; diff --git a/src/rccstring.c b/src/rccstring.c index eee2ac2..e56c45d 100644 --- a/src/rccstring.c +++ b/src/rccstring.c @@ -19,7 +19,11 @@ #include #include + #include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "../config.h" diff --git a/src/rcctranslate.c b/src/rcctranslate.c index cce76e1..aee027f 100644 --- a/src/rcctranslate.c +++ b/src/rcctranslate.c @@ -19,7 +19,11 @@ #include #include + #include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "internal.h" #include "rccconfig.h" diff --git a/src/rccxml.c b/src/rccxml.c index 1db5788..cc07fa9 100644 --- a/src/rccxml.c +++ b/src/rccxml.c @@ -18,9 +18,13 @@ */ #include -#include #include +#include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ + #include "../config.h" #ifdef HAVE_UNISTD_H @@ -467,7 +471,10 @@ clear: } xmlFreeDoc(doc); } + +#ifdef HAVE_FSYNC fsync(fd); +#endif /* HAVE_FSYNC */ #if defined(HAVE_FLOCK) flock(fd, LOCK_UN); diff --git a/src/recode.c b/src/recode.c index e1929b5..5529e42 100644 --- a/src/recode.c +++ b/src/recode.c @@ -19,7 +19,11 @@ #include #include + #include +#ifdef HAVE_STRINGS_H +# include +#endif /* HAVE_STRINGS_H */ #include "../config.h" -- cgit v1.2.3