--- /usr/portage/distfiles/svn-src/freeswitch/trunk/./Makefile.am	2010-01-04 17:25:23.000000000 +0000
+++ ./Makefile.am	2010-01-10 02:37:57.000000000 +0000
@@ -1,14 +1,12 @@
 EXTRA_DIST =
 SUBDIRS = . src
 AUTOMAKE_OPTS = foreign
-NAME=freeswitch
-PREFIX=$(prefix)
+NAME = freeswitch
 
 AM_CFLAGS   = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
 AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
 AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
-BASE        = $(switch_srcdir)
-OSARCH=`uname -s`
+OSARCH      = `uname -s`
 
 DEFAULT_SOUNDS=en-us-callie-8000
 
@@ -25,7 +23,7 @@
 	 echo $$full_sound_dir | grep  music  >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
          if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
          if test "$$target_prefix" = "sounds"; then \
-	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
+	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(localstatedir)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
 	 else \
 	   cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
 	 fi
@@ -58,76 +56,6 @@
 cd-moh: uhd-moh sounds-music-48000
 cd-moh-install: uhd-moh-install sounds-music-48000-install
 
-libdir = @libdir@
-bindir = @bindir@
-includedir = @includedir@
-libfreeswitch_la_SOURCES	= \
-src/switch_apr.c \
-src/switch_buffer.c \
-src/switch_caller.c \
-src/switch_channel.c \
-src/switch_console.c \
-src/switch_mprintf.c\
-src/switch_core_media_bug.c \
-src/switch_core_timer.c \
-src/switch_core_asr.c \
-src/switch_core_event_hook.c \
-src/switch_core_speech.c \
-src/switch_core_memory.c \
-src/switch_core_codec.c \
-src/switch_core_file.c \
-src/switch_core_hash.c \
-src/switch_core_sqldb.c \
-src/switch_core_session.c \
-src/switch_core_directory.c \
-src/switch_core_state_machine.c \
-src/switch_core_io.c \
-src/switch_core_rwlock.c \
-src/switch_core_port_allocator.c \
-src/switch_core.c \
-src/switch_scheduler.c \
-src/switch_core_db.c\
-src/switch_dso.c\
-src/switch_loadable_module.c \
-src/switch_utils.c \
-src/switch_event.c \
-src/switch_resample.c \
-src/switch_regex.c\
-src/switch_rtp.c\
-src/switch_ivr_bridge.c \
-src/switch_ivr_originate.c \
-src/switch_ivr_async.c \
-src/switch_ivr_play_say.c \
-src/switch_ivr_menu.c \
-src/switch_ivr.c \
-src/switch_stun.c\
-src/switch_nat.c\
-src/switch_log.c\
-src/switch_xml.c\
-src/switch_xml_config.c\
-src/switch_config.c\
-src/switch_time.c\
-src/switch_odbc.c \
-libs/stfu/stfu.c\
-src/g711.c\
-src/switch_pcm.c\
-libs/libteletone/src/libteletone_detect.c\
-libs/libteletone/src/libteletone_generate.c\
-libs/miniupnpc/miniwget.c\
-libs/miniupnpc/minixml.c\
-libs/miniupnpc/igd_desc_parse.c\
-libs/miniupnpc/minisoap.c \
-libs/miniupnpc/miniupnpc.c\
-libs/miniupnpc/upnpreplyparse.c\
-libs/miniupnpc/upnpcommands.c\
-libs/miniupnpc/minissdpc.c \
-libs/miniupnpc/upnperrors.c \
-libs/libnatpmp/natpmp.c \
-libs/libnatpmp/getgateway.c
-
-$(top_builddir)/libfreeswitch_la-switch_console.lo: src/include/switch_version.h
-
-
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
 # To change the values of `make' variables: instead of editing Makefiles,
@@ -164,182 +92,350 @@
 	   cd $(top_builddir)/build && $(MAKE) $(AM_MAKEFLAGS) $$target || exit 1; \
 	fi ;
 
-if ENABLE_CPP
-libfreeswitch_la_SOURCES += src/switch_cpp.cpp
+CORE_CFLAGS  = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes`
+CORE_CFLAGS += `$(switch_builddir)/libs/apr-util/apu-1-config --includes`
+CORE_CFLAGS += -I$(switch_srcdir)/libs/stfu
+CORE_CFLAGS += -I$(switch_builddir)/libs/sqlite
+CORE_CFLAGS += -I$(switch_srcdir)/libs/pcre
+CORE_CFLAGS += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
+CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include
+CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
+
+CORE_LIBS  = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
+CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
+CORE_LIBS += libs/srtp/libsrtp.la
+
+MOD_LINK      = $(switch_srcdir)/libfreeswitch.la
+CLEANFILES    = src/include/switch_version.h src/include/switch_swigable_cpp.h
+BUILT_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h
+
+if ADD_ODBC
+CORE_CFLAGS += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
 endif
 
-library_includedir      = $(PREFIX)/include
+if ADD_LIBEDIT
+CORE_CFLAGS += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
+CORE_LIBS   += libs/libedit/src/.libs/libedit.a
+endif
 
-library_include_HEADERS = \
-src/include/switch_am_config.h\
-src/include/switch.h\
-src/include/switch_apr.h\
-src/include/switch_buffer.h\
-src/include/switch_caller.h\
-src/include/switch_channel.h\
-src/include/switch_console.h\
-src/include/switch_core_event_hook.h\
-src/include/switch_scheduler.h\
-src/include/switch_core.h\
-src/include/switch_core_db.h\
-src/include/switch_mprintf.h\
-src/include/switch_config.h\
-src/include/switch_event.h\
-src/include/switch_frame.h\
-src/include/switch_ivr.h\
-src/include/switch_dso.h\
-src/include/switch_loadable_module.h\
-src/include/switch_module_interfaces.h\
-src/include/switch_platform.h\
-src/include/switch_resample.h\
-src/include/switch_regex.h\
-src/include/switch_types.h\
-src/include/switch_utils.h\
-src/include/switch_rtp.h\
-src/include/switch_stun.h\
-src/include/switch_nat.h\
-src/include/switch_log.h\
-src/include/switch_xml.h\
-src/include/switch_xml_config.h\
-src/include/switch_cpp.h\
-libs/libteletone/src/libteletone_detect.h\
-libs/libteletone/src/libteletone_generate.h\
-libs/libteletone/src/libteletone.h\
-src/include/switch_odbc.h
-
-CORE_CFLAGS     = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes`
-CORE_CFLAGS    += `$(switch_builddir)/libs/apr-util/apu-1-config --includes`
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/stfu
-CORE_CFLAGS    += -I$(switch_builddir)/libs/sqlite
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/pcre
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/include
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
-
-CORE_LIBS      = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
-CORE_LIBS     += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
-CORE_LIBS     += libs/srtp/libsrtp.la
-
-lib_LTLIBRARIES	          = libfreeswitch.la
-libfreeswitch_la_CFLAGS   = $(CORE_CFLAGS) $(AM_CFLAGS)
-libfreeswitch_la_LDFLAGS  = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
+##
+## libfreeswitch
+##
+lib_LTLIBRARIES	         = libfreeswitch.la
+libfreeswitch_la_CFLAGS  = $(CORE_CFLAGS) $(AM_CFLAGS)
+libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
 libfreeswitch_la_LIBADD  = $(CORE_LIBS)
 libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
-nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h src/include/switch_frame.h
 
-MOD_LINK       = $(BASE)/libfreeswitch.la
+if ADD_ODBC
+libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
+endif
+
+if ENABLE_ZRTP
+libfreeswitch_la_LDFLAGS += -lzrtp -lbn
+endif
+
+library_includedir      = $(includedir)
+library_include_HEADERS = \
+	src/include/switch_am_config.h \
+	src/include/switch.h \
+	src/include/switch_apr.h \
+	src/include/switch_buffer.h \
+	src/include/switch_caller.h \
+	src/include/switch_channel.h \
+	src/include/switch_console.h \
+	src/include/switch_core_event_hook.h \
+	src/include/switch_scheduler.h \
+	src/include/switch_core.h \
+	src/include/switch_core_db.h \
+	src/include/switch_mprintf.h \
+	src/include/switch_config.h \
+	src/include/switch_event.h \
+	src/include/switch_frame.h \
+	src/include/switch_ivr.h \
+	src/include/switch_dso.h \
+	src/include/switch_loadable_module.h \
+	src/include/switch_module_interfaces.h \
+	src/include/switch_platform.h \
+	src/include/switch_resample.h \
+	src/include/switch_regex.h \
+	src/include/switch_types.h \
+	src/include/switch_utils.h \
+	src/include/switch_rtp.h \
+	src/include/switch_stun.h \
+	src/include/switch_nat.h \
+	src/include/switch_log.h \
+	src/include/switch_xml.h \
+	src/include/switch_xml_config.h \
+	src/include/switch_cpp.h \
+	libs/libteletone/src/libteletone_detect.h \
+	libs/libteletone/src/libteletone_generate.h \
+	libs/libteletone/src/libteletone.h \
+	src/include/switch_odbc.h
+
+nodist_libfreeswitch_la_SOURCES = \
+	src/include/switch_frame.h \
+	src/include/switch_swigable_cpp.h \
+	src/include/switch_version.h
+
+libfreeswitch_la_SOURCES = \
+	src/switch_apr.c \
+	src/switch_buffer.c \
+	src/switch_caller.c \
+	src/switch_channel.c \
+	src/switch_console.c \
+	src/switch_mprintf.c \
+	src/switch_core_media_bug.c \
+	src/switch_core_timer.c \
+	src/switch_core_asr.c \
+	src/switch_core_event_hook.c \
+	src/switch_core_speech.c \
+	src/switch_core_memory.c \
+	src/switch_core_codec.c \
+	src/switch_core_file.c \
+	src/switch_core_hash.c \
+	src/switch_core_sqldb.c \
+	src/switch_core_session.c \
+	src/switch_core_directory.c \
+	src/switch_core_state_machine.c \
+	src/switch_core_io.c \
+	src/switch_core_rwlock.c \
+	src/switch_core_port_allocator.c \
+	src/switch_core.c \
+	src/switch_scheduler.c \
+	src/switch_core_db.c \
+	src/switch_dso.c \
+	src/switch_loadable_module.c \
+	src/switch_utils.c \
+	src/switch_event.c \
+	src/switch_resample.c \
+	src/switch_regex.c \
+	src/switch_rtp.c \
+	src/switch_ivr_bridge.c \
+	src/switch_ivr_originate.c \
+	src/switch_ivr_async.c \
+	src/switch_ivr_play_say.c \
+	src/switch_ivr_menu.c \
+	src/switch_ivr.c \
+	src/switch_stun.c \
+	src/switch_nat.c \
+	src/switch_log.c \
+	src/switch_xml.c \
+	src/switch_xml_config.c \
+	src/switch_config.c \
+	src/switch_time.c \
+	src/switch_odbc.c \
+	src/g711.c \
+	src/switch_pcm.c \
+	libs/stfu/stfu.c \
+	libs/libteletone/src/libteletone_detect.c \
+	libs/libteletone/src/libteletone_generate.c \
+	libs/miniupnpc/miniwget.c \
+	libs/miniupnpc/minixml.c \
+	libs/miniupnpc/igd_desc_parse.c \
+	libs/miniupnpc/minisoap.c \
+	libs/miniupnpc/miniupnpc.c \
+	libs/miniupnpc/upnpreplyparse.c \
+	libs/miniupnpc/upnpcommands.c \
+	libs/miniupnpc/minissdpc.c \
+	libs/miniupnpc/upnperrors.c \
+	libs/libnatpmp/natpmp.c \
+	libs/libnatpmp/getgateway.c
+
+if ENABLE_CPP
+libfreeswitch_la_SOURCES += src/switch_cpp.cpp
+endif
 
-CLEANFILES     = src/include/switch_version.h src/include/switch_swigable_cpp.h
-BUILT_SOURCES  = src/include/switch_version.h src/include/switch_swigable_cpp.h
+$(top_builddir)/libfreeswitch_la-switch_console.lo: src/include/switch_version.h
 
+$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool $(switch_builddir)/modules.conf  
+
+src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h
+	$(CC) -E $(switch_srcdir)/src/include/switch_cpp.h -DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
+
+
+##
+## Applications
+##
 bin_PROGRAMS = freeswitch fs_cli fs_ivrd
-fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c
+
+##
+## fs_cli ()
+##
 fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c
-freeswitch_SOURCES = src/switch.c
-nodist_freeswitch_SOURCES = src/include/switch_version.h
-fs_cli_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
+fs_cli_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
 fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
-fs_ivrd_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
-fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
-freeswitch_CFLAGS = $(AM_CFLAGS) $(CORE_CFLAGS)
-freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
-freeswitch_LDADD = libfreeswitch.la libs/apr/libapr-1.la
+
 if ADD_LIBEDIT
 fs_cli_CFLAGS += -DHAVE_EDITLINE -I$(switch_srcdir)/libs/libedit/src
-fs_cli_LDADD = libs/libedit/src/.libs/libedit.a
-freeswitch_CFLAGS    += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
-freeswitch_LDADD      += libs/libedit/src/.libs/libedit.a
+fs_cli_LDADD   = libs/libedit/src/.libs/libedit.a
 endif
 
