Index: Portfile
===================================================================
--- Portfile	(revision 120566)
+++ Portfile	(working copy)
@@ -60,7 +60,13 @@
                     --with-ssldir=${prefix}/etc/ssl \
                     --enable-shared \
                     --disable-static \
-                    --with-shared-libs
+                    --with-shared-libs \
+                    --without-ldap \
+                    --without-lucene \
+                    --without-mysql \
+                    --without-pgsql \
+                    --without-solr \
+                    --without-stemmer
 
 # Do not build with kqueue or poll support prior to Darwin 10.7.0 (Mac OS X 10.6)
 if {${os.platform} eq "darwin" && [vercmp ${os.version} 10.7.0] < 0} {
@@ -67,15 +73,16 @@
     configure.args-append \
                     --with-ioloop=select
 }
-configure.cppflags  -I${prefix}/include/openssl
+configure.cppflags-append \
+                    -I${prefix}/include/openssl
 
-variant postgresql82  \
+variant postgresql82 \
     conflicts postgresql83 postgresql84 postgresql90 postgresql91 postgresql92 \
     description "Enable PostgreSQL 8.2 support" {
 
     depends_lib-append          port:postgresql82
     configure.env-append        PG_CONFIG=${prefix}/lib/postgresql82/bin/pg_config
-    configure.args-append       --with-pgsql
+    configure.args-replace      --without-pgsql --with-pgsql
 }
 
 variant postgresql83 \
@@ -84,7 +91,7 @@
 
     depends_lib-append          port:postgresql83
     configure.env-append        PG_CONFIG=${prefix}/lib/postgresql83/bin/pg_config
-    configure.args-append       --with-pgsql
+    configure.args-replace      --without-pgsql --with-pgsql
 }
 
 variant postgresql84 \
@@ -93,7 +100,7 @@
 
     depends_lib-append          port:postgresql84
     configure.env-append        PG_CONFIG=${prefix}/lib/postgresql84/bin/pg_config
-    configure.args-append       --with-pgsql
+    configure.args-replace      --without-pgsql --with-pgsql
 }
 
 variant postgresql90 \
@@ -102,7 +109,7 @@
 
     depends_lib-append          port:postgresql90
     configure.env-append        PG_CONFIG=${prefix}/lib/postgresql90/bin/pg_config
-    configure.args-append       --with-pgsql
+    configure.args-replace      --without-pgsql --with-pgsql
 }
 
 variant postgresql91 \
@@ -111,7 +118,7 @@
 
     depends_lib-append          port:postgresql91
     configure.env-append        PG_CONFIG=${prefix}/lib/postgresql91/bin/pg_config
-    configure.args-append       --with-pgsql
+    configure.args-replace      --without-pgsql --with-pgsql
 }
 
 variant postgresql92 \
@@ -120,7 +127,7 @@
 
     depends_lib-append          port:postgresql92
     configure.env-append        PG_CONFIG=${prefix}/lib/postgresql92/bin/pg_config
-    configure.args-append       --with-pgsql
+    configure.args-replace      --without-pgsql --with-pgsql
 }
 
 variant mysql5 \
@@ -129,7 +136,7 @@
 
     depends_lib-append          port:mysql5
     configure.env-append        MYSQL_CONFIG=${prefix}/lib/mysql5/bin/mysql_config
-    configure.args-append       --with-mysql
+    configure.args-replace      --without-mysql --with-mysql
 }
 
 variant mysql51 \
@@ -138,7 +145,7 @@
 
     depends_lib-append          port:mysql51
     configure.env-append        MYSQL_CONFIG=${prefix}/lib/mysql51/bin/mysql_config
-    configure.args-append       --with-mysql
+    configure.args-replace      --without-mysql --with-mysql
 }
 
 variant mysql55 \
@@ -147,7 +154,7 @@
 
     depends_lib-append          port:mysql55
     configure.env-append        MYSQL_CONFIG=${prefix}/lib/mysql55/bin/mysql_config
-    configure.args-append       --with-mysql
+    configure.args-replace      --without-mysql --with-mysql
 }
 
 variant mysql56 \
@@ -156,7 +163,7 @@
 
     depends_lib-append          port:mysql56
     configure.env-append        MYSQL_CONFIG=${prefix}/lib/mysql56/bin/mysql_config
-    configure.args-append       --with-mysql
+    configure.args-replace      --without-mysql --with-mysql
 }
 
 variant mariadb \
@@ -165,45 +172,36 @@
 
     depends_lib-append          port:mariadb
     configure.env-append        MYSQL_CONFIG=${prefix}/lib/mariadb/bin/mysql_config
-    configure.args-append       --with-mysql
+    configure.args-replace      --without-mysql --with-mysql
 }
 
 variant percona \
     conflicts mysql5 mysql51 mysql55 mysql56 mariadb \
     description "Enable Percona (MySQL) support" {
-        depends_lib-append          port:percona
-        configure.env-append        MYSQL_CONFIG=${prefix}/lib/percona/bin/mysql_config
-        configure.args-append       --with-mysql
+
+    depends_lib-append          port:percona
+    configure.env-append        MYSQL_CONFIG=${prefix}/lib/percona/bin/mysql_config
+    configure.args-replace      --without-mysql --with-mysql
 }
 
 variant ldap description {Enable LDAP support} {
-
     depends_lib-append          port:openldap
-    configure.args-append       --with-ldap
+    configure.args-replace      --without-ldap --with-ldap
 }
 
-if {[vercmp ${version} 2.1.0] > -1} {
-
-    variant lucene description {Enable lucene support} {
-
-        depends_lib-append          port:clucene
-        configure.args-append       --with-lucene
-        configure.cppflags-append   -I/opt/local/include -I/opt/local/lib
-        configure.ldflags-append    -L/opt/local/lib/
-    }
+variant lucene description {Enable lucene support} {
+    depends_lib-append          port:clucene
+    configure.args-replace      --without-lucene --with-lucene
 }
 
-variant libstemmer description {Use libstemmer for full-text search} {
-    depends_lib-append          port:libstemmer
-    configure.args-append       --with-libstemmer
-    configure.cppflags-append   -I${prefix}/include
-    configure.ldflags-append    -L${prefix}/lib/
+variant libstemmer requires lucene description {Use libstemmer for full-text search} {
+    depends_build-append        port:libstemmer
+    configure.args-replace      --without-stemmer --with-stemmer
 }
 
 variant solr description {Enable apache-solr support} {
-
     depends_lib-append          port:expat port:curl
-    configure.args-append       --with-solr
+    configure.args-replace      --without-solr --with-solr
 }
 
 variant no_startupitem description {Do not install a launchd plist} {}
