null+****@clear*****
null+****@clear*****
2012年 4月 13日 (金) 17:19:27 JST
Kouhei Sutou 2012-04-13 17:19:27 +0900 (Fri, 13 Apr 2012)
New Revision: 9ec737bf91b247dc444aef03966001ca648ed17c
Log:
Use dlfcn.h availability to determin plugin backend
Modified files:
build/ac_macros/check_headers.m4
lib/plugin.c
Modified: build/ac_macros/check_headers.m4 (+1 -0)
===================================================================
--- build/ac_macros/check_headers.m4 2012-04-13 17:11:38 +0900 (c3075b0)
+++ build/ac_macros/check_headers.m4 2012-04-13 17:19:27 +0900 (89a393a)
@@ -1,5 +1,6 @@
# -*- autoconf -*-
+AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_HEADERS(netdb.h)
Modified: lib/plugin.c (+9 -9)
===================================================================
--- lib/plugin.c 2012-04-13 17:11:38 +0900 (062399e)
+++ lib/plugin.c 2012-04-13 17:19:27 +0900 (18b4cd5)
@@ -31,15 +31,7 @@ static grn_hash *grn_plugins = NULL;
#define PATHLEN(filename) (strlen(filename) + 1)
-#ifdef WIN32
-# define grn_dl_open(filename) LoadLibrary(filename)
-# define grn_dl_open_error_label() "LoadLibrary"
-# define grn_dl_close(dl) (FreeLibrary(dl) != 0)
-# define grn_dl_close_error_label() "FreeLibrary"
-# define grn_dl_sym(dl, symbol) ((void *)GetProcAddress(dl, symbol))
-# define grn_dl_sym_error_label() "GetProcAddress"
-# define grn_dl_clear_error()
-#else
+#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
# define grn_dl_open(filename) dlopen(filename, RTLD_LAZY | RTLD_LOCAL)
# define grn_dl_open_error_label() dlerror()
@@ -48,6 +40,14 @@ static grn_hash *grn_plugins = NULL;
# define grn_dl_sym(dl, symbol) dlsym(dl, symbol)
# define grn_dl_sym_error_label() dlerror()
# define grn_dl_clear_error() dlerror()
+#else
+# define grn_dl_open(filename) LoadLibrary(filename)
+# define grn_dl_open_error_label() "LoadLibrary"
+# define grn_dl_close(dl) (FreeLibrary(dl) != 0)
+# define grn_dl_close_error_label() "FreeLibrary"
+# define grn_dl_sym(dl, symbol) ((void *)GetProcAddress(dl, symbol))
+# define grn_dl_sym_error_label() "GetProcAddress"
+# define grn_dl_clear_error()
#endif
grn_id