autotools: UPnP

Günther Brammer 2012-01-27 01:42:37 +01:00
parent 597f928ec6
commit 7e8deec201
4 changed files with 67 additions and 25 deletions

View File

@ -39,26 +39,32 @@ AM_CXXFLAGS = $(PTHREAD_CFLAGS) $(WINDOWS_CFLAGS) $(WARNING_FLAGS)
AM_CFLAGS = -Wall
AM_CPPFLAGS = \
-I$(builddir) \
-I$(srcdir)/src \
-I$(srcdir)/src/c4group \
-I$(srcdir)/src/network \
-I$(srcdir)/src/lib \
-I$(srcdir)/src/platform \
-I$(srcdir)/src/config \
-I$(srcdir)/src/res \
-I$(srcdir)/src/control \
-I$(srcdir)/src/gui \
-I$(srcdir)/src/editor \
-I$(srcdir)/src/game/landscape \
-I$(srcdir)/src/game/player \
-I$(srcdir)/src/game/script \
-I$(srcdir)/src/game \
-I$(srcdir)/src/game/object \
-I$(srcdir)/src/lib/texture \
-I$(srcdir)/src/script \
-I$(srcdir)/thirdparty \
$(GLEW_CFLAGS) $(GTK_CFLAGS) $(OPENAL_CFLAGS) $(FREETYPE_CFLAGS) $(SDL_CFLAGS) $(BOOST_CPPFLAGS)
-I$(builddir) \
-I$(srcdir)/src \
-I$(srcdir)/src/c4group \
-I$(srcdir)/src/network \
-I$(srcdir)/src/lib \
-I$(srcdir)/src/platform \
-I$(srcdir)/src/config \
-I$(srcdir)/src/res \
-I$(srcdir)/src/control \
-I$(srcdir)/src/gui \
-I$(srcdir)/src/editor \
-I$(srcdir)/src/game/landscape \
-I$(srcdir)/src/game/player \
-I$(srcdir)/src/game/script \
-I$(srcdir)/src/game \
-I$(srcdir)/src/game/object \
-I$(srcdir)/src/lib/texture \
-I$(srcdir)/src/script \
-I$(srcdir)/thirdparty \
$(GLEW_CFLAGS) \
$(GTK_CFLAGS) \
$(OPENAL_CFLAGS) \
$(FREETYPE_CFLAGS) \
$(SDL_CFLAGS) \
$(BOOST_CPPFLAGS) \
$(LIBUPNP_CFLAGS)
##BUILT_SOURCES = hgrevision.h
##hgrevision.h: $(srcdir)/.hg/dirstate
@ -436,6 +442,7 @@ src/network/C4Network2ResDlg.cpp \
src/network/C4Network2Res.h \
src/network/C4Network2Stats.cpp \
src/network/C4Network2Stats.h \
src/network/C4Network2UPnP.h \
src/network/C4Packet2.cpp \
src/network/C4PacketBase.h \
src/platform/Bitmap256.cpp \
@ -569,6 +576,15 @@ endif
if DEVELOPER_MODE
clonk_SOURCES += src/platform/C4WindowGTK.cpp src/platform/C4WindowGTK.h src/editor/C4ConsoleGTK.cpp
endif
if LIBUPNP
clonk_SOURCES += src/network/C4Network2UPnPLinux.cpp
else
if NATUPNP
clonk_SOURCES += src/network/C4Network2UPnPWin32.cpp
else
clonk_SOURCES += src/network/C4Network2UPnPDummy.cpp
endif
endif
clonk_LDADD = \
lib.a \
@ -579,7 +595,8 @@ clonk_LDADD = \
$(SDL_LIBS) \
$(PTHREAD_LIBS) \
$(Z_LIBS) \
$(CLONK_LIBS)
$(CLONK_LIBS) \
$(LIBUPNP_LIBS)
# build the resources
.rc.o:

View File

@ -82,7 +82,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 16
#serial 17
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
@ -256,7 +256,14 @@ if test "x$ax_pthread_ok" = xyes; then
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
*-osf* | *-hpux*) flag="-D_REENTRANT";;
*solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then

View File

@ -45,6 +45,9 @@
/* Define to 1 if you have the <multimon.h> header file. */
#undef HAVE_MULTIMON_H
/* Define to 1 if you have the <natupnp.h> header file. */
#undef HAVE_NATUPNP_H
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H

View File

@ -64,7 +64,7 @@ AM_CONDITIONAL(MACOSX, [test $osx = true])
dnl the whitespace is there to prevent AC_INCLUDES_DEFAULT
AC_CHECK_HEADERS([stdint.h unistd.h poll.h sys/file.h sys/stat.h sys/types.h locale.h sys/socket.h signal.h langinfo.h sys/eventfd.h sys/timerfd.h sys/inotify.h], , , [[ ]])
# Mingw does not ship with multimon.h
AC_CHECK_HEADERS([multimon.h io.h direct.h share.h], [], [], [[#include <windows.h>]])
AC_CHECK_HEADERS([multimon.h io.h direct.h share.h natupnp.h], [], [], [[#include <windows.h>]])
# iconv
AX_ICONV
# vasprintf is a GNU extension
@ -303,6 +303,20 @@ if test "$with_directx" = yes; then
AC_DEFINE([USE_DIRECTX], 1, [DirectX graphics])
fi
# UPnP
AC_ARG_WITH([upnp],
[AS_HELP_STRING([--with-upnp],[compile with upnp support [default=no]])],
, [with_upnp=no])
AS_IF([test $with_upnp = yes], [
AM_CONDITIONAL(NATUPNP, [test "$ac_cv_header_natupnp_h" = yes])
PKG_CHECK_MODULES(LIBUPNP, [libupnp], [have_libupnp=yes], [have_libupnp=no])
], [
AM_CONDITIONAL(NATUPNP, [false])
have_libupnp=no
])
AM_CONDITIONAL(LIBUPNP, [test "$have_libupnp" = yes])
# Automatic Update
AC_ARG_WITH([automatic-update],
[AS_HELP_STRING([--with-automatic-update],[enable support for automatic engine updates [default=yes]])],
, [with_automatic_update="yes"])
@ -369,7 +383,8 @@ echo "Configuration:
SDL_Mixer: $with_sdl_mixer
OpenAL: $with_openal
GTK+: $with_gtk
X11: $have_x"
X11: $have_x
Nat/LibUPnP: $ac_cv_header_natupnp_h/$have_libupnp"
if test "$enable_sdlmainloop" = yes; then echo " SDL: mainloop";
else echo " SDL: $with_sdl"; fi