From 9d1d0214e57d002ec5f42e27040c6207384f0b2e Mon Sep 17 00:00:00 2001 From: glenux Date: Tue, 10 Jan 2006 12:03:37 +0000 Subject: [PATCH] --- Makefile.am | 7 ++ src/Makefile.am | 16 ++- src/{XSock.cpp => xsock.cpp} | 2 +- src/{XSock.h => xsock.h} | 0 src/{XSock_errors.h => xsock_errors.h} | 0 src/{XSock_global.h => xsock_global.h} | 0 src/{XSock_iface.h => xsock_iface.h} | 0 src/{XSockTCP.cpp => xsock_tcp.cpp} | 0 src/{XSockUDP.cpp => xsock_udp.cpp} | 0 ...DP_RELIABLE.cpp => xsock_udp_reliable.cpp} | 0 xsock.m4 | 110 ++++++++++++++++++ 11 files changed, 125 insertions(+), 10 deletions(-) rename src/{XSock.cpp => xsock.cpp} (99%) rename src/{XSock.h => xsock.h} (100%) rename src/{XSock_errors.h => xsock_errors.h} (100%) rename src/{XSock_global.h => xsock_global.h} (100%) rename src/{XSock_iface.h => xsock_iface.h} (100%) rename src/{XSockTCP.cpp => xsock_tcp.cpp} (100%) rename src/{XSockUDP.cpp => xsock_udp.cpp} (100%) rename src/{XSockUDP_RELIABLE.cpp => xsock_udp_reliable.cpp} (100%) create mode 100644 xsock.m4 diff --git a/Makefile.am b/Makefile.am index e1e3ed3..6becca3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,10 @@ SUBDIRS = src +m4datadir = $(datadir)/aclocal +m4data_DATA = xsock.m4 + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xsock.pc + EXTRA_DIST = doc INSTALL README Doxyfile autogen.sh + diff --git a/src/Makefile.am b/src/Makefile.am index f589e47..418cf7b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,18 +5,16 @@ lib_LTLIBRARIES = libXSock.la #bin_PROGRAMS = libulm.o libXSock_la_SOURCES = \ - XSock.cpp \ - XSockTCP.cpp \ - XSockUDP.cpp \ - XSockUDP_RELIABLE.cpp + xsock.cpp \ + xsock_tcp.cpp \ + xsock_udp.cpp \ + xsock_udp_reliable.cpp libXSock_la_SOURCES += \ xsock.h \ - introspect.h \ - command.h \ - macrocommand.h \ - singleton.h \ - identifiable.h + xsock_errors.h \ + xsock_global.h \ + xsock_iface.h libXSock_la_CFLAGS = -DTRACE -static diff --git a/src/XSock.cpp b/src/xsock.cpp similarity index 99% rename from src/XSock.cpp rename to src/xsock.cpp index 4b4c704..26714ea 100644 --- a/src/XSock.cpp +++ b/src/xsock.cpp @@ -4,7 +4,7 @@ * */ -#include "XSock.h" +#include "xsock.h" /*! * \def VERBOSE Active ou pas le mode verbeux diff --git a/src/XSock.h b/src/xsock.h similarity index 100% rename from src/XSock.h rename to src/xsock.h diff --git a/src/XSock_errors.h b/src/xsock_errors.h similarity index 100% rename from src/XSock_errors.h rename to src/xsock_errors.h diff --git a/src/XSock_global.h b/src/xsock_global.h similarity index 100% rename from src/XSock_global.h rename to src/xsock_global.h diff --git a/src/XSock_iface.h b/src/xsock_iface.h similarity index 100% rename from src/XSock_iface.h rename to src/xsock_iface.h diff --git a/src/XSockTCP.cpp b/src/xsock_tcp.cpp similarity index 100% rename from src/XSockTCP.cpp rename to src/xsock_tcp.cpp diff --git a/src/XSockUDP.cpp b/src/xsock_udp.cpp similarity index 100% rename from src/XSockUDP.cpp rename to src/xsock_udp.cpp diff --git a/src/XSockUDP_RELIABLE.cpp b/src/xsock_udp_reliable.cpp similarity index 100% rename from src/XSockUDP_RELIABLE.cpp rename to src/xsock_udp_reliable.cpp diff --git a/xsock.m4 b/xsock.m4 new file mode 100644 index 0000000..91bae5e --- /dev/null +++ b/xsock.m4 @@ -0,0 +1,110 @@ +# Configure paths for libxsock +# Glenn Rolland 2006-01-10 +# Shamelessly inspired from libvorbis-1.1.2 + +dnl GYR_PATH_XSOCK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for libxsock, and define XSOCK_CFLAGS and XSOCK_LIBS +dnl +AC_DEFUN([GYR_PATH_XSOCK], +[dnl +dnl Get the cflags and libraries +dnl +AC_ARG_WITH(xsock,[ --with-xsock=PFX Prefix where libxsock is installed (optional)], xsock_prefix="$withval", xsock_prefix="") +AC_ARG_WITH(xsock-libraries,[ --with-xsock-libraries=DIR Directory where libxsock is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="") +AC_ARG_WITH(xsock-includes,[ --with-xsock-includes=DIR Directory where libxsock header files are installed (optional)], xsock_includes="$withval", xsock_includes="") +AC_ARG_ENABLE(xsocktest, [ --disable-xsocktest Do not try to compile and run a test XSock program],, enable_xsocktest=yes) + + if test "x$xsock_libraries" != "x" ; then + XSOCK_LIBS="-L$xsock_libraries" + elif test "x$sock_prefix" != "x" ; then + XSOCK_LIBS="-L$xsock_prefix/lib" + elif test "x$prefix" != "xNONE" ; then + XSOCK_LIBS="-L$prefix/lib" + fi + + XSOCK_LIBS="$XSOCK_LIBS -lxsock" + + if test "x$xsock_includes" != "x" ; then + XSOCK_CFLAGS="-I$xsock_includes" + elif test "x$xsock_prefix" != "x" ; then + XSOCK_CFLAGS="-I$xsock_prefix/include" + elif test "x$prefix" != "xNONE"; then + XSOCK_CFLAGS="-I$prefix/include" + fi + + AC_MSG_CHECKING(for XSock) + no_xsock="" + + if test "x$enable_xsock" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $XSOCK_CFLAGS" + LIBS="$LIBS $XSOCK_LIBS" +dnl +dnl New check if the installed XSock is sufficiently new +dnl + rm -f conf.xsocktest + AC_TRY_RUN([ +#include +#include +#include +#include + +int main() +{ + XSock sock_serv_tcp(XSock::CLIENT, XSock::TCP); + sock_serv_tcp.port(20500); + sock_serv_tcp.ip(INADDR_LOOPBACK); + sock_serv_tcp.launch(); + + // XSock sock_serv_udp_std(XSock::CLIENT, XSock::UDP); + //XSock sock_serv_udp_reliable(XSock::CLIENT, XSock::UDP); + + system("touch conf.xsocktest"); + return 0; + } + +],, no_xsock=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_xsock" = "x" ; then + AC_MSG_RESULT(yes) + ifelse([$1], , :, [$1]) + else + AC_MSG_RESULT(no) + if test -f conf.xsocktest ; then + : + else + echo "*** Could not run XSock test program, checking why..." + CFLAGS="$CFLAGS $XSOCK_CFLAGS" + LIBS="$LIBS $XSOCK_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but dit not run. This usually means" + echo "*** that the run-time linker is not finding XSock or finding the wrong" + echo "*** version of XSock. If it is not finding XSock, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location. Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means XSock was incorrectly installed" + echo "*** or that you have moved XSock since it was installed." ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + XSOCK_CFLAGS="" + XSOCK_LIBS="" + ifelse([$2], , :, [$2]) + fi + AC_SUBST(XSOCK_CFLAGS) + AC_SUBST(XSOCK_LIBS) + rm -f conf.xsocktest +]) +