Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

used by luadist/cmake to make aprutil and apreq dependencies optional #13

Open
wants to merge 1 commit into from

1 participant

@davidm

No description provided.

@davidm davidm prepare to allow compile without aprutil and apreq.
This makes it easier for autoconf and cmake-style builds to compile without
aprutil and apreq dependencies.
f73896a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 7, 2012
  1. @davidm

    prepare to allow compile without aprutil and apreq.

    davidm authored
    This makes it easier for autoconf and cmake-style builds to compile without
    aprutil and apreq dependencies.
This page is out of date. Refresh to see the latest.
View
81 Makefile
@@ -27,43 +27,46 @@ APREQ_BINARY = apreq.so
# Names of source code files to compile & link (the individual lines enable
# automatic rebasing between git feature branches and the master branch).
-SOURCES = src/base64.c \
- src/buffer.c \
- src/crypt.c \
- src/date.c \
- src/dbd.c \
- src/dbm.c \
- src/env.c \
- src/errno.c \
- src/filepath.c \
- src/fnmatch.c \
- src/getopt.c \
- src/http.c \
- src/io_dir.c \
- src/io_file.c \
- src/io_net.c \
- src/io_pipe.c \
- src/ldap.c \
- src/lua_apr.c \
- src/memcache.c \
- src/memory_pool.c \
- src/object.c \
- src/permissions.c \
- src/pollset.c \
- src/proc.c \
- src/serialize.c \
- src/shm.c \
- src/signal.c \
- src/stat.c \
- src/str.c \
- src/thread.c \
- src/thread_queue.c \
- src/time.c \
- src/uri.c \
- src/user.c \
- src/uuid.c \
- src/xlate.c \
- src/xml.c
+SOURCES_BASE = \
+ src/buffer.c \
+ src/env.c \
+ src/errno.c \
+ src/filepath.c \
+ src/fnmatch.c \
+ src/getopt.c \
+ src/http.c \
+ src/io_dir.c \
+ src/io_file.c \
+ src/io_net.c \
+ src/io_pipe.c \
+ src/lua_apr.c \
+ src/memory_pool.c \
+ src/object.c \
+ src/permissions.c \
+ src/pollset.c \
+ src/proc.c \
+ src/shm.c \
+ src/signal.c \
+ src/stat.c \
+ src/str.c \
+ src/thread.c \
+ src/thread_queue.c \
+ src/time.c \
+ src/user.c
+SOURCES_APRUTIL = \
+ src/base64.c \
+ src/crypt.c \
+ src/date.c \
+ src/dbd.c \
+ src/dbm.c \
+ src/ldap.c \
+ src/memcache.c \
+ src/serialize.c \
+ src/uri.c \
+ src/uuid.c \
+ src/xlate.c \
+ src/xml.c
+SOURCES = $(SOURCE_BASE) $(SOURCES_APRUTIL)
# Determine compiler flags and linker flags for external dependencies using a
# combination of pkg-config, apr-1-config, apu-1-config and apreq2-config.
@@ -110,6 +113,10 @@ $(APREQ_BINARY): etc/apreq_standalone.c Makefile
$(OBJECTS): %.o: %.c src/lua_apr.h Makefile
$(CC) -Wall -c $(CFLAGS) -fPIC $< -o $@ || lua etc/make.lua --check
+src/lua_apr.h: src/lua_apr_config.h
+src/lua_apr_config.h: src/lua_apr_config.h.in
+ cp $^ $@
+
# Always try to regenerate the error handling module.
src/errno.c: etc/errors.lua Makefile
@lua etc/errors.lua
View
81 Makefile.win
@@ -43,43 +43,46 @@ LFLAGS = "/LIBPATH:$(LUA_LINKDIR)" lua51.lib "/LIBPATH:$(APR_LIBDIR)" libapr-1.l
# Names of compiled object files (the individual lines enable automatic
# rebasing between git feature branches and the master branch).
-OBJECTS = src\base64.obj \
- src\buffer.obj \
- src\crypt.obj \
- src\date.obj \
- src\dbd.obj \
- src\dbm.obj \
- src\env.obj \
- src\errno.obj \
- src\filepath.obj \
- src\fnmatch.obj \
- src\getopt.obj \
- src\http.obj \
- src\io_dir.obj \
- src\io_file.obj \
- src\io_net.obj \
- src\io_pipe.obj \
- src\ldap.obj \
- src\lua_apr.obj \
- src\memcache.obj \
- src\memory_pool.obj \
- src\object.obj \
- src\permissions.obj \
- src\pollset.obj \
- src\proc.obj \
- src\serialize.obj \
- src\shm.obj \
- src\signal.obj \
- src\stat.obj \
- src\str.obj \
- src\thread.obj \
- src\thread_queue.obj \
- src\time.obj \
- src\uri.obj \
- src\user.obj \
- src\uuid.obj \
- src\xlate.obj \
- src\xml.obj
+OBJECTS_CORE = \
+ src\buffer.obj \
+ src\env.obj \
+ src\errno.obj \
+ src\filepath.obj \
+ src\fnmatch.obj \
+ src\getopt.obj \
+ src\http.obj \
+ src\io_dir.obj \
+ src\io_file.obj \
+ src\io_net.obj \
+ src\io_pipe.obj \
+ src\lua_apr.obj \
+ src\memory_pool.obj \
+ src\object.obj \
+ src\permissions.obj \
+ src\pollset.obj \
+ src\proc.obj \
+ src\shm.obj \
+ src\signal.obj \
+ src\stat.obj \
+ src\str.obj \
+ src\thread.obj \
+ src\thread_queue.obj \
+ src\time.obj \
+ src\user.obj \
+OBJECTS_APRUTIL = \
+ src\base64.obj \
+ src\crypt.obj \
+ src\date.obj \
+ src\dbd.obj \
+ src\dbm.obj \
+ src\ldap.obj \
+ src\memcache.obj \
+ src\serialize.obj \
+ src\uri.obj \
+ src\uuid.obj \
+ src\xlate.obj \
+ src\xml.obj
+OBJECTS = $(OBJECTS_CORE) $(OBJECTS_APRUTIL)
# Create debug builds by default but enable release builds
# using the command line "NMAKE /f Makefile.win RELEASE=1".
@@ -108,6 +111,10 @@ $(OBJECTS): Makefile
.c.obj:
@CL /W3 /nologo /MD /D"WIN32" /D"LUA_BUILD_AS_DLL" $(CFLAGS) /TC /c $< /Fo$@
+src/lua_apr.h: src/lua_apr_config.h
+src/lua_apr_config.h: src/lua_apr_config.h.in
+ copy $** $@
+
# Always try to regenerate the error handling module.
src\errno.c: etc\errors.lua
@LUA etc\errors.lua > src\errno.c.new && MOVE src\errno.c.new src\errno.c || EXIT /B 0
View
34 src/lua_apr.c
@@ -7,7 +7,9 @@
*/
#include "lua_apr.h"
+#if LUAAPR_HAVE_APRUTIL
#include <apr_ldap.h> /* APR_HAS_LDAP */
+#endif
#include <apr_portable.h>
#include <ctype.h>
#if LUA_APR_HAVE_APREQ
@@ -28,20 +30,24 @@ lua_apr_objtype *lua_apr_types[] = {
# endif
&lua_apr_pollset_type,
&lua_apr_proc_type,
+# if LUAARP_HAVE_APRUTIL
&lua_apr_dbm_type,
&lua_apr_dbd_type,
&lua_apr_dbr_type,
&lua_apr_dbp_type,
+# endif
# if APR_HAS_LDAP
&lua_apr_ldap_type,
# endif
-#if LUA_APR_HAVE_MEMCACHE
+# if LUA_APR_HAVE_MEMCACHE
&lua_apr_memcache_type,
&lua_apr_memcache_server_type,
-#endif
+# endif
+# if LUAAPR_HAVE_APRUTIL
&lua_apr_md5_type,
&lua_apr_sha1_type,
&lua_apr_xml_type,
+# endif
NULL
};
@@ -60,30 +66,42 @@ LUA_APR_EXPORT int luaopen_apr_core(lua_State *L)
{ "os_default_encoding", lua_apr_os_default_encoding },
{ "os_locale_encoding", lua_apr_os_locale_encoding },
{ "type", lua_apr_type },
+#if LUAAPR_HAVE_APRUTIL
{ "ref", lua_apr_ref },
{ "deref", lua_apr_deref },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* base64.c -- base64 encoding/decoding. */
{ "base64_encode", lua_apr_base64_encode },
{ "base64_decode", lua_apr_base64_decode },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* crypt.c -- cryptographic functions. */
{ "md5_init", lua_apr_md5_init },
{ "md5_encode", lua_apr_md5_encode },
{ "password_get", lua_apr_password_get },
{ "password_validate", lua_apr_password_validate },
{ "sha1_init", lua_apr_sha1_init },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* date.c -- date parsing. */
{ "date_parse_http", lua_apr_date_parse_http },
{ "date_parse_rfc", lua_apr_date_parse_rfc },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* dbd.c -- database module. */
{ "dbd", lua_apr_dbd },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* dbm.c -- dbm routines. */
{ "dbm_open", lua_apr_dbm_open },
{ "dbm_getnames", lua_apr_dbm_getnames },
+#endif
/* env.c -- environment variable handling. */
{ "env_get", lua_apr_env_get },
@@ -171,10 +189,12 @@ LUA_APR_EXPORT int luaopen_apr_core(lua_State *L)
{ "proc_fork", lua_apr_proc_fork },
# endif
+#if LUAAPR_HAVE_APRUTIL
/* shm.c -- shared memory. */
{ "shm_create", lua_apr_shm_create },
{ "shm_attach", lua_apr_shm_attach },
{ "shm_remove", lua_apr_shm_remove },
+#endif
/* signal.c -- signal handling. */
{ "signal", lua_apr_signal },
@@ -207,25 +227,33 @@ LUA_APR_EXPORT int luaopen_apr_core(lua_State *L)
{ "time_implode", lua_apr_time_implode },
{ "time_format", lua_apr_time_format },
+#if LUAAPR_HAVE_APRUTIL
/* uri.c -- URI parsing/unparsing. */
{ "uri_parse", lua_apr_uri_parse },
{ "uri_unparse", lua_apr_uri_unparse },
{ "uri_port_of_scheme", lua_apr_uri_port_of_scheme },
+#endif
/* user.c -- user/group identification. */
{ "user_get", lua_apr_user_get },
{ "user_homepath_get", lua_apr_user_homepath_get },
+#if LUAAPR_HAVE_APRUTIL
/* uuid.c -- UUID generation. */
{ "uuid_get", lua_apr_uuid_get },
{ "uuid_format", lua_apr_uuid_format },
{ "uuid_parse", lua_apr_uuid_parse },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* xlate.c -- character encoding translation. */
{ "xlate", lua_apr_xlate },
+#endif
+#if LUAAPR_HAVE_APRUTIL
/* xml.c -- XML parsing. */
{ "xml", lua_apr_xml },
+#endif
# if LUA_APR_HAVE_MEMCACHE
/* memcache.c -- memcached client. */
@@ -337,7 +365,7 @@ int lua_apr_version_get(lua_State *L)
lua_newtable(L);
lua_pushstring(L, apr_version_string());
lua_setfield(L, -2, "apr");
-# if APR_MAJOR_VERSION < 2
+# if LUAAPR_HAVE_APRUTIL && APR_MAJOR_VERSION < 2
lua_pushstring(L, apu_version_string());
lua_setfield(L, -2, "aprutil");
# endif
View
12 src/lua_apr.h
@@ -10,24 +10,28 @@
#define LUA_APR_H
/* Global headers. {{{1 */
+#include "lua_apr_config.h"
#include <assert.h>
#include <stdlib.h>
#include <lua.h>
#include <lauxlib.h>
#include <apr.h>
-#include <apu.h>
#include <apr_version.h>
-#include <apu_version.h>
#include <apr_general.h>
#include <apr_file_info.h>
#include <apr_file_io.h>
#include <apr_network_io.h>
#include <apr_thread_proc.h>
-#include <apr_queue.h>
#include <apr_atomic.h>
+#if LUAAPR_HAVE_ARPUTIL
+#include <apu.h>
+#include <apu_version.h>
+#include <apr_queue.h>
+#endif
#define LUA_APR_HAVE_MEMCACHE \
- (APR_MAJOR_VERSION > 1 || (APR_MAJOR_VERSION == 1 && APR_MINOR_VERSION >= 3))
+ (LUAAPR_HAVE_APRUTIL && \
+ (APR_MAJOR_VERSION > 1 || (APR_MAJOR_VERSION == 1 && APR_MINOR_VERSION >= 3)))
/* Macro definitions. {{{1 */
View
6 src/lua_apr_config.h.in
@@ -0,0 +1,6 @@
+#ifndef LUAAPR_CONF_H
+#define LUAAPR_CONF_H
+
+#define LUAAPR_HAVE_APRUTIL 1
+
+#endif
View
2  src/time.c
@@ -24,7 +24,9 @@
#include "lua_apr.h"
#include <apr_time.h>
+#if LUAAPR_HAVE_APRUTIL
#include <apr_date.h>
+#endif
/* Internal functions {{{1 */
Something went wrong with that request. Please try again.