SF Tracker [ 1703533 ] Patch to make it compile under FreeBSD
Submitted By: Timothy Redaelli - drittz I made some patches to make it compile under FreeBSD using gethostbyaddr_r when supported. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@165 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
@@ -11,6 +11,12 @@ Version 1.4.5
|
|||||||
* Fix for a bug in makeAction where va_arg was beeing called one
|
* Fix for a bug in makeAction where va_arg was beeing called one
|
||||||
extra time.
|
extra time.
|
||||||
|
|
||||||
|
2007-04-19 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* SF Tracker [ 1703533 ] Patch to make it compile under FreeBSD
|
||||||
|
Submitted By: Timothy Redaelli - drittz
|
||||||
|
I made some patches to make it compile under FreeBSD using
|
||||||
|
gethostbyaddr_r when supported.
|
||||||
|
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
Version 1.4.4
|
Version 1.4.4
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
|
@@ -13,7 +13,3 @@ autoreconf --force --install -Wall -Wno-obsolete $* || exit 1
|
|||||||
echo "Now run ./configure and then make."
|
echo "Now run ./configure and then make."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
93
configure.ac
93
configure.ac
@@ -48,6 +48,11 @@ AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
|
|||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
||||||
|
|
||||||
|
#
|
||||||
|
# Get canonical host names in host and host_os
|
||||||
|
#
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
#
|
#
|
||||||
# There are 3 configuration files :
|
# There are 3 configuration files :
|
||||||
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
||||||
@@ -131,11 +136,14 @@ RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
|||||||
# version on that.
|
# version on that.
|
||||||
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
||||||
AC_MSG_CHECKING([for documentation directory])
|
AC_MSG_CHECKING([for documentation directory])
|
||||||
AC_ARG_WITH([documentation],
|
AC_ARG_WITH(
|
||||||
AS_HELP_STRING([--with-documentation=directory_name],
|
[documentation],
|
||||||
|
AS_HELP_STRING(
|
||||||
|
[--with-documentation=directory_name],
|
||||||
[where documentation is installed
|
[where documentation is installed
|
||||||
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
||||||
AS_HELP_STRING([--without-documentation],
|
AS_HELP_STRING(
|
||||||
|
[--without-documentation],
|
||||||
[do not install the documentation]),
|
[do not install the documentation]),
|
||||||
[],
|
[],
|
||||||
[with_documentation=no])
|
[with_documentation=no])
|
||||||
@@ -159,25 +167,40 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_EGREP
|
AC_PROG_EGREP
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default compilation flags
|
# Default compilation flags
|
||||||
#
|
#
|
||||||
if test x"$enable_debug" = xyes; then
|
echo "--------------------- Default compilation flags -------------------------------"
|
||||||
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
echo host is $host
|
||||||
:
|
echo host_os is $host_os
|
||||||
else
|
case $host_os in
|
||||||
# add optimise for size
|
FreeBSD*)
|
||||||
AX_CFLAGS_GCC_OPTION([-Os])
|
echo "Using FreeBSD specific compiler settings"
|
||||||
fi
|
# Put FreeBSD specific compiler flags here
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Using non-specific system compiler settings"
|
||||||
|
if test x"$enable_debug" = xyes; then
|
||||||
|
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
||||||
|
:
|
||||||
|
else
|
||||||
|
# add optimise for size
|
||||||
|
AX_CFLAGS_GCC_OPTION([-Os])
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
AX_CFLAGS_WARN_ALL
|
AX_CFLAGS_WARN_ALL
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Lot's of stuff to ensure large file support
|
# Lot's of stuff to ensure large file support
|
||||||
#
|
#
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
AC_DEFINE(_LARGE_FILE_SOURCE, [], [Large files support])
|
AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support])
|
||||||
AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size])
|
AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -186,7 +209,24 @@ AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size])
|
|||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
# libupnp code doesn't use autoconf variables yet,
|
# libupnp code doesn't use autoconf variables yet,
|
||||||
# so just abort if a header file is not found.
|
# so just abort if a header file is not found.
|
||||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h],[],[AC_MSG_ERROR([required header file missing])])
|
AC_CHECK_HEADERS(
|
||||||
|
[ \
|
||||||
|
arpa/inet.h \
|
||||||
|
fcntl.h \
|
||||||
|
limits.h \
|
||||||
|
netdb.h \
|
||||||
|
netinet/in.h \
|
||||||
|
stdlib.h \
|
||||||
|
string.h \
|
||||||
|
sys/ioctl.h \
|
||||||
|
sys/socket.h \
|
||||||
|
sys/time.h \
|
||||||
|
sys/timeb.h \
|
||||||
|
syslog.h \
|
||||||
|
unistd.h \
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR([required header file missing])])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -202,25 +242,28 @@ TYPE_SOCKLEN_T
|
|||||||
#
|
#
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
|
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for POSIX Threads
|
# Checks for POSIX Threads
|
||||||
#
|
#
|
||||||
ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
ACX_PTHREAD(
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
||||||
|
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
|
ixml/Makefile
|
||||||
|
ixml/doc/Makefile
|
||||||
|
threadutil/Makefile
|
||||||
|
upnp/Makefile
|
||||||
|
upnp/doc/Makefile
|
||||||
|
docs/dist/Makefile
|
||||||
|
libupnp.pc
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
|
||||||
ixml/Makefile
|
|
||||||
ixml/doc/Makefile
|
|
||||||
threadutil/Makefile
|
|
||||||
upnp/Makefile
|
|
||||||
upnp/doc/Makefile
|
|
||||||
docs/dist/Makefile
|
|
||||||
libupnp.pc
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
@@ -47,6 +47,10 @@ extern "C" {
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||||
/* This system has SuS2-compliant mutex attributes.
|
/* This system has SuS2-compliant mutex attributes.
|
||||||
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
||||||
|
@@ -34,8 +34,11 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
#include <osreldate.h>
|
||||||
|
#if __FreeBSD_version < 601103
|
||||||
#include <lwres/netdb.h>
|
#include <lwres/netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
|
|
||||||
@@ -620,7 +623,7 @@ parse_hostport( const char *in,
|
|||||||
&h,
|
&h,
|
||||||
temp_hostbyname_buff,
|
temp_hostbyname_buff,
|
||||||
BUFFER_SIZE, &errcode );
|
BUFFER_SIZE, &errcode );
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__) && __FreeBSD_version < 601103
|
||||||
h = lwres_gethostbyname_r( temp_host_name,
|
h = lwres_gethostbyname_r( temp_host_name,
|
||||||
&h_buf,
|
&h_buf,
|
||||||
temp_hostbyname_buff,
|
temp_hostbyname_buff,
|
||||||
|
Reference in New Issue
Block a user