Skip to content

Commit

Permalink
Switch to using autohate :(
Browse files Browse the repository at this point in the history
I really didn't want to do this, but much as I hate libtool it is the
easiest way to portably build shared libraries, and we really do need
to build libopenconnect as a shared library. And having used libtool
we might as well concede entirely and use autoconf/automake.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 27, 2011
1 parent 423eee0 commit 25a6dce
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 156 deletions.
152 changes: 0 additions & 152 deletions Makefile

This file was deleted.

56 changes: 56 additions & 0 deletions Makefile.am
@@ -0,0 +1,56 @@


lib_LTLIBRARIES = libopenconnect.la
bin_PROGRAMS = openconnect
man8_MANS = openconnect.8

openconnect_SOURCES = xml.c main.c dtls.c cstp.c mainloop.c tun.c

openconnect_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS)
openconnect_LDADD = libopenconnect.la $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS)

libopenconnect_la_SOURCES = ssl.c http.c version.c auth.c library.c
libopenconnect_la_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS)
libopenconnect_la_LIBADD = $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS)
libopenconnect_la_LDFLAGS = -version-number 1:2
noinst_HEADERS = openconnect-internal.h openconnect.h
include_HEADERS = openconnect.h

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = openconnect.pc

EXTRA_DIST = version.sh openconnect.html openconnect.8 COPYING.LGPL

DISTCLEANFILES = $(pkgconfig_DATA) version.c

version.c: $(filter-out version.c, $(libopenconnect_la_SOURCES)) \
$(openconnect_SOURCES) Makefile.am configure.ac \
openconnect.h openconnect-internal.h version.sh \
$(wildcard .git/index .git/refs/tags)
@./version.sh

dist-hook:
@git update-index --refresh --unmerged
@if git diff-index --name-only HEAD | grep ^ ; then \
echo Uncommitted changes in above files; exit 1; fi

ifdef VERSION
tag:
@git update-index --refresh --unmerged
@if git diff-index --name-only HEAD | grep ^ ; then \
echo Uncommitted changes in above files; exit 1; fi
@sed 's/AC_INIT.*/AC_INIT(openconnect, $(VERSION))/' -i configure.ac
@sed 's/^v=.*/v="v$(VERSION)"/' -i version.sh
@( echo "s/Last modified: .*/Last modified: $(shell date)/" ;\
echo '/ <LI><B>OpenConnect HEAD/a\' ;\
echo ' <UL>\' ;\
echo ' <LI><I>No changelog entries yet</I></LI>\';\
echo ' </UL><BR>\' ; echo ' </LI>\' ;\
echo ' <LI><B><A HREF="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a></B> &mdash; $(shell date +%Y-%m-%d)<BR>' ) | \
sed -f - -i openconnect.html
# stupid syntax highlighting '
@git commit -s -m "Tag version $(VERSION)" configure.ac version.sh openconnect.html
@git tag v$(VERSION)
@./autogen.sh

endif
6 changes: 6 additions & 0 deletions autogen.sh
@@ -0,0 +1,6 @@
#!/bin/sh

aclocal && \
libtoolize --automake --copy --force && \
automake --foreign --add-missing && \
autoconf
43 changes: 43 additions & 0 deletions configure.ac
@@ -0,0 +1,43 @@

AC_INIT(openconnect, 3.02)
PKG_PROG_PKG_CONFIG
AC_LANG_C
AM_INIT_AUTOMAKE([foreign])

AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl],
[Location of OpenSSL build dir]),
[OPENSSL_CFLAGS="-I${with_openssl}/include"
OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
AC_ENABLE_STATIC
AC_DISABLE_SHARED],
[PKG_CHECK_MODULES(OPENSSL, openssl)
AC_ENABLE_SHARED
AC_DISABLE_STATIC])

AC_PROG_LIBTOOL

PKG_CHECK_MODULES(LIBXML2, libxml-2.0)

libproxy_hdr=no
AC_CHECK_HEADER([libproxy.h],
[libproxy_hdr='"libproxy.h"'],
[AC_CHECK_HEADER([proxy.h],
[libproxy_hdr='"libproxy.h"'])])
if (test "$libproxy_hdr" != "no"); then
AC_DEFINE([LIBPROXY_HDR], $libproxy_hdr)
PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, AC_SUBST(LIBPROXY_PC, libproxy-1.0), dummy=yes)
fi

AC_CHECK_HEADER([if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
[AC_CHECK_HEADER([linux/if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
[AC_CHECK_HEADER([net/if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
[AC_CHECK_HEADER([net/tun/if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])

AC_OUTPUT(Makefile openconnect.pc)
12 changes: 8 additions & 4 deletions openconnect.pc.in
@@ -1,8 +1,12 @@
libdir=LIBDIR
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@


Name: openconnect
Description: OpenConnect VPN client
Version: VERSION
Requires: LIBPROXY zlib openssl libxml-2.0
Version: @VERSION@
Requires: @LIBPROXY_PC@ zlib openssl libxml-2.0
Libs: -L${libdir} -lopenconnect
Cflags:
Cflags: -I${includedir}

0 comments on commit 25a6dce

Please sign in to comment.