[PATCH ocserv 5/5] Allow linking with system libopts if installed

Mike Miller mtmiller at ieee.org
Sun Jul 21 00:16:23 EDT 2013


---
 Makefile.am     |  6 +++++-
 configure.ac    |  2 --
 src/Makefile.am | 12 +++++++++---
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 6883823..6810efd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,10 @@
 EXTRA_DIST = m4/lib-link.m4 LICENSE
 
-SUBDIRS = gl libopts src doc tests
+SUBDIRS = gl
+if NEED_LIBOPTS
+SUBDIRS += libopts
+endif
+SUBDIRS += src doc tests
 
 ACLOCAL_AMFLAGS = -I gl/m4 -I libopts/m4 -I m4
 
diff --git a/configure.ac b/configure.ac
index e8da5ec..344032e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,8 +141,6 @@ LIBS="$oldlibs"
 
 AM_CONDITIONAL(PCL, test "$pcl_enabled" = yes)
 
-enable_local_libopts=yes
-NEED_LIBOPTS_DIR=true
 LIBOPTS_CHECK([libopts])
 
 AC_CONFIG_FILES([
diff --git a/src/Makefile.am b/src/Makefile.am
index 0686613..4752d49 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,13 @@
 SUBDIRS =
 
 AM_CPPFLAGS = -I$(srcdir)/../gl/ -I$(builddir)/../gl/ \
-	-I$(srcdir)/ -I$(builddir)/../ -I$(srcdir)/../libopts
+	-I$(srcdir)/ -I$(builddir)/../ $(LIBOPTS_CFLAGS)
+
+if NEED_LIBOPTS
+LIBOPTS = ../libopts/libopts.a
+else
+LIBOPTS = $(LIBOPTS_LDADD)
+endif
 
 EXTRA_DIST = ccan/licenses/BSD-MIT version.def.in \
 	ccan/licenses/CC0 ccan/licenses/LGPL-2.1
@@ -26,7 +32,7 @@ ocserv_SOURCES = main.c main-auth.c worker-vpn.c worker-auth.c tlslib.c \
 
 ocserv_SOURCES += ocserv-args.def ocserv-args.c ocserv-args.h
 
-ocserv_LDADD = ../gl/libgnu.a ../libopts/libopts.a
+ocserv_LDADD = ../gl/libgnu.a $(LIBOPTS)
 ocserv_LDADD += $(LIBGNUTLS_LIBS) $(GDBM_LIBS) $(PAM_LIBS) $(LIBUTIL) \
 	$(LIBSECCOMP) $(LIBWRAP) $(LIBCRYPT) 
 	
@@ -43,7 +49,7 @@ ocserv-args.c ocserv-args.h: $(srcdir)/ocserv-args.def
 
 ocpasswd_SOURCES = ocpasswd.c ocpasswd-args.def ocpasswd-args.c ocpasswd-args.h
 
-ocpasswd_LDADD = ../gl/libgnu.a ../libopts/libopts.a
+ocpasswd_LDADD = ../gl/libgnu.a $(LIBOPTS)
 ocpasswd_LDADD += $(LIBGNUTLS_LIBS) $(LIBCRYPT)
 
 ocpasswd-args.c ocpasswd-args.h: $(srcdir)/ocpasswd-args.def
-- 
1.8.3.2



More information about the openconnect-devel mailing list