Created
May 1, 2012 17:34
-
-
Save fumiyas/2569888 to your computer and use it in GitHub Desktop.
Cyrus SASL 2.1.25 configure --enable-staticplugin patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Based on the following articles: | |
http://developer.cybozu.co.jp/oss/2010/01/build-with-stat.html | |
http://lists.andrew.cmu.edu/pipermail/cyrus-sasl/2009-December/001929.html | |
diff -upr cyrus-sasl-2.1.25/config/plain.m4 cyrus-sasl-2.1.25-static-plugin/config/plain.m4 | |
--- cyrus-sasl-2.1.25/config/plain.m4 2009-12-04 04:07:01.000000000 +0900 | |
+++ cyrus-sasl-2.1.25-static-plugin/config/plain.m4 2012-03-15 16:42:47.141186907 +0900 | |
@@ -21,7 +21,7 @@ dnl PLAIN | |
if test "$plain" != no; then | |
AC_MSG_RESULT(enabled) | |
SASL_MECHS="$SASL_MECHS libplain.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS plain.o" | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/plain.c" | |
AC_DEFINE(STATIC_PLAIN,[],[Link PLAIN Staticly]) | |
diff -upr cyrus-sasl-2.1.25/config/sasldb.m4 cyrus-sasl-2.1.25-static-plugin/config/sasldb.m4 | |
--- cyrus-sasl-2.1.25/config/sasldb.m4 2009-12-04 04:07:01.000000000 +0900 | |
+++ cyrus-sasl-2.1.25-static-plugin/config/sasldb.m4 2012-03-15 16:42:47.145186971 +0900 | |
@@ -127,7 +127,7 @@ case "$dblib" in | |
;; | |
esac | |
-if test "$enable_static" = yes; then | |
+if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
if test "$dblib" != "none"; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/sasldb.c $SASL_DB_BACKEND_STATIC_SRCS" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS sasldb.o $SASL_DB_BACKEND_STATIC" | |
diff -upr cyrus-sasl-2.1.25/configure.in cyrus-sasl-2.1.25-static-plugin/configure.in | |
--- cyrus-sasl-2.1.25/configure.in 2011-09-07 22:19:44.000000000 +0900 | |
+++ cyrus-sasl-2.1.25-static-plugin/configure.in 2012-04-25 19:29:08.566247722 +0900 | |
@@ -119,6 +119,13 @@ else | |
SASL_STATIC_LIBS= | |
fi | |
+AC_ARG_ENABLE(staticplugin, [ --enable-staticplugin link plugins statically [[no]] ], | |
+ enable_staticplugin=$enableval, | |
+ enable_staticplugin=no) | |
+if test "$enable_staticplugin" = yes; then | |
+ AC_DEFINE(STATIC_PLUGIN,[],[link plugins statically]) | |
+fi | |
+ | |
AC_ARG_ENABLE(staticdlopen, [ --enable-staticdlopen try dynamic plugins when we are a static libsasl [[no]] ], | |
enable_staticdlopen=$enableval, | |
enable_staticdlopen=no) | |
@@ -391,7 +398,7 @@ if test "$cram" != no; then | |
if test "$enable_obsolete_cram_attr" = yes; then | |
CPPFLAGS="$CPPFLAGS -DOBSOLETE_CRAM_ATTR=1" | |
fi | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS cram.o" | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/cram.c" | |
AC_DEFINE(STATIC_CRAMMD5, [], [Link CRAM-MD5 Staticly]) | |
@@ -426,7 +433,7 @@ AC_MSG_CHECKING(DIGEST-MD5) | |
if test "$digest" != no; then | |
AC_MSG_RESULT(enabled) | |
SASL_MECHS="$SASL_MECHS libdigestmd5.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/digestmd5.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS digestmd5.o" | |
AC_DEFINE(STATIC_DIGESTMD5, [], [Link DIGEST-MD5 Staticly]) | |
@@ -478,7 +485,7 @@ if test "$otp" != no; then | |
OTP_LIBS="-lcrypto $LIB_RSAREF" | |
SASL_MECHS="$SASL_MECHS libotp.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/otp.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS otp.o" | |
AC_DEFINE(STATIC_OTP, [], [Link OTP Staticly]) | |
@@ -535,7 +542,7 @@ if test "$srp" != no; then | |
SRP_LIBS="-lcrypto $LIB_RSAREF" | |
SASL_MECHS="$SASL_MECHS libsrp.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/srp.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS srp.o" | |
AC_DEFINE(STATIC_SRP, [], [Link SRP Staticly]) | |
@@ -591,7 +598,7 @@ AC_MSG_CHECKING(ANONYMOUS) | |
if test "$anon" != no; then | |
AC_MSG_RESULT(enabled) | |
SASL_MECHS="$SASL_MECHS libanonymous.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS anonymous.o" | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/anonymous.c" | |
AC_DEFINE(STATIC_ANONYMOUS, [], [Link ANONYMOUS Staticly]) | |
@@ -609,7 +616,7 @@ AC_MSG_CHECKING(LOGIN) | |
if test "$login" != no; then | |
AC_MSG_RESULT(enabled) | |
SASL_MECHS="$SASL_MECHS liblogin.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/login.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS login.o" | |
AC_DEFINE(STATIC_LOGIN,[],[Link LOGIN Staticly]) | |
@@ -635,7 +642,7 @@ if test "$ntlm" != no; then | |
AC_SUBST(NTLM_LIBS) | |
SASL_MECHS="$SASL_MECHS libntlm.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/ntlm.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS ntlm.o" | |
AC_DEFINE(STATIC_NTLM,[],[Link NTLM Staticly]) | |
@@ -661,7 +668,7 @@ if test "$passdss" != no; then | |
AC_SUBST(PASSDSS_LIBS) | |
SASL_MECHS="$SASL_MECHS libpassdss.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS passdss.o" | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/passdss.c" | |
AC_DEFINE(STATIC_PASSDSS,[],[Link PASSDSS Staticly]) | |
@@ -692,7 +699,7 @@ AC_MSG_CHECKING(SQL) | |
if test "$sql" != no; then | |
AC_MSG_RESULT(enabled) | |
SASL_MECHS="$SASL_MECHS libsql.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/sql.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS sql.o" | |
AC_DEFINE(STATIC_SQL,[],[Link SQL plugin staticly]) | |
@@ -938,7 +945,7 @@ if test "$sql" = yes -a "$with_pgsql" = | |
AC_ERROR([--enable-sql chosen but neither Postgres nor MySQL nor SQLite nor SQLite3 found]) | |
fi | |
-if test "$enable_shared" = yes; then | |
+if test "$enable_shared" = yes -a "$enable_staticplugin" != yes; then | |
AC_DEFINE(DO_DLOPEN,[],[Should we build a shared plugin (via dlopen) library?]) | |
fi | |
@@ -984,7 +991,7 @@ if test "$ldapdb" != no; then | |
AC_SUBST(LIB_LDAP) | |
SASL_MECHS="$SASL_MECHS libldapdb.la" | |
- if test "$enable_static" = yes; then | |
+ if test "$enable_static" = yes -o "$enable_staticplugin" = yes; then | |
SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/ldapdb.c" | |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS ldapdb.o" | |
AC_DEFINE(STATIC_LDAPDB,[],[Link ldapdb plugin Staticly]) | |
@@ -1005,6 +1012,13 @@ AC_SUBST(SASL_STATIC_SRCS) | |
AC_SUBST(SASL_STATIC_OBJS) | |
AC_SUBST(SASL_STATIC_LIBS) | |
+SASL_STATIC_PLUGIN_SRCS="$SASL_STATIC_SRCS" | |
+SASL_STATIC_PLUGIN_OBJS="$SASL_STATIC_OBJS" | |
+SASL_STATIC_PLUGIN_LTOBJS=`echo "$SASL_STATIC_PLUGIN_@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` | |
+AC_SUBST(SASL_STATIC_PLUGIN_SRCS) | |
+AC_SUBST(SASL_STATIC_PLUGIN_OBJS) | |
+AC_SUBST(SASL_STATIC_PLUGIN_LTOBJS) | |
+ | |
AC_ARG_WITH(plugindir, [ --with-plugindir=DIR set the directory where plugins will | |
be found [[/usr/lib/sasl2]] ], | |
plugindir=$withval, | |
diff -upr cyrus-sasl-2.1.25/lib/Makefile.am cyrus-sasl-2.1.25-static-plugin/lib/Makefile.am | |
--- cyrus-sasl-2.1.25/lib/Makefile.am 2011-09-05 23:18:10.000000000 +0900 | |
+++ cyrus-sasl-2.1.25-static-plugin/lib/Makefile.am 2012-03-15 17:49:23.190730576 +0900 | |
@@ -55,8 +55,8 @@ BUILT_SOURCES = $(SASL_STATIC_SRCS) | |
common_headers = saslint.h | |
common_sources = auxprop.c canonusr.c checkpw.c client.c common.c config.c external.c md5.c saslutil.c server.c seterror.c dlopen.c ../plugins/plugin_common.c | |
-LTLIBOBJS = @LTLIBOBJS@ | |
-LIBOBJS = @LIBOBJS@ | |
+LTLIBOBJS = @LTLIBOBJS@ @SASL_STATIC_PLUGIN_LTOBJS@ | |
+LIBOBJS = @LIBOBJS@ @SASL_STATIC_PLUGIN_OBJS@ | |
LIB_DOOR= @LIB_DOOR@ | |
lib_LTLIBRARIES = libsasl2.la | |
@@ -64,7 +64,7 @@ lib_LTLIBRARIES = libsasl2.la | |
libsasl2_la_SOURCES = $(common_sources) $(common_headers) | |
libsasl2_la_LDFLAGS = -version-info $(sasl_version) | |
libsasl2_la_DEPENDENCIES = $(LTLIBOBJS) | |
-libsasl2_la_LIBADD = $(LTLIBOBJS) $(SASL_DL_LIB) $(LIB_SOCKET) $(LIB_DOOR) | |
+libsasl2_la_LIBADD = $(LTLIBOBJS) $(SASL_DL_LIB) $(LIB_SOCKET) $(LIB_DOOR) $(LIB_LDAP) | |
if MACOSX | |
framedir = /Library/Frameworks/SASL2.framework | |
diff -upr cyrus-sasl-2.1.25/lib/dlopen.c cyrus-sasl-2.1.25-static-plugin/lib/dlopen.c | |
--- cyrus-sasl-2.1.25/lib/dlopen.c 2009-12-04 04:07:01.000000000 +0900 | |
+++ cyrus-sasl-2.1.25-static-plugin/lib/dlopen.c 2012-03-15 16:42:47.149187035 +0900 | |
@@ -56,7 +56,7 @@ | |
#include <sasl.h> | |
#include "saslint.h" | |
-#ifndef PIC | |
+#if !defined(PIC) || defined(STATIC_PLUGIN) | |
#include <saslplug.h> | |
#include "staticopen.h" | |
#endif | |
@@ -407,7 +407,7 @@ int _sasl_load_plugins(const add_plugin_ | |
DIR *dp; | |
struct dirent *dir; | |
#endif | |
-#ifndef PIC | |
+#if !defined(PIC) || defined(STATIC_PLUGIN) | |
add_plugin_t *add_plugin; | |
_sasl_plug_type type; | |
_sasl_plug_rec *p; | |
@@ -422,7 +422,7 @@ int _sasl_load_plugins(const add_plugin_ | |
|| ! verifyfile_cb->proc) | |
return SASL_BADPARAM; | |
-#ifndef PIC | |
+#if !defined(PIC) || defined(STATIC_PLUGIN) | |
/* do all the static plugins first */ | |
for(cur_ep = entrypoints; cur_ep->entryname; cur_ep++) { | |
@@ -449,7 +449,7 @@ int _sasl_load_plugins(const add_plugin_ | |
result = add_plugin(p->name, p->plug); | |
} | |
} | |
-#endif /* !PIC */ | |
+#endif /* !PIC || STATIC_PLUGIN */ | |
/* only do the following if: | |
* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment