File: configure.ac

package info (click to toggle)
cnrun 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 720 kB
  • sloc: cpp: 7,849; makefile: 205
file content (109 lines) | stat: -rw-r--r-- 2,859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
AC_COPYRIGHT([Copyright (c) 2008-15 Andrei Zavada <johnhommer@gmail.com>])

AC_INIT([cnrun], [2.1.0], [johnhommer@gmail.com])
AC_CONFIG_SRCDIR([src/libcnrun/model/model.hh])
AC_CONFIG_MACRO_DIR([m4])
AC_PREREQ(2.61)

AM_INIT_AUTOMAKE([-Wno-portability silent-rules subdir-objects])
dnl AM_SILENT_RULES([yes])

AC_CONFIG_HEADERS([config.h])

AC_PROG_LD()
AM_DISABLE_STATIC()
LT_INIT()

AC_PROG_CXX([$CXX])
AC_LANG([C++])

dnl Check for c++11 features
AC_DEFUN([AC_CXX_STDCPP11_FEATURES],
[AC_CACHE_CHECK(whether $CXX has all required c++11 features,
ac_cv_cxx_cpp11_features,
[AC_LANG([C++])
 old_CXX=$CXX
 CXX="$CXX -std=c++0x"
 AC_TRY_RUN([
    #include <vector>
    #include <algorithm>
    using namespace std;
    enum class fafa : int { ke, pi };
    class C { C(int) {} C(int x, int) : C(x) {} };
    int main (int , char **)
    {
      void* p = nullptr;
      vector<vector<int>> v {{1, 2}};
      for ( auto& i : v )
      	;
      unsigned c = count_if( v.begin(), v.end(), [&] (vector<int> &i) { return i == vector<int> ({2,3}); });
      return 0;
    }
 ],
 ac_cv_cxx_cpp11_features=yes, ac_cv_cxx_cpp11_features=no,
 ac_cv_cxx_cpp11_features=yes)
 CXX=$old_CXX
])
])
AC_CXX_STDCPP11_FEATURES()
test $ac_cv_cxx_cpp11_features = no && \
   AC_MSG_ERROR([
Your C++ compiler seems to not support some c++11 features\
that we would rather like to have.  Please check config.log for details.
], 1)
cxx_version=`$CXX --version | head -n1`

AC_OPENMP()

PKG_CHECK_MODULES([LIBCN], [gsl libxml-2.0])

#AX_PROG_LUA([5.1], [5.3],)
# we carry own copy of ax_lua.m4, with suffixed macros to differentiate those from standard ones
AX_PROG_LUA2014(,,)
AX_LUA_LIBS2014
AX_LUA_HEADERS2014
dnl we cannot do strcmp in cpp, so here's bash to the rescue
if test x"$LUA_VERSION" = x"5.2"; then
   AC_DEFINE([HAVE_LUA_52], [], ["Do we have lua 5.2?"])
fi

AC_ARG_ENABLE(
	[tools],
	AS_HELP_STRING( [--enable-tools], [build spike2sdf, varfold & hh-latency-estimator (default = yes)]),
	[do_tools=$enableval], [do_tools=yes])
AM_CONDITIONAL(DO_TOOLS, [test x"$do_tools" = xyes])

AC_ARG_ENABLE(
	[lua-api-docs],
	AS_HELP_STRING( [--enable-lua-api-docs], [build lua API docs (default = no)]),
	[do_luaapidocs=$enableval], [do_luaapidocs=no])
AM_CONDITIONAL(DO_LUAAPIDOCS, [test x"$do_luaapidocs" = xyes])

AC_OUTPUT([
	Makefile
        libcnrun.pc
	src/Makefile
	src/libstilton/Makefile
	src/libcnrun/Makefile
	src/lua-cnrun/Makefile
	doc/Makefile
	doc/lua-api/Makefile
	man/spike2sdf.1
	man/hh-latency-estimator.1
	src/tools/Makefile])

AC_MSG_RESULT([
** Configuration summary for $PACKAGE $VERSION:

   PREFIX:              $prefix

   CXX:			$CXX (${cxx_version})
   CXXFLAGS:            $CXXFLAGS
   LDFLAGS:             $LDFLAGS

   LUA:                 $LUA_VERSION (execdir: $luaexecdir)

   build tools:		${do_tools}
   build lua API docs:	${do_luaapidocs}

])