[patch] pptp: Backport of pppd plugin building



Hi,

the way the pppd plugin gets built and installed is a lot cleaner in 
trunk than in the 0.6 branch, which has some major flaws:
* doesn't work with pppd != 2.4.3 (for me)
* installs library into bindir and not the ppp plugin-dir

To fix this here's a backport from the the changes introduced in the 
trunk, and a fix when the prefix is unset. Apply it like so:

1. Remove src/pppd
2. Copy /src/extern from trunk
3. Apply patch

Thanks,

Robert
Index: configure.in
===================================================================
--- configure.in	(revision 2712)
+++ configure.in	(working copy)
@@ -15,6 +15,10 @@
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 
+if [[ "$prefix" = "NONE" ]]; then
+  prefix=$ac_default_prefix
+fi
+
 dnl
 dnl Required headers
 dnl
@@ -104,6 +108,62 @@
 	AC_MSG_RESULT(no)
 fi
 
+AC_ARG_WITH(pppd, AC_HELP_STRING([--with-pppd=DIR], [Specify path to pppd.h (and patchlevel.h)]))
+AC_ARG_WITH(pppd-version, AC_HELP_STRING([--with-pppd-version=VERSION], [Version of pppd.h]))
+if test "z$with_pppd" != "z"; then
+  AC_MSG_CHECKING([for $with_pppd/pppd.h])
+  if test -f "$with_pppd/pppd.h"; then
+    PPPD_CFLAGS="-I $with_pppd"
+    PPPD_VERSION=`grep VERSION $with_pppd/patchlevel.h | awk '{print $3}' | sed -e 's/\s*"\s*//g'`
+    found_pppd_headers=yes
+    AC_MSG_RESULT(found version $PPPD_VERSION)
+  else
+    AC_MSG_ERROR(not found in $with_pppd)
+  fi 
+fi
+
+if test "z$found_pppd_headers" = "z"; then
+  AC_MSG_CHECKING([for pppd.h under $prefix/include])
+  find_pppd_h=`find $prefix/include -name pppd.h | xargs | awk '{print $1}'`
+  if echo $find_pppd_h | grep pppd.h; then
+    with_pppd=`dirname $find_pppd_h`
+    PPPD_CFLAGS="-I $with_pppd"
+    PPPD_VERSION=`grep VERSION $with_pppd/patchlevel.h | awk '{print $3}' | sed -e 's/\s*"\s*//g'`
+    found_pppd_headers=yes
+    AC_MSG_RESULT(found version $PPPD_VERSION)
+  else
+    AC_MSG_RESULT(not found)
+  fi
+fi
+
+if test "z$found_pppd_headers" = "z"; then
+  if test "z$PPPD_VERSION" = "z"; then
+    AC_MSG_RESULT(Couldn't find pppd.h trying to determine pppd version to use in tree headers)
+    ##### Find PPPD executable
+    AC_CHECK_PROG(PPPD,pppd,pppd)
+    if test "z$PPPD" = "z"; then
+        AC_MSG_ERROR(Cannot compile without pppd)
+    fi
+    AC_MSG_RESULT(pppd version not found attempting to run 'pppd --version')
+    PPPD_VERSION=`$PPPD --version 2>&1 | awk '{print $3}'`
+    if test "z$PPPD_VERSION" = "z"; then
+        AC_MSG_ERROR(Couldn't determine the version of your pppd package.)
+    fi
+  fi
+
+  if ! test -d "src/external/$PPPD_VERSION"; then
+    AC_MSG_ERROR(pppd headers could not be found)
+  fi
+
+  AC_MSG_RESULT(Found in source headers for pppd version $PPPD_VERSION)
+  PPPD_CFLAGS="-I ./external/$PPPD_VERSION"
+fi
+
+pppdplugindir="$libdir/pppd/$PPPD_VERSION"
+AC_SUBST(pppdplugindir)
+AC_SUBST(PPPD_CFLAGS)
+
+
 AC_OUTPUT([
 Makefile
 src/Makefile
Index: src/nm-pptp-service-pppd-plugin.c
===================================================================
--- src/nm-pptp-service-pppd-plugin.c	(revision 2712)
+++ src/nm-pptp-service-pppd-plugin.c	(working copy)
@@ -22,6 +22,11 @@
 #include "pppd/pppd.h"
 #include "pppd/fsm.h"
 #include "pppd/ipcp.h"
+#ifndef PPPD_VERSION
+  #ifdef VERSION
+    #define PPPD_VERSION VERSION
+  #endif
+#endif
 
 #include <glib.h>
 #include <stdlib.h>
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 2712)
+++ src/Makefile.am	(working copy)
@@ -4,6 +4,7 @@
 	$(DBUS_CFLAGS)						\
 	$(GTHREAD_CFLAGS)					\
 	$(NETWORK_MANAGER_CFLAGS)				\
+	$(PPPD_CFLAGS)						\
 	-Wall							\
 	-DDBUS_API_SUBJECT_TO_CHANGE				\
 	-DG_DISABLE_DEPRECATED					\
@@ -14,27 +15,34 @@
 	-DLIBDIR=\""$(libdir)"\"				\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DLOCALSTATEDIR=\""$(localstatedir)"\"		 	\
-	-DDATADIR=\"$(datadir)\"				\
-	-fPIC
+	-DDATADIR=\"$(datadir)\"
 
-bin_PROGRAMS = nm-pptp-service nm-pptp-service-pppd-plugin.so
+bin_PROGRAMS = nm-pptp-service
 
 nm_pptp_service_SOURCES =				\
 				nm-pptp-service.c	\
 				nm-pptp-service.h	\
 				nm-utils.c		\
 				nm-utils.h		\
-				pppd/fsm.h		\
-				pppd/ipcp.h		\
-				pppd/patchlevel.h 	\
-				pppd/pppd.h
+				external/2.4.3/pppd/patchlevel.h \
+				external/2.4.3/pppd/ipcp.h \
+				external/2.4.3/pppd/pppd.h \
+				external/2.4.3/pppd/fsm.h \
+				external/2.4.4/pppd/patchlevel.h \
+				external/2.4.4/pppd/ipcp.h \
+				external/2.4.4/pppd/pppd.h \
+				external/2.4.4/pppd/fsm.h \
+				external/2.4.4b1/pppd/patchlevel.h \
+				external/2.4.4b1/pppd/ipcp.h \
+				external/2.4.4b1/pppd/pppd.h \
+				external/2.4.4b1/pppd/fsm.h
 
-
 nm_pptp_service_LDADD = 						\
 				$(DBUS_LIBS)				\
 				$(GTHREAD_LIBS)				\
 				$(NETWORK_MANAGER_LIBS)
 
+pppdplugin_PROGRAMS = nm-pptp-service-pppd-plugin.so
 
 nm_pptp_service_pppd_plugin_so_SOURCES = 		\
 				nm-pptp-service-pppd-plugin.c
@@ -42,6 +50,9 @@
 nm_pptp_service_pppd_plugin_so_LDFLAGS = 		\
                 -shared
 
+nm_pptp_service_pppd_plugin_so_CFLAGS = 		\
+		-fPIC
+
 nm_pptp_service_pppd_plugin_so_LDADD = 		\
 				$(DBUS_LIBS)				\
 				$(GTHREAD_LIBS)				\

Attachment: signature.asc
Description: This is a digitally signed message part.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]