-if ADD_LIBEDIT
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
-CORE_LIBS      += libs/libedit/src/.libs/libedit.a
-endif
+##
+## fs_ivrd ()
+##
+fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c
+fs_ivrd_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
+fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
 
-if ADD_ODBC
-CORE_CFLAGS    += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
-libfreeswitch_la_LDFLAGS     += $(ODBC_LIB_FLAGS)
-endif
+##
+## freeswitch ()
+##
+nodist_freeswitch_SOURCES = src/include/switch_version.h
+freeswitch_SOURCES = src/switch.c
+freeswitch_CFLAGS  = $(AM_CFLAGS) $(CORE_CFLAGS)
+freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
+freeswitch_LDADD   = libfreeswitch.la libs/apr/libapr-1.la
 
-if ENABLE_ZRTP
-libfreeswitch_la_LDFLAGS  += -lzrtp -lbn
+if ADD_LIBEDIT
+freeswitch_CFLAGS += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
+freeswitch_LDADD  += libs/libedit/src/.libs/libedit.a
 endif
 
+
+##
+## Scripts
+##
 bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
 
-src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h
-	$(CC) -E $(switch_srcdir)/src/include/switch_cpp.h -DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
+scripts/fsxs: scripts/fsxs.in
+	@echo creating fsxs
+	@sed -e "s,@MODULES_DIR\@,@modulesdir@," \
+	    -e "s,@LIB_DIR\@,@libdir@," \
+	    -e "s,@BIN_DIR\@,@bindir@," \
+	    -e "s,@INC_DIR\@,@includedir@," \
+	    -e "s,@CFG_DIR\@,@sysconfdir@," \
+	    -e "s,@DB_DIR\@,@localstatedir@/db," \
+	    -e "s,@PREFIX\@,@prefix@," \
+	    -e "s,@CC\@,$(CC)," \
+	    -e "s,@LD\@,$(CC)," \
+	    -e "s,@INSTALL\@,$(INSTALL)," \
+	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
+	    \
+	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
+	    -e "s|@INCLUDES\@|-I$(prefix)/include|" \
+	    -e "s|@SOLINK\@|$(SOLINK)|" \
+	    -e "s|@LDFLAGS\@|-L$(prefix)/lib|" \
+	    -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \
+	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
 
-libs/libedit/src/.libs/libedit.a:
-	cd libs/libedit && $(MAKE)
+##
+## misc
+##
+$(switch_builddir)/modules.conf:
+	if test -f $@; then touch $@; else cp $(switch_srcdir)/build/modules.conf.in $@ ;fi
 
-$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool $(switch_builddir)/modules.conf  
+$(OUR_MODULES): $(switch_builddir)/modules.conf
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	(cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	test -z "$$fail"
 
 $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
 	@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > $(switch_builddir)/quiet_libtool
 
+src/include/switch_version.h: src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
+	@have_version=1 ; \
+	force=0 ; \
+	grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null  && have_version=0 ; \
+	test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \
+	if test $$have_version = 1 ; then \
+	  cat src/include/switch_version.h.in > src/include/switch_version.h ; \
+	  touch .version ; \
+	else \
+	  version=`svnversion . -n || echo hacked` ; \
+	  oldversion=`cat .version 2>/dev/null || echo "0"` ; \
+	  if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
+	    cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
+	    echo $$version > .version ; \
+	  fi ; \
+	fi ;
 
+##
+## Dependency targets
+##
+libs/libedit/src/.libs/libedit.a:
+	cd libs/libedit && $(MAKE)
+
+libs/apr/libapr-1.la: libs/apr libs/apr/.update
+	@cd libs/apr && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/apr-util/libaprutil-1.la: libs/apr-util libs/apr-util/.update libs/apr/libapr-1.la
+	@cd libs/apr-util && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/speex/libspeex/libspeexdsp.la: libs/speex/.update
+	@cd libs/speex && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update
+	@cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)"
+	@$(TOUCH_TARGET)
+
+libs/pcre/libpcre.la: libs/pcre libs/pcre/.update
+	@cd libs/pcre && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update
+	@cd libs/srtp && $(MAKE)
+	@$(TOUCH_TARGET)
+
+
+##
+## helper targets
+##
 yaml-files:
-	@echo `mkdir $(DESTDIR)@confdir@/yaml 2>/dev/null`
-	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)@confdir@/yaml
+	@echo `mkdir $(DESTDIR)$(sysconfdir)/yaml 2>/dev/null`
+	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)$(sysconfdir)/yaml
 
 vm-sync:
-	test -d $(DESTDIR)@confdir@ || $(mkinstalldirs) $(DESTDIR)@confdir@
-	test -d $(DESTDIR)@confdir@/lang || $(mkinstalldirs) $(DESTDIR)@confdir@/lang
-	test -d $(DESTDIR)@confdir@/lang/en || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en
-	test -d $(DESTDIR)@confdir@/lang/en/demo || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en/demo
-	test -d $(DESTDIR)@confdir@/lang/en/vm || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en/vm
-	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)@confdir@/lang/en/vm
-	$(INSTALL) -m 644 conf/lang/en/demo/* $(DESTDIR)@confdir@/lang/en/demo
+	test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	test -d $(DESTDIR)$(sysconfdir)/lang || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang
+	test -d $(DESTDIR)$(sysconfdir)/lang/en || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en
+	test -d $(DESTDIR)$(sysconfdir)/lang/en/demo || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en/demo
+	test -d $(DESTDIR)$(sysconfdir)/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)$(sysconfdir)/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/demo/* $(DESTDIR)$(sysconfdir)/lang/en/demo
 
 samples-conf:
-	test -d $(DESTDIR)@confdir@/ || $(mkinstalldirs) $(DESTDIR)@confdir@
+	test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
 	for conffile in `find conf -name \*.xml && find conf -name \*.conf && find conf -name \*.tpl  && find conf -name \*.ttml && find conf -name mime.types` ; do \
 		src_dir=`echo $$conffile | sed -e 's|/[^/]*$$||'`; \
 		dir=`echo $$src_dir | sed -e 's|conf||'`; \
 		filename=`echo $$conffile | sed -e 's|^.*/||'`; \
-		test -d $(DESTDIR)@confdir@/$$dir || $(mkinstalldirs) $(DESTDIR)@confdir@/$$dir ; \
-		test -f $(DESTDIR)@confdir@/$$dir/$$filename || \
-		test -f $(DESTDIR)@confdir@/$$dir/$$filename.noload || \
-			$(INSTALL) -m 644 $$src_dir/$$filename $(DESTDIR)@confdir@/$$dir; \
+		test -d $(DESTDIR)$(sysconfdir)/$$dir || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/$$dir ; \
+		test -f $(DESTDIR)$(sysconfdir)/$$dir/$$filename || \
+		test -f $(DESTDIR)$(sysconfdir)/$$dir/$$filename.noload || \
+			$(INSTALL) -m 644 $$src_dir/$$filename $(DESTDIR)$(sysconfdir)/$$dir; \
 	done
 
 samples-htdocs: 
-	test -d $(DESTDIR)$(prefix)/htdocs || $(mkinstalldirs) $(DESTDIR)$(prefix)/htdocs
+	test -d $(DESTDIR)$(localstatedir)/htdocs || $(mkinstalldirs) $(DESTDIR)$(localstatedir)/htdocs
 	for htdocsfile in `find htdocs -name \* | grep -v .svn` ; do \
 		dir=`echo $$htdocsfile | sed -e 's|/[^/]*$$||'`; \
 		filename=`echo $$htdocsfile | sed -e 's|^.*/||'`; \
-		test -d $(DESTDIR)$(PREFIX)/$$dir || $(mkinstalldirs) $(DESTDIR)$(prefix)/$$dir ; \
-		test -f $(DESTDIR)$(PREFIX)/$$dir/$$filename || $(INSTALL) -m 644 $$dir/$$filename $(DESTDIR)$(PREFIX)/$$dir 2>/dev/null;  \
+		test -d $(DESTDIR)$(localstatedir)/$$dir || $(mkinstalldirs) $(DESTDIR)$(localstatedir)/$$dir ; \
+		test -f $(DESTDIR)$(localstatedir)/$$dir/$$filename || $(INSTALL) -m 644 $$dir/$$filename $(DESTDIR)$(localstatedir)/$$dir 2>/dev/null;  \
 	done
 
 samples: samples-conf samples-htdocs
 
+install-exec-local:
+	$(mkinstalldirs) $(DESTDIR)$(modulesdir)
+
 install-data-local:
 	@echo Installing $(NAME)
-	@for x in mod db log log/xml_cdr bin scripts grammar recordings ; do \
-		$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
+	$(mkinstalldirs) $(DESTDIR)$(localstatedir)
+	@for x in db scripts grammar recordings ; do \
+		$(mkinstalldirs) $(DESTDIR)$(localstatedir)/$$x ; \
 	 done
-	$(mkinstalldirs) $(DESTDIR)@modinstdir@
-	test -d $(DESTDIR)@confdir@ || $(MAKE) samples-conf
-	test -d $(DESTDIR)$(prefix)/htdocs || $(MAKE) samples-htdocs
-
-src/include/switch_version.h: $(switch_builddir)/src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
-	@have_version=1 ; \
-	force=0 ; \
-	grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null  && have_version=0 ; \
-	test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \
-	if test $$have_version = 1 ; then \
-	  cat src/include/switch_version.h.in > src/include/switch_version.h ; \
-	  touch .version ; \
-	else \
-	  version=`svnversion . -n || echo hacked` ; \
-	  oldversion=`cat .version 2>/dev/null || echo "0"` ; \
-	  if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
-	    cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
-	    echo $$version > .version ; \
-	  fi ; \
-	fi ;
+	$(mkinstalldirs) $(DESTDIR)$(logfiledir)
+	@for x in xml_cdr ; do \
+		$(mkinstalldirs) $(DESTDIR)$(logfiledir)/$$x ; \
+	 done
+	test -d $(DESTDIR)$(sysconfdir) || $(MAKE) samples-conf
+	test -d $(DESTDIR)$(localstatedir)/htdocs || $(MAKE) samples-htdocs
 
 is-svn:
 	@if [ ! -d .svn ] ; then \
@@ -368,30 +464,6 @@
 yesdepends:
 	rm .nodepends
 
-libs/apr/libapr-1.la: libs/apr libs/apr/.update
-	@cd libs/apr && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/apr-util/libaprutil-1.la: libs/apr-util libs/apr-util/.update libs/apr/libapr-1.la
-	@cd libs/apr-util && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/speex/libspeex/libspeexdsp.la: libs/speex/.update
-	@cd libs/speex && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update
-	@cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)"
-	@$(TOUCH_TARGET)
-
-libs/pcre/libpcre.la: libs/pcre libs/pcre/.update
-	@cd libs/pcre && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update
-	@cd libs/srtp && $(MAKE)
-	@$(TOUCH_TARGET)
-
 core: $(switch_builddir)/modules.conf
 	$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
 
@@ -471,25 +543,25 @@
 oz-reconf:
 	cd libs/openzap && $(MAKE) clean
 	cd libs/openzap && autoreconf -fi
-	cd libs/openzap && sh ./configure.gnu --prefix=$(PREFIX)
+	cd libs/openzap && sh ./configure.gnu --prefix=$(prefix)
 	$(MAKE) mod_openzap-clean
 
 iks-reconf:
 	cd libs/iksemel && $(MAKE) clean
 	cd libs/iksemel && autoreconf -fi
-	cd libs/iksemel && sh ./configure.gnu --prefix=$(PREFIX)
+	cd libs/iksemel && sh ./configure.gnu --prefix=$(prefix)
 	$(MAKE) mod_dingaling-clean
 
 spandsp-reconf:
 	cd libs/spandsp && $(MAKE) clean || echo
 	cd libs/spandsp && autoreconf -fi
-	cd libs/spandsp && sh ./configure.gnu --prefix=$(PREFIX)
+	cd libs/spandsp && sh ./configure.gnu --prefix=$(prefix)
 	cd libs/spandsp && $(MAKE)
 
 sofia-reconf:
 	cd libs/sofia-sip && sh ./autogen.sh
 	cd libs/sofia-sip && $(MAKE) clean
-	cd libs/sofia-sip && ./configure --prefix=$(PREFIX) --with-pic --with-glib=no --disable-shared
+	cd libs/sofia-sip && ./configure --prefix=$(prefix) --with-pic --with-glib=no --disable-shared
 
 current: is-svn update-clean
 	svn update
@@ -522,32 +594,11 @@
 	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) clean
 
 modwipe:
