Jeff Thompson | b752300 | 2013-10-09 10:25:00 -0700 | [diff] [blame] | 1 | # To build using autotools on OS X: |
| 2 | # $ sudo port install autoconf |
| 3 | # $ sudo port install automake |
| 4 | # $ sudo port install doxygen |
| 5 | # Enter the following to show directory for m4 macros, and download the the following into there (use sudo): |
| 6 | # $ aclocal --print |
| 7 | # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_cxx_compile_stdcxx_11.m4 |
| 8 | # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_prog_doxygen.m4 |
| 9 | # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_openssl.m4 |
| 10 | # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_lib_sqlite3.m4 |
| 11 | # http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_prefix_config_h.m4 |
| 12 | |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 13 | AC_PREREQ([2.59]) |
Jeff Thompson | 93a2416 | 2013-09-27 13:28:13 -0700 | [diff] [blame] | 14 | AC_INIT([ndn-cpp], [0.2], [ndn-lib@lists.cs.ucla.edu], [ndn-cpp], [https://github.com/named-data/ndn-cpp]) |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 15 | AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign]) |
| 16 | |
Jeff Thompson | 23cb742 | 2013-10-09 16:11:47 -0700 | [diff] [blame] | 17 | AC_CONFIG_MACRO_DIR([m4]) |
Jeff Thompson | 5d16a90 | 2013-10-10 11:15:14 -0700 | [diff] [blame] | 18 | AC_CONFIG_SRCDIR([configure.ac]) |
Jeff Thompson | 6e22904 | 2013-10-10 11:09:49 -0700 | [diff] [blame] | 19 | # Create config.h without prefixes. Put it in the include directory so CFLAGS will have -I./include . |
| 20 | AC_CONFIG_HEADERS(include/config.h) |
| 21 | # Add prefixes and output to a unique file name which will go into the ndn-cpp include install directory. |
| 22 | AX_PREFIX_CONFIG_H(include/ndn-cpp/ndn-cpp-config.h) |
Jeff Thompson | 47053ad | 2013-08-05 10:36:53 -0700 | [diff] [blame] | 23 | AM_MAINTAINER_MODE |
Jeff Thompson | 3b3aabf | 2013-06-21 16:50:20 -0700 | [diff] [blame] | 24 | AM_PROG_AR |
Jeff Thompson | 4f03164 | 2013-08-05 11:03:16 -0700 | [diff] [blame] | 25 | AC_PROG_LIBTOOL |
Jeff Thompson | 23cb742 | 2013-10-09 16:11:47 -0700 | [diff] [blame] | 26 | LT_PREREQ([2.2]) |
| 27 | LT_INIT() |
Jeff Thompson | 4f03164 | 2013-08-05 11:03:16 -0700 | [diff] [blame] | 28 | AC_PROG_CXX |
Jeff Thompson | 1a1b4c0 | 2013-06-28 22:28:51 -0700 | [diff] [blame] | 29 | AM_PROG_CC_C_O |
Jeff Thompson | fcc4daa | 2013-10-01 14:52:23 -0700 | [diff] [blame] | 30 | AC_PROG_OBJCXX |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 31 | AC_LANG([C++]) |
Jeff Thompson | b18b6eb | 2013-10-11 18:28:50 -0700 | [diff] [blame] | 32 | |
| 33 | # Special case. |
| 34 | case "$host" in |
| 35 | *-darwin* | *-macos10*) |
| 36 | if test -d /opt/local ; then |
| 37 | CFLAGS="$CFLAGS -I/opt/local/include" |
| 38 | CXXFLAGS="$CXXFLAGS -I/opt/local/include" |
| 39 | CPPFLAGS="$CPPFLAGS -I/opt/local/include" |
| 40 | LDFLAGS="$LDFLAGS -L/opt/local/lib" |
| 41 | elif test -d /sw ; then |
| 42 | CFLAGS="$CFLAGS -I/sw/include" |
| 43 | CXXFLAGS="$CXXFLAGS -I/sw/include" |
| 44 | CPPFLAGS="$CPPFLAGS -I/sw/include" |
| 45 | LDFLAGS="$LDFLAGS -L/sw/lib" |
| 46 | fi |
| 47 | ;; |
| 48 | esac |
| 49 | |
Jeff Thompson | 32a2333 | 2013-10-07 18:39:00 -0700 | [diff] [blame] | 50 | AC_TYPE_SIZE_T |
| 51 | AC_TYPE_INT8_T |
| 52 | AC_TYPE_INT16_T |
| 53 | AC_TYPE_INT32_T |
| 54 | AC_TYPE_INT64_T |
| 55 | AC_TYPE_UINT8_T |
| 56 | AC_TYPE_UINT16_T |
| 57 | AC_TYPE_UINT32_T |
| 58 | AC_TYPE_UINT64_T |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 59 | AC_CHECK_FUNCS([memcmp] [memcpy] [memset]) |
| 60 | AC_CHECK_FUNCS([strchr], :, AC_MSG_ERROR([*** strchr not found. Check 'config.log' for more details.])) |
| 61 | 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] | 62 | 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] | 63 | AC_CHECK_HEADERS([sys/time.h], :, AC_MSG_ERROR([*** sys/time.h not found. Check 'config.log' for more details.])) |
| 64 | AC_CHECK_FUNCS([gettimeofday], :, AC_MSG_ERROR([*** gettimeofday not found. processEvents requires it. Check 'config.log' for more details.])) |
Jeff Thompson | 1b8f4c9 | 2013-06-19 16:18:46 -0700 | [diff] [blame] | 65 | AX_CXX_COMPILE_STDCXX_11(, optional) |
Jeff Thompson | 6e22904 | 2013-10-10 11:09:49 -0700 | [diff] [blame] | 66 | AC_C_INLINE |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 67 | |
| 68 | AC_MSG_CHECKING([for std::shared_ptr]) |
| 69 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 70 | [[#include <memory>]] |
| 71 | [[std::shared_ptr<int> have_shared_ptr;]]) |
| 72 | ], [ |
| 73 | AC_MSG_RESULT([yes]) |
| 74 | AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 1, [1 if have the `std::shared_ptr' class.]) |
| 75 | ], [ |
| 76 | AC_MSG_RESULT([no]) |
| 77 | AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 0, [1 if have the `std::shared_ptr' class.]) |
| 78 | ]) |
Jeff Thompson | 9e9ea9f | 2013-06-22 10:31:18 -0700 | [diff] [blame] | 79 | AC_MSG_CHECKING([for boost::shared_ptr]) |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 80 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 81 | [[#include <boost/shared_ptr.hpp>]] |
| 82 | [[boost::shared_ptr<int> have_shared_ptr;]]) |
| 83 | ], [ |
| 84 | AC_MSG_RESULT([yes]) |
| 85 | AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 1, [1 if have the `boost::shared_ptr' class.]) |
| 86 | ], [ |
| 87 | AC_MSG_RESULT([no]) |
| 88 | AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 0, [1 if have the `boost::shared_ptr' class.]) |
| 89 | ]) |
| 90 | |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 91 | AC_MSG_CHECKING([for std::function]) |
| 92 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 93 | [[#include <functional>]] |
| 94 | [[std::function<int> have_function();]]) |
| 95 | ], [ |
| 96 | AC_MSG_RESULT([yes]) |
| 97 | AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], 1, [1 if have the `std::function' class.]) |
| 98 | ], [ |
| 99 | AC_MSG_RESULT([no]) |
| 100 | AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], 0, [1 if have the `std::function' class.]) |
| 101 | ]) |
| 102 | AC_MSG_CHECKING([for boost::function]) |
| 103 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 104 | [[#include <boost/function.hpp>]] |
| 105 | [[boost::function<int> have_function();]]) |
| 106 | ], [ |
| 107 | AC_MSG_RESULT([yes]) |
| 108 | AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], 1, [1 if have the `boost::function' class.]) |
| 109 | ], [ |
| 110 | AC_MSG_RESULT([no]) |
| 111 | AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], 0, [1 if have the `boost::function' class.]) |
| 112 | ]) |
| 113 | |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 114 | AC_MSG_CHECKING([for gmtime support]) |
| 115 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
Jeff Thompson | d32bab6 | 2013-10-18 14:55:26 -0700 | [diff] [blame] | 116 | [[#include <time.h>]] |
Jeff Thompson | ea94620 | 2013-10-18 14:35:32 -0700 | [diff] [blame] | 117 | [[#include <sys/time.h>]] |
| 118 | [[struct timeval tv;]] |
| 119 | [[int result1 = gettimeofday(&tv, 0);]] |
| 120 | [[time_t time1 = time(0);]] |
| 121 | [[struct tm* tm1 = gmtime(&time1);]] |
| 122 | [[time_t time2 = timegm(tm1);]]) |
| 123 | ], [ |
| 124 | AC_MSG_RESULT([yes]) |
| 125 | AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 1, [1 if have sys/time gmtime support including timegm.]) |
| 126 | ], [ |
| 127 | AC_MSG_RESULT([no]) |
| 128 | AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 0, [1 if have sys/time gmtime support including timegm.]) |
| 129 | ]) |
| 130 | |
Jeff Thompson | d0f62e1 | 2013-10-09 17:41:25 -0700 | [diff] [blame] | 131 | # Require libcrypto. |
| 132 | AC_CHECK_LIB([crypto], [EVP_EncryptInit], [], |
| 133 | [AC_MSG_FAILURE([can't find openssl crypto lib])]) |
| 134 | |
Jeff Thompson | bb6b568 | 2013-10-09 18:22:38 -0700 | [diff] [blame] | 135 | # Conditionally use libsqlite3. AX_LIB_SQLITE3 defines HAVE_SQLITE3 in confdefs.h . |
Jeff Thompson | d0f62e1 | 2013-10-09 17:41:25 -0700 | [diff] [blame] | 136 | AX_LIB_SQLITE3() |
Jeff Thompson | bb6b568 | 2013-10-09 18:22:38 -0700 | [diff] [blame] | 137 | if grep -q "#define HAVE_SQLITE3" confdefs.h ; then |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 138 | AC_CHECK_LIB([sqlite3], [sqlite3_open], [], |
| 139 | [AC_MSG_FAILURE([have sqlite2 headers but no libsqlite3])]) |
Jeff Thompson | d0f62e1 | 2013-10-09 17:41:25 -0700 | [diff] [blame] | 140 | fi |
| 141 | |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 142 | # Conditionally use the OSX Security framework . |
| 143 | AC_MSG_CHECKING([for OSX Security framework]) |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 144 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 145 | [[#include <CoreFoundation/CoreFoundation.h>]] |
| 146 | [[#include <Security/Security.h>]] |
| 147 | [[#include <CoreServices/CoreServices.h>]] |
| 148 | [[void test() { SecKeychainRef x; }]]) |
| 149 | ], [ |
| 150 | AC_MSG_RESULT([yes]) |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 151 | HAVE_OSX_SECURITY=1 |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 152 | ], [ |
| 153 | AC_MSG_RESULT([no]) |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 154 | HAVE_OSX_SECURITY=0 |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 155 | ]) |
Jeff Thompson | f21e224 | 2013-10-09 19:01:49 -0700 | [diff] [blame] | 156 | AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], $HAVE_OSX_SECURITY, [1 if have the OSX framework.]) |
| 157 | if test "$HAVE_OSX_SECURITY" == "1" ; then |
| 158 | LIBS="$LIBS -framework Security" |
| 159 | fi |
Jeff Thompson | 9cf9dfb | 2013-10-04 16:36:52 -0700 | [diff] [blame] | 160 | |
Jeff Thompson | ca45e55 | 2013-06-26 17:40:06 -0700 | [diff] [blame] | 161 | DX_HTML_FEATURE(ON) |
| 162 | DX_CHM_FEATURE(OFF) |
| 163 | DX_CHI_FEATURE(OFF) |
| 164 | DX_MAN_FEATURE(OFF) |
| 165 | DX_RTF_FEATURE(OFF) |
| 166 | DX_XML_FEATURE(OFF) |
| 167 | DX_PDF_FEATURE(OFF) |
| 168 | DX_PS_FEATURE(OFF) |
| 169 | DX_INIT_DOXYGEN([$PACKAGE_NAME],[Doxyfile]) |
| 170 | |
Jeff Thompson | 6e22904 | 2013-10-10 11:09:49 -0700 | [diff] [blame] | 171 | AC_CONFIG_FILES([Makefile |
| 172 | include/Makefile]) |
Jeff Thompson | ff092f5 | 2013-06-19 13:38:12 -0700 | [diff] [blame] | 173 | AC_OUTPUT |