Add a LICENSE file for folly
[folly.git] / folly / configure.ac
1
2 #                                               -*- Autoconf -*-
3 # Process this file with autoconf to produce a configure script.
4
5 AC_PREREQ(2.59)
6 AC_INIT(folly, 0.1, folly@fb.com)
7 AC_CONFIG_SRCDIR([Likely.h])
8 AC_CONFIG_HEADERS([config.h])
9 AX_PREFIX_CONFIG_H([folly-config.h], [folly], [config.h])
10 AC_CONFIG_AUX_DIR([build-aux])
11
12 AM_INIT_AUTOMAKE([foreign dist-bzip2])
13
14 AC_CONFIG_MACRO_DIR([m4])
15
16 AC_PROG_INSTALL
17 AM_PROG_LIBTOOL
18
19 AC_LANG([C++])
20
21 # Checks for programs.
22 AC_PROG_CXX
23 AC_PROG_CC
24 AC_CXX_COMPILE_STDCXX_0X
25
26 # Checks for libraries.
27 AC_CHECK_LIB([glog],[openlog],[],[AC_MSG_ERROR(
28              [Please install google-glog library])])
29 AC_CHECK_LIB([gflags],[getenv],[],[AC_MSG_ERROR(
30              [Please install google-gflags library])])
31
32 # check for boost libs
33 AX_BOOST_BASE
34 AX_BOOST_THREAD
35 AX_BOOST_REGEX
36
37 # Checks for header files.
38 AC_HEADER_STDC
39 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h stdlib.h string.h sys/time.h unistd.h mutex.h features.h malloc.h])
40
41 AC_CHECK_HEADER(double-conversion.h, [], [AC_MSG_ERROR(
42                 [Couldn't find double-conversion.h, please download from \
43                 http://code.google.com/p/double-conversion/])], [])
44 AC_CHECK_LIB([double_conversion_pic],[ceil],[],[AC_MSG_ERROR(
45              [Please install double-conversion library])])
46
47 # Checks for typedefs, structures, and compiler characteristics.
48 AC_HEADER_STDBOOL
49 AC_C_CONST
50 AC_C_INLINE
51 AC_TYPE_SIZE_T
52 AC_HEADER_TIME
53 AC_C_VOLATILE
54 AC_CHECK_TYPES([ptrdiff_t])
55
56 # Checks for library functions.
57 AC_CHECK_FUNCS([getdelim \
58                 gettimeofday \
59                 memmove \
60                 memset \
61                 pow \
62                 strerror \
63                 pthread_yield \
64                 ffsll \
65                 rallocm \
66                 malloc_size \
67                 malloc_usable_size])
68
69 if test "$ac_cv_func_pthread_yield" = "no"; then
70    AC_CHECK_HEADERS([sched.h])
71    AC_CHECK_FUNCS([sched_yield])
72 fi
73
74 CXX_FLAGS=""
75 if test "$ac_cv_cxx_compile_cxx0x_cxx" = yes; then
76    CXX_FLAGS="-std=c++0x"
77 fi
78 if test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
79    CXX_FLAGS="-std=gnu++0x"
80 fi
81
82 AC_SUBST(AM_CPPFLAGS, '-I../$(top_srcdir)'" "'-I$(top_srcdir)/io'" "'-I$(top_srcdir)/test'" -lstdc++ $CXX_FLAGS $BOOST_CPPFLAGS")
83 AC_SUBST(AM_CXXFLAGS, "$BOOST_THREAD_LIB")
84
85 AM_CONDITIONAL([HAVE_STD_THREAD], [test "$ac_cv_header_features" = "yes"])
86 AM_CONDITIONAL([HAVE_X86_64], [test "$build_cpu" = "x86_64"])
87
88 # Output
89 AC_CONFIG_FILES([Makefile
90                  test/Makefile
91                  test/function_benchmark/Makefile])
92 AC_OUTPUT