Jeff Thompson | 18f43e1 | 2013-11-21 12:45:12 -0800 | [diff] [blame] | 1 | # To build using autotools, see the Development section of the file INSTALL. |
Jeff Thompson | b752300 | 2013-10-09 10:25:00 -0700 | [diff] [blame] | 2 | |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 3 | AC_PREREQ([2.59]) |
Yingdi Yu | 61ec272 | 2014-01-20 14:22:32 -0800 | [diff] [blame] | 4 | AC_INIT([ndn-cpp-dev], [0.2.1], [ndn-lib@lists.cs.ucla.edu], [ndn-cpp-dev], [https://github.com/named-data/ndn-cpp]) |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign]) |
| 6 | |
Jeff Thompson | 23cb742 | 2013-10-09 16:11:47 -0700 | [diff] [blame] | 7 | AC_CONFIG_MACRO_DIR([m4]) |
Jeff Thompson | 5d16a90 | 2013-10-10 11:15:14 -0700 | [diff] [blame] | 8 | AC_CONFIG_SRCDIR([configure.ac]) |
Jeff Thompson | 6e22904 | 2013-10-10 11:09:49 -0700 | [diff] [blame] | 9 | # Create config.h without prefixes. Put it in the include directory so CFLAGS will have -I./include . |
| 10 | AC_CONFIG_HEADERS(include/config.h) |
| 11 | # Add prefixes and output to a unique file name which will go into the ndn-cpp include install directory. |
Yingdi Yu | 61ec272 | 2014-01-20 14:22:32 -0800 | [diff] [blame] | 12 | AX_PREFIX_CONFIG_H(include/ndn-cpp-dev/ndn-cpp-config.h, ndn-cpp) |
Jeff Thompson | 47053ad | 2013-08-05 10:36:53 -0700 | [diff] [blame] | 13 | AM_MAINTAINER_MODE |
Jeff Thompson | 3b3aabf | 2013-06-21 16:50:20 -0700 | [diff] [blame] | 14 | AM_PROG_AR |
Jeff Thompson | 4f03164 | 2013-08-05 11:03:16 -0700 | [diff] [blame] | 15 | AC_PROG_LIBTOOL |
Jeff Thompson | 23cb742 | 2013-10-09 16:11:47 -0700 | [diff] [blame] | 16 | LT_PREREQ([2.2]) |
| 17 | LT_INIT() |
Jeff Thompson | 4f03164 | 2013-08-05 11:03:16 -0700 | [diff] [blame] | 18 | AC_PROG_CXX |
Jeff Thompson | 1a1b4c0 | 2013-06-28 22:28:51 -0700 | [diff] [blame] | 19 | AM_PROG_CC_C_O |
Jeff Thompson | fcc4daa | 2013-10-01 14:52:23 -0700 | [diff] [blame] | 20 | AC_PROG_OBJCXX |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 21 | AC_LANG([C++]) |
Jeff Thompson | b18b6eb | 2013-10-11 18:28:50 -0700 | [diff] [blame] | 22 | |
| 23 | # Special case. |
| 24 | case "$host" in |
| 25 | *-darwin* | *-macos10*) |
| 26 | if test -d /opt/local ; then |
| 27 | CFLAGS="$CFLAGS -I/opt/local/include" |
| 28 | CXXFLAGS="$CXXFLAGS -I/opt/local/include" |
| 29 | CPPFLAGS="$CPPFLAGS -I/opt/local/include" |
| 30 | LDFLAGS="$LDFLAGS -L/opt/local/lib" |
| 31 | elif test -d /sw ; then |
| 32 | CFLAGS="$CFLAGS -I/sw/include" |
| 33 | CXXFLAGS="$CXXFLAGS -I/sw/include" |
| 34 | CPPFLAGS="$CPPFLAGS -I/sw/include" |
| 35 | LDFLAGS="$LDFLAGS -L/sw/lib" |
| 36 | fi |
| 37 | ;; |
| 38 | esac |
| 39 | |
Jeff Thompson | 32a2333 | 2013-10-07 18:39:00 -0700 | [diff] [blame] | 40 | AC_TYPE_SIZE_T |
| 41 | AC_TYPE_INT8_T |
| 42 | AC_TYPE_INT16_T |
| 43 | AC_TYPE_INT32_T |
| 44 | AC_TYPE_INT64_T |
| 45 | AC_TYPE_UINT8_T |
| 46 | AC_TYPE_UINT16_T |
| 47 | AC_TYPE_UINT32_T |
| 48 | AC_TYPE_UINT64_T |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 49 | AC_CHECK_FUNCS([memcmp] [memcpy] [memset]) |
| 50 | AC_CHECK_FUNCS([strchr], :, AC_MSG_ERROR([*** strchr not found. Check 'config.log' for more details.])) |
| 51 | AC_CHECK_FUNCS([sscanf], :, AC_MSG_ERROR([*** sscanf not found. Check 'config.log' for more details.])) |
Jeff Thompson | d32bab6 | 2013-10-18 14:55:26 -0700 | [diff] [blame] | 52 | AC_CHECK_HEADERS([time.h], :, AC_MSG_ERROR([*** time.h not found. Check 'config.log' for more details.])) |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 53 | AC_CHECK_HEADERS([sys/time.h], :, AC_MSG_ERROR([*** sys/time.h not found. Check 'config.log' for more details.])) |
| 54 | AC_CHECK_FUNCS([gettimeofday], :, AC_MSG_ERROR([*** gettimeofday not found. processEvents requires it. Check 'config.log' for more details.])) |
Jeff Thompson | 6e22904 | 2013-10-10 11:09:49 -0700 | [diff] [blame] | 55 | AC_C_INLINE |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 56 | |
Alexander Afanasyev | 9e92bfd | 2014-01-24 12:23:33 -0800 | [diff] [blame^] | 57 | # Unless --with-c++11 specified, do not enable C++11 features |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 58 | AX_CXX_COMPILE_STDCXX_11(, optional) |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 59 | |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 60 | AC_ARG_WITH([system-boost], |
| 61 | AS_HELP_STRING( |
Alexander Afanasyev | 9e92bfd | 2014-01-24 12:23:33 -0800 | [diff] [blame^] | 62 | [--without-system-boost], |
| 63 | [do not attempt to use system-installed boost libraries and use the bundled version (ndnboost) when necessary.] |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 64 | ), |
Alexander Afanasyev | 9e92bfd | 2014-01-24 12:23:33 -0800 | [diff] [blame^] | 65 | [ |
| 66 | if test "$withval" = "no"; then |
| 67 | want_system_boost="no" |
| 68 | fi |
| 69 | ], |
| 70 | [want_system_boost="yes"] |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 71 | ) |
| 72 | |
| 73 | AX_BOOST_BASE([1.42.0], |
| 74 | [ |
| 75 | if test "$want_system_boost" == "yes" ; then |
| 76 | AC_DEFINE(USE_SYSTEM_BOOST,[1],[use system-installed boost libraries]) |
Alexander Afanasyev | f7f878c | 2014-01-12 13:57:56 -0800 | [diff] [blame] | 77 | AM_CONDITIONAL(USE_SYSTEM_BOOST, true) |
| 78 | else |
| 79 | AM_CONDITIONAL(USE_SYSTEM_BOOST, false) |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 80 | fi |
| 81 | ], |
Alexander Afanasyev | f7f878c | 2014-01-12 13:57:56 -0800 | [diff] [blame] | 82 | [AM_CONDITIONAL(USE_SYSTEM_BOOST, false)] |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 83 | ) |
Alexander Afanasyev | fad679c | 2014-01-06 18:09:26 -0800 | [diff] [blame] | 84 | AX_BOOST_ASIO |
| 85 | |
| 86 | AC_ARG_WITH([tests], |
| 87 | AS_HELP_STRING( |
| 88 | [--with-tests], |
| 89 | [Enable compilation of library tests (disabled by default).] |
| 90 | ), |
| 91 | [ |
| 92 | want_tests="yes" |
| 93 | AM_CONDITIONAL(COMPILE_TESTS, true) |
| 94 | ], |
| 95 | [ |
| 96 | want_tests="no" |
| 97 | AM_CONDITIONAL(COMPILE_TESTS, false) |
| 98 | ] |
| 99 | ) |
| 100 | |
Alexander Afanasyev | 9e92bfd | 2014-01-24 12:23:33 -0800 | [diff] [blame^] | 101 | # @todo: These checks are not really optional |
Alexander Afanasyev | fad679c | 2014-01-06 18:09:26 -0800 | [diff] [blame] | 102 | AX_BOOST_SYSTEM |
Yingdi Yu | 2d9c50f | 2014-01-21 18:25:00 -0800 | [diff] [blame] | 103 | AX_BOOST_FILESYSTEM |
Alexander Afanasyev | fad679c | 2014-01-06 18:09:26 -0800 | [diff] [blame] | 104 | AX_BOOST_UNIT_TEST_FRAMEWORK |
| 105 | AM_CONDITIONAL(HAVE_BOOST_UNIT_TEST_FRAMEWORK, [test "x$ax_cv_boost_unit_test_framework" = "xyes"]) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 106 | |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 107 | AC_MSG_CHECKING([for gmtime support]) |
| 108 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
Jeff Thompson | d32bab6 | 2013-10-18 14:55:26 -0700 | [diff] [blame] | 109 | [[#include <time.h>]] |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 110 | [[#include <sys/time.h>]] |
| 111 | [[struct timeval tv;]] |
| 112 | [[int result1 = gettimeofday(&tv, 0);]] |
| 113 | [[time_t time1 = time(0);]] |
| 114 | [[struct tm* tm1 = gmtime(&time1);]] |
| 115 | [[time_t time2 = timegm(tm1);]]) |
| 116 | ], [ |
| 117 | AC_MSG_RESULT([yes]) |
| 118 | AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 1, [1 if have sys/time gmtime support including timegm.]) |
| 119 | ], [ |
| 120 | AC_MSG_RESULT([no]) |
| 121 | AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 0, [1 if have sys/time gmtime support including timegm.]) |
| 122 | ]) |
| 123 | |
Alexander Afanasyev | 0d3671a | 2014-01-02 20:09:59 -0800 | [diff] [blame] | 124 | # Require openssl (libcrypto). |
| 125 | AX_CHECK_OPENSSL([], [AC_MSG_FAILURE([can't find openssl crypto lib])]) |
Jeff Thompson | d0f62e1 | 2013-10-09 17:41:25 -0700 | [diff] [blame] | 126 | |
Alexander Afanasyev | c5bb2ad | 2014-01-06 16:03:34 -0800 | [diff] [blame] | 127 | AX_LIB_CRYPTOPP([], [AC_MSG_FAILURE([can't find crypto++ library])]) |
| 128 | |
Jeff Thompson | bb6b568 | 2013-10-09 18:22:38 -0700 | [diff] [blame] | 129 | # Conditionally use libsqlite3. AX_LIB_SQLITE3 defines HAVE_SQLITE3 in confdefs.h . |
Jeff Thompson | d0f62e1 | 2013-10-09 17:41:25 -0700 | [diff] [blame] | 130 | AX_LIB_SQLITE3() |
Jeff Thompson | bb6b568 | 2013-10-09 18:22:38 -0700 | [diff] [blame] | 131 | if grep -q "#define HAVE_SQLITE3" confdefs.h ; then |
Alexander Afanasyev | 0d3671a | 2014-01-02 20:09:59 -0800 | [diff] [blame] | 132 | AC_CHECK_LIB([sqlite3], [sqlite3_open], [ ], # space necessar to prevent updating LIBS |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 133 | [AC_MSG_FAILURE([have sqlite2 headers but no libsqlite3])]) |
Jeff Thompson | d0f62e1 | 2013-10-09 17:41:25 -0700 | [diff] [blame] | 134 | fi |
| 135 | |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 136 | # Conditionally use the OSX Security framework . |
| 137 | AC_MSG_CHECKING([for OSX Security framework]) |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 138 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 139 | [[#include <CoreFoundation/CoreFoundation.h>]] |
| 140 | [[#include <Security/Security.h>]] |
| 141 | [[#include <CoreServices/CoreServices.h>]] |
| 142 | [[void test() { SecKeychainRef x; }]]) |
| 143 | ], [ |
| 144 | AC_MSG_RESULT([yes]) |
Alexander Afanasyev | 0d3671a | 2014-01-02 20:09:59 -0800 | [diff] [blame] | 145 | AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], 1, [1 if have the OSX framework.]) |
Alexander Afanasyev | d155da4 | 2014-01-06 16:03:47 -0800 | [diff] [blame] | 146 | AM_CONDITIONAL(HAVE_OSX_SECURITY, true) |
Alexander Afanasyev | 0d3671a | 2014-01-02 20:09:59 -0800 | [diff] [blame] | 147 | |
| 148 | OSX_SECURITY_LIBS="-framework Security" |
| 149 | AC_SUBST([OSX_SECURITY_LIBS]) |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 150 | ], [ |
| 151 | AC_MSG_RESULT([no]) |
Alexander Afanasyev | d155da4 | 2014-01-06 16:03:47 -0800 | [diff] [blame] | 152 | AM_CONDITIONAL(HAVE_OSX_SECURITY, false) |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 153 | ]) |
| 154 | |
Jeff Thompson | ca45e55 | 2013-06-26 17:40:06 -0700 | [diff] [blame] | 155 | DX_HTML_FEATURE(ON) |
| 156 | DX_CHM_FEATURE(OFF) |
| 157 | DX_CHI_FEATURE(OFF) |
| 158 | DX_MAN_FEATURE(OFF) |
| 159 | DX_RTF_FEATURE(OFF) |
| 160 | DX_XML_FEATURE(OFF) |
| 161 | DX_PDF_FEATURE(OFF) |
| 162 | DX_PS_FEATURE(OFF) |
| 163 | DX_INIT_DOXYGEN([$PACKAGE_NAME],[Doxyfile]) |
| 164 | |
Jeff Thompson | 6e22904 | 2013-10-10 11:09:49 -0700 | [diff] [blame] | 165 | AC_CONFIG_FILES([Makefile |
Alexander Afanasyev | 7eb64f1 | 2014-01-02 18:39:49 -0800 | [diff] [blame] | 166 | include/Makefile |
Alexander Afanasyev | c4b7598 | 2014-01-09 14:51:45 -0800 | [diff] [blame] | 167 | examples/Makefile |
Alexander Afanasyev | 303b350 | 2014-01-07 12:02:59 -0800 | [diff] [blame] | 168 | tools/Makefile |
Alexander Afanasyev | fad679c | 2014-01-06 18:09:26 -0800 | [diff] [blame] | 169 | tests/Makefile |
Alexander Afanasyev | 06e9d25 | 2014-01-18 16:52:18 -0800 | [diff] [blame] | 170 | tests_boost/Makefile |
| 171 | libndn-cpp-dev.pc]) |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 172 | AC_OUTPUT |