-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.ac
268 lines (227 loc) · 8.15 KB
/
configure.ac
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
m4_define([selfie_major_version], [1])
m4_define([selfie_minor_version], [0])
m4_define([selfie_revision_version], [4])
m4_define([selfie_version], [selfie_major_version.selfie_minor_version.selfie_revision_version])
AC_PREREQ([2.63])
AC_INIT([SELFIE], [selfie_version], [laurent.nguyen@cea.fr],[],[https://github.com/cea-hpc/selFIe])
AM_INIT_AUTOMAKE([-Wall subdir-objects])
AC_CONFIG_SRCDIR([src/selfie.c])
AC_CONFIG_HEADERS([config.h])
# Version
AC_DEFINE([SELFIE_MAJOR_VERSION],[selfie_major_version],[Major version])
AC_DEFINE([SELFIE_MINOR_VERSION],[selfie_minor_version],[Minor version])
AC_DEFINE([SELFIE_REVISION_VERSION],[selfie_revision_version],[Revision version])
AC_DEFINE([SELFIE_VERSION],[selfie_version],[Version])
# use the C++ compiler for the following checks
AC_LANG([C])
# find OpenMP flag
AC_OPENMP
# use Python
AM_PATH_PYTHON([3.4])
# Checks for programs.
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC([gcc cc])
AC_PROG_CXX([g++ c++])
AC_LANG_PUSH(C)
AC_LANG_POP(C)
AM_PROG_AR
AM_PROG_LIBTOOL
AC_PROG_INSTALL
# Checks for libraries.
AC_DISABLE_STATIC
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([locale.h])
AC_CHECK_HEADERS([regex.h])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([syslog.h])
AC_CHECK_HEADERS([sys/resource.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([dlfcn.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_HEADER_STDBOOL
AC_TYPE_SSIZE_T
# Options
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug mode],
[ AC_DEFINE([HAVE_DEBUG],[],[Enable debug mode]) ])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([regcomp])
AC_CHECK_FUNCS([setlocale])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([getopt])
AC_CHECK_FUNCS([readlink])
AC_CHECK_FUNCS([stat])
AC_CHECK_FUNCS([strcpy])
AC_CHECK_FUNCS([strcat])
AC_CHECK_FUNCS([strncpy])
AC_CHECK_FUNCS([strncat])
AC_CHECK_FUNCS([strlen])
AC_CHECK_FUNCS([snprintf])
AC_CHECK_FUNCS([sprintf])
AC_CHECK_FUNCS([fprintf])
AC_CHECK_FUNCS([printf])
AC_CHECK_FUNCS([fopen])
AC_CHECK_FUNCS([fclose])
AC_CHECK_FUNCS([atof])
AC_CHECK_FUNCS([atoi])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([getenv])
AC_CHECK_FUNCS([regcomp])
AC_CHECK_FUNCS([regexec])
AC_CHECK_FUNCS([regfree])
AC_CHECK_FUNCS([openlog])
AC_CHECK_FUNCS([syslog])
AC_CHECK_FUNCS([closelog])
AC_CHECK_LIB([dl],[dlopen],[],[AC_MSG_ERROR([Unable to use libdl])])
AC_CHECK_LIB([dl],[dlsym],[],[AC_MSG_ERROR([Unable to use libdl])])
AC_CHECK_LIB([dl],[dlclose],[],[AC_MSG_ERROR([Unable to use libdl])])
# Check for libYAML
# introduce the optional configure parameter for a non-standard install prefix of libyaml
AC_ARG_WITH([libyaml],
[AS_HELP_STRING([--with-libyaml=prefix],
[Directory where to find libyaml (libYAML must have been compiled with --with-pic option)])],
[LIBYAMLPATHSET=1],
[LIBYAMLPATHSET=0])
# if optional parameter used, extend path flags for compliler and linker
if test $LIBYAMLPATHSET = 1 ; then
# extend the compiler and linker flags according to the path set
AM_CXXFLAGS="$AM_CXXFLAGS -I$with_libyaml/include"
AM_CPPFLAGS="$AM_CPPFLAGS -I$with_libyaml/include"
AM_CFLAGS="$AM_CFLAGS -I$with_libyaml/include"
LIBS="$LIBS $with_libyaml/lib/libyaml.a"
AC_MSG_CHECKING([libyaml prefix])
AC_MSG_RESULT([$with_libyaml])
else
# Otherwise, link to libyaml from system
LIBS="$LIBS -lyaml"
fi
CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
CFLAGS="$AM_CFLAGS $CFLAGS"
AC_CHECK_HEADERS([yaml.h], [], [AC_MSG_ERROR([Unable to find libyaml])])
AC_CHECK_FUNCS([yaml_parser_initialize], [], [AC_MSG_ERROR([Unable to use libyaml])])
AC_CHECK_FUNCS([yaml_parser_set_input_file], [], [AC_MSG_ERROR([Unable to use libyaml])])
AC_CHECK_FUNCS([yaml_parser_parse], [], [AC_MSG_ERROR([Unable to use libyaml])])
AC_CHECK_FUNCS([yaml_event_delete], [], [AC_MSG_ERROR([Unable to use libyaml])])
AC_CHECK_FUNCS([yaml_parser_delete], [], [AC_MSG_ERROR([Unable to use libyaml])])
# Check for POSIXIO
AC_ARG_WITH([posixio],
[AS_HELP_STRING([--with-posixio=builtin|hook],
[Enable POSIXIO profiling (default=hook)])],
[ENABLEPOSIXIO=1],
[ENABLEPOSIXIO=0])
if test $ENABLEPOSIXIO = 1; then
AC_DEFINE([HAVE_POSIXIO],[],[Enable POSIXIO profiling])
if test "x$with_posixio" = xbuiltin ; then
AC_DEFINE([__SELFIE_POSIXIO_BUILTIN__],[],[Enable POSIXIO built-in hook])
else
AC_DEFINE([__SELFIE_POSIXIO_HOOK__],[],[Enable POSIXIO standard hook])
fi
fi
# Check for MPI
AC_ARG_WITH([mpi],
[AS_HELP_STRING([--with-mpi],
[Enable MPI profiling])],
[ENABLEMPI=1],
[ENABLEMPI=0])
if test $ENABLEMPI = 1; then
AC_DEFINE([HAVE_MPI],[],[Enable MPI profiling])
AC_DEFINE([__SELFIE_MPI_BUILTIN__],[],[Enable MPI built-in hook])
fi
# Check for PAPI
# introduce the optional configure parameter for a non-standard install prefix of PAPI
AC_ARG_WITH([papi],
[AS_HELP_STRING([--with-papi=prefix],
[Directory where to find PAPI (PAPI must have been compiled with shared library) ])],
[LIBPAPIPATHSET=1],
[LIBPAPIPATHSET=0])
# Check for OMP
AC_ARG_WITH([omp],
[AS_HELP_STRING([--with-omp],
[Enable OMP profiling])],
[ENABLEOMP=1],
[ENABLEOMP=0])
if test $ENABLEOMP = 1; then
AC_DEFINE([HAVE_OMP],[],[Enable OMP profiling])
fi
OLD_AM_CXXFLAGS="$AM_CXXFLAGS"
OLD_AM_CPPFLAGS="$AM_CPPFLAGS"
OLD_AM_CFLAGS="$AM_CFLAGS"
OLD_LIBS="$LIBS"
# if optional parameter used, extend path flags for compliler and linker
if test $LIBPAPIPATHSET = 1 ; then
if test "x$with_papi" != xno ; then
OLD_AM_CXXFLAGS="$AM_CXXFLAGS"
OLD_AM_CPPFLAGS="$AM_CPPFLAGS"
OLD_AM_CFLAGS="$AM_CFLAGS"
OLD_LIBS="$LIBS"
# Enable PAPI plugin
AC_DEFINE([HAVE_PAPI],[],[Enable PAPI plugin])
# Check system path for libpapi.so
if test "x$with_papi" != xyes ; then
AC_MSG_CHECKING([PAPI prefix])
AC_MSG_RESULT([$with_papi])
PAPI_PREFIX="$with_papi"
AC_CHECK_FILE([$PAPI_PREFIX/include/papi.h],
[PAPI_INCLUDE="$PAPI_PREFIX/include/papi.h"])
AC_CHECK_FILE([$PAPI_PREFIX/lib/libpapi.so],
[LIBPAPI_PATH="$PAPI_PREFIX/lib"])
AC_CHECK_FILE([$PAPI_PREFIX/lib64/libpapi.so],
[LIBPAPI_PATH="$PAPI_PREFIX/lib64"])
AM_CXXFLAGS="$AM_CXXFLAGS -I$PAPI_PREFIX/include"
AM_CPPFLAGS="$AM_CPPFLAGS -I$PAPI_PREFIX/include"
AM_CFLAGS="$AM_CFLAGS -I$PAPI_PREFIX/include"
LIBS="$LIBS $LIBPAPI_PATH/libpapi.so"
AC_DEFINE_UNQUOTED([SELFIE_PAPILIBPATH],["$LIBPAPI_PATH"],[Enable directory where to find libpapi.so])
else
LIBS="$LIBS -lpapi"
AC_DEFINE_UNQUOTED([SELFIE_PAPILIBPATH],["/usr/lib/x86_64-linux-gnu/"],[Enable directory where to find libpapi.so])
fi
AC_CHECK_FUNCS([PAPI_library_init], [], [AC_MSG_ERROR([Unable to use PAPI])])
AC_CHECK_FUNCS([PAPI_library_init])
AC_CHECK_FUNCS([PAPI_multiplex_init])
AC_CHECK_FUNCS([PAPI_create_eventset])
AC_CHECK_FUNCS([PAPI_event_name_to_code])
AC_CHECK_FUNCS([PAPI_add_event])
AC_CHECK_FUNCS([PAPI_start])
AC_CHECK_FUNCS([PAPI_stop])
AC_CHECK_FUNCS([PAPI_cleanup_eventset])
AC_CHECK_FUNCS([PAPI_destroy_eventset])
AC_DEFINE_UNQUOTED([SELFIE_PAPILIB],["libpapi.so"],[Name of PAPI library])
fi
fi
#AM_CXXFLAGS="$OLD_AM_CXXFLAGS"
#AM_CPPFLAGS="$OLD_AM_CPPFLAGS"
#AM_CFLAGS="$OLD_AM_CFLAGS"
LIBS="$OLD_LIBS"
# Add math library
LIBS="$LIBS -lm"
# Plugins
AC_DEFINE([HAVE_DUMMY],[],[Enable dummy plugin])
AC_DEFINE([HAVE_DEFAULT],[],[Enable default plugin])
# distribute additional compiler and linker flags among Makefiles
# --> set and change these variables instead of CXXFLAGS or LDFLAGS (for user only)
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])
# Set configuration parameters
AC_SUBST([CONFIGFILENAME],[selfie.conf])
AC_CONFIG_FILES([Makefile
src/Makefile
test/Makefile])
AC_OUTPUT