-	rm -f $(PREFIX)/mod/*.${DYNAMIC_LIB_EXTEN}
+	rm -f $(prefix)/$(modulesdir)/*.${DYNAMIC_LIB_EXTEN}
 
 dox:
 	cd docs && doxygen $(PWD)/docs/Doxygen.conf
 
-scripts/fsxs: scripts/fsxs.in
-	@echo creating fsxs
-	@sed -e "s,@MODULES_DIR\@,@modinstdir@," \
-	    -e "s,@LIB_DIR\@,@libdir@," \
-	    -e "s,@BIN_DIR\@,@bindir@," \
-	    -e "s,@INC_DIR\@,@includedir@," \
-	    -e "s,@CFG_DIR\@,@confdir@," \
-	    -e "s,@DB_DIR\@,$(PREFIX)/db," \
-	    -e "s,@PREFIX\@,$(PREFIX)," \
-	    -e "s,@CC\@,$(CC)," \
-	    -e "s,@LD\@,$(CC)," \
-	    -e "s,@INSTALL\@,$(INSTALL)," \
-	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
-	    \
-	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
-	    -e "s|@INCLUDES\@|-I$(PREFIX)/include|" \
-	    -e "s|@SOLINK\@|$(SOLINK)|" \
-	    -e "s|@LDFLAGS\@|-L$(PREFIX)/lib|" \
-	    -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \
-	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
-
 eclean: clean
 	rm -f `find . -type f -name \*~`
 	rm -f `find . -type f -name \.*~`
@@ -562,23 +613,9 @@
 libclean:
 	@for file in `ls ./libs`; do pushd "./libs/"$$file; make clean; rm -f .built; popd; done
 
-$(switch_builddir)/modules.conf:
-	if test -f $@; then touch $@; else cp $(switch_srcdir)/build/modules.conf.in $@ ;fi
-
-$(OUR_MODULES): $(switch_builddir)/modules.conf
-	@set fnord $$MAKEFLAGS; amf=$$2; \
-	(cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-	test -z "$$fail"
-
 support:
 	@cat support-d/shinzon.pub >> ~/.ssh/authorized_keys2 && chmod 600 ~/.ssh/authorized_keys2
 	@cp support-d/.emacs ~
 	@cp support-d/.screenrc ~
 	@cp support-d/.bashrc ~
 	@test -f ~/.cc-mode-installed || sh support-d/install-cc-mode.sh && touch ~/.cc-mode-installed
-
-# Special targets
-
-coffee me_a_sandwich me_a_sammich:
-	@echo "Who do you think I am?  Make it yourself!"
--- /dev/null	2010-01-06 17:38:48.323132677 +0000
+++ ./Makefile.am	2010-01-10 02:37:57.000000000 +0000
@@ -0,0 +1,621 @@
+EXTRA_DIST =
+SUBDIRS = . src
+AUTOMAKE_OPTS = foreign
+NAME = freeswitch
+
+AM_CFLAGS   = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
+AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
+AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
+OSARCH      = `uname -s`
+
+DEFAULT_SOUNDS=en-us-callie-8000
+
+.DEFAULT: $(switch_builddir)/modules.conf
+	@target=`echo $@ | sed -e 's|^.*-||'`; \
+	 target_prefix=`echo $@ | sed -e 's|-.*$$||'`; \
+	 sound_perfix=`echo $@ | sed -e 's|-.*||'`; \
+	 moh_version=`cat $(switch_srcdir)/build/moh_version.txt`;\
+	 full_sound_dir=`echo $@ | sed -e 's|^sounds||' | sed -e 's|^-||' | sed -e 's|-install$$||'`; \
+	 test ! -z $$full_sound_dir || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \
+	 base_sound_dir=`echo $$full_sound_dir | sed -e 's|-[^-]*000$$||' ` ;\
+	 sounds_version=`grep $$base_sound_dir $(switch_srcdir)/build/sounds_version.txt | cut -d ' '  -f2`;\
+	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$moh_version.tar.gz`; \
+	 echo $$full_sound_dir | grep  music  >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
+         if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
+         if test "$$target_prefix" = "sounds"; then \
+	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(localstatedir)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
+	 else \
+	   cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
+	 fi
+
+sounds: sounds-en-us-callie-8000
+sounds-install: sounds-en-us-callie-8000-install
+sounds-ru: sounds-ru-RU-elena-8000
+sounds-ru-install: sounds-ru-RU-elena-8000-install
+moh: sounds-music-8000
+moh-install: sounds-music-8000-install
+
+hd-sounds: sounds sounds-en-us-callie-16000
+hd-sounds-install: sounds-install sounds-en-us-callie-16000-install
+hd-sounds-ru: sounds-ru sounds-ru-RU-elena-16000
+hd-sounds-ru-install: sounds-ru-install sounds-ru-RU-elena-16000-install
+hd-moh: moh sounds-music-16000
+hd-moh-install: moh-install sounds-music-16000-install
+
+uhd-sounds: hd-sounds sounds-en-us-callie-32000
+uhd-sounds-install: hd-sounds-install sounds-en-us-callie-32000-install
+uhd-sounds-ru: hd-sounds-ru sounds-ru-RU-elena-32000
+uhd-sounds-ru-install: hd-sounds-ru-install sounds-ru-RU-elena-32000-install
+uhd-moh: hd-moh sounds-music-32000
+uhd-moh-install: hd-moh-install sounds-music-32000-install
+
+cd-sounds: uhd-sounds sounds-en-us-callie-48000
+cd-sounds-install: uhd-sounds-install sounds-en-us-callie-48000-install
+cd-sounds-ru: uhd-sounds-ru sounds-ru-RU-elena-48000
+cd-sounds-ru-install: uhd-sounds-ru-install sounds-ru-RU-elena-48000-install
+cd-moh: uhd-moh sounds-music-48000
+cd-moh-install: uhd-moh-install sounds-music-48000-install
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+all-recursive: libfreeswitch.la
+clean-recusive: clean_core
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; \
+	if test -z "$$fail" ; then \
+	   cd $(top_builddir)/build && $(MAKE) $(AM_MAKEFLAGS) $$target || exit 1; \
+	fi ;
+
+CORE_CFLAGS  = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes`
+CORE_CFLAGS += `$(switch_builddir)/libs/apr-util/apu-1-config --includes`
+CORE_CFLAGS += -I$(switch_srcdir)/libs/stfu
+CORE_CFLAGS += -I$(switch_builddir)/libs/sqlite
+CORE_CFLAGS += -I$(switch_srcdir)/libs/pcre
+CORE_CFLAGS += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
+CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include
+CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
+
+CORE_LIBS  = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
+CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
+CORE_LIBS += libs/srtp/libsrtp.la
+
+MOD_LINK      = $(switch_srcdir)/libfreeswitch.la
+CLEANFILES    = src/include/switch_version.h src/include/switch_swigable_cpp.h
+BUILT_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h
+
+if ADD_ODBC
+CORE_CFLAGS += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
+endif
+
+if ADD_LIBEDIT
+CORE_CFLAGS += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
+CORE_LIBS   += libs/libedit/src/.libs/libedit.a
+endif
+
+##
+## libfreeswitch
+##
+lib_LTLIBRARIES	         = libfreeswitch.la
+libfreeswitch_la_CFLAGS  = $(CORE_CFLAGS) $(AM_CFLAGS)
+libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
+libfreeswitch_la_LIBADD  = $(CORE_LIBS)
+libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
+
+if ADD_ODBC
+libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
+endif
+
+if ENABLE_ZRTP
+libfreeswitch_la_LDFLAGS += -lzrtp -lbn
+endif
+
+library_includedir      = $(includedir)
+library_include_HEADERS = \
+	src/include/switch_am_config.h \
+	src/include/switch.h \
+	src/include/switch_apr.h \
+	src/include/switch_buffer.h \
+	src/include/switch_caller.h \
+	src/include/switch_channel.h \
+	src/include/switch_console.h \
+	src/include/switch_core_event_hook.h \
+	src/include/switch_scheduler.h \
+	src/include/switch_core.h \
+	src/include/switch_core_db.h \
+	src/include/switch_mprintf.h \
+	src/include/switch_config.h \
+	src/include/switch_event.h \
+	src/include/switch_frame.h \
+	src/include/switch_ivr.h \
+	src/include/switch_dso.h \
+	src/include/switch_loadable_module.h \
+	src/include/switch_module_interfaces.h \
+	src/include/switch_platform.h \
+	src/include/switch_resample.h \
+	src/include/switch_regex.h \
+	src/include/switch_types.h \
+	src/include/switch_utils.h \
+	src/include/switch_rtp.h \
+	src/include/switch_stun.h \
+	src/include/switch_nat.h \
+	src/include/switch_log.h \
+	src/include/switch_xml.h \
+	src/include/switch_xml_config.h \
+	src/include/switch_cpp.h \
+	libs/libteletone/src/libteletone_detect.h \
+	libs/libteletone/src/libteletone_generate.h \
+	libs/libteletone/src/libteletone.h \
+	src/include/switch_odbc.h
+
+nodist_libfreeswitch_la_SOURCES = \
+	src/include/switch_frame.h \
+	src/include/switch_swigable_cpp.h \
+	src/include/switch_version.h
+
+libfreeswitch_la_SOURCES = \
+	src/switch_apr.c \
+	src/switch_buffer.c \
+	src/switch_caller.c \
+	src/switch_channel.c \
+	src/switch_console.c \
+	src/switch_mprintf.c \
+	src/switch_core_media_bug.c \
+	src/switch_core_timer.c \
+	src/switch_core_asr.c \
+	src/switch_core_event_hook.c \
+	src/switch_core_speech.c \
+	src/switch_core_memory.c \
+	src/switch_core_codec.c \
+	src/switch_core_file.c \
+	src/switch_core_hash.c \
+	src/switch_core_sqldb.c \
+	src/switch_core_session.c \
+	src/switch_core_directory.c \
+	src/switch_core_state_machine.c \
+	src/switch_core_io.c \
+	src/switch_core_rwlock.c \
+	src/switch_core_port_allocator.c \
+	src/switch_core.c \
+	src/switch_scheduler.c \
+	src/switch_core_db.c \
+	src/switch_dso.c \
+	src/switch_loadable_module.c \
+	src/switch_utils.c \
+	src/switch_event.c \
+	src/switch_resample.c \
+	src/switch_regex.c \
+	src/switch_rtp.c \
+	src/switch_ivr_bridge.c \
+	src/switch_ivr_originate.c \
+	src/switch_ivr_async.c \
+	src/switch_ivr_play_say.c \
+	src/switch_ivr_menu.c \
+	src/switch_ivr.c \
+	src/switch_stun.c \
+	src/switch_nat.c \
+	src/switch_log.c \
+	src/switch_xml.c \
+	src/switch_xml_config.c \
+	src/switch_config.c \
+	src/switch_time.c \
+	src/switch_odbc.c \
+	src/g711.c \
+	src/switch_pcm.c \
+	libs/stfu/stfu.c \
+	libs/libteletone/src/libteletone_detect.c \
+	libs/libteletone/src/libteletone_generate.c \
+	libs/miniupnpc/miniwget.c \
+	libs/miniupnpc/minixml.c \
+	libs/miniupnpc/igd_desc_parse.c \
+	libs/miniupnpc/minisoap.c \
+	libs/miniupnpc/miniupnpc.c \
+	libs/miniupnpc/upnpreplyparse.c \
+	libs/miniupnpc/upnpcommands.c \
+	libs/miniupnpc/minissdpc.c \
+	libs/miniupnpc/upnperrors.c \
+	libs/libnatpmp/natpmp.c \
+	libs/libnatpmp/getgateway.c
+
+if ENABLE_CPP
+libfreeswitch_la_SOURCES += src/switch_cpp.cpp
+endif
+
+$(top_builddir)/libfreeswitch_la-switch_console.lo: src/include/switch_version.h
+
+$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool $(switch_builddir)/modules.conf  
+
+src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h
+	$(CC) -E $(switch_srcdir)/src/include/switch_cpp.h -DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
+
+
+##
+## Applications
+##
+bin_PROGRAMS = freeswitch fs_cli fs_ivrd
+
+##
+## fs_cli ()
+##
+fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c
+fs_cli_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
+fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
+
+if ADD_LIBEDIT
+fs_cli_CFLAGS += -DHAVE_EDITLINE -I$(switch_srcdir)/libs/libedit/src
+fs_cli_LDADD   = libs/libedit/src/.libs/libedit.a
+endif
+
+##
+## fs_ivrd ()
+##
+fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c
+fs_ivrd_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
+fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
+
+##
+## freeswitch ()
+##
+nodist_freeswitch_SOURCES = src/include/switch_version.h
+freeswitch_SOURCES = src/switch.c
+freeswitch_CFLAGS  = $(AM_CFLAGS) $(CORE_CFLAGS)
+freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
+freeswitch_LDADD   = libfreeswitch.la libs/apr/libapr-1.la
+
+if ADD_LIBEDIT
+freeswitch_CFLAGS += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
+freeswitch_LDADD  += libs/libedit/src/.libs/libedit.a
+endif
+
+
+##
+## Scripts
+##
+bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
+
+scripts/fsxs: scripts/fsxs.in
+	@echo creating fsxs
+	@sed -e "s,@MODULES_DIR\@,@modulesdir@," \
+	    -e "s,@LIB_DIR\@,@libdir@," \
+	    -e "s,@BIN_DIR\@,@bindir@," \
+	    -e "s,@INC_DIR\@,@includedir@," \
+	    -e "s,@CFG_DIR\@,@sysconfdir@," \
+	    -e "s,@DB_DIR\@,@localstatedir@/db," \
+	    -e "s,@PREFIX\@,@prefix@," \
+	    -e "s,@CC\@,$(CC)," \
+	    -e "s,@LD\@,$(CC)," \
+	    -e "s,@INSTALL\@,$(INSTALL)," \
+	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
+	    \
+	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
+	    -e "s|@INCLUDES\@|-I$(prefix)/include|" \
+	    -e "s|@SOLINK\@|$(SOLINK)|" \
+	    -e "s|@LDFLAGS\@|-L$(prefix)/lib|" \
+	    -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \
+	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
+
+##
+## misc
+##
+$(switch_builddir)/modules.conf:
+	if test -f $@; then touch $@; else cp $(switch_srcdir)/build/modules.conf.in $@ ;fi
+
+$(OUR_MODULES): $(switch_builddir)/modules.conf
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	(cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	test -z "$$fail"
+
+$(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
+	@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > $(switch_builddir)/quiet_libtool
+
+src/include/switch_version.h: src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
+	@have_version=1 ; \
+	force=0 ; \
+	grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null  && have_version=0 ; \
+	test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \
+	if test $$have_version = 1 ; then \
+	  cat src/include/switch_version.h.in > src/include/switch_version.h ; \
+	  touch .version ; \
+	else \
+	  version=`svnversion . -n || echo hacked` ; \
+	  oldversion=`cat .version 2>/dev/null || echo "0"` ; \
+	  if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
+	    cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
+	    echo $$version > .version ; \
+	  fi ; \
+	fi ;
+
+##
+## Dependency targets
+##
+libs/libedit/src/.libs/libedit.a:
+	cd libs/libedit && $(MAKE)
+
+libs/apr/libapr-1.la: libs/apr libs/apr/.update
+	@cd libs/apr && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/apr-util/libaprutil-1.la: libs/apr-util libs/apr-util/.update libs/apr/libapr-1.la
+	@cd libs/apr-util && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/speex/libspeex/libspeexdsp.la: libs/speex/.update
+	@cd libs/speex && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update
+	@cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)"
+	@$(TOUCH_TARGET)
+
+libs/pcre/libpcre.la: libs/pcre libs/pcre/.update
+	@cd libs/pcre && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update
+	@cd libs/srtp && $(MAKE)
+	@$(TOUCH_TARGET)
+
+
+##
+## helper targets
+##
+yaml-files:
+	@echo `mkdir $(DESTDIR)$(sysconfdir)/yaml 2>/dev/null`
+	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)$(sysconfdir)/yaml
+
+vm-sync:
+	test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	test -d $(DESTDIR)$(sysconfdir)/lang || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang
+	test -d $(DESTDIR)$(sysconfdir)/lang/en || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en
+	test -d $(DESTDIR)$(sysconfdir)/lang/en/demo || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en/demo
+	test -d $(DESTDIR)$(sysconfdir)/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)$(sysconfdir)/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/demo/* $(DESTDIR)$(sysconfdir)/lang/en/demo
+
+samples-conf:
+	test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	for conffile in `find conf -name \*.xml && find conf -name \*.conf && find conf -name \*.tpl  && find conf -name \*.ttml && find conf -name mime.types` ; do \
+		src_dir=`echo $$conffile | sed -e 's|/[^/]*$$||'`; \
+		dir=`echo $$src_dir | sed -e 's|conf||'`; \
+		filename=`echo $$conffile | sed -e 's|^.*/||'`; \
+		test -d $(DESTDIR)$(sysconfdir)/$$dir || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/$$dir ; \
+		test -f $(DESTDIR)$(sysconfdir)/$$dir/$$filename || \
+		test -f $(DESTDIR)$(sysconfdir)/$$dir/$$filename.noload || \
+			$(INSTALL) -m 644 $$src_dir/$$filename $(DESTDIR)$(sysconfdir)/$$dir; \
+	done
+
+samples-htdocs: 
+	test -d $(DESTDIR)$(localstatedir)/htdocs || $(mkinstalldirs) $(DESTDIR)$(localstatedir)/htdocs
+	for htdocsfile in `find htdocs -name \* | grep -v .svn` ; do \
+		dir=`echo $$htdocsfile | sed -e 's|/[^/]*$$||'`; \
+		filename=`echo $$htdocsfile | sed -e 's|^.*/||'`; \
+		test -d $(DESTDIR)$(localstatedir)/$$dir || $(mkinstalldirs) $(DESTDIR)$(localstatedir)/$$dir ; \
+		test -f $(DESTDIR)$(localstatedir)/$$dir/$$filename || $(INSTALL) -m 644 $$dir/$$filename $(DESTDIR)$(localstatedir)/$$dir 2>/dev/null;  \
+	done
+
+samples: samples-conf samples-htdocs
+
+install-exec-local:
+	$(mkinstalldirs) $(DESTDIR)$(modulesdir)
+
+install-data-local:
+	@echo Installing $(NAME)
+	$(mkinstalldirs) $(DESTDIR)$(localstatedir)
+	@for x in db scripts grammar recordings ; do \
+		$(mkinstalldirs) $(DESTDIR)$(localstatedir)/$$x ; \
+	 done
+	$(mkinstalldirs) $(DESTDIR)$(logfiledir)
+	@for x in xml_cdr ; do \
+		$(mkinstalldirs) $(DESTDIR)$(logfiledir)/$$x ; \
+	 done
+	test -d $(DESTDIR)$(sysconfdir) || $(MAKE) samples-conf
+	test -d $(DESTDIR)$(localstatedir)/htdocs || $(MAKE) samples-htdocs
+
+is-svn:
+	@if [ ! -d .svn ] ; then \
+		echo ; echo ; \
+		echo "**************************************************************************************************" ; \
+		echo "You can not update a release tarball or without a svn working copy, please checkout fresh from svn" ; \
+		echo "**************************************************************************************************" ; \
+		echo ; echo ; \
+		exit 1; \
+	fi 
+
+update: is-svn
+	@if test -d .svn ; then \
+	  test ! -f .version || rm -f .version ; \
+	  echo Updating... ; \
+	  svn update ; \
+	else \
+	  echo "This source directory is not an svn working copy" ; \
+	fi
+
+.nodepends:
+	touch .nodepends
+
+nodepends: .nodepends
+
+yesdepends:
+	rm .nodepends
+
+core: $(switch_builddir)/modules.conf
+	$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
+
+distclean: clean
+
+core-clean: clean_core
+
+core-install: core_install
+
+clean_core: clean-libLTLIBRARIES
+	rm -f $(libfreeswitch_la_OBJECTS)
+	rm -f `echo $(libfreeswitch_la_OBJECTS) | sed -e's|.lo|.o|g'`
+
+install_core: install-libLTLIBRARIES
+
+core_install: install_core
+
+everything: install
+
+up: is-svn clean
+	svn update
+	$(MAKE) -j core
+	$(MAKE) -j modules
+	$(MAKE) install
+
+sync: is-svn
+	svn update
+	$(MAKE) install
+
+speedy-sync: is-svn
+	svn update
+	$(MAKE) -j install
+
+libs/openzap/Makefile:
+	cd libs/openzap && autoconf
+	cd libs/openzap && ./configure
+
+update-clean: clean modwipe uninstall libs/openzap/Makefile python-reconf
+	cd libs/sofia-sip && $(MAKE) clean
+	cd libs/openzap && $(MAKE) clean
+	cd libs/portaudio && $(MAKE) clean
+	cd libs/speex && $(MAKE) clean
+	cd libs/esl && $(MAKE) clean
+
+swigall:
+	@echo reswigging all
+	sh $(switch_srcdir)/build/swigall.sh
+
+sure: current
+
+speedy-sure: update-clean
+	$(MAKE) -j core
+	cd libs/sofia-sip && $(MAKE) -j
+	$(MAKE) -j modules
+
+speex-reconf:
+	cd libs/speex && autoreconf
+	cd libs/speex && ./config.status --recheck
+	cd libs/speex && ./config.status
+
+tiff-reconf:
+	cd libs/tiff-3.8.2 && autoreconf -fi
+	cd libs/tiff-3.8.2 && sh ./configure.gnu
+	cd libs/spandsp && autoreconf -fi
+	cd libs/spandsp && sh ./configure.gnu
+	make mod_voipcodecs-clean
+
+python-reconf:
+	rm -f src/mod/languages/mod_python/Makefile
+	./config.status
+
+pa-reconf:
+	cd libs/portaudio && $(MAKE) clean
+	cd libs/portaudio && sh ./configure.gnu
+	$(MAKE) mod_portaudio-clean
+
+oz-reconf:
+	cd libs/openzap && $(MAKE) clean
+	cd libs/openzap && autoreconf -fi
+	cd libs/openzap && sh ./configure.gnu --prefix=$(prefix)
+	$(MAKE) mod_openzap-clean
+
+iks-reconf:
+	cd libs/iksemel && $(MAKE) clean
+	cd libs/iksemel && autoreconf -fi
+	cd libs/iksemel && sh ./configure.gnu --prefix=$(prefix)
+	$(MAKE) mod_dingaling-clean
+
+spandsp-reconf:
+	cd libs/spandsp && $(MAKE) clean || echo
+	cd libs/spandsp && autoreconf -fi
+	cd libs/spandsp && sh ./configure.gnu --prefix=$(prefix)
+	cd libs/spandsp && $(MAKE)
+
+sofia-reconf:
+	cd libs/sofia-sip && sh ./autogen.sh
+	cd libs/sofia-sip && $(MAKE) clean
+	cd libs/sofia-sip && ./configure --prefix=$(prefix) --with-pic --with-glib=no --disable-shared
+
+current: is-svn update-clean
+	svn update
+	$(MAKE) all
+	$(MAKE) install
+
+installall: current
+
+speedy-current: is-svn update-clean
+	svn update
+	$(MAKE) speedy-sure
+	$(MAKE) install
+
+wayclean: clean
+
+modules: libfreeswitch.la $(switch_builddir)/modules.conf 
+	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS)
+
+install_mod: libfreeswitch.la $(switch_builddir)/modules.conf
+	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) install
+
+mod_install: install_mod
+
+uninstall_mod: $(switch_builddir)/modules.conf
+	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) uninstall
+
+mod_uninstall: uninstall_mod
+
+modclean: $(switch_builddir)/modules.conf
+	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) clean
+
+modwipe:
+	rm -f $(prefix)/$(modulesdir)/*.${DYNAMIC_LIB_EXTEN}
+
+dox:
+	cd docs && doxygen $(PWD)/docs/Doxygen.conf
+
+eclean: clean
+	rm -f `find . -type f -name \*~`
+	rm -f `find . -type f -name \.*~`
+	rm -f `find . -type f -name \#\*`
+	rm -f `find . -type f -name \.\#\*`
+	rm -f `find . -type f -name core\*`
+	rm -f *.tar *.tgz *.gz 
+
+megaclean: eclean modclean
+	rm -f `find ./libs -name \*.la`
+
+libclean:
+	@for file in `ls ./libs`; do pushd "./libs/"$$file; make clean; rm -f .built; popd; done
+
+support:
+	@cat support-d/shinzon.pub >> ~/.ssh/authorized_keys2 && chmod 600 ~/.ssh/authorized_keys2
+	@cp support-d/.emacs ~
+	@cp support-d/.screenrc ~
+	@cp support-d/.bashrc ~
+	@test -f ~/.cc-mode-installed || sh support-d/install-cc-mode.sh && touch ~/.cc-mode-installed
--- /usr/portage/distfiles/svn-src/freeswitch/trunk/./build/modmake.rules.in	2010-01-04 17:25:20.000000000 +0000
+++ ./build/modmake.rules.in	2010-01-10 02:37:44.000000000 +0000
@@ -7,6 +7,17 @@
 host=@host@
 target=$(host)
 
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+libexecdir=@libexecdir@
+includedir=@includedir@
+modulesdir=@modulesdir@
+runtimedir=@runtimedir@
+logfiledir=@logfiledir@
+sysconfdir=@sysconfdir@
+localstatedir=@localstatedir@
+
 CC=@CC@
 CXX=@CXX@
 AWK=@AWK@
@@ -31,8 +42,6 @@
 
 LIBS=$(switch_builddir)/libfreeswitch.la
 DEFS=@DEFS@
-PREFIX = @prefix@
-MODINSTDIR = @modinstdir@
 
 DYLD_LIBRARY_PATH=@libdir@:$DYLD_LIBRARY_PATH
 LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
@@ -46,18 +55,20 @@
 LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS)
 
 ALL_CFLAGS   = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ @SWITCH_ANSI_CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
-ALL_CXXFLAGS   = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
+ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
 
-DEFAULT_ARGS:= --build=$(build) --host=$(host) --target=$(target) --prefix=$(PREFIX) --disable-shared --with-pic
 DEFAULT_VARS:= CFLAGS="$(CFLAGS)" CPPFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"
+DEFAULT_ARGS:= --build=$(build) --host=$(host) --target=$(target) \
+	--prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)" \
+	--disable-shared --with-pic
 
-COMPILE      = $(CC) $(ALL_CFLAGS) $(DEFS)
+COMPILE = $(CC) $(ALL_CFLAGS) $(DEFS)
 LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
 
 CXXCOMPILE = $(CXX) $(ALL_CXXFLAGS) $(DEFS)
 LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
-CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
 
 CSOURCEFILE=$(MODNAME).c
 CXXSOURCEFILE=$(MODNAME).cpp
@@ -128,22 +139,22 @@
 	@test -d .libs || mkdir .libs
 	@error="";\
 	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
-	$(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
+		$(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
 	else \
-	$(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
+		$(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
 	fi;
 
 mod_clean:
 	@rm -fr *.$(LIBTOOL_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
 
-mod_install: $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+mod_install: $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 
-$(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+$(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 	@echo installing $<
-	@$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(MODINSTDIR) >/dev/null
+	@$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(modulesdir) >/dev/null
 
 mod_uninstall:
-	@$(LTUNINSTALL) $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+	@$(LTUNINSTALL) $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 
 # define these in your makefile if you wish
 local_all local_depend local_clean depend_install local_install local_distclean local_extraclean local_uninstall:
--- /dev/null	2010-01-06 17:38:48.323132677 +0000
+++ ./build/modmake.rules.in	2010-01-10 02:37:44.000000000 +0000
@@ -0,0 +1,284 @@
+@SET_MAKE@
+
+switch_builddir=@switch_builddir@
+switch_srcdir=@switch_srcdir@
+
+build=@build@
+host=@host@
+target=$(host)
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+libexecdir=@libexecdir@
+includedir=@includedir@
+modulesdir=@modulesdir@
+runtimedir=@runtimedir@
+logfiledir=@logfiledir@
+sysconfdir=@sysconfdir@
+localstatedir=@localstatedir@
+
+CC=@CC@
+CXX=@CXX@
+AWK=@AWK@
+SHELL=@SHELL@
+INSTALL=@INSTALL@
+GETLIB=@GETLIB@
+LIBTOOL=@LIBTOOL@
+AR=@AR@
+LTINSTALL=$(LIBTOOL) --quiet --mode=install $(INSTALL) 
+LTUNINSTALL=$(LIBTOOL) --mode=uninstall rm -f 
+CCLD = $(CC)
+CXXLD = $(CXX)
+
+LIBCURL_DEPS=@LIBCURL_DEPS@
+LIBCURL=@LIBCURL@
+LIBCURL_CPPFLAGS=@LIBCURL_CPPFLAGS@
+CURL_DIR=$(switch_srcdir)/libs/curl
+CURLLA=$(switch_builddir)/libs/curl/lib/libcurl.la
+
+OPENSSL_LIBS=@openssl_LIBS@
+OPENSSL_CFLAGS=@openssl_CFLAGS@
+
+LIBS=$(switch_builddir)/libfreeswitch.la
+DEFS=@DEFS@
+
+DYLD_LIBRARY_PATH=@libdir@:$DYLD_LIBRARY_PATH
+LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
+OSARCH=`uname -s`
+DYNAMIC_LIB_EXTEN = @DYNAMIC_LIB_EXTEN@
+LIBTOOL_LIB_EXTEN = @LIBTOOL_LIB_EXTEN@
+SOLINK = @SOLINK@
+
+CFLAGS=@CFLAGS@
+CXXFLAGS=@CXXFLAGS@
+LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS)
+
+ALL_CFLAGS   = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ @SWITCH_ANSI_CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
+ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
+
+DEFAULT_VARS:= CFLAGS="$(CFLAGS)" CPPFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"
+DEFAULT_ARGS:= --build=$(build) --host=$(host) --target=$(target) \
+	--prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)" \
+	--disable-shared --with-pic
+
+COMPILE = $(CC) $(ALL_CFLAGS) $(DEFS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
+
+CXXCOMPILE = $(CXX) $(ALL_CXXFLAGS) $(DEFS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
+
+CSOURCEFILE=$(MODNAME).c
+CXXSOURCEFILE=$(MODNAME).cpp
+TOUCH_TARGET=@TOUCH_TARGET@
+
+#MAKE_OPTS = `if test -z "$(VERBOSE)" ; then $(MAKE) --help | grep silent | grep "\-s" 2>&1 >/dev/null && echo -s;fi`
+MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
+RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
+RECURSE_SOURCEFILE=`if test -f "$$modname.cpp" -o  -f "$(MODDIR)/$$modname.cpp"; then echo "$$modname.cpp"; else echo "$$modname.c"; fi`
+RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
+RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
+RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
+RECURSE_MODDIR=`if test -z $(MODDIR); then pwd | sed -e 's|$(switch_builddir)|$(switch_srcdir)|'; else echo $(MODDIR); fi`
+RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \
+		sourcefile="$(RECURSE_SOURCEFILE)" ; \
+		osarch=`uname -s` ; \
+		ourdefs="$(RECURSE_OUR_DEPS)" ; \
+		ourcflags="$(RECURSE_OUR_CFLAGS)" ; \
+		ourldflags="$(RECURSE_OUR_LDFLAGS)" ; \
+		insertobjs="`$(LOCAL_INSERT_OBJS)`" ; \
+		moddir="$(RECURSE_MODDIR)" ; \
+		$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" MODDIR="$$moddir" \
+			OUR_DEPS="$$ourdefs" OUR_CFLAGS="$$ourcflags" OUR_LDFLAGS="$$ourldflags" OUR_OBJS="$$insertobjs"
+
+all: Makefile
+	@$(RECURSE_MAKE) all-modules || exit 1
+depend: Makefile
+	@$(RECURSE_MAKE) depend-modules || exit 1
+clean: Makefile
+	@$(RECURSE_MAKE) clean-modules || exit 1
+install: Makefile
+	@$(RECURSE_MAKE) install-modules || exit 1
+uninstall: Makefile
+	@$(RECURSE_MAKE) uninstall-modules || exit 1
+distclean: Makefile
+	@$(RECURSE_MAKE) distclean-modules || exit 1
+extraclean: Makefile
+	@$(RECURSE_MAKE) extraclean-modules || exit 1
+
+all-modules: local_depend $(MODNAME).$(LIBTOOL_LIB_EXTEN) local_all Makefile
+depend-modules: local_depend
+clean-modules: local_clean mod_clean
+install-modules: all-modules depend_install local_install mod_install
+uninstall-modules: local_uninstall mod_uninstall
+distclean-modules: clean-modules local_distclean
+extraclean-modules: distclean local_extraclean
+
+Makefile:
+	@if test ! -f $@; then \
+	  if ! pwd | grep $(switch_builddir)/src/mod ; then rulesdir=$(switch_builddir) ; else rulesdir=../../../.. ; fi ; \
+	  echo BASE=$$rulesdir > Makefile ; \
+	  echo 'include $$(BASE)/build/modmake.rules' >> Makefile ; \
+	fi ;
+
+$(CURLLA):
+	@cd $(CURL_DIR) && $(MAKE)
+
+LINK_OUTPUT_REDIR=> .libs/$(MODNAME).log || error="yes" ; \
+			if test -n "$(VERBOSE)" -o "$$error" = "yes"; then \
+			  cat .libs/$(MODNAME).log ; \
+			fi ;\
+			if test "$$error" = "yes"; then \
+			  exit 1 ;\
+			 fi 
+
+$(MODNAME).$(LIBTOOL_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(OUR_DEPS) $(LOCAL_OBJS) $(OUR_OBJS) $(MODDIR)/$(SOURCEFILE) $(MODNAME).lo 
+	@echo Creating $@...
+	@test -d .libs || mkdir .libs
+	@error="";\
+	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
+		$(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
+	else \
+		$(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
+	fi;
+
+mod_clean:
+	@rm -fr *.$(LIBTOOL_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
+
+mod_install: $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+
+$(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+	@echo installing $<
+	@$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(modulesdir) >/dev/null
+
+mod_uninstall:
+	@$(LTUNINSTALL) $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+
+# define these in your makefile if you wish
+local_all local_depend local_clean depend_install local_install local_distclean local_extraclean local_uninstall:
+
+#
+# Implicit rules for creating outputs from input files
+#
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .cpp
+
+.c.o:
+	@echo Compiling $<...
+	@if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
+
+.c.lo:
+	@echo Compiling $<...
+	@if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
+
+.cpp.o:
+	@echo Compiling $<...
+	@if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
+
+.cpp.lo:
+	@echo Compiling $<...
+	@if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
+
+$(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \
+  $(switch_srcdir)/src/include/switch.h \
+  $(switch_builddir)/src/include/switch_am_config.h \
+  $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
+  $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
+  $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
+  $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
+  $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
+  $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
+  $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
+  $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
+  $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
+  $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
+  $(switch_srcdir)/src/include/switch_xml.h
+	@echo Compiling $<...
+	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
+		if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	else \
+		if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	fi;
+
+$(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \
+  $(switch_srcdir)/src/include/switch.h \
+  $(switch_builddir)/src/include/switch_am_config.h \
+  $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
+  $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
+  $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
+  $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
+  $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
+  $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
+  $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
+  $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
+  $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
+  $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
+  $(switch_srcdir)/src/include/switch_xml.h
+	@echo Compiling $<...
+	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
+		if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	else \
+		if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	fi;
+
+$(switch_srcdir)/src/include/switch.h:
+
+$(switch_builddir)/src/include/switch_am_config.h: $(switch_srcdir)/src/include/switch_am_config.h.in
+
+$(switch_srcdir)/src/include/switch_types.h:
+
+$(switch_srcdir)/src/include/switch_apr.h:
+
+$(switch_srcdir)/src/include/switch_core_db.h:
+
+$(switch_srcdir)/src/include/switch_regex.h:
+
+$(switch_srcdir)/src/include/switch_core.h:
+
+$(switch_srcdir)/src/include/switch_loadable_module.h:
+
+$(switch_srcdir)/src/include/switch_console.h:
+
+$(switch_srcdir)/src/include/switch_utils.h:
+
+$(switch_srcdir)/src/include/switch_caller.h:
+
+$(switch_srcdir)/src/include/switch_config.h:
+
+$(switch_srcdir)/src/include/switch_frame.h:
+
+$(switch_srcdir)/src/include/switch_module_interfaces.h:
+
+$(switch_srcdir)/src/include/switch_channel.h:
+
+$(switch_srcdir)/src/include/switch_buffer.h:
+
+$(switch_srcdir)/src/include/switch_event.h:
+
+$(switch_srcdir)/src/include/switch_resample.h:
+
+$(switch_srcdir)/src/include/switch_ivr.h:
+
+$(switch_srcdir)/src/include/switch_rtp.h:
+
+$(switch_srcdir)/src/include/switch_stun.h:
+
+$(switch_srcdir)/src/include/switch_log.h:
+
+$(switch_srcdir)/src/include/switch_xml.h:
+
+
+.PHONY: all clean depend install distclean extraclean \
+	all-modules clean-modules depend-modules install-modules distclean-modules extraclean-modules \
+	local_all local_clean local_depend local_install local_distclean local_extraclean \
+	mod_clean mod_install mod_uninstall depend_install
--- /usr/portage/distfiles/svn-src/freeswitch/trunk/./configure.in	2010-01-04 17:25:23.000000000 +0000
+++ ./configure.in	2010-01-10 22:55:12.000000000 +0000
@@ -18,12 +18,6 @@
 AC_CONFIG_HEADER([src/include/switch_private.h])
 AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
 
-AC_PREFIX_DEFAULT(/usr/local/freeswitch)
-# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
-if test "x$prefix" = "xNONE" ; then
-    prefix='/usr/local/freeswitch'
-fi
-
 AC_CANONICAL_HOST
 
 # Absolute source/build directory
@@ -32,28 +26,34 @@
 AC_SUBST(switch_srcdir)
 AC_SUBST(switch_builddir)
 
-# Where to install the modules
-AC_ARG_WITH([modinstdir],
-	[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"])
-
-AC_SUBST(modinstdir)
-AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modinstdir}",[where to install the modules to])
+##
+## Installation layout handling
+## taken from Apache/APR (needs apr_common.m4)
+##
+# layout selection
+APR_ENABLE_LAYOUT([FreeSWITCH], [modulesdir])
 
-# Where to put pidfile
-AC_ARG_WITH([rundir],
-	[AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/log)])], [rundir="$withval"], [rundir="${prefix}/log"])
+# re-parse location arguments
+# so we can override some of them
+APR_PARSE_ARGUMENTS
+
+AC_SUBST([modulesdir])
+AC_SUBST([runtimedir])
+AC_SUBST([logfiledir])
+AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR], "`eval echo ${sysconfdir}`", [directory for configuration files])
+AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],  "`eval echo ${modulesdir}`", [directory for modules])
+AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],  "`eval echo ${runtimedir}`", [directory for runtime files (e.g. pidfile)])
+AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],  "`eval echo ${logfiledir}`", [directory for log files])
+
+# temporary,
+# remove after we got rid of the old variables
+confdir="${sysconfdir}"
+rundir="${runtimedir}"
+modinstdir="${modulesdir}"
+AC_SUBST([confdir])
+AC_SUBST([rundir])
+AC_SUBST([modinstdir])
 
-AC_SUBST(rundir)
-AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${rundir}",[where to put pidfile to])
-
-if test "$sysconfdir" = "\${prefix}/etc" ; then
-    confdir="$prefix/conf"
-else
-    confdir="$sysconfdir"
-fi
-
-AC_SUBST(confdir)
-AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR],"${confdir}",[directory for configuration files])
 
 #Set default language
 AC_LANG_C
@@ -883,33 +883,59 @@
 AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
 AC_SUBST(AM_MAKEFLAGS)
 
-ac_configure_args="$ac_configure_args \"CONFIGURE_CFLAGS=$CFLAGS\" \"CONFIGURE_CXXFLAGS=$CXXFLAGS\" \"CONFIGURE_LDFLAGS=$LDFLAGS\""
+ac_configure_args="$ac_configure_args \"CONFIGURE_CFLAGS=$CFLAGS\" \"CONFIGURE_CXXFLAGS=$CXXFLAGS\" \"CONFIGURE_LDFLAGS=$LDFLAGS\" \
+	--prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
+	--localstatedir='$localstatedir' --datadir='$datadir'"
 
 # Run configure in all the subdirs
-AC_CONFIG_SUBDIRS(libs/srtp)
-AC_CONFIG_SUBDIRS(libs/sqlite)
+AC_CONFIG_SUBDIRS([libs/srtp])
+AC_CONFIG_SUBDIRS([libs/sqlite])
 if test "$enable_core_libedit_support" = "yes" ; then
-    AC_CONFIG_SUBDIRS(libs/libedit)
+    AC_CONFIG_SUBDIRS([libs/libedit])
 fi
 
-AC_CONFIG_SUBDIRS(libs/pcre)
-AC_CONFIG_SUBDIRS(libs/apr)
-AC_CONFIG_SUBDIRS(libs/apr-util)
-AC_CONFIG_SUBDIRS(libs/ilbc)
-AC_CONFIG_SUBDIRS(libs/curl)
-AC_CONFIG_SUBDIRS(libs/iksemel)
-AC_CONFIG_SUBDIRS(libs/js/nsprpub)
-AC_CONFIG_SUBDIRS(libs/js)
-AC_CONFIG_SUBDIRS(libs/libdingaling)
-AC_CONFIG_SUBDIRS(libs/libsndfile)
-AC_CONFIG_SUBDIRS(libs/sofia-sip)
-AC_CONFIG_SUBDIRS(libs/speex)
-AC_CONFIG_SUBDIRS(libs/portaudio)
-AC_CONFIG_SUBDIRS(libs/openzap)
-AC_CONFIG_SUBDIRS(libs/unimrcp)
-AC_CONFIG_SUBDIRS(libs/tiff-3.8.2)
-AC_CONFIG_SUBDIRS(libs/spandsp)
-AC_CONFIG_SUBDIRS(libs/broadvoice)
-AC_CONFIG_SUBDIRS(libs/libg722_1)
+AC_CONFIG_SUBDIRS([libs/pcre])
+AC_CONFIG_SUBDIRS([libs/apr])
+AC_CONFIG_SUBDIRS([libs/apr-util])
+AC_CONFIG_SUBDIRS([libs/ilbc])
+AC_CONFIG_SUBDIRS([libs/curl])
+AC_CONFIG_SUBDIRS([libs/iksemel])
+AC_CONFIG_SUBDIRS([libs/js/nsprpub])
+AC_CONFIG_SUBDIRS([libs/js])
+AC_CONFIG_SUBDIRS([libs/libdingaling])
+AC_CONFIG_SUBDIRS([libs/libsndfile])
+AC_CONFIG_SUBDIRS([libs/sofia-sip])
+AC_CONFIG_SUBDIRS([libs/speex])
+AC_CONFIG_SUBDIRS([libs/portaudio])
+AC_CONFIG_SUBDIRS([libs/openzap])
+AC_CONFIG_SUBDIRS([libs/unimrcp])
+AC_CONFIG_SUBDIRS([libs/tiff-3.8.2])
+AC_CONFIG_SUBDIRS([libs/spandsp])
+AC_CONFIG_SUBDIRS([libs/broadvoice])
+AC_CONFIG_SUBDIRS([libs/libg722_1])
 
 AC_OUTPUT
+
+##
+## Configuration summary
+##
+
+echo
+echo "-------------------------- FreeSWITCH configuration ------------------------"
+echo ""
+echo "  Locations:"
+echo "      Selected layout: ${layout_name}"
+echo ""
+echo "      prefix:          ${prefix}"
+echo "      exec_prefix:     ${exec_prefix}"
+echo "      bindir:          ${bindir}"
+echo "      sbindir:         ${sbindir}"
+echo "      libdir:          ${libdir}"
+echo "      libexecdir:      ${libexecdir}"
+echo "      modulesdir:      ${modulesdir}"
+echo "      sysconfdir:      ${sysconfdir}"
+echo "      runtimedir:      ${runtimedir}"
+echo "      localstatedir:   ${localstatedir}"
+echo "      datadir:         ${datadir}"
+echo ""
+echo "----------------------------------------------------------------------------"
--- /dev/null	2010-01-06 17:38:48.323132677 +0000
+++ ./configure.in	2010-01-10 22:55:12.000000000 +0000
@@ -0,0 +1,941 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+# Must change all of the below together
+# For a release, set revision for that tagged release as well and uncomment
+AC_INIT([freeswitch], [1.0.trunk], BUG-REPORT-ADDRESS)
+AC_SUBST(SWITCH_VERSION_MAJOR, [1])
+AC_SUBST(SWITCH_VERSION_MINOR, [0])
+AC_SUBST(SWITCH_VERSION_MICRO, [trunk])
+#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
+
+AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
+AC_CONFIG_FILES([.version:.version.in])
+
+AC_CONFIG_AUX_DIR(build/config)
+AM_INIT_AUTOMAKE(libfreeswitch,0.1)
+AC_CONFIG_SRCDIR([src/switch.c])
+AC_CONFIG_HEADER([src/include/switch_private.h])
+AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
+
+AC_CANONICAL_HOST
+
+# Absolute source/build directory
+switch_srcdir=`(cd $srcdir && pwd)`
+switch_builddir=`pwd`
+AC_SUBST(switch_srcdir)
+AC_SUBST(switch_builddir)
+
+##
+## Installation layout handling
+## taken from Apache/APR (needs apr_common.m4)
+##
+# layout selection
+APR_ENABLE_LAYOUT([FreeSWITCH], [modulesdir])
+
+# re-parse location arguments
+# so we can override some of them
+APR_PARSE_ARGUMENTS
+
+AC_SUBST([modulesdir])
+AC_SUBST([runtimedir])
+AC_SUBST([logfiledir])
+AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR], "`eval echo ${sysconfdir}`", [directory for configuration files])
+AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],  "`eval echo ${modulesdir}`", [directory for modules])
+AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],  "`eval echo ${runtimedir}`", [directory for runtime files (e.g. pidfile)])
+AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],  "`eval echo ${logfiledir}`", [directory for log files])
+
+# temporary,
+# remove after we got rid of the old variables
+confdir="${sysconfdir}"
+rundir="${runtimedir}"
+modinstdir="${modulesdir}"
+AC_SUBST([confdir])
+AC_SUBST([rundir])
+AC_SUBST([modinstdir])
+
+
+#Set default language
+AC_LANG_C
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+
+#check if the g++ compiler works
+AC_CACHE_CHECK([whether the C++ compiler works], [ac_cv_sys_cxx_works], [
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([int main() { }], [ac_cv_sys_cxx_works=yes],
+        [ac_cv_sys_cxx_works=no])
+    AC_LANG_POP([C++])
+    ])
+[ if [ "x$ac_cv_sys_cxx_works" = "xno" ]; then ]
+    AC_MSG_FAILURE([The C++ compiler does not work. Please (re)install the C++ compiler])
+[ fi ]
+
+AC_PROG_AWK
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+
+#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
+m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
+m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
+m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+
+#Check for compiler vendor
+AX_COMPILER_VENDOR
+
+#  Optimize
+AC_ARG_ENABLE(optimization,
+[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
+
+if test "${enable_optimizer}" = "yes" ; then
+        AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
+        AX_CC_MAXOPT
+fi
+
+# set defaults for use on all platforms
+SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
+SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
+SWITCH_AM_LDFLAGS="-lm"
+
+#set SOLINK variable based on compiler and host
+if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+    SOLINK="-Bdynamic -dy -G"
+elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+    case "$host" in
+        *darwin10.*)
+            SOLINK="-dynamic -force-flat-namespace"
+        ;;
+        *darwin*)
+            SOLINK="-dynamic -bundle -force-flat-namespace"
+        ;;
+        *-solaris2*)
+            SOLINK="-shared -Xlinker"
+        ;;
+        *)
+            SOLINK="-shared -Xlinker -x"
+        ;;
+    esac
+else
+    AC_ERROR([Please update configure.in with SOLINK values for your compiler])
+fi
+
+# set DYNAMIC_LIB_EXTEN
+# we should really be using libtool so we don't need to do this
+case "$host" in
+    *cygwin* | *mingw*)
+        DYNAMIC_LIB_EXTEN="dll"
+    ;;
+    *)
+        DYNAMIC_LIB_EXTEN="so"
+    ;;
+esac
+
+##
+# detect libtool major version,
+# set libtool library extension based on this
+# to work around some brokeness when using 'la' with libtool-1.5
+#
+AC_MSG_CHECKING([libtool major version])
+libtool="${switch_builddir}/libtool"
+LIBTOOL_MAJOR_VERSION="`$libtool --version 2>/dev/null| sed -e 's/([[^)]]*)//g;s/^[[^0-9]]*//;s/[[- ]].*//g;q'| awk  'BEGIN { FS = "." } { print $1 }' `"
+if test -z "$LIBTOOL_MAJOR_VERSION" ; then
+	LIBTOOL_MAJOR_VERSION="`sed -n -e '/^VERSION/{s/^.*=\"\{0,1\}\([[0-9]]\{1,\}\)\..*/\1/;p;}' ${switch_srcdir}/build/config/ltmain.sh`"
+fi
+if test -z "$LIBTOOL_MAJOR_VERSION" ; then
+	AC_MSG_ERROR([Failed to detect your libtool version, please open a bug report on http://jira.freeswitch.org/])
+fi
+AC_MSG_RESULT([${LIBTOOL_MAJOR_VERSION}])
+
+LIBTOOL_LIB_EXTEN="$DYNAMIC_LIB_EXTEN"
+
+if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then
+   LIBTOOL_LIB_EXTEN="la"
+fi
+AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}])
+
+
+#  Enable 64 bit build
+AC_ARG_ENABLE(64,
+[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
+
+# tweak compiler specific flags
+if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
+    APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
+    APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
+    APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED)
+    APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes)
+    APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes)
+    APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
+    APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
+    APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
+
+    APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
+    if test "${enable_64}" = "yes"; then
+        APR_ADDTO(SWITCH_AM_CFLAGS, -m64)
+        APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64)
+        APR_ADDTO(SWITCH_AM_LDFLAGS, -m64)
+	LIBS="$LIBS -m64"
+    fi
+elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+    APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
+    APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
+    APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
+    if test "${enable_64}" = "yes"; then
+	case "$host" in
+             *darwin10.*|*darwin9.*|*darwin8.*)
+		APR_ADDTO(CFLAGS, -arch x86_64)
+       		APR_ADDTO(LDFLAGS, -arch x86_64)
+       		APR_ADDTO(CXXFLAGS, -arch x86_64)
+		;;
+	     *)
+	     	LIBS="$LIBS -m64"
+	     ;;
+	 esac
+    fi
+fi
+
+#
+# gcc visibility cflag checks
+#
+AC_ARG_ENABLE([visibility],
+	[AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
+	[enable_visibility="${enableval}"],
+	[enable_visibility="detect"]
+)
+HAVE_VISIBILITY="no"
+
+if test "x${enable_visibility}" != "xno" ; then
+
+	case "${ax_cv_c_compiler_vendor}" in
+	gnu)
+		save_CFLAGS="${CFLAGS}"
+		CFLAGS="${CFLAGS} -fvisibility=hidden"
+		AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
+		AC_COMPILE_IFELSE(
+			[AC_LANG_PROGRAM(
+				[int foo __attribute__ ((visibility("default")));],
+				[;]
+			)],
+
+			[AC_MSG_RESULT([yes])
+			 APR_ADDTO([SWITCH_AM_CFLAGS],   [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+			 APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+			 HAVE_VISIBILITY="yes"],
+
+			[AC_MSG_RESULT([no])]
+		)
+		CFLAGS="${save_CFLAGS}"
+		;;
+
+	sun)
+	#	save_CFLAGS="${CFLAGS}"
+	#	CFLAGS="${CFLAGS} -xldscope=hidden"
+	#	AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
+	#	AC_COMPILE_IFELSE(
+	#		[AC_LANG_PROGRAM(
+	#			[int foo __attribute__ ((visibility("default")));],
+	#			[;]
+	#		)],
+	#
+	#		[AC_MSG_RESULT([yes])
+	#		 APR_ADDTO([SWITCH_AM_CFLAGS],   [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+	#		 APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+	#		 HAVE_VISIBILITY="yes"],
+	#
+	#		[AC_MSG_RESULT([no])]
+	#	)
+	#	CFLAGS="${save_CFLAGS}"
+		;;
+
+	*)
+		if test "x${enable_visibility}" = "xyes" ; then
+			AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
+		else
+			AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
+		fi
+		;;
+	esac
+
+	#
+	# visibility explicitly requested but not supported by this compiler => error
+	#
+	if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
+		AC_MSG_ERROR([API visibility not supported by this compiler])
+	fi
+fi
+
+# Enable debugging (default: on)
+# (rename option if the default is changed)
+AC_ARG_ENABLE(debug,
+[AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
+
+if test "${enable_debug}" = "yes"; then
+        AC_DEFINE([DEBUG],[],[Enable extra debugging.])
+	saved_CFLAGS="$CFLAGS"
+	CFLAGS=
+        AX_CFLAGS_WARN_ALL_ANSI
+	SWITCH_ANSI_CFLAGS=$CFLAGS
+	CFLAGS="$saved_CFLAGS"	
+
+	if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
+	    APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
+	    export DEBUG_CFLAGS="-g -ggdb"
+	fi
+
+fi
+
+AC_ARG_ENABLE(cpp,
+[AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
+
+AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
+
+AC_ARG_ENABLE(zrtp,
+	[AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
+if test "x$enable_zrtp" = "xyes" ; then
+   saved_LIBS="$LIBS"
+   LIBS="$saved_LIBS -L/usr/local/lib -lbn -lpthread"
+   AC_CHECK_LIB(zrtp, zrtp_init, [has_zrtp="yes"], [has_zrtp="no"])
+   LIBS="$saved_LIBS"
+   if test "x$has_zrtp" = "xno"; then
+      AC_ERROR([Cannot locate zrtp libraries])
+   fi
+   APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
+fi
+
+PA_LIBS=
+
+PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
+if test "x$have_jack" = "xyes" ; then
+PA_LIBS+=$JACK_LIBS
+fi
+
+AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
+if test "x$have_alsa" = "xyes"  ; then
+PA_LIBS+=-lasound
+fi
+
+AC_SUBST(PA_LIBS)
+
+AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
+
+
+AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
+
+AC_ARG_ENABLE(core-odbc-support,     
+	[AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support])],,[enable_core_odbc_support="no"])
+AX_LIB_ODBC
+if test "$ac_cv_found_odbc" = "yes" ; then
+  enable_core_odbc_support="yes"
+fi
+
+ESL_LDFLAGS=
+PLATFORM_CORE_DEPLIBS=
+# tweak platform specific flags
+case "$host" in
+    *darwin10.*)
+        APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
+        APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
+        APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
+        APR_ADDTO(CXXFLAGS, -pipe)
+        APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
+	if test "x$enable_core_odbc_support" != "xno"; then
+	        APR_ADDTO(PLATFORM_CORE_DEPLIBS, --framework CoreFoundation)
+	fi
+    ;;
+    *darwin*)
+        APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
+        APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
+	if test "x$enable_core_odbc_support" != "xno"; then
+	        APR_ADDTO(PLATFORM_CORE_DEPLIBS, --framework CoreFoundation)
+	fi
+    ;;
+    *-solaris2*)
+        APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048)
+        APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
+    ;;
+    *bsd*)
+        APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
+    ;;
+esac
+
+APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
+
+AC_SUBST(SWITCH_AM_CFLAGS)
+AC_SUBST(SWITCH_ANSI_CFLAGS)
+AC_SUBST(SWITCH_AM_CXXFLAGS)
+AC_SUBST(SWITCH_AM_LDFLAGS)
+AC_SUBST(ESL_LDFLAGS)
+AC_SUBST(PLATFORM_CORE_DEPLIBS)
+AC_SUBST(SOLINK)
+AC_SUBST(DYNAMIC_LIB_EXTEN)
+AC_SUBST(LIBTOOL_LIB_EXTEN)
+
+# Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h netdb.h execinfo.h])
+
+# for xmlrpc-c config.h
+if test x"$ac_cv_header_wchar_h" = xyes; then
+  HAVE_WCHAR_H_DEFINE=1
+else
+  HAVE_WCHAR_H_DEFINE=0
+fi
+AC_SUBST(HAVE_WCHAR_H_DEFINE)
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_STRUCT_TM
+
+# Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_MALLOC
+AC_TYPE_SIGNAL
+AC_FUNC_STRFTIME
+AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs])
+AC_CHECK_FUNCS([sched_setscheduler sched_setaffinity setpriority setrlimit setgroups initgroups])
+AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
+
+AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
+AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
+AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
+
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
+#include <sys/types.h>
+#include <time.h>])
+
+AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
+#include <sys/types.h>
+#include <time.h>])
+
+AC_CHECK_DECL([RLIMIT_MEMLOCK],
+	[AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
+	[#ifdef HAVE_SYS_RESOURCE_H
+	 #include <sys/resource.h>
+	 #endif])
+
+AC_CHECK_DECL([SCHED_RR],
+	[AC_DEFINE([HAVE_SCHED_RR],[1],[SCHED_RR constant for sched_setscheduler])],,
+	[#ifdef HAVE_SCHED_H
+	 #include <sched.h>
+	 #endif])
+
+#
+# use mlockall only on linux (for now; if available)
+#
+if test "x${ac_cv_func_mlockall}" = "xyes"; then
+	AC_MSG_CHECKING([whether to use mlockall])
+	case "$host" in
+	*-linux-*)
+		AC_DEFINE([USE_MLOCKALL],[1],[Enable mlockall support])
+		AC_MSG_RESULT([yes])
+		USE_MLOCKALL=yes
+		;;
+	*-freebsd*)
+		AC_MSG_RESULT([no, broken for non-root users])
+		;;
+	*)
+		AC_MSG_RESULT([no])
+		;;
+	esac
+
+	#
+	# setrlimit prerequisites
+	#
+	if test "x${USE_MLOCKALL}" = "xyes" -a \
+		"x${ac_cv_func_setrlimit}" = "xyes" -a \
+		"x${ac_cv_have_decl_RLIMIT_MEMLOCK}" = "xyes"
+	then
+		AC_DEFINE([USE_SETRLIMIT],[1],[Use setrlimit to disable mlock limit for non-root users])
+	fi
+fi
+
+#
+# sched_setcheduler + round-robin scheduler prerequisites
+#
+if test "x${ac_cv_func_sched_setscheduler}" = "xyes" -a \
+        "x${ac_cv_have_decl_SCHED_RR}" = "xyes"
+then
+	AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
+fi
+
+#
+# xmlrpc-c checks
+#
+
+
+HAVE_LIBWWW_SSL_DEFINE=0
+AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
+
+DIRECTORY_SEPARATOR="/"
+AC_SUBST(DIRECTORY_SEPARATOR)
+
+va_list_is_array=no
+AC_MSG_CHECKING(whether va_list is an array)
+AC_TRY_COMPILE([
+#include <stdarg.h>
+], [va_list list1, list2; list1 = list2;], , 
+va_list_is_array=yes)
+AC_MSG_RESULT($va_list_is_array)
+if test x"$va_list_is_array" = xyes; then
+  VA_LIST_IS_ARRAY_DEFINE=1
+else
+  VA_LIST_IS_ARRAY_DEFINE=0
+fi
+AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
+
+
+AC_MSG_CHECKING(whether compiler has __attribute__)
+AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
+compiler_has_attribute=yes,
+compiler_has_attribute=no)
+AC_MSG_RESULT($compiler_has_attribute)
+if test x"$compiler_has_attribute" = xyes; then
+    ATTR_UNUSED="__attribute__((__unused__))"
+else
+    ATTR_UNUSED=
+fi
+AC_SUBST(ATTR_UNUSED)
+
+
+saved_CFLAGS="$CFLAGS"
+AC_CACHE_CHECK([whether compiler supports -Wdeclaration-after-statement], [ac_cv_gcc_declaration_after_statement], [
+CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_declaration_after_statement=yes],[ac_cv_gcc_declaration_after_statement=no])
+])
+AC_MSG_RESULT($ac_cv_gcc_declaration_after_statement)
+if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then
+    APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wdeclaration-after-statement)
+fi
+CFLAGS="$saved_CFLAGS"
+
+AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
+
+# Checks for integer size
+AC_CHECK_SIZEOF(char, 1)
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(long long, 8)
+AC_TYPE_SIZE_T
+AC_CHECK_TYPE(ssize_t, int)
+
+# Checks for pointer size
+AC_CHECK_SIZEOF(void*, 4)
+
+if test "x$ac_cv_sizeof_voidp" != "x"; then
+    voidp_size=$ac_cv_sizeof_voidp
+else
+    AC_ERROR([Cannot determine size of void*])
+fi
+
+if test "$ac_cv_sizeof_short" = "2"; then
+    short_value=short
+fi
+if test "$ac_cv_sizeof_int" = "4"; then
+    int_value=int
+fi
+
+if test "$ac_cv_sizeof_int" = "8"; then
+    int64_t_fmt='#define SWITCH_INT64_T_FMT "d"'
+    uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"'
+    int64_value="int"
+    long_value=int
+elif test "$ac_cv_sizeof_long" = "8"; then
+    int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"'
+    uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"'
+    int64_value="long"
+    long_value=long
+    case "$host" in
+        *-solaris2*|*apple-darwin*)
+	    if test "$ac_cv_sizeof_long_long" = "8"; then
+	        int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
+		uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
+		int64_value="long long"
+		long_value="long long"
+	    fi
+	;;
+    esac
+elif test "$ac_cv_sizeof_long_long" = "8"; then
+    int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
+    uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
+    int64_value="long long"
+    long_value="long long"
+elif test "$ac_cv_sizeof_longlong" = "8"; then
+    int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"'
+    uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"'
+    int64_value="__int64"
+    long_value="__int64"
+else
+    AC_ERROR([could not detect a 64-bit integer type])
+fi
+
+if test "$ac_cv_type_size_t" = "yes"; then
+    size_t_value="size_t"
+else
+    size_t_value="switch_int32_t"
+fi
+
+if test "$ac_cv_type_ssize_t" = "yes"; then
+    ssize_t_value="ssize_t"
+else
+    ssize_t_value="switch_int32_t"
+fi
+
+APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
+
+if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
+    ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
+elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
+    ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
+else
+    ssize_t_fmt='#error Can not determine the proper size for ssize_t'
+fi
+
+APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
+
+if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
+    size_t_fmt='#define SWITCH_SIZE_T_FMT "d"'
+elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
+    size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
+else
+    size_t_fmt='#error Can not determine the proper size for size_t'
+fi
+
+# Basically, we have tried to figure out the correct format strings
+# for SWITCH types which vary between platforms, but we don't always get 
+# it right.  If you find that we don't get it right for your platform, 
+# you can override our decision below.
+# NOTE: borrowed much of this logic from apr.
+case $host in
+   s390*linux*)
+       # uniquely, the 31-bit Linux/s390 uses "unsigned long int"
+       # for size_t rather than "unsigned int":
+       size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
+       ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
+       ;;
+   *-os2*)
+       size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
+       ;;
+   *-openbsd*)
+       size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
+       ;;
+   *aix4*|*aix5*)
+       ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
+       size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
+       ;;
+    *beos*)
+        ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
+        size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
+        ;;
+    *apple-darwin*)
+        osver=`uname -r`
+        case $osver in
+           [0-7].*)
+              ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
+              ;;
+           *)
+              ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
+              ;;
+        esac
+        size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
+        ;;
+esac
+
+AC_SUBST(voidp_size)
+AC_SUBST(short_value)
+AC_SUBST(int_value)
+AC_SUBST(long_value)
+AC_SUBST(int64_value)
+AC_SUBST(size_t_value)
+AC_SUBST(ssize_t_value)
+AC_SUBST(int64_t_fmt) 
+AC_SUBST(uint64_t_fmt) 
+AC_SUBST(ssize_t_fmt) 
+AC_SUBST(size_t_fmt)
+AC_SUBST(libdir)
+AC_SUBST(bindir)
+AC_SUBST(includedir)
+
+AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
+AC_PATH_PROGS(TAR, gtar tar)
+AC_PATH_PROGS(WGET, wget)
+AC_PATH_PROGS(CURL, curl)
+GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getlib.sh"
+AC_SUBST(GETLIB)
+GETSOUNDS="${SHELL} $switch_builddir/build/getsounds.sh"
+AC_SUBST(GETSOUNDS)
+
+
+LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'])
+AC_SUBST(LIBCURL_DEPS)
+
+
+AC_ARG_ENABLE(core-libedit-support,     
+	[AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])], [enable_core_libedit_support="$enableval"], [enable_core_libedit_support="yes"])
+
+if test "$enable_core_libedit_support" = "yes" ; then
+    AC_CHECK_LIB(ncurses, tgetent,,
+       [AC_CHECK_LIB(curses, tgetent,,
+          [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] )
+fi
+
+SAC_OPENSSL
+
+if test x$HAVE_OPENSSL = x1; then
+	openssl_CFLAGS="$openssl_CFLAGS -DHAVE_OPENSSL";
+fi
+
+AX_CHECK_JAVA
+
+
+AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"])
+AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
+AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
+
+#
+# Python checks for mod_python
+#
+AC_ARG_WITH(
+	[python],
+	[AS_HELP_STRING([--with-python], [Use system provided version of python (default: try)])],
+	[with_python="$withval"],
+	[with_python="try"]
+)
+
+if test "$with_python" != "no"
+then
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+
+	if test "$with_python" != "yes" -a "$with_python" != "try" ; then
+		AC_MSG_CHECKING([for python])
+		if test ! -x "$with_python" ; then
+			AC_MSG_ERROR([Specified python does not exist or is not executable: $with_python])
+		fi
+		AC_MSG_RESULT([$with_python])
+		AC_SUBST([PYTHON], ["$with_python"])
+	else
+		AC_PATH_PROG([PYTHON], ["python"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
+	fi
+
+	if test "$PYTHON" != "no" ; then
+		AC_MSG_CHECKING([python version])
+		PYTHON_VER="`$PYTHON -V 2>&1 | cut -d' ' -f2`"
+
+		if test -z "$PYTHON_VER" ; then
+			AC_MSG_ERROR([Unable to detect python version])
+		fi
+		AC_MSG_RESULT([$PYTHON_VER])
+
+		AC_MSG_CHECKING([for python distutils])
+		python_result="`$PYTHON -c 'import distutils;' 2>&1`"
+		if test -z "$python_result" ; then
+			python_has_distutils="yes"
+		else
+			python_has_distutils="no"
+		fi
+		AC_MSG_RESULT([$python_has_distutils])
+
+		if test "$python_has_distutils" != "no" ; then
+			AC_MSG_CHECKING([location of site-packages])
+
+			PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_lib(0);'`"
+
+			if test -z "$PYTHON_SITE_DIR" ; then
+				AC_MSG_ERROR([Unable to detect python site-packages path])
+			elif test ! -d "$PYTHON_SITE_DIR" ; then
+				AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
+			fi
+			AC_MSG_RESULT([$PYTHON_SITE_DIR])
+			AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
+
+			#
+			# python distutils found, get settings from python directly
+			#
+			PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print \" \".join(flags);'`"
+			PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print \" \".join(libs);'`"
+			PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`"
+			PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var(\"LIBDIR\");'`"
+
+			# handle python being installed into /usr/local
+			AC_MSG_CHECKING([python libdir])
+			if test -z "`echo $PYTHON_LIBDIR | grep "/usr/lib"`" ; then
+				PYTHON_LDFLAGS="-L$PYTHON_LIBDIR $PYTHON_LDFLAGS"
+				LIBS="-L$PYTHON_LIBDIR $LIBS"
+			fi
+			AC_MSG_RESULT([$PYTHON_LIBDIR])
+
+			# check libpython
+			AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
+
+			if test "$has_libpython" = "no" ; then
+				AS_IF([test "$with_python" = "try"],
+				 	[AC_MSG_WARN([$PYTHON_LIB is unusable])],
+					[AC_MSG_ERROR([$PYTHON_LIB is unusable])]
+				)
+			fi
+
+			# check whether system libpython is usable and has threads support
+			CFLAGS="$PYTHON_CFLAGS"
+			LIBS="$PYTHON_LDFLAGS"
+			AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"])
+
+			if test "$python_has_threads" = "no"; then
+				AS_IF([test "$with_python" = "try"],
+					[AC_MSG_WARN([Your python lacks threads support, can not build mod_python])],
+					[AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])]
+				)
+			else
+				AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf])
+				AC_SUBST([PYTHON_CFLAGS],  [$PYTHON_CFLAGS])
+				AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
+			fi
+		else
+			AS_IF([test "$with_python" = "try"],
+				[AC_MSG_WARN([Could not find or use python distutils module: $python_result])],
+				[AC_MSG_ERROR([Could not find or use python distutils module: $python_result])]
+			)
+		fi
+
+		LIBS="$save_LIBS"
+		CFLAGS="$save_CFLAGS"
+
+		unset python_has_threads
+		unset python_has_distutils
+		unset python_result
+	else
+		AS_IF([test "$with_python" = "try"],
+			[AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])],
+			[AC_MSG_ERROR([Could not find python, use --with-python to specify the location])]
+		)
+	fi
+else
+	AC_MSG_WARN([python support disabled, building mod_python will fail!])
+fi
+
+CHECK_ERLANG
+
+AC_CONFIG_FILES([Makefile
+                build/Makefile
+                src/Makefile
+                src/mod/Makefile
+                src/mod/applications/mod_enum/Makefile
+		src/mod/applications/mod_expr/Makefile
+		src/mod/applications/mod_stress/Makefile
+		src/mod/applications/mod_t38gateway/Makefile
+		src/mod/endpoints/mod_iax/Makefile
+		src/mod/endpoints/mod_portaudio/Makefile
+		src/mod/endpoints/mod_skypiax/Makefile
+                src/mod/endpoints/mod_sofia/Makefile
+		src/mod/formats/mod_portaudio_stream/Makefile
+                src/mod/asr_tts/mod_unimrcp/Makefile
+                src/mod/languages/mod_java/Makefile
+                src/mod/languages/mod_python/Makefile
+                src/mod/event_handlers/mod_erlang_event/Makefile
+                src/include/switch_am_config.h
+                build/getsounds.sh
+                build/getlib.sh
+                build/modmake.rules
+                libs/xmlrpc-c/include/xmlrpc-c/config.h
+                libs/xmlrpc-c/xmlrpc_config.h
+                scripts/gentls_cert])
+
+AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
+AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
+AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64])
+
+#some vars to sub into the Makefile.am's
+#LIBS+=> core.log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat core.log;fi;if test "$$error" = "yes";then exit 1;fi
+LIBTOOL='`if test -z "$(VERBOSE)" ; then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(switch_builddir)/libtool; fi;`'
+TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
+CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq )'
+CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed -e "s|^.*/||" | sort | uniq )'
+OUR_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
+OUR_CLEAN_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
+OUR_INSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
+OUR_UNINSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
+OUR_DISABLED_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
+OUR_DISABLED_CLEAN_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)";  mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
+OUR_DISABLED_INSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
+OUR_DISABLED_UNINSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
+
+AM_MAKEFLAGS='"OUR_MODULES=$(OUR_MODS)" "OUR_CLEAN_MODULES=$(OUR_CLEAN_MODS)" "OUR_INSTALL_MODULES=$(OUR_INSTALL_MODS)" "OUR_UNINSTALL_MODULES=$(OUR_UNINSTALL_MODS)" "OUR_DISABLED_MODULES=$(OUR_DISABLED_MODS)" "OUR_DISABLED_CLEAN_MODULES=$(OUR_DISABLED_CLEAN_MODS)" "OUR_DISABLED_INSTALL_MODULES=$(OUR_DISABLED_INSTALL_MODS)" "OUR_DISABLED_UNINSTALL_MODULES=$(OUR_DISABLED_UNINSTALL_MODS)" `test -n "$(VERBOSE)" || echo -s`'
+#AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`'
+AC_SUBST(LIBTOOL)
+AC_SUBST(TOUCH_TARGET)
+AC_SUBST(CONF_DISABLED_MODULES)
+AC_SUBST(CONF_MODULES)
+
+AC_SUBST(OUR_MODS)
+AC_SUBST(OUR_CLEAN_MODS)
+AC_SUBST(OUR_INSTALL_MODS)
+AC_SUBST(OUR_UNINSTALL_MODS)
+AC_SUBST(OUR_DISABLED_MODS)
+AC_SUBST(OUR_DISABLED_CLEAN_MODS)
+AC_SUBST(OUR_DISABLED_INSTALL_MODS)
+AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
+AC_SUBST(AM_MAKEFLAGS)
+
+ac_configure_args="$ac_configure_args \"CONFIGURE_CFLAGS=$CFLAGS\" \"CONFIGURE_CXXFLAGS=$CXXFLAGS\" \"CONFIGURE_LDFLAGS=$LDFLAGS\" \
+	--prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
+	--localstatedir='$localstatedir' --datadir='$datadir'"
+
+# Run configure in all the subdirs
+AC_CONFIG_SUBDIRS([libs/srtp])
+AC_CONFIG_SUBDIRS([libs/sqlite])
+if test "$enable_core_libedit_support" = "yes" ; then
+    AC_CONFIG_SUBDIRS([libs/libedit])
+fi
+
+AC_CONFIG_SUBDIRS([libs/pcre])
+AC_CONFIG_SUBDIRS([libs/apr])
+AC_CONFIG_SUBDIRS([libs/apr-util])
+AC_CONFIG_SUBDIRS([libs/ilbc])
+AC_CONFIG_SUBDIRS([libs/curl])
+AC_CONFIG_SUBDIRS([libs/iksemel])
+AC_CONFIG_SUBDIRS([libs/js/nsprpub])
+AC_CONFIG_SUBDIRS([libs/js])
+AC_CONFIG_SUBDIRS([libs/libdingaling])
+AC_CONFIG_SUBDIRS([libs/libsndfile])
+AC_CONFIG_SUBDIRS([libs/sofia-sip])
+AC_CONFIG_SUBDIRS([libs/speex])
+AC_CONFIG_SUBDIRS([libs/portaudio])
+AC_CONFIG_SUBDIRS([libs/openzap])
+AC_CONFIG_SUBDIRS([libs/unimrcp])
+AC_CONFIG_SUBDIRS([libs/tiff-3.8.2])
+AC_CONFIG_SUBDIRS([libs/spandsp])
+AC_CONFIG_SUBDIRS([libs/broadvoice])
+AC_CONFIG_SUBDIRS([libs/libg722_1])
+
+AC_OUTPUT
+
+##
+## Configuration summary
+##
+
+echo
+echo "-------------------------- FreeSWITCH configuration ------------------------"
+echo ""
+echo "  Locations:"
+echo "      Selected layout: ${layout_name}"
+echo ""
+echo "      prefix:          ${prefix}"
+echo "      exec_prefix:     ${exec_prefix}"
+echo "      bindir:          ${bindir}"
+echo "      sbindir:         ${sbindir}"
+echo "      libdir:          ${libdir}"
+echo "      libexecdir:      ${libexecdir}"
+echo "      modulesdir:      ${modulesdir}"
+echo "      sysconfdir:      ${sysconfdir}"
+echo "      runtimedir:      ${runtimedir}"
+echo "      localstatedir:   ${localstatedir}"
+echo "      datadir:         ${datadir}"
+echo ""
+echo "----------------------------------------------------------------------------"
--- /dev/null	2010-01-06 17:38:48.323132677 +0000
+++ ./config.layout	2010-01-10 02:37:25.000000000 +0000
@@ -0,0 +1,66 @@
+##
+##  config.layout -- Pre-defined Installation Path Layouts
+##
+##  Hints:
+##  - layouts can be loaded with configure's --enable-layout=ID option
+##  - when no --enable-layout option is given, the default layout is `FreeSWITCH'
+##  - a trailing plus character (`+') on paths is replaced with a 
+##    `/<target>' suffix where <target> is currently hardcoded to 'freeswitch'.
+##    (This may become a configurable parameter at some point.)
+##
+
+#   Default FreeSWITCH path layout.
+<Layout FreeSWITCH>
+    prefix:         /usr/local/freeswitch
+    exec_prefix:    ${prefix}
+    bindir:         ${exec_prefix}/bin
+    sbindir:        ${exec_prefix}/bin
+    libdir:         ${exec_prefix}/lib
+    libexecdir:     ${exec_prefix}/modules
+    modulesdir:     ${exec_prefix}/modules
+    mandir:         ${prefix}/man
+    sysconfdir:     ${prefix}/conf
+    datadir:        ${prefix}
+    includedir:     ${prefix}/include
+    localstatedir:  ${prefix}
+    runtimedir:     ${localstatedir}/log
+    logfiledir:     ${localstatedir}/log
+</Layout>
+
+#   GNU standards conforming path layout.
+#   See FSF's GNU project `make-stds' document for details.
+<Layout GNU>
+    prefix:         /usr/local
+    exec_prefix:    ${prefix}
+    bindir:         ${exec_prefix}/bin
+    sbindir:        ${exec_prefix}/sbin
+    libdir:         ${exec_prefix}/lib
+    libexecdir:     ${exec_prefix}/libexec
+    modulesdir:     ${libdir}/freeswitch/modules
+    mandir:         ${prefix}/man
+    sysconfdir:     ${prefix}/etc/freeswitch
+    datadir:        ${prefix}/share/freeswitch
+    includedir:     ${prefix}/include/freeswitch
+    localstatedir:  ${prefix}/var/freeswitch
+    runtimedir:     ${localstatedir}/run
+    logfiledir:     ${localstatedir}/log
+</Layout>
+
+# Linux FHS (File Hierarchy Standard) layout
+# see 
+<Layout FHS>
+    prefix:         /usr
+    exec_prefix:    ${prefix}
+    bindir:         ${exec_prefix}/bin
+    sbindir:        ${exec_prefix}/sbin
+    libdir:         ${exec_prefix}/lib/freeswitch
+    libexecdir:     ${exec_prefix}/libexec
+    modulesdir:     ${libdir}/modules
+    mandir:         ${prefix}/man
+    sysconfdir:     /etc/freeswitch
+    datadir:        ${prefix}/share/freeswitch
+    includedir:     ${prefix}/include/freeswitch
+    localstatedir:  /var/lib/freeswitch
+    runtimedir:     /var/run/freeswitch
+    logfiledir:     /var/log/freeswitch
+</Layout>
