From: Trond Norbye Date: Fri, 18 Sep 2009 06:41:25 +0000 (+0200) Subject: Fix compilation on Linux (lacks ntohll etc) X-Git-Tag: 0.34~17^2~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=70bc45e38d896c4d90d0b93bb309c701effb9ecd;p=m6w6%2Flibmemcached Fix compilation on Linux (lacks ntohll etc) --- diff --git a/example/Makefile.am b/example/Makefile.am index 7c93764e..0000896b 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -5,4 +5,9 @@ memcached_light_SOURCES= memcached_light.c \ interface_v0.c \ interface_v1.c memcached_light_LDADD= $(top_builddir)/libmemcached/protocol/libmemcachedprotocol.la +memcached_light_DEPENDENCIES= $(top_builddir)/libmemcached/protocol/libmemcachedprotocol.la +if BUILD_BYTEORDER +memcached_light_LDADD+=$(top_builddir)/libmemcached/libbyteorder.la +memcached_light_DEPENDENCIES+= $(top_builddir)/libmemcached/libbyteorder.la +endif diff --git a/example/common.h b/example/common.h deleted file mode 100644 index 6f87a025..00000000 --- a/example/common.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EXAMPLE_COMMON_H -#define EXAMPLE_COMMON_H - -#include - -#ifdef linux -/* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to - * optimize the conversion functions, but the prototypes generate warnings - * from gcc. The conversion methods isn't the bottleneck for my app, so - * just remove the warnings by undef'ing the optimization .. - */ -#undef ntohs -#undef ntohl -#undef htons -#undef htonl -#endif - -#endif diff --git a/example/interface_v0.c b/example/interface_v0.c index 5971366d..8f78f34f 100644 --- a/example/interface_v0.c +++ b/example/interface_v0.c @@ -17,7 +17,7 @@ #include #include -#include "common.h" +#include #include "storage.h" static protocol_binary_response_status noop_command_handler(const void *cookie, diff --git a/example/interface_v1.c b/example/interface_v1.c index 04e62aa3..b77a0b61 100644 --- a/example/interface_v1.c +++ b/example/interface_v1.c @@ -21,7 +21,7 @@ #include #include -#include "common.h" +#include #include "storage.h" static protocol_binary_response_status add_handler(const void *cookie, diff --git a/example/memcached_light.c b/example/memcached_light.c index b373a12f..ff3e4044 100644 --- a/example/memcached_light.c +++ b/example/memcached_light.c @@ -31,7 +31,7 @@ #include #include -#include "common.h" +#include #include "storage.h" extern struct memcached_binary_protocol_callback_st interface_v0_impl; diff --git a/libmemcached/Makefile.am b/libmemcached/Makefile.am index 2ae51ec5..87d1a576 100644 --- a/libmemcached/Makefile.am +++ b/libmemcached/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = libmemcached_probes.d memcached/README.txt libmemcached.ver \ memcached_configure.h.in -SUBDIRS = protocol +SUBDIRS = . protocol EXTRA_HEADERS = BUILT_SOURCES= diff --git a/libmemcached/byteorder.h b/libmemcached/byteorder.h index 0964b61a..254641f8 100644 --- a/libmemcached/byteorder.h +++ b/libmemcached/byteorder.h @@ -17,4 +17,16 @@ LIBMEMCACHED_LOCAL extern uint64_t htonll(uint64_t); #endif +#ifdef linux +/* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to + * optimize the conversion functions, but the prototypes generate warnings + * from gcc. The conversion methods isn't the bottleneck for my app, so + * just remove the warnings by undef'ing the optimization .. + */ +#undef ntohs +#undef ntohl +#undef htons +#undef htonl +#endif + #endif /* LIBMEMCACHED_BYTEORDER_H */ diff --git a/libmemcached/protocol/Makefile.am b/libmemcached/protocol/Makefile.am index fb4b0a76..8847016e 100644 --- a/libmemcached/protocol/Makefile.am +++ b/libmemcached/protocol/Makefile.am @@ -2,7 +2,12 @@ EXTRA_DIST= libmemcachedprotocol.ver lib_LTLIBRARIES=libmemcachedprotocol.la -noinst_HEADERS = common.h +noinst_HEADERS = common.h libmemcachedprotocol_la_SOURCES= protocol_handler.c cache.c pedantic.c libmemcachedprotocol_la_LDFLAGS= -version-info $(MEMCACHEDPROTOCOL_LIBRARY_VERSION) $(LD_PROTOCOL_VERSION_SCRIPT) + +if BUILD_BYTEORDER +libmemcachedprotocol_la_LIBADD=$(top_builddir)/libmemcached/libbyteorder.la +libmemcachedprotocol_la_DEPENDENCIES= $(top_builddir)/libmemcached/libbyteorder.la +endif diff --git a/libmemcached/protocol/common.h b/libmemcached/protocol/common.h index 036a13f6..f6062422 100644 --- a/libmemcached/protocol/common.h +++ b/libmemcached/protocol/common.h @@ -7,25 +7,12 @@ #include #include -#ifdef linux -/* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to - * optimize the conversion functions, but the prototypes generate warnings - * from gcc. The conversion methods isn't the bottleneck for my app, so - * just remove the warnings by undef'ing the optimization .. - */ -#undef ntohs -#undef ntohl -#undef htons -#undef htonl - -#endif - - /* Define this here, which will turn on the visibilty controls while we're * building libmemcached. */ #define BUILDING_LIBMEMCACHED 1 +#include #include #include