blob: 485a6ceb93d80d639c37b23e6fcec6e889c4bd7c [file] [log] [blame]
Jeff Thompson18f43e12013-11-21 12:45:12 -08001# To build using autotools, see the Development section of the file INSTALL.
Jeff Thompsonb7523002013-10-09 10:25:00 -07002
Jeff Thompsonff092f52013-06-19 13:38:12 -07003AC_PREREQ([2.59])
Jeff Thompson93a24162013-09-27 13:28:13 -07004AC_INIT([ndn-cpp], [0.2], [ndn-lib@lists.cs.ucla.edu], [ndn-cpp], [https://github.com/named-data/ndn-cpp])
Jeff Thompsonff092f52013-06-19 13:38:12 -07005AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
6
Jeff Thompson23cb7422013-10-09 16:11:47 -07007AC_CONFIG_MACRO_DIR([m4])
Jeff Thompson5d16a902013-10-10 11:15:14 -07008AC_CONFIG_SRCDIR([configure.ac])
Jeff Thompson6e229042013-10-10 11:09:49 -07009# Create config.h without prefixes. Put it in the include directory so CFLAGS will have -I./include .
10AC_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.
12AX_PREFIX_CONFIG_H(include/ndn-cpp/ndn-cpp-config.h)
Jeff Thompson47053ad2013-08-05 10:36:53 -070013AM_MAINTAINER_MODE
Jeff Thompson3b3aabf2013-06-21 16:50:20 -070014AM_PROG_AR
Jeff Thompson4f031642013-08-05 11:03:16 -070015AC_PROG_LIBTOOL
Jeff Thompson23cb7422013-10-09 16:11:47 -070016LT_PREREQ([2.2])
17LT_INIT()
Jeff Thompson4f031642013-08-05 11:03:16 -070018AC_PROG_CXX
Jeff Thompson1a1b4c02013-06-28 22:28:51 -070019AM_PROG_CC_C_O
Jeff Thompsonfcc4daa2013-10-01 14:52:23 -070020AC_PROG_OBJCXX
Jeff Thompsonff092f52013-06-19 13:38:12 -070021AC_LANG([C++])
Jeff Thompsonb18b6eb2013-10-11 18:28:50 -070022
23# Special case.
24case "$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 ;;
38esac
39
Jeff Thompson32a23332013-10-07 18:39:00 -070040AC_TYPE_SIZE_T
41AC_TYPE_INT8_T
42AC_TYPE_INT16_T
43AC_TYPE_INT32_T
44AC_TYPE_INT64_T
45AC_TYPE_UINT8_T
46AC_TYPE_UINT16_T
47AC_TYPE_UINT32_T
48AC_TYPE_UINT64_T
Jeff Thompsonea946202013-10-18 14:35:32 -070049AC_CHECK_FUNCS([memcmp] [memcpy] [memset])
50AC_CHECK_FUNCS([strchr], :, AC_MSG_ERROR([*** strchr not found. Check 'config.log' for more details.]))
51AC_CHECK_FUNCS([sscanf], :, AC_MSG_ERROR([*** sscanf not found. Check 'config.log' for more details.]))
Jeff Thompsond32bab62013-10-18 14:55:26 -070052AC_CHECK_HEADERS([time.h], :, AC_MSG_ERROR([*** time.h not found. Check 'config.log' for more details.]))
Jeff Thompsonea946202013-10-18 14:35:32 -070053AC_CHECK_HEADERS([sys/time.h], :, AC_MSG_ERROR([*** sys/time.h not found. Check 'config.log' for more details.]))
54AC_CHECK_FUNCS([gettimeofday], :, AC_MSG_ERROR([*** gettimeofday not found. processEvents requires it. Check 'config.log' for more details.]))
Jeff Thompson1b8f4c92013-06-19 16:18:46 -070055AX_CXX_COMPILE_STDCXX_11(, optional)
Jeff Thompson6e229042013-10-10 11:09:49 -070056AC_C_INLINE
Jeff Thompsonff092f52013-06-19 13:38:12 -070057
58AC_MSG_CHECKING([for std::shared_ptr])
59AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
60 [[#include <memory>]]
61 [[std::shared_ptr<int> have_shared_ptr;]])
62], [
63 AC_MSG_RESULT([yes])
64 AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 1, [1 if have the `std::shared_ptr' class.])
65], [
66 AC_MSG_RESULT([no])
67 AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 0, [1 if have the `std::shared_ptr' class.])
68])
Jeff Thompson9e9ea9f2013-06-22 10:31:18 -070069AC_MSG_CHECKING([for boost::shared_ptr])
Jeff Thompsonff092f52013-06-19 13:38:12 -070070AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
71 [[#include <boost/shared_ptr.hpp>]]
72 [[boost::shared_ptr<int> have_shared_ptr;]])
73], [
74 AC_MSG_RESULT([yes])
75 AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 1, [1 if have the `boost::shared_ptr' class.])
76], [
77 AC_MSG_RESULT([no])
78 AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 0, [1 if have the `boost::shared_ptr' class.])
79])
80
Jeff Thompsona28eed82013-08-22 16:21:10 -070081AC_MSG_CHECKING([for std::function])
82AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
83 [[#include <functional>]]
84 [[std::function<int> have_function();]])
85], [
86 AC_MSG_RESULT([yes])
87 AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], 1, [1 if have the `std::function' class.])
88], [
89 AC_MSG_RESULT([no])
90 AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], 0, [1 if have the `std::function' class.])
91])
92AC_MSG_CHECKING([for boost::function])
93AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
94 [[#include <boost/function.hpp>]]
95 [[boost::function<int> have_function();]])
96], [
97 AC_MSG_RESULT([yes])
98 AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], 1, [1 if have the `boost::function' class.])
99], [
100 AC_MSG_RESULT([no])
101 AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], 0, [1 if have the `boost::function' class.])
102])
103
Jeff Thompsonea946202013-10-18 14:35:32 -0700104AC_MSG_CHECKING([for gmtime support])
105AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Jeff Thompsond32bab62013-10-18 14:55:26 -0700106 [[#include <time.h>]]
Jeff Thompsonea946202013-10-18 14:35:32 -0700107 [[#include <sys/time.h>]]
108 [[struct timeval tv;]]
109 [[int result1 = gettimeofday(&tv, 0);]]
110 [[time_t time1 = time(0);]]
111 [[struct tm* tm1 = gmtime(&time1);]]
112 [[time_t time2 = timegm(tm1);]])
113], [
114 AC_MSG_RESULT([yes])
115 AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 1, [1 if have sys/time gmtime support including timegm.])
116], [
117 AC_MSG_RESULT([no])
118 AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 0, [1 if have sys/time gmtime support including timegm.])
119])
120
Jeff Thompsond0f62e12013-10-09 17:41:25 -0700121# Require libcrypto.
122AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
123 [AC_MSG_FAILURE([can't find openssl crypto lib])])
124
Jeff Thompsonbb6b5682013-10-09 18:22:38 -0700125# Conditionally use libsqlite3. AX_LIB_SQLITE3 defines HAVE_SQLITE3 in confdefs.h .
Jeff Thompsond0f62e12013-10-09 17:41:25 -0700126AX_LIB_SQLITE3()
Jeff Thompsonbb6b5682013-10-09 18:22:38 -0700127if grep -q "#define HAVE_SQLITE3" confdefs.h ; then
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700128 AC_CHECK_LIB([sqlite3], [sqlite3_open], [],
129 [AC_MSG_FAILURE([have sqlite2 headers but no libsqlite3])])
Jeff Thompsond0f62e12013-10-09 17:41:25 -0700130fi
131
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700132# Conditionally use the OSX Security framework .
133AC_MSG_CHECKING([for OSX Security framework])
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700134AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
135 [[#include <CoreFoundation/CoreFoundation.h>]]
136 [[#include <Security/Security.h>]]
137 [[#include <CoreServices/CoreServices.h>]]
138 [[void test() { SecKeychainRef x; }]])
139], [
140 AC_MSG_RESULT([yes])
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700141 HAVE_OSX_SECURITY=1
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700142], [
143 AC_MSG_RESULT([no])
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700144 HAVE_OSX_SECURITY=0
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700145])
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700146AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], $HAVE_OSX_SECURITY, [1 if have the OSX framework.])
147if test "$HAVE_OSX_SECURITY" == "1" ; then
148 LIBS="$LIBS -framework Security"
149fi
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700150
Jeff Thompsonca45e552013-06-26 17:40:06 -0700151DX_HTML_FEATURE(ON)
152DX_CHM_FEATURE(OFF)
153DX_CHI_FEATURE(OFF)
154DX_MAN_FEATURE(OFF)
155DX_RTF_FEATURE(OFF)
156DX_XML_FEATURE(OFF)
157DX_PDF_FEATURE(OFF)
158DX_PS_FEATURE(OFF)
159DX_INIT_DOXYGEN([$PACKAGE_NAME],[Doxyfile])
160
Jeff Thompson6e229042013-10-10 11:09:49 -0700161AC_CONFIG_FILES([Makefile
162 include/Makefile])
Jeff Thompsonff092f52013-06-19 13:38:12 -0700163AC_OUTPUT