summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2019-02-11 18:35:15 +0000
committerMonty Taylor <mordred@inaugust.com>2019-02-11 18:35:15 +0000
commit5b5776383158353ac71a5fa38092e010e536f297 (patch)
tree76c6e1ef88fc7e6b605a299fa59520362ce991dd
parentd78f94457fa50ac1e7753597f4454a5e97afbd06 (diff)
Remove ax_cxx_check_lib and use autoconf-archive
We don't need this local lib check macro. We can use AX_CHECK_LIBRARY from autoconf-archive.
-rw-r--r--m4/ax_cxx_check_lib.m4110
-rw-r--r--m4/require_libcpprest.m49
2 files changed, 5 insertions, 114 deletions
diff --git a/m4/ax_cxx_check_lib.m4 b/m4/ax_cxx_check_lib.m4
deleted file mode 100644
index d4aab47..0000000
--- a/m4/ax_cxx_check_lib.m4
+++ /dev/null
@@ -1,110 +0,0 @@
1dnl @synopsis AX_CXX_CHECK_LIB(libname, functioname, action-if, action-if-not)
2dnl
3dnl The standard AC_CHECK_LIB can not test functions in namespaces.
4dnl Therefore AC_CHECK_LIB(cgicc, cgicc::Cgicc::getVersion) will always
5dnl fail. We need to decompose the functionname into a series of namespaces
6dnl where it gets declared so that it can be used for a link test.
7dnl
8dnl In the first version I did allow namespace::functionname to be a
9dnl reference to a void-argument global functionname (just wrapped in a
10dnl namespace) like its C counterparts would be - but in reality such
11dnl thing does not exist. The only global / static functions are always
12dnl made const-functions which is an attribute mangled along into the
13dnl library function export name.
14dnl
15dnl The normal usage will ask for a test of a class-member function which
16dnl should be presented with a full function spec with arguments given in
17dnl parentheses following the function name - if the function to test for
18dnl does expect arguments then you should add default initial values in the
19dnl prototype (even if they do not exist originally, these are used only
20dnl locally to build a correct function call in the configure test script).
21dnl
22dnl In the current version if you do omit the parenthesis from the macro
23dnl argument then the macro will assume that you want to check for the
24dnl class name - which is really to check for default constructor being
25dnl exported from the given library name.
26dnl
27dnl EXAMPLE:
28dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::HTTPCookie])
29dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::Cgicc::getVersion () const],
30dnl AX_CXX_CHECK_LIB(boost_regex, [boost::RegEx::Position (int i = 0) const])
31dnl
32dnl Result:
33dnl Just as the usual AX_CXX_CHECK_LIB - defines HAVE_LIBCGICC
34dnl and adds the libraries to the default library path (and
35dnl uses internally the normal ac_check_lib cache symbol
36dnl like ac_cv_lib_cgicc_cgicc__Cgicc)
37dnl
38dnl Footnote: The C++ language is not good at creating stable library
39dnl interfaces at the binary level - a lot of functionality is usually being
40dnl given as inline functions plus there is hardly a chance to create opaque
41dnl types. Therefore most C++ library tests will only do compile tests using
42dnl the header files. Doing a check_lib is however good to check the link
43dnl dependency before hitting it as an error in the build later.
44dnl
45dnl @category C++
46dnl @author Guido U. Draheim
47dnl @vesion 2006-12-18
48
49AC_DEFUN([AX_CXX_CHECK_LIB],
50[m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
51AS_LITERAL_IF([$1],
52 [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
53 [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
54AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
55[ac_check_lib_save_LIBS=$LIBS
56LIBS="-l$1 $5 $LIBS"
57case "$2"
58in *::*::*\(*)
59AC_LINK_IFELSE([AC_LANG_PROGRAM([
60 namespace `echo "$2" | sed -e "s/::.*//"`
61 { class `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/" -e "s/(.*//"`
62 { public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
63 };
64 }
65],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
66 [AS_VAR_SET(ac_Lib, yes)],
67 [AS_VAR_SET(ac_Lib, no)])
68;; *::*::*)
69AC_LINK_IFELSE([AC_LANG_PROGRAM([
70 namespace `echo "$2" | sed -e "s/::.*//"`
71 { namespace `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/"`
72 { class `echo "$2" | sed -e "s/.*:://"`
73 { public: `echo "$2" | sed -e "s/.*:://"` ();
74 };
75 }
76 }
77],[new $2()])],
78 [AS_VAR_SET(ac_Lib, yes)],
79 [AS_VAR_SET(ac_Lib, no)])
80;; *::*\(*)
81AC_LINK_IFELSE([AC_LANG_PROGRAM([
82 class `echo "$2" | sed -e "s/\\(.*\\)::.*/\\1/" -e "s/(.*//"`
83 { public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
84 };
85],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
86 [AS_VAR_SET(ac_Lib, yes)],
87 [AS_VAR_SET(ac_Lib, no)])
88;; *::*)
89AC_LINK_IFELSE([AC_LANG_PROGRAM([
90 namespace `echo "$2" | sed -e "s/::.*//"`
91 { class `echo "$2" | sed -e "s/.*:://"`
92 { public: `echo "$2" | sed -e "s/.*:://"` ();
93 };
94 }
95],[new $2()])],
96 [AS_VAR_SET(ac_Lib, yes)],
97 [AS_VAR_SET(ac_Lib, no)])
98;; *)
99AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
100 [AS_VAR_SET(ac_Lib, yes)],
101 [AS_VAR_SET(ac_Lib, no)])
102;; esac
103LIBS=$ac_check_lib_save_LIBS])
104AS_IF([test AS_VAR_GET(ac_Lib) = yes],
105 [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
106 LIBS="-l$1 $LIBS"
107])],
108 [$4])dnl
109AS_VAR_POPDEF([ac_Lib])dnl
110])# AC_CHECK_LIB
diff --git a/m4/require_libcpprest.m4 b/m4/require_libcpprest.m4
index eeeaa8d..e7ead0e 100644
--- a/m4/require_libcpprest.m4
+++ b/m4/require_libcpprest.m4
@@ -38,12 +38,13 @@ AC_DEFUN([REQUIRE_LIBCPPREST],[
38 AX_BOOST_BASE(1.62) 38 AX_BOOST_BASE(1.62)
39 AX_BOOST_SYSTEM 39 AX_BOOST_SYSTEM
40 40
41 AX_CXX_CHECK_LIB(cpprest, [utility::datetime::utc_now()]) 41 AX_CHECK_LIBRARY([LIBCPPREST], [cpprest/http_client.h], [cpprest], [],
42 [AC_MSG_ERROR([Unable to find libcpprest])])
42 AC_LANG_POP() 43 AC_LANG_POP()
43 AS_IF([test "x${ac_cv_lib_cpprest_utility__datetime__utc_now__}" = "xno"], 44 AS_IF([test "x${ac_cv_lib_cpprest_utility__datetime__utc_now__}" = "xno"],
44 AC_MSG_ERROR([libcpprest is required for ${PACKAGE}.])) 45 AC_MSG_ERROR([libcpprest is required for ${PACKAGE}.]))
45 46
46 LIBS="${LIBS} ${OPENSSL_LIBS} ${BOOST_SYSTEM_LIB}" 47 LIBS="${LIBS} ${OPENSSL_LIBS} ${BOOST_SYSTEM_LIB} -lcpprest"
47 AM_CXXFLAGS="${AM_CXXFLAGS} ${OPENSSL_CFLAGS}" 48 AM_CXXFLAGS="${AM_CXXFLAGS} ${OPENSSL_CFLAGS} ${LIBCPPREST_CFLAGS}"
48 AM_LDFLAGS="${AM_LDFLAGS} ${OPENSSL_LDFLAGS}" 49 AM_LDFLAGS="${AM_LDFLAGS} ${OPENSSL_LDFLAGS} "${LIBCPPREST_LDFLAGS}"
49]) 50])