From: Tomek Mrugalski Date: Thu, 14 Aug 2014 16:24:14 +0000 (+0200) Subject: [3421] Removed host and obsolete bind10/rpath/boost macros. X-Git-Tag: trac3482_base~32^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60df6f7af9aa4548cb379720c4fb27bfe90486bc;p=thirdparty%2Fkea.git [3421] Removed host and obsolete bind10/rpath/boost macros. --- diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index ef437ebf31..0000000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = host - -# Make sure macros under m4 will be included -ACLOCAL_AMFLAGS = -I m4 diff --git a/examples/README b/examples/README index e8e7953c5d..1de7f670f4 100644 --- a/examples/README +++ b/examples/README @@ -1,6 +1,6 @@ This is the top directory for sample programs that can be developed -using public BIND 10 libraries outside of the BIND 10 project. It's -intended to be built with installed BIND 10 header files and library +using public Kea libraries outside of the Kea project. It's +intended to be built with installed Kea header files and library objects, so it's not a target of the main build tree, and does not refer to any other part of the BIND 10 source tree that contains this directory. @@ -10,38 +10,5 @@ provide a sample configure.ac and Makefile.am files for GNU automake environments with helper autoconf macros to detect the availability and location of BIND 10 header files and library objects. -You can use the configure.ac and Makefile.am files with macros under -the "m4" subdirectory as a template for your own project. The key is -to call the AX_ISC_BIND10 function (as the sample configure.ac does) -from your configure.ac. Then it will check the availability of -necessary stuff and set some corresponding AC variables. You can then -use the resulting variables in your Makefile.in or Makefile.am. - -If you use automake, don't forget adding the following line to the top -level Makefile.am: - -ACLOCAL_AMFLAGS = -I m4 - -This is necessary to incorporate the helper macro definitions. - -If you don't use automake but autoconf, make sure to add the following -to the configure.ac file: - -sinclude(m4/ax_boost_include.m4) -sinclude(m4/ax_isc_bind10.m4) -(and same for other m4 files as they are added under m4/) - -On some systems, especially if you have installed the BIND 10 -libraries in an uncommon path, programs linked with the BIND 10 -library may not work at run time due to the "missing" shared library. -Normally, you should be able to avoid this problem by making sure -to invoking the program explicitly specifying the path to the library, -e.g., "LD_LIBRARY_PATH=/usr/local/lib/bind10 ./my_bind10_app", or -you may not even notice the issue if you have installed BIND 10 -library in a common library path on your system (sometimes you may -still need to run ldconfig(8) beforehand). Another option is to embed -the path to the library in your program. While this approach is -controversial, and some people rather choose the alternatives, we -provide a helper tool in case you want to use this option: see the -lines using BIND10_RPATH in the sample configure.ac file of this -directory. +This directory is currently empty, but we expect to move example +code here soon. diff --git a/examples/configure.ac b/examples/configure.ac deleted file mode 100644 index 850e7ef4a9..0000000000 --- a/examples/configure.ac +++ /dev/null @@ -1,43 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.59]) -AC_INIT(bind10-examples, 20120817, bind10-dev@isc.org) -AC_CONFIG_SRCDIR([README]) -AM_INIT_AUTOMAKE -AC_CONFIG_HEADERS([config.h]) - -# Checks for programs. -AC_PROG_CXX -AC_LANG([C++]) - -# Checks for BIND 10 headers and libraries -AX_ISC_BIND10 - -# We use -R option etc so the resulting program will be more likekly to -# "just work" by default. Embedding a specific library path is a controversial -# practice, though; if you don't like it you can remove the following setting, -# or use the --disable-rpath option. -if test "x$BIND10_RPATH" != "x"; then - LDFLAGS="$LDFLAGS $BIND10_RPATH" -fi - -# For the example host program, we require some socket API library -# and the BIND 10 DNS library. - -# In practice, these are specific to Solaris, but wouldn't do any harm for -# others except for the checking overhead. -AC_SEARCH_LIBS(inet_pton, [nsl]) -AC_SEARCH_LIBS(recvfrom, [socket]) - -if test "x$BIND10_DNS_LIB" = "x"; then - AC_MSG_ERROR([unable to find BIND 10 DNS library needed to build 'host']) -fi - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL - -AC_CONFIG_FILES([Makefile - host/Makefile]) - -AC_OUTPUT diff --git a/examples/host/.gitignore b/examples/host/.gitignore deleted file mode 100644 index 01ef357a26..0000000000 --- a/examples/host/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/b10-host -/b10-host.1 diff --git a/examples/host/Makefile.am b/examples/host/Makefile.am deleted file mode 100644 index dbd57a2821..0000000000 --- a/examples/host/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(BIND10_CPPFLAGS) - -bin_PROGRAMS = b10-host -b10_host_SOURCES = host.cc -b10_host_LDFLAGS = ${BIND10_LDFLAGS} -b10_host_LDADD = ${BIND10_DNS_LIB} diff --git a/examples/host/README b/examples/host/README deleted file mode 100644 index 5cc4068257..0000000000 --- a/examples/host/README +++ /dev/null @@ -1,4 +0,0 @@ -Rewriting host(1) in C++ from scratch using BIND 10's libdns++. - -The bugs and incompatibilities are listed in the manual page -and in the source code. diff --git a/examples/host/b10-host.xml b/examples/host/b10-host.xml deleted file mode 100644 index a17ef67a56..0000000000 --- a/examples/host/b10-host.xml +++ /dev/null @@ -1,196 +0,0 @@ -]> - - - - - - - May 4, 2011 - - - - b10-host - 1 - BIND10 - - - - b10-host - DNS lookup utility - - - - - 2011 - Internet Systems Consortium, Inc. ("ISC") - - - - - - b10-host - - - - - - - - name - - - - - - DESCRIPTION - - The b10-host utility does DNS lookups. - Its initial goal is to be a - host - 1 - clone, but also add a few features useful for BIND 10 development - testing. - - - - By default, it looks up the A, AAAA, and MX record sets for the - name. - Optionally, you may select a name server to query against by adding - the server argument. - - - - - OPTIONS - - The arguments are as follows: - - - - - - - Enable verbose mode and do a query for type ANY. - (If the option is also set, then the - ANY query is not done, but it still uses verbose mode.) - - - - - - - Define the class for the query. - The default is IN (Internet). - - - - - - - - Enable verbose output mode, including elapsed time in - milliseconds. - Verbose mode shows the header, question, answer, authority, - and additional sections (if provided). - (Same as .) - - - - - - - Select an alternative port for the query. - This may be a number or a service name. - The default is 53 (domain). - This is not a standard feature of - host - 1. - - - - - - - Disable recursive processing by not setting the - Recursion Desired flag in the query. - - - - - - - Select a specific resource record type for the query. - By default, it looks up the A, AAAA, and MX record sets. - - (This overrides the option.) - - - - - - - Same as option. - - - - - - - - - COMPATIBILITY / BUGS - - b10-host does not do reverse lookups by - default yet (by detecting if name is a IPv4 or IPv6 address). - - - - Unknown class or type - causes b10-host to Abort. - - - - Not all types are supported yet for formatting. - Not all switches are supported yet. - - - - It doesn't use /etc/resolv.conf at this time. - The default name server used is 127.0.0.1. - - - - is not a standard feature. - - - - - HISTORY - - The C++ version of b10-host was started in - October 2009 by Jeremy C. Reed of ISC. - Its usage and output were based on the standard host - command. - - - diff --git a/examples/host/host.cc b/examples/host/host.cc deleted file mode 100644 index ebfa1d8cff..0000000000 --- a/examples/host/host.cc +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (C) 2010-2011 Internet Systems Consortium, Inc. ("ISC") -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -// PERFORMANCE OF THIS SOFTWARE. - -// host rewritten in C++ using Kea DNS library - -#include -#include // for getaddrinfo -#include // for gettimeofday -#include // networking functions and definitions on FreeBSD - -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace isc::dns; -using namespace isc::util; - -namespace { -char* dns_type = NULL; // not set, so A, AAAA, MX -const char* server = "127.0.0.1"; -const char* server_port = "53"; -const char* dns_class = "IN"; -bool verbose = false; -bool dns_any = false; -int first_time = 1; -bool recursive_bit = true; -struct timeval before_time, after_time; - -int -host_lookup(const char* const name, const char* const dns_class, - const char* const type, bool any) { - - Message msg(Message::RENDER); - - msg.setQid(0); // does this matter? - - // TODO: add switch for this - msg.setOpcode(Opcode::QUERY()); - msg.setRcode(Rcode::NOERROR()); - if (recursive_bit) { - msg.setHeaderFlag(Message::HEADERFLAG_RD); // set recursive bit - } - - msg.addQuestion(Question(Name(name), - RRClass(dns_class), - any ? RRType::ANY() : RRType(type))); // if NULL then: - - MessageRenderer renderer; - msg.toWire(renderer); - - struct addrinfo hints, *res; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = 0; // not using AI_NUMERICHOST in case to bootstrap - if (getaddrinfo(server, server_port, &hints, &res) != 0) { - cerr << "address/port conversion for " << server << ":" - << server_port << " failed" << endl; - return (1); - } - - if (verbose) { - cout << "Trying \"" << name << "\"\n"; - } - - if (verbose && first_time) { - // this is only output the first time - first_time = 0; - cout << "Using domain server:\n"; - cout << "Name: " << server << "\n"; - // TODO: I guess I have to do a lookup to get that address and aliases - // too - //cout << "Address: " << address << "\n" ; - //cout << "Aliases: " << server << "\n"; - } - - int s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - - if (s < 0) { - cerr << "failed to open socket" << endl; - return (1); - } - - if (verbose) { - gettimeofday(&before_time, NULL); - } - - sendto(s, renderer.getData(), renderer.getLength(), 0, res->ai_addr, - res->ai_addrlen); - - struct sockaddr_storage ss; - struct sockaddr* sa; - socklen_t sa_len; - - sa_len = sizeof(ss); - sa = static_cast((void*)&ss); - - char recvbuf[4096]; - int cc; - if ((cc = recvfrom(s, recvbuf, sizeof(recvbuf), 0, sa, &sa_len)) > 0) { - try { - Message rmsg(Message::PARSE); - InputBuffer ibuffer(recvbuf, cc); - - rmsg.fromWire(ibuffer); - if (!verbose) { - string description = ""; - for (RRsetIterator it = - rmsg.beginSection(Message::SECTION_ANSWER); - it != rmsg.endSection(Message::SECTION_ANSWER); - ++it) { - - if ((*it)->getType() == RRType::A()) { - description = "has address"; - } - else if ((*it)->getType() == RRType::AAAA()) { - description = "has IPv6 address"; - } - else if ((*it)->getType() == RRType::MX()) { - description = "mail is handled by"; - } - else if ((*it)->getType() == RRType::TXT()) { - description = "descriptive text"; - } - - RdataIteratorPtr rit = (*it)->getRdataIterator(); - for (; !rit->isLast(); rit->next()) { - // instead of using my name, maybe use returned label? - cout << name << " " << description << " " << - (*rit).getCurrent().toText() << endl; - } - } - } else { - gettimeofday(&after_time, NULL); - - // HEADER and QUESTION, ANSWER, AUTHORITY, and ADDITIONAL - std::cout << rmsg.toText() << std::endl; - - if (before_time.tv_usec > after_time.tv_usec) { - after_time.tv_usec += 1000000; - --after_time.tv_sec; - } - - int elapsed_time = - (after_time.tv_sec - before_time.tv_sec) - + ((after_time.tv_usec - before_time.tv_usec))/1000; - - // TODO: if NXDOMAIN, host(1) doesn't show HEADER - // Host hsdjkfhksjhdfkj not found: 3(NXDOMAIN) - // TODO: test if NXDOMAIN - - std::cout << "Received " << cc << - " bytes in " << elapsed_time << " ms\n"; - // TODO: " bytes from 127.0.0.1#53 in 0 ms - - } //verbose -/* -TODO: handle InvalidRRClass -TODO: handle invalid type exception - } catch (InvalidType ivt) { - std::cerr << "invalid type:" << ivt.what(); -*/ - } catch (const exception& ex) { - std::cerr << "parse failed for " << - string(name) << "/" << type << ": " << ex.what() << std::endl; - } catch (...) { - std::cerr << "parse failed for " << string(name) << "/" << type; - } - } - - freeaddrinfo(res); - - return (0); -} // host_lookup() -} - -int -main(int argc, char* argv[]) { - int c; - - while ((c = getopt(argc, argv, "ac:dp:rt:v")) != -1) - switch (c) { - case 'a': - dns_any = true; - verbose = true; - break; - case 'c': - dns_class = optarg; - break; - // p for port is a non-standard switch - case 'p': - server_port = optarg; - break; - case 'r': - recursive_bit = false; - break; - case 't': - dns_type = optarg; - break; - case 'd': - // drop through to v, because debug and verbose are equivalent - case 'v': - verbose = true; - break; - } - argc -= optind; - argv += optind; - - if (argc < 1) { - cout << "Usage: host [-adrv] [-c class] [-p port] [-t type] hostname [server]\n"; - exit(1); - } - - if (argc >= 2) { - server = argv[1]; - } - - if (dns_type == NULL) { - host_lookup(argv[0], dns_class, "A", dns_any); - // TODO: don't do next if A doesn't exist - host_lookup(argv[0], dns_class, "AAAA", dns_any); - host_lookup(argv[0], dns_class, "MX", dns_any); - } else { - // -t overrides -a, regardless of order - host_lookup(argv[0], dns_class, dns_type, false); - } - return (0); -} diff --git a/examples/m4/ax_boost_include.m4 b/examples/m4/ax_boost_include.m4 deleted file mode 100644 index 77d19cafde..0000000000 --- a/examples/m4/ax_boost_include.m4 +++ /dev/null @@ -1,64 +0,0 @@ -dnl @synopsis AX_BOOST_INCLUDE -dnl -dnl Test for the Boost C++ header files -dnl -dnl If no path to the installed boost header files is given via the -dnl --with-boost-include option, the macro searchs under -dnl /usr/local /usr/pkg /opt /opt/local directories. -dnl -dnl This macro calls: -dnl -dnl AC_SUBST(BOOST_CPPFLAGS) -dnl - -AC_DEFUN([AX_BOOST_INCLUDE], [ -AC_LANG_SAVE -AC_LANG([C++]) - -# -# Configure Boost header path -# -# If explicitly specified, use it. -AC_ARG_WITH([boost-include], - AS_HELP_STRING([--with-boost-include=PATH], - [specify exact directory for Boost headers]), - [boost_include_path="$withval"]) -# If not specified, try some common paths. -if test -z "$with_boost_include"; then - boostdirs="/usr/local /usr/pkg /opt /opt/local" - for d in $boostdirs - do - if test -f $d/include/boost/shared_ptr.hpp; then - boost_include_path=$d/include - break - fi - done -fi -CPPFLAGS_SAVED="$CPPFLAGS" -if test "${boost_include_path}" ; then - BOOST_CPPFLAGS="-I${boost_include_path}" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" -fi -# Make sure some commonly used headers are available -AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/bind.hpp boost/function.hpp],, - AC_MSG_ERROR([Missing required Boost header files.])) - -# Detect whether Boost tries to use threads by default, and, if not, -# make it sure explicitly. In some systems the automatic detection -# may depend on preceding header files, and if inconsistency happens -# it could lead to a critical disruption. -AC_MSG_CHECKING([whether Boost tries to use threads]) -AC_TRY_COMPILE([ -#include -#ifdef BOOST_HAS_THREADS -#error "boost will use threads" -#endif],, -[AC_MSG_RESULT(no) - CPPFLAGS_BOOST_THREADCONF="-DBOOST_DISABLE_THREADS=1"], -[AC_MSG_RESULT(yes)]) - -CPPFLAGS="$CPPFLAGS_SAVED $CPPFLAGS_BOOST_THREADCONF" -AC_SUBST(BOOST_CPPFLAGS) - -AC_LANG_RESTORE -])dnl AX_BOOST_INCLUDE diff --git a/examples/m4/ax_isc_bind10.m4 b/examples/m4/ax_isc_bind10.m4 deleted file mode 100644 index 75c37c5f70..0000000000 --- a/examples/m4/ax_isc_bind10.m4 +++ /dev/null @@ -1,136 +0,0 @@ -dnl @synopsis AX_ISC_BIND10 -dnl -dnl @summary figure out how to build C++ programs using ISC BIND 10 libraries -dnl -dnl If no path to the installed BIND 10 header files or libraries is given -dnl via the --with-bind10-include or --with-bind10-lib option, the macro -dnl searchs under /usr/local/{include, lib}, /usr/pkg/{include, lib}, -dnl /opt/{include, lib}, /opt/local/{include, lib} directories, respectively. -dnl -dnl This macro calls: -dnl -dnl AC_SUBST(BIND10_CPPFLAGS) -dnl AC_SUBST(BIND10_LDFLAGS) -dnl AC_SUBST(BIND10_COMMON_LIB) -dnl AC_SUBST(BIND10_DNS_LIB) -dnl -dnl If this macro finds CPPFLAGS, LDFLAGS or COMMON_LIB unavailable, it treats -dnl that as a fatal error. -dnl Checks for other BIND 10 module libraries are option, as not all -dnl applications need all libraries. The main configure.ac can handle any -dnl missing library as fatal by checking whether the corresponding -dnl BIND10_xxx_LIB is defined. -dnl -dnl In addition, it sets the BIND10_RPATH variable to a usable linker option -dnl to embed the path to the BIND 10 library to the programs that are to be -dnl linked with the library. If the developer wants to use the option, -dnl it can be used as follows: -dnl if test "x$BIND10_RPATH" != "x"; then -dnl LDFLAGS="$LDFLAGS $BIND10_RPATH" -dnl fi - -AC_DEFUN([AX_ISC_BIND10], [ -AC_REQUIRE([AX_BOOST_INCLUDE]) -AC_REQUIRE([AX_ISC_RPATH]) -AC_LANG_SAVE -AC_LANG([C++]) - -# Check for BIND10 common headers - -AC_ARG_WITH(bind10-include, - AS_HELP_STRING([--with-bind10-include=PATH], - [specify a path to BIND 10 header files]), - bind10_inc_path="$withval", bind10_inc_path="no") -# If not specified, try some common paths. -if test "$bind10_inc_path" = "no"; then - for d in /usr/local /usr/pkg /opt /opt/local - do - if test -f $d/include/util/buffer.h; then - bind10_inc_path=$d - break - fi - done -fi -CPPFLAGS_SAVED="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" # boost headers will be used in buffer.h -if test "${bind10_inc_path}" != "no"; then - BIND10_CPPFLAGS="-I${bind10_inc_path}" - CPPFLAGS="$CPPFLAGS $BIND10_CPPFLAGS" -fi -AC_CHECK_HEADERS([util/buffer.h],, - AC_MSG_ERROR([Missing a commonly used BIND 10 header file])) -CPPFLAGS="$CPPFLAGS_SAVED" -AC_SUBST(BIND10_CPPFLAGS) - -# Check for BIND10 libraries -CPPFLAGS_SAVED="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS $BIND10_CPPFLAGS" - -AC_ARG_WITH(bind10-lib, - AS_HELP_STRING([--with-bind10-lib=PATH], - [specify a path to BIND 10 library files]), - bind10_lib_path="$withval", bind10_lib_path="no") -if test $bind10_lib_path != "no"; then - bind10_lib_dirs=$bind10_lib_path -else - # If not specified, try some common paths. - bind10_lib_dirs="/usr/local/lib /usr/pkg/lib /opt/lib /opt/local/lib" -fi - -# make sure we have buildable libraries -AC_MSG_CHECKING([for BIND 10 common library]) -BIND10_COMMON_LIB="-lb10-util -lb10-exceptions" -LDFLAGS_SAVED="$LDFLAGS" -LDFLAGS_CHECK_COMMON="$LDFLAGS $BIND10_LDFLAGS" -LIBS_SAVED="$LIBS" -LIBS="$LIBS $BIND10_COMMON_LIB" -for d in $bind10_lib_dirs -do - LDFLAGS="$LDFLAGS_CHECK_COMMON -L$d" - AC_TRY_LINK([ -#include -],[ -isc::util::OutputBuffer buffer(0); -], [BIND10_LDFLAGS="-L${d}" - if test "x$ISC_RPATH_FLAG" != "x"; then - BIND10_RPATH="${ISC_RPATH_FLAG}${d}" - fi - ]) - if test "x$BIND10_LDFLAGS" != "x"; then - break - fi -done -if test "x$BIND10_LDFLAGS" != "x"; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) - AC_MSG_ERROR([unable to find required BIND 10 libraries]) -fi - -# restore LIBS once at this point -LIBS="$LIBS_SAVED" - -AC_SUBST(BIND10_LDFLAGS) -AC_SUBST(BIND10_COMMON_LIB) - -# Check per-module BIND 10 libraries - -# DNS library -AC_MSG_CHECKING([for BIND 10 DNS library]) -LIBS="$LIBS $BIND10_COMMON_LIB -lb10-dns++" -AC_TRY_LINK([ -#include -],[ -isc::dns::RRType rrtype(1); -], [BIND10_DNS_LIB="-lb10-dns++" - AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)]) -LIBS="$LIBS_SAVED" -AC_SUBST(BIND10_DNS_LIB) - -# Restore other flags -CPPFLAGS="$CPPFLAGS_SAVED" -LDFLAGS="$LDFLAGS_SAVED" - -AC_LANG_RESTORE -])dnl AX_ISC_BIND10 diff --git a/examples/m4/ax_isc_rpath.m4 b/examples/m4/ax_isc_rpath.m4 deleted file mode 100644 index ce8d3226f1..0000000000 --- a/examples/m4/ax_isc_rpath.m4 +++ /dev/null @@ -1,60 +0,0 @@ -dnl @synopsis AX_ISC_RPATH -dnl -dnl @summary figure out whether and which "rpath" linker option is available -dnl -dnl This macro checks if the linker supports an option to embed a path -dnl to a runtime library (often installed in an uncommon place), such as the -dnl commonly used -R option. If found, it sets the ISC_RPATH_FLAG variable to -dnl the found option flag. The main configure.ac can use it as follows: -dnl if test "x$ISC_RPATH_FLAG" != "x"; then -dnl LDFLAGS="$LDFLAGS ${ISC_RPATH_FLAG}/usr/local/lib/some_library" -dnl fi -dnl -dnl If you pass --disable-rpath to configure, ISC_RPATH_FLAG is not set - -AC_DEFUN([AX_ISC_RPATH], [ - -AC_ARG_ENABLE(rpath, - [AC_HELP_STRING([--disable-rpath], [don't hardcode library path into binaries])], - rpath=$enableval, rpath=yes) - -if test x$rpath != xno; then - # We'll tweak both CXXFLAGS and CCFLAGS so this function will work - # whichever language is used in the main script. Note also that it's not - #LDFLAGS; technically this is a linker flag, but we've noticed $LDFLAGS - # can be placed where the compiler could interpret it as a compiler - # option, leading to subtle failure mode. So, in the check below using - # the compiler flag is safer (in the actual Makefiles the flag should be - # set in LDFLAGS). - CXXFLAGS_SAVED="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib" - CCFLAGS_SAVED="$CCFLAGS" - CCFLAGS="$CCFLAGS -Wl,-R/usr/lib" - - # check -Wl,-R and -R rather than gcc specific -rpath to be as portable - # as possible. -Wl,-R seems to be safer, so we try it first. In some - # cases -R is not actually recognized but AC_TRY_LINK doesn't fail due to - # that. - AC_MSG_CHECKING([whether -Wl,-R flag is available in linker]) - AC_TRY_LINK([],[], - [ AC_MSG_RESULT(yes) - ISC_RPATH_FLAG=-Wl,-R - ],[ AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether -R flag is available in linker]) - - # Apple clang 5.1 is now considers unknown parameters passed to linker (ld) as errors. - # However, the same unknown parameters passed to compiler (g++ ) are merely threated - # as warnings. To make sure that we pick those up, is to use -Werror. - CXXFLAGS="$CXXFLAGS_SAVED -R/usr/lib" - CCFLAGS="$CCFLAGS_SAVED -R/usr/lib" - AC_TRY_LINK([], [], - [ AC_MSG_RESULT([yes; note that -R is more sensitive about the position in option arguments]) - ISC_RPATH_FLAG=-R - ],[ AC_MSG_RESULT(no) ]) - ]) - - CXXFLAGS=$CXXFLAGS_SAVED - CCFLAGS=$CCFLAGS_SAVED -fi - -])dnl AX_ISC_RPATH