blob: ebd0565ce57141fb5829c69f44e4a4fea4141ded [file] [log] [blame]
Jeff Thompsonb7523002013-10-09 10:25:00 -07001# 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 Thompsonff092f52013-06-19 13:38:12 -070013AC_PREREQ([2.59])
Jeff Thompson93a24162013-09-27 13:28:13 -070014AC_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 -070015AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
16
Jeff Thompson23cb7422013-10-09 16:11:47 -070017AC_CONFIG_MACRO_DIR([m4])
Jeff Thompson5d16a902013-10-10 11:15:14 -070018AC_CONFIG_SRCDIR([configure.ac])
Jeff Thompson6e229042013-10-10 11:09:49 -070019# Create config.h without prefixes. Put it in the include directory so CFLAGS will have -I./include .
20AC_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.
22AX_PREFIX_CONFIG_H(include/ndn-cpp/ndn-cpp-config.h)
Jeff Thompson47053ad2013-08-05 10:36:53 -070023AM_MAINTAINER_MODE
Jeff Thompson3b3aabf2013-06-21 16:50:20 -070024AM_PROG_AR
Jeff Thompson4f031642013-08-05 11:03:16 -070025AC_PROG_LIBTOOL
Jeff Thompson23cb7422013-10-09 16:11:47 -070026LT_PREREQ([2.2])
27LT_INIT()
Jeff Thompson4f031642013-08-05 11:03:16 -070028AC_PROG_CXX
Jeff Thompson1a1b4c02013-06-28 22:28:51 -070029AM_PROG_CC_C_O
Jeff Thompsonfcc4daa2013-10-01 14:52:23 -070030AC_PROG_OBJCXX
Jeff Thompsonff092f52013-06-19 13:38:12 -070031AC_LANG([C++])
Jeff Thompsonb18b6eb2013-10-11 18:28:50 -070032
33# Special case.
34case "$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 ;;
48esac
49
Jeff Thompson32a23332013-10-07 18:39:00 -070050AC_TYPE_SIZE_T
51AC_TYPE_INT8_T
52AC_TYPE_INT16_T
53AC_TYPE_INT32_T
54AC_TYPE_INT64_T
55AC_TYPE_UINT8_T
56AC_TYPE_UINT16_T
57AC_TYPE_UINT32_T
58AC_TYPE_UINT64_T
Jeff Thompsonea946202013-10-18 14:35:32 -070059AC_CHECK_FUNCS([memcmp] [memcpy] [memset])
60AC_CHECK_FUNCS([strchr], :, AC_MSG_ERROR([*** strchr not found. Check 'config.log' for more details.]))
61AC_CHECK_FUNCS([sscanf], :, AC_MSG_ERROR([*** sscanf not found. Check 'config.log' for more details.]))
62AC_CHECK_HEADERS([sys/time.h], :, AC_MSG_ERROR([*** sys/time.h not found. Check 'config.log' for more details.]))
63AC_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 -070064AX_CXX_COMPILE_STDCXX_11(, optional)
Jeff Thompson6e229042013-10-10 11:09:49 -070065AC_C_INLINE
Jeff Thompsonff092f52013-06-19 13:38:12 -070066
67AC_MSG_CHECKING([for std::shared_ptr])
68AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
69 [[#include <memory>]]
70 [[std::shared_ptr<int> have_shared_ptr;]])
71], [
72 AC_MSG_RESULT([yes])
73 AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 1, [1 if have the `std::shared_ptr' class.])
74], [
75 AC_MSG_RESULT([no])
76 AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], 0, [1 if have the `std::shared_ptr' class.])
77])
Jeff Thompson9e9ea9f2013-06-22 10:31:18 -070078AC_MSG_CHECKING([for boost::shared_ptr])
Jeff Thompsonff092f52013-06-19 13:38:12 -070079AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
80 [[#include <boost/shared_ptr.hpp>]]
81 [[boost::shared_ptr<int> have_shared_ptr;]])
82], [
83 AC_MSG_RESULT([yes])
84 AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 1, [1 if have the `boost::shared_ptr' class.])
85], [
86 AC_MSG_RESULT([no])
87 AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], 0, [1 if have the `boost::shared_ptr' class.])
88])
89
Jeff Thompsona28eed82013-08-22 16:21:10 -070090AC_MSG_CHECKING([for std::function])
91AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
92 [[#include <functional>]]
93 [[std::function<int> have_function();]])
94], [
95 AC_MSG_RESULT([yes])
96 AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], 1, [1 if have the `std::function' class.])
97], [
98 AC_MSG_RESULT([no])
99 AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], 0, [1 if have the `std::function' class.])
100])
101AC_MSG_CHECKING([for boost::function])
102AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
103 [[#include <boost/function.hpp>]]
104 [[boost::function<int> have_function();]])
105], [
106 AC_MSG_RESULT([yes])
107 AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], 1, [1 if have the `boost::function' class.])
108], [
109 AC_MSG_RESULT([no])
110 AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], 0, [1 if have the `boost::function' class.])
111])
112
Jeff Thompsonea946202013-10-18 14:35:32 -0700113AC_MSG_CHECKING([for gmtime support])
114AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
115 [[#include <sys/time.h>]]
116 [[struct timeval tv;]]
117 [[int result1 = gettimeofday(&tv, 0);]]
118 [[time_t time1 = time(0);]]
119 [[struct tm* tm1 = gmtime(&time1);]]
120 [[time_t time2 = timegm(tm1);]])
121], [
122 AC_MSG_RESULT([yes])
123 AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 1, [1 if have sys/time gmtime support including timegm.])
124], [
125 AC_MSG_RESULT([no])
126 AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 0, [1 if have sys/time gmtime support including timegm.])
127])
128
Jeff Thompsond0f62e12013-10-09 17:41:25 -0700129# Require libcrypto.
130AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
131 [AC_MSG_FAILURE([can't find openssl crypto lib])])
132
Jeff Thompsonbb6b5682013-10-09 18:22:38 -0700133# Conditionally use libsqlite3. AX_LIB_SQLITE3 defines HAVE_SQLITE3 in confdefs.h .
Jeff Thompsond0f62e12013-10-09 17:41:25 -0700134AX_LIB_SQLITE3()
Jeff Thompsonbb6b5682013-10-09 18:22:38 -0700135if grep -q "#define HAVE_SQLITE3" confdefs.h ; then
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700136 AC_CHECK_LIB([sqlite3], [sqlite3_open], [],
137 [AC_MSG_FAILURE([have sqlite2 headers but no libsqlite3])])
Jeff Thompsond0f62e12013-10-09 17:41:25 -0700138fi
139
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700140# Conditionally use the OSX Security framework .
141AC_MSG_CHECKING([for OSX Security framework])
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700142AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
143 [[#include <CoreFoundation/CoreFoundation.h>]]
144 [[#include <Security/Security.h>]]
145 [[#include <CoreServices/CoreServices.h>]]
146 [[void test() { SecKeychainRef x; }]])
147], [
148 AC_MSG_RESULT([yes])
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700149 HAVE_OSX_SECURITY=1
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700150], [
151 AC_MSG_RESULT([no])
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700152 HAVE_OSX_SECURITY=0
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700153])
Jeff Thompsonf21e2242013-10-09 19:01:49 -0700154AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], $HAVE_OSX_SECURITY, [1 if have the OSX framework.])
155if test "$HAVE_OSX_SECURITY" == "1" ; then
156 LIBS="$LIBS -framework Security"
157fi
Jeff Thompson9cf9dfb2013-10-04 16:36:52 -0700158
Jeff Thompsonca45e552013-06-26 17:40:06 -0700159DX_HTML_FEATURE(ON)
160DX_CHM_FEATURE(OFF)
161DX_CHI_FEATURE(OFF)
162DX_MAN_FEATURE(OFF)
163DX_RTF_FEATURE(OFF)
164DX_XML_FEATURE(OFF)
165DX_PDF_FEATURE(OFF)
166DX_PS_FEATURE(OFF)
167DX_INIT_DOXYGEN([$PACKAGE_NAME],[Doxyfile])
168
Jeff Thompson6e229042013-10-10 11:09:49 -0700169AC_CONFIG_FILES([Makefile
170 include/Makefile])
Jeff Thompsonff092f52013-06-19 13:38:12 -0700171AC_OUTPUT