diff --git a/Makefile.am b/Makefile.am index ba6ef000..5df15f1c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,8 +4,11 @@ endif if JAVA_ENABLED JAVA_SD = java endif +if PHP_ENABLED + PHP_SD = php +endif -SUBDIRS = lasso docs $(PYTHON_SD) $(JAVA_SD) tests +SUBDIRS = lasso docs $(PHP_SD) $(PYTHON_SD) $(JAVA_SD) tests ABS_BUILDDIR = $(shell pwd) diff --git a/configure.ac b/configure.ac index 4ec20a30..0d68c05e 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,7 @@ esac dnl ========================================================================== -dnl Version +dnl Version Super.Size.Me.L dnl ========================================================================== changequote(<<, >>)dnl @@ -173,6 +173,7 @@ AC_CHECK_PROGS(JAVAC, gcj javac) AC_CHECK_PROGS(JAVAH, gcjh javah) AC_CHECK_PROGS(JAR, fastjar jar) AC_CHECK_PROGS(PYTHON, python) +AC_CHECK_PROGS(PHP, php) AC_CHECK_PROGS(SWIG, swig) AC_CHECK_PROGS(PKG_CONFIG, pkg-config) @@ -271,6 +272,7 @@ if test "X$with_python" != Xno; then fi + dnl need to change quotes to allow square brackets changequote(<<, >>)dnl PYTHON_VERSION=`$PYTHON -c 'import sys; print sys.version[:3]' 2>/dev/null` @@ -313,6 +315,49 @@ AM_CONDITIONAL([PYTHON_ENABLED],[test "x$with_python" = "xyes"]) AC_MSG_RESULT($with_python) AC_SUBST(PYTHON_VERSION) +AC_CHECK_PROG(PHP_CONFIG, php-config, php-config) +if test "X$PHP_CONFIG" != X ; then + + PHP_INCLUDES=`$PHP_CONFIG --includes` + PHP_LDFLAGS=`$PHP_CONFIG --ldflags` + PHP_LIBS=`$PHP_CONFIG --libs` + PHP_EXTENSION_DIR=`$PHP_CONFIG --extension-dir` +else + # This allows 'make clean' in the python directory to work when + # php isn't available + PHP=: + PHP_INCLUDES= + PHP_LDFLAGS= + PHP_LIBS= + PHP_EXTENSION_DIR= +fi +AC_SUBST(PHP_INCLUDES) +AC_SUBST(PHP_LDFLAGS) +AC_SUBST(PHP_LIBS) +AC_SUBST(PHP_EXTENSION_DIR) + +AC_ARG_WITH(php, [ --with-php(=PHP) Enable the PHP interface], with_php="$withval", with_php="no") +AC_MSG_CHECKING(Enable PHP API) +if test "X$with_php" != Xno ; then + if test "X$with_php" != Xyes; then + PHP=$with_php + fi + with_php=yes +fi + +PHP_VERSION=`php-config --version 2>/dev/null` +if test "X$PHP_VERSION" != X; then + languages_available="$languages_available php($PHP_VERSION)" + if test $with_php = yes; then + languages="$languages php" + fi +fi +AC_MSG_RESULT($with_php) +AM_CONDITIONAL([PHP_ENABLED],[test "x$with_php" = "xyes"]) +AC_SUBST(PHP_VERSION) + +SD_LANG="$languages" +AC_SUBST(SD_LANG) dnl ========================================================================== dnl Test suite (requires check) @@ -437,7 +482,7 @@ if test "z$enable_pedantic" = "zyes" ; then else AC_MSG_RESULT(no) fi - +lasso_ dnl ========================================================================== dnl Static linking dnl ========================================================================== @@ -514,6 +559,10 @@ python/protocols/Makefile python/protocols/elements/Makefile python/tests/Makefile python/xml/Makefile +php/Makefile +php/environs/Makefile +php/xml/Makefile +php/tests/Makefile tests/Makefile java/Makefile] dnl [java/coldfusion/Makefile] @@ -547,6 +596,9 @@ Optionals builds Python binding: ${with_python} +PHP binding: + ${with_php} + Build Java binding: ${with_java} diff --git a/php/Makefile.am b/php/Makefile.am new file mode 100644 index 00000000..04a85472 --- /dev/null +++ b/php/Makefile.am @@ -0,0 +1,29 @@ +SUBDIRS = environs tests xml + +PHP_PACKAGE=lasso + +liblasso_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/lasso/.libs $(PHP_LDFLAGS) + +INCLUDES = \ + -DPACKAGE=\"@PACKAGE@\" \ + -I$(top_srcdir) \ + -I$(top_srcdir)/lasso \ + $(LASSO_DEFINES) \ + $(LASSO_CFLAGS) \ + $(PHP_INCLUDES) \ + $(NULL) + + +mylibs = $(top_builddir)/lasso/liblasso.la + +LASSOSOURCES = lasso.c lasso.h php_lasso.h + +lib_LTLIBRARIES = liblasso.la \ + $(NULL) + +liblasso_la_SOURCES = $(LASSOSOURCES) +liblasso_la_LIBADD = $(mylibs) \ + ./environs/libenvirons.a \ + ./xml/libxml.a \ + $(PHP_LIBS) \ + $(NULL) diff --git a/php/environs/Makefile.am b/php/environs/Makefile.am new file mode 100644 index 00000000..dcc37073 --- /dev/null +++ b/php/environs/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = \ + -DPACKAGE=\"@PACKAGE@\" \ + -I$(top_srcdir) \ + -I$(top_srcdir)/lasso \ + $(LASSO_DEFINES) \ + $(LASSO_CFLAGS) \ + $(PHP_INCLUDES) + + +ENVSOURCES = lasso_identity.c lasso_profile.c lasso_session.c lasso_federation.c lasso_login.c lasso_server.c + +noinst_LIBRARIES = libenvirons.a +libenvirons_a_SOURCES = $(ENVSOURCES) + +EXTRA_DIST = $(ENVSOURCES) diff --git a/php/environs/lasso_federation.c b/php/environs/lasso_federation.c index ba461f68..6776476a 100644 --- a/php/environs/lasso_federation.c +++ b/php/environs/lasso_federation.c @@ -22,13 +22,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h" diff --git a/php/environs/lasso_identity.c b/php/environs/lasso_identity.c index d61b924b..75336a33 100644 --- a/php/environs/lasso_identity.c +++ b/php/environs/lasso_identity.c @@ -22,13 +22,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h" @@ -98,30 +98,3 @@ PHP_FUNCTION(lasso_identity_dump) { } /* }}} */ - -/* {{{ proto resource lasso_identity_get_next_providerID(resource identity) */ -PHP_FUNCTION(lasso_identity_get_next_providerid) -{ - LassoIdentity *identity; - char *providerID; - zval *param; - - zend_printf("DEBUG: lasso_identity_get_next_providerID\n"); - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(identity, LassoIdentity *, ¶m, -1, le_lassoidentity_name, le_lassoidentity); - - zend_printf("DEBUG: identity at 0x%p\n", identity); - - providerID = (char *) lasso_identity_get_next_providerID(identity); - RETURN_STRING(providerID, 1); -} -/* }}} */ diff --git a/php/environs/lasso_login.c b/php/environs/lasso_login.c index cebaca3f..39523215 100644 --- a/php/environs/lasso_login.c +++ b/php/environs/lasso_login.c @@ -22,13 +22,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h" diff --git a/php/environs/lasso_profile.c b/php/environs/lasso_profile.c index 9f835cd8..5dd2f37c 100644 --- a/php/environs/lasso_profile.c +++ b/php/environs/lasso_profile.c @@ -23,13 +23,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h" diff --git a/php/environs/lasso_server.c b/php/environs/lasso_server.c index 2ec37d48..d262715c 100644 --- a/php/environs/lasso_server.c +++ b/php/environs/lasso_server.c @@ -22,13 +22,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h" diff --git a/php/environs/lasso_session.c b/php/environs/lasso_session.c index 38787897..c42228f3 100644 --- a/php/environs/lasso_session.c +++ b/php/environs/lasso_session.c @@ -22,12 +22,12 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h" diff --git a/php/lasso.c b/php/lasso.c index cd413afe..c2fa86be 100644 --- a/php/lasso.c +++ b/php/lasso.c @@ -23,7 +23,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" @@ -74,7 +74,6 @@ function_entry lasso_functions[] = { /* lasso_user.c */ PHP_FE(lasso_identity_new, NULL) PHP_FE(lasso_identity_dump, NULL) - PHP_FE(lasso_identity_get_next_providerid, NULL) PHP_FE(lasso_identity_destroy, NULL) /* lasso_profile_.c */ diff --git a/php/php_lasso.h b/php/php_lasso.h index 4e55ef5b..0b6d192d 100644 --- a/php/php_lasso.h +++ b/php/php_lasso.h @@ -71,7 +71,6 @@ PHP_FUNCTION(lasso_login_build_authn_request_msg); /* lasso_user.c */ PHP_FUNCTION(lasso_identity_new); -PHP_FUNCTION(lasso_identity_get_next_providerid); PHP_FUNCTION(lasso_identity_dump); PHP_FUNCTION(lasso_identity_destroy); diff --git a/php/tests/Makefile.am b/php/tests/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/php/xml/Makefile.am b/php/xml/Makefile.am new file mode 100644 index 00000000..ff3def57 --- /dev/null +++ b/php/xml/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = \ + -DPACKAGE=\"@PACKAGE@\" \ + -I$(top_srcdir) \ + -I$(top_srcdir)/lasso \ + $(LASSO_DEFINES) \ + $(LASSO_CFLAGS) \ + $(PHP_INCLUDES) + + +XMLSOURCES = lasso_lib_authn_request.c + +noinst_LIBRARIES = libxml.a +libxml_a_SOURCES = $(XMLSOURCES) + +EXTRA_DIST = diff --git a/php/xml/lasso_lib_authn_request.c b/php/xml/lasso_lib_authn_request.c index 64810e40..69a8a856 100644 --- a/php/xml/lasso_lib_authn_request.c +++ b/php/xml/lasso_lib_authn_request.c @@ -23,13 +23,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "lasso_config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "php_lasso.h" +#include "../php_lasso.h" #include "lasso.h"