chiark / gitweb /
squash! Use autoconf to find -linnstorage etc., and link statically
[innduct.git] / configure.ac
1 #  innduct
2 #  tailing reliable realtime streaming feeder for inn
3 #  configure.in
4 #
5 #  Copyright (C) 2010 Ian Jackson <ijackson@chiark.greenend.org.uk>
6
7 #  This program is free software: you can redistribute it and/or modify
8 #  it under the terms of the GNU General Public License as published by
9 #  the Free Software Foundation, either version 3 of the License, or
10 #  (at your option) any later version.
11
12 #  This program is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #  GNU General Public License for more details.
16
17 #  You should have received a copy of the GNU General Public License
18 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 #  (I believe that when you compile and link this as part of the inn2
21 #  build, with the Makefile runes I have provided, all the libraries
22 #  and files which end up included in innduct are licence-compatible
23 #  with GPLv3.  If not then please let me know.  -Ian Jackson.)
24
25 AC_INIT([innduct],[1.0],[duct.c])
26 AC_CONFIG_AUX_DIR(autoconf-aux)
27 AM_INIT_AUTOMAKE([])
28
29 AC_PROG_CC
30
31 LDFLAGS="$LDFLAGS -L/usr/lib/news"
32 AC_CHECK_HEADERS(sys/inotify.h)
33
34 LIBS="-Wl,-Bdynamic $LIBS"
35
36 # Possibly, we could link dynamically.  But the ABI stability of
37 # the inn libraries is questionable.  On Debian only the .a files
38 # are in inn2-dev.  The .so's are in inn2.deb, which isn't depended on
39 # by inn2-dev, and which doesn't have a # shlibs file for them.
40 # So right now we can't sensibly link dynamically.
41 #
42 # So we pass -Bstatic.
43 #
44 # Recall that LIBS is generally *prepended* to.  So we need to
45 # temporarily put -Bstatic in LDFLAGS so that it ends up before
46 # the actual libraries in the following tests.
47 LDFLAGS="$LDFLAGS -Wl,-Bstatic"
48
49 AC_SEARCH_LIBS(NNTPconnect, [inn], [],[
50   AC_MSG_ERROR([failed to find libinn])
51 ])
52 AC_SEARCH_LIBS(SMinit, [innstorage storage], [],[
53   AC_MSG_ERROR([Failed to find INN storage library (-linnstorage, -lstorage)])
54 ])
55
56 # Now move the -Bstatic to LIBS where it belongs.
57 # LDFLAGS and LIBS are automatically included in link lines by automake
58 # so nothing is needed in Makefile.am.)
59 LDFLAGS="${LDFLAGS% -Wl,-Bstatic}"
60 LIBS="-Wl,-Bstatic $LIBS"
61
62 AM_CONFIG_HEADER(config.h)
63 AC_CONFIG_FILES([Makefile])
64 AC_OUTPUT