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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
dnl Copyright (C) 2009-2011 Tavian Barnes <tavianator@gmail.com>
dnl
dnl This file is part of The Dimension Build Suite.
dnl
dnl The Dimension Build Suite is free software; you can redistribute it
dnl and/or modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl
dnl The Dimension Build Suite is distributed in the hope that it will be
dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty
dnl of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl Initialization
AC_PREREQ(2.65)
AC_INIT(Dimension, 0.0.0, tavianator@gmail.com, dimension,
[http://dmnsn.googlecode.com])
AM_INIT_AUTOMAKE([parallel-tests color-tests std-options])
AM_SILENT_RULES([yes])
dnl Use C99 mode with GNU extensions
CFLAGS="-std=gnu99 -D_REENTRANT $CFLAGS"
dnl Programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AM_PROG_LEX
AC_PROG_YACC
AM_PROG_AS
AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
dnl PNG canvas export
AC_ARG_ENABLE([png],
[AS_HELP_STRING([--enable-png],
[Enable PNG canvas export [default=yes]])],
[],
[enable_png=yes])
AM_CONDITIONAL([PNG], [test "$enable_png" != "no"])
dnl OpenGL canvas export
AC_ARG_ENABLE([gl],
[AS_HELP_STRING([--enable-gl],
[Enable OpenGL canvas export [default=yes]])],
[],
[enable_gl=yes])
AM_CONDITIONAL([GL], [test "$enable_gl" != "no"])
dnl Built-in profiling support
AC_ARG_ENABLE([profile],
[AS_HELP_STRING([--enable-profile],
[Enable built-in branch profiling support [default=no]])],
[],
[enable_profile=no])
AM_CONDITIONAL([PROFILE], [test "$enable_profile" = "yes"])
dnl Timing library for benchmarks
PKG_CHECK_MODULES([libsandglass], [libsandglass >= 0.2],
[],
[AC_MSG_WARN([libsandglass not found - benchmarking suite will not work])])
AC_SUBST(libsandglass_CFLAGS)
AC_SUBST(libsandglass_LIBS)
dnl Platform feature tests
AC_MSG_CHECKING([for sched_getaffinity()])
AC_LINK_IFELSE([
AC_LANG_PROGRAM(
[
#define _GNU_SOURCE
#include <sched.h>
],
[
cpu_set_t cpuset;
sched_getaffinity(0, sizeof(cpuset), &cpuset);
]
)],
[AC_DEFINE([DMNSN_SCHED_GETAFFINITY], [1])
AC_MSG_RESULT([yes])],
[AC_DEFINE([DMNSN_SCHED_GETAFFINITY], [0])
AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([for sysconf(_SC_NPROCESSORS_ONLN)])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[ #include <unistd.h> ],
[ sysconf(_SC_NPROCESSORS_ONLN); ]
)],
[AC_DEFINE([DMNSN_SC_NPROCESSORS_ONLN], [1])
AC_MSG_RESULT([yes])],
[AC_DEFINE([DMNSN_SC_NPROCESSORS_ONLN], [0])
AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([for backtrace()])
AC_LINK_IFELSE([
AC_LANG_PROGRAM(
[ #include <execinfo.h> ],
[ backtrace(0, 0); ]
)],
[AC_DEFINE([DMNSN_BACKTRACE], [1])
AC_MSG_RESULT([yes])],
[AC_DEFINE([DMNSN_BACKTRACE], [0])
AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([for gettid()])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[ #include <sys/syscall.h> ],
[ syscall(SYS_gettid); ]
)],
[AC_DEFINE([DMNSN_GETTID], [1])
AC_MSG_RESULT([yes])],
[AC_DEFINE([DMNSN_GETTID], [0])
AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([for times()])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[
#include <sys/times.h>
#include <unistd.h>
],
[
long clk_tck = sysconf(_SC_CLK_TCK);
struct tms buf;
clock_t real = times(&buf);
]
)],
[AC_DEFINE([DMNSN_TIMES], [1])
AC_MSG_RESULT([yes])],
[AC_DEFINE([DMNSN_TIMES], [0])
AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([for ioctl(TIOCGWINSZ)])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[
#include <sys/ioctl.h>
#include <unistd.h>
],
[
struct winsize ws;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
]
)],
[AC_DEFINE([DMNSN_TIOCGWINSZ], [1])
AC_MSG_RESULT([yes])],
[AC_DEFINE([DMNSN_TIOCGWINSZ], [0])
AC_MSG_RESULT([no])]
)
AC_CHECK_HEADER([GL/glx.h], [enable_glx=yes], [enable_glx=no])
AM_CONDITIONAL([GLX], [test "$enable_glx" != "no"])
dnl Generate Makefiles
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_FILES([Makefile
libdimension/Makefile
libdimension/Doxyfile
libdimension/libdimension.pc
dimension/Makefile
tests/Makefile
tests/libdimension/Makefile
tests/dimension/Makefile
bench/Makefile
bench/libdimension/Makefile
bench/dimension/Makefile
doc/Makefile])
AC_OUTPUT
|