fix issue #38: install, uninstall, libtool, configureoutsidesrcdir,

the dist compiles.  library version set to 0:0:0.
This commit is contained in:
W.C.A. Wijngaards 2013-11-29 15:41:06 +01:00
parent d9afcf760b
commit 69c6d0694b
8 changed files with 134 additions and 17 deletions

View File

@ -20,6 +20,14 @@ default:
all : default
install: all
cd src && $(MAKE) $@
cd doc && $(MAKE) $@
uninstall:
cd src && $(MAKE) $@
cd doc && $(MAKE) $@
doc:
cd doc && $(MAKE) $@
@ -44,13 +52,16 @@ $(distdir):
mkdir -p $(distdir)/src/getdns
mkdir -p $(distdir)/src/test
mkdir -p $(distdir)/src/example
mkdir -p $(distdir)/doc
cp $(srcdir)/configure.ac $(distdir)
cp $(srcdir)/configure $(distdir)
cp $(srcdir)/Makefile.in $(distdir)
cp $(srcdir)/install-sh $(distdir)
cp $(srcdir)/config.sub $(distdir)
cp $(srcdir)/config.guess $(distdir)
cp $(srcdir)/ltmain.sh $(distdir)
cp $(srcdir)/src/Makefile.in $(distdir)/src
cp $(srcdir)/src/Doxyfile.in $(distdir)/src
cp $(srcdir)/src/*.[ch] $(distdir)/src
cp $(srcdir)/src/getdns/*.in $(distdir)/src/getdns
cp $(srcdir)/src/getdns/*.h $(distdir)/src/getdns
@ -59,6 +70,8 @@ $(distdir):
cp $(srcdir)/src/test/*.can $(distdir)/src/test
cp $(srcdir)/src/example/Makefile.in $(distdir)/src/example
cp $(srcdir)/src/example/*.c $(distdir)/src/example
cp $(srcdir)/doc/Makefile.in $(distdir)/doc
cp $(srcdir)/doc/*.in $(distdir)/doc
distcheck: $(distdir).tar.gz
gzip -cd $(distdir).tar.gz | tar xvf -

View File

@ -49,18 +49,25 @@ External Dependencies
External dependencies are linked outside the getdns API build tree (we rely on configure to find them). We would like to keep the dependency tree short.
* [libevent](http://libevent.org) version 2.0.21 stable
Sometimes called libevent2
* [libldns from NL](https://www.nlnetlabs.nl/projects/ldns/) version 1.6.16 (ldns may require openssl headers and libraries)
* [libunbound from NL](http://www.nlnetlabs.nl/projects/unbound/) svn revision 3012, configure must be run with the --with-libevent option (recommended to also use --with-libunbound-only).
* [libexpat](http://expat.sourceforge.net/) for libunbound.
* [libidn from the FSF](http://www.gnu.org/software/libidn/) version 1.
* Doxygen is used to generate documentation, while this is not technically necessary for the build it makes things a lot more pleasant.
Assuming that the getdns sources are in a diretory named getdns in your home directory, to build libunbound (note that the svn checkout may take a while):
You have to install the library and also the library-devel (or -dev) for your
package management system to install the compile time files. If you checked
out our git; the configure script is built with autoreconf --install.
Assuming that the getdns sources are in a diretory named getdns in your home directory, to build libunbound:
```
# mkdir unbound
# cd unbound
# svn checkout -r 3012 http://unbound.nlnetlabs.nl/svn
# cd svn/trunk
# svn export -r 3012 http://unbound.nlnetlabs.nl/svn/trunk
# cd trunk
# ./configure --with-libevent --with-libunbound-only
### add --disable-gost --disable-ecdsa if elliptic curves are disabled for you.
# make
# make install
```

View File

@ -5,7 +5,7 @@
# @configure_input@
#
AC_PREREQ([2.68])
AC_PREREQ([2.56])
AC_INIT([getdns], [0.1.0], [melinda.shore@nomountain.net])
AC_CONFIG_SRCDIR([src/getdns/getdns.h])
# AM_INIT_AUTOMAKE
@ -24,6 +24,34 @@ esac
AC_PROG_CC
AC_PROG_CPP
# always use ./libtool unless override from commandline (libtool=mylibtool)
if test -z "$libtool"; then
libtool="`pwd`/libtool"
fi
AC_SUBST(libtool)
AC_PROG_LIBTOOL
AC_PROG_INSTALL
dnl Add option to disable the evil rpath. Check whether to use rpath or not.
dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool.
AC_DEFUN([ACX_ARG_RPATH],
[
AC_ARG_ENABLE(rpath,
[ --disable-rpath disable hardcoded rpath (default=enabled)],
enable_rpath=$enableval, enable_rpath=yes)
if test "x$enable_rpath" = xno; then
dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.])
AC_CONFIG_COMMANDS([disable-rpath], [
sed < libtool > libtool-2 \
's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
mv libtool-2 libtool
chmod 755 libtool
libtool="./libtool"
])
fi
])
ACX_ARG_RPATH
# Checks for libraries.
found_all_libs=1
AC_MSG_NOTICE([Checking for dependencies libevent, ldns])
@ -66,6 +94,4 @@ AC_CONFIG_FILES([Makefile src/Makefile src/getdns/Makefile src/example/Makefile
if [ test -n "$DOXYGEN" ]
then AC_CONFIG_FILES([src/Doxyfile])
fi
AC_CONFIG_SUBDIRS([src/ src/getdns/ src/example/ src/test/ doc/])
AC_OUTPUT

View File

@ -1 +0,0 @@
/usr/local/share/automake-1.12/depcomp

View File

@ -10,21 +10,42 @@ distdir = $(tarname)-$(version)
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
# datarootdir is here to please some checkers
datarootdir=@datarootdir@
mandir = @mandir@
INSTALL = @INSTALL@
srcdir = @srcdir@
VPATH = @srcdir@
DOCDIRS = html latex man
MANPAGES = libgetdns.3 getdns_address.3
default: all
all: doc
doc:
doc: $(MANPAGES)
cd ../src && doxygen
libgetdns.3: libgetdns.3.in
cp $< $@
getdns_address.3: getdns_address.3.in
cp $< $@
install: $(MANPAGES)
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
$(INSTALL) -m 644 libgetdns.3 $(DESTDIR)$(mandir)/man3
$(INSTALL) -m 644 getdns_address.3 $(DESTDIR)$(mandir)/man3
uninstall:
rm -f $(DESTDIR)$(mandir)/man3/libgetdns.3
rm -f $(DESTDIR)$(mandir)/man3/getdns_address.3
clean:
rm -rf $(DOCDIRS)
rm -rf $(DOCDIRS) $(MANPAGES)
distclean : clean
rm -f Makefile config.status config.log

View File

@ -7,9 +7,23 @@ version = @PACKAGE_VERSION@
tarname = @PACKAGE_TARNAME@
distdir = $(tarname)-$(version)
# current:revision:age
# (binary-api-number):(which-binary-api-version):(how-many-nrs-backwardscompat)
# if api unchanged: no changes
# if api broken: current++ ; revision = 0; age = 0
# if programs compiled against existing library work and link with new
# version of library with new binary api: revision++; age++
libversion = 0:0:0
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
# datarootdir is here to please some checkers
datarootdir=@datarootdir@
INSTALL = @INSTALL@
LIBTOOL = @libtool@
srcdir = @srcdir@
VPATH = @srcdir@
@ -17,27 +31,44 @@ VPATH = @srcdir@
CC=gcc
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I/usr/local/include -std=c99
LDFLAGS=@LDFLAGS@ -levent_core -lldns -lunbound -lidn
# PROGRAMS=example-simple-answers example-tree example-all-functions example-synchronous
GETDNS_OBJ=sync.lo context.lo list.lo dict.lo convert.lo general.lo \
hostname.lo service.lo request-internal.lo validate_dnssec.lo \
util-internal.lo getdns_error.lo
.SUFFIXES: .c .o .a .lo .h
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
.c.lo:
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
default: all
all: libgetdns.so
all: libgetdns.la
cd test && $(MAKE) $@
cd example && $(MAKE) $@
libgetdns.so: sync.o context.o list.o dict.o convert.o general.o hostname.o service.o request-internal.o \
validate_dnssec.o util-internal.o getdns_error.o
$(CC) $(CFLAGS) -shared -o $@ $? $(LDFLAGS)
install: libgetdns.la
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/getdns
$(INSTALL) -m 644 $(srcdir)/getdns/getdns.h $(DESTDIR)$(includedir)/getdns/getdns.h
$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install cp libgetdns.la $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
uninstall:
rm -f $(DESTDIR)$(includedir)/getdns/getdns.h
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libgetdns.la
libgetdns.la: $(GETDNS_OBJ)
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined
clean:
cd test && $(MAKE) $@
cd example && $(MAKE) $@
rm -f *.o $(PROGRAMS) libgetdns.so
rm -f *.o *.lo $(PROGRAMS) libgetdns.la
rm -rf .libs
distclean : clean
cd test && $(MAKE) $@

View File

@ -10,13 +10,14 @@ distdir = $(tarname)-$(version)
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
LIBTOOL = @libtool@
srcdir = @srcdir@
VPATH = @srcdir@
CC=gcc
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I$(srcdir)/../ -I/usr/local/include -std=c99
LDFLAGS=@LDFLAGS@ -L. -L$(srcdir)/.. -L/usr/local/lib
LDFLAGS=@LDFLAGS@ -L. -L.. -L/usr/local/lib
LDLIBS=-lgetdns -lldns -levent_core -lunbound
PROGRAMS=example_simple_answers example_tree example_all_functions example_synchronous
@ -29,8 +30,21 @@ default: all
all: $(PROGRAMS)
example_simple_answers: example_simple_answers.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_simple_answers.o
example_tree: example_tree.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_tree.o
example_all_functions: example_all_functions.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_all_functions.o
example_synchronous: example_synchronous.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_synchronous.o
clean:
rm -f *.o $(PROGRAMS)
rm -rf .libs
distclean : clean
rm -f Makefile config.status config.log

View File

@ -10,13 +10,14 @@ distdir = $(tarname)-$(version)
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
LIBTOOL = @libtool@
srcdir = @srcdir@
VPATH = @srcdir@
CC=gcc
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I$(srcdir)/../ -I/usr/local/include -std=c99 $(cflags)
LDFLAGS=@LDFLAGS@ -L. -L$(srcdir)/.. -L/usr/local/lib
LDFLAGS=@LDFLAGS@ -L. -L.. -L/usr/local/lib
LDLIBS=-lgetdns -lldns -levent_core -lunbound
PROGRAMS=tests_dict tests_list tests_stub_async tests_stub_sync
@ -30,15 +31,20 @@ default: all
all: $(PROGRAMS)
tests_dict: tests_dict.o testmessages.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.o testmessages.o
tests_list: tests_list.o testmessages.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.o testmessages.o
tests_stub_async: tests_stub_async.o testmessages.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.o testmessages.o
tests_stub_sync: tests_stub_sync.o
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.o
clean:
rm -f *.o $(PROGRAMS)
rm -rf .libs
distclean : clean
rm -f Makefile config.status config.log