diff -Nru asterisk-1.2.14.org/Makefile asterisk-1.2.14/Makefile
--- asterisk-1.2.14.org/Makefile	2006-12-11 22:55:43.000000000 +0100
+++ asterisk-1.2.14/Makefile	2006-12-27 09:16:50.000000000 +0100
@@ -356,16 +356,6 @@
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
 	cryptostub.o
 
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
-  OBJS+= poll.o
-  ASTCFLAGS+=-DPOLLCOMPAT
-endif
-
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
-  OBJS+= dlfcn.o
-  ASTCFLAGS+=-DDLFCNCOMPAT
-endif
-
 ifeq ($(OSARCH),Linux)
   LIBS+=-ldl -lpthread -lncurses -lm -lresolv  #-lnjamd
 else
@@ -420,8 +410,6 @@
   HAVEDOT=no
 endif
 
-LIBS+=-lssl
-
 _all: all
 	@echo " +--------- Asterisk Build Complete ---------+"  
 	@echo " + Asterisk has successfully been built, but +"  
@@ -447,12 +435,12 @@
 	cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
 
 editline/libedit.a: FORCE
-	cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
+	cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE) $(EXTRA_CFLAGS)" LDFLAGS="$(EXTRA_LDFLAGS)" ./configure
 	$(MAKE) -C editline libedit.a
 
 db1-ast/libdb1.a: FORCE
 	@if [ -d db1-ast ]; then \
-		$(MAKE) -C db1-ast libdb1.a ; \
+		$(MAKE) OORG="$(OPTIMIZE)" -C db1-ast libdb1.a ; \
 	else \
 		echo "You need to do a cvs update -d not just cvs update"; \
 		exit 1; \
@@ -530,7 +518,7 @@
 	fi
 	rm -f include/asterisk/build.h.tmp
 	$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
-	$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
+	$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(EXTRA_LDFLAGS) $(LIBS)
 
 muted: muted.o
 	$(CC) $(AUDIO_LIBS) -o muted muted.o