chiark / gitweb /
changelog: Finalise 2.2
[innduct.git] / configure.ac
index 04072f1025da2522932a0d45f2e3bd64987cbee8..21ad8245eb41140abf64d4e3e504a30497fa50c8 100644 (file)
@@ -1,34 +1,48 @@
 #  innduct
 #  tailing reliable realtime streaming feeder for inn
-#  configure.in
+#  configure.ac
 #
-#  Copyright (C) 2010 Ian Jackson <ijackson@chiark.greenend.org.uk>
-# 
-#  This program is free software: you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-# 
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-# 
-#  You should have received a copy of the GNU General Public License
-#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-#  (I believe that when you compile and link this as part of the inn2
-#  build, with the Makefile runes I have provided, all the libraries
-#  and files which end up included in innduct are licence-compatible
-#  with GPLv3.  If not then please let me know.  -Ian Jackson.)
+#  Copyright Ian Jackson <ijackson@chiark.greenend.org.uk>
+#  and contributors; see LICENCE.txt.
+#  SPDX-License-Identifier: GPL-3.0-or-later
 
-AC_INIT([innduct], [1.0], [duct.c])
+AC_INIT([innduct],[1.0],[ijackson@chiark.greenend.org.uk])
 AC_CONFIG_AUX_DIR(autoconf-aux)
 AM_INIT_AUTOMAKE([])
 
 AC_PROG_CC
 
+LDFLAGS="$LDFLAGS -L/usr/lib/news"
 AC_CHECK_HEADERS(sys/inotify.h)
 
+LIBS="-Wl,-Bdynamic $LIBS"
+
+# Possibly, we could link dynamically.  But the ABI stability of
+# the inn libraries is questionable.  On Debian only the .a files
+# are in inn2-dev.  The .so's are in inn2.deb, which isn't depended on
+# by inn2-dev, and which doesn't have a # shlibs file for them.
+# So right now we can't sensibly link dynamically.
+#
+# So we pass -Bstatic.
+#
+# Recall that LIBS is generally *prepended* to.  So we need to
+# temporarily put -Bstatic in LDFLAGS so that it ends up before
+# the actual libraries in the following tests.
+LDFLAGS="$LDFLAGS -Wl,-Bstatic"
+
+AC_SEARCH_LIBS(NNTPconnect, [inn], [],[
+  AC_MSG_ERROR([failed to find libinn])
+])
+AC_SEARCH_LIBS(SMinit, [innstorage storage], [],[
+  AC_MSG_ERROR([Failed to find INN storage library (-linnstorage, -lstorage)])
+])
+
+# Now move the -Bstatic to LIBS where it belongs.
+# LDFLAGS and LIBS are automatically included in link lines by automake
+# so nothing is needed in Makefile.am.)
+LDFLAGS="${LDFLAGS% -Wl,-Bstatic}"
+LIBS="-Wl,-Bstatic $LIBS"
+
 AM_CONFIG_HEADER(config.h)
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT