- added --with-apr/apu to configure
diff --git a/CHANGES b/CHANGES
index 1d457bc..24c3a6e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -19,6 +19,9 @@
 Trunk
 -----
 
+- Added --with-apr and --with-apu to allow more flexible configuration
+  with configure
+
 - Fixed Web_InterpCfg_AP and Web_InterpClassCfg_AP in modwebsh_ap.c
   (potential segfault for invalid parameters)
 
diff --git a/src/ChangeLog b/src/ChangeLog
index 257faf4..99457af 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-13 Brunner Ronnie <ronnie.brunner@netcetera.ch>
+	* src/unix/configure.in, src/unix/Makefile.in:
+	- added --with-apr and --with-apu to allow more flexibility 
+	  with configure (e.g. to compile w/o manual tweaking for 
+	  paths under OSX Lion)
+
 2011-08-15 Brunner Ronnie <ronnie.brunner@netcetera.ch>
 	* src/generic/modwebsh_ap.c:
 	- fixed Web_InterpCfg_AP and Web_InterpClassCfg_AP: NULL terminate
diff --git a/src/unix/Makefile.in b/src/unix/Makefile.in
index a2405a6..44fb17b 100644
--- a/src/unix/Makefile.in
+++ b/src/unix/Makefile.in
@@ -116,6 +116,7 @@
 SHLIB_LDFLAGS = @SHLIB_LDFLAGS@
 SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
 STLIB_LD = @STLIB_LD@
+APRU_LIBS = @APR_LIB@@APU_LIB@
 TCL_BIN_DIR = @TCL_BIN_DIR@
 TCL_DEFS = @TCL_DEFS@
 TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
@@ -276,10 +277,11 @@
 
 mod_websh$(MODULE_LIB_SUFFIX): $(web_OBJECTS_ap) $(web_LIB_FILE)
 	$(SHLIB_LD_CURRENT) -o mod_websh$(MODULE_LIB_SUFFIX) \
-	$(web_OBJECTS_ap) $(web_LIB_FILE) $(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC)
+	$(web_OBJECTS_ap) $(web_LIB_FILE) $(APRU_LIBS) \
+	$(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC)
 
 mod_websh$(UNSHARED_LIB_SUFFIX): $(web_OBJECTS_ap) $(web_OBJECTS)
-	$(STLIB_LD) $(TCL_LD_FLAGS) -o mod_websh$(UNSHARED_LIB_SUFFIX) \
+	$(STLIB_LD) mod_websh$(UNSHARED_LIB_SUFFIX) \
 	$(web_OBJECTS_ap) $(web_OBJECTS)
 
 pure: websh$(VERSION).pure
diff --git a/src/unix/configure.in b/src/unix/configure.in
index c11aec6..0914986 100644
--- a/src/unix/configure.in
+++ b/src/unix/configure.in
@@ -192,7 +192,7 @@
 # --with-apr and --with-apr-util
 #--------------------------------------------------------------------
 # needed for Apache httpd 2.2.4 (and others) if Apache httpd is configured
-# with --with-apr and/or --with-apr-util -> header files are missing in 
+# with --with-apr and/or --with-apu -> header files are missing in 
 # installation of httpd
 
 AC_ARG_WITH(aprinclude, [  --with-aprinclude       directory containing apr header files.], with_aprinclude=${withval}, with_aprinclude=NA)
@@ -227,6 +227,44 @@
   AC_SUBST(APU_INCLUDES)
 fi
 
+if test "`uname -s`" = "Darwin" ; then
+ shlibext=dylib
+else
+ shlibext=so
+fi
+ 
+AC_ARG_WITH(apr, [  --with-apr              directory containing apr library.], with_apr=${withval}, with_apr=NA)
+
+if test x"${with_apr}" != xNA ; then
+  AC_MSG_CHECKING(for apache runtime (apr) library)
+  if test -f "${with_apr}/libapr-1.${shlibext}" ; then
+      echo "found ${with_apr}"
+      APR_LIB=" -L\"${with_apr}\" -lapr-1"
+      AC_SUBST(APR_LIB)
+  else
+      AC_MSG_ERROR([${with_apr}: directory does not contain apr library libapr-1.${shlibext}])
+  fi
+else
+  APR_LIB=
+  AC_SUBST(APR_LIB)
+fi
+
+AC_ARG_WITH(apu, [  --with-apu              directory containing apr util library.], with_apu=${withval}, with_apu=NA)
+
+if test x"${with_apu}" != xNA ; then
+  AC_MSG_CHECKING(for apache runtime utils (apu) library)
+  if test -f "${with_apu}/libaprutil-1.${shlibext}" ; then
+      echo "found ${with_apu}"
+      APU_LIB=" -L\"${with_apu}\" -laprutil-1"
+      AC_SUBST(APU_LIB)
+  else
+      AC_MSG_ERROR([${with_apu}: directory does not contain apu library libaprutil-1.${shlibext}])
+  fi
+else
+  APU_LIB=
+  AC_SUBST(APU_LIB)
+fi
+
 #--------------------------------------------------------------------
 # A few miscellaneous platform-specific items:
 #