FreeBSD support and clean up of unnecessary ifdef FREEBSD

This commit is contained in:
Michael Cook 2013-05-11 14:32:14 -04:00
parent 9ea71dd94f
commit 73a4e87379
11 changed files with 33 additions and 12 deletions

View File

@ -84,6 +84,14 @@ ELSE(MSVC)
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
ENDIF(MSVC)
#FreeBSD support
IF(UNIX)
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
ADD_DEFINITIONS(-DFREEBSD)
SET(FREEBSD TRUE)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
ENDIF(UNIX)
#use stdint.h types if they exist for this platform (we have to guess otherwise)
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
IF(HAVE_STDINT_H)

View File

@ -74,7 +74,7 @@ Mutex::Mutex() {
#else
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
#if defined(__CYGWIN__) || defined(__APPLE__)
#if defined(__CYGWIN__) || defined(__APPLE__) || defined(FREEBSD)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);

View File

@ -29,6 +29,9 @@
#include <stdio.h>
#endif
#include "eqemu_exception.h"
#ifdef FREEBSD
#include <sys/stat.h>
#endif
namespace EQEmu {

View File

@ -26,7 +26,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(eqlaunch "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(eqlaunch "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(eqlaunch "z")
TARGET_LINK_LIBRARIES(eqlaunch "m")
TARGET_LINK_LIBRARIES(eqlaunch "rt")

View File

@ -53,7 +53,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(loginserver "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(loginserver "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(loginserver "z")
TARGET_LINK_LIBRARIES(loginserver "m")
TARGET_LINK_LIBRARIES(loginserver "rt")

View File

@ -32,7 +32,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(queryserv "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(queryserv "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(queryserv "z")
TARGET_LINK_LIBRARIES(queryserv "m")
TARGET_LINK_LIBRARIES(queryserv "rt")

View File

@ -31,7 +31,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(shared_memory "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(shared_memory "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(shared_memory "z")
TARGET_LINK_LIBRARIES(shared_memory "m")
TARGET_LINK_LIBRARIES(shared_memory "rt")

View File

@ -34,7 +34,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(ucs "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(ucs "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(ucs "z")
TARGET_LINK_LIBRARIES(ucs "m")
TARGET_LINK_LIBRARIES(ucs "rt")

View File

@ -80,7 +80,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(world "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(world "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(world "z")
TARGET_LINK_LIBRARIES(world "m")
TARGET_LINK_LIBRARIES(world "rt")

View File

@ -168,7 +168,9 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(zone "dl")
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(zone "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(zone "z")
TARGET_LINK_LIBRARIES(zone "m")
TARGET_LINK_LIBRARIES(zone "rt")

View File

@ -12549,11 +12549,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app)
//
char *GuildName = (char *)app->pBuffer;
#ifdef FREEBSD
if(strlen(GuildName) > 60)
#else
if(strnlen(GuildName, 64) > 60)
#endif
{
Message(clientMessageError, "Guild name too long.");
return;