This repository has been archived by the owner on Sep 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure.ac
304 lines (265 loc) · 9.33 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# -*- shell-script -*-
#
# Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 University of Wisconsin-La Crosse.
# All rights reserved.
# Copyright (c) 2014 Inria. All rights reserved.
#
# $COPYRIGHT$
#
# See COPYING in top-level directory.
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_INIT([netloc],
[m4_normalize(esyscmd([config/netloc_get_version.sh VERSION --version]))],
[http://www.open-mpi.org/projects/netloc/], [netloc])
AC_LANG([C])
AC_PREREQ(2.63)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.11 -Wall -Werror])
AM_SILENT_RULES([yes])
# We want new Libtool. None of that old stuff. Pfft.
m4_ifdef([LT_PREREQ], [],
[m4_fatal([libtool version 2.2.6 or higher is required], [63])])
LT_PREREQ([2.2.6])
# Get the version of netloc that we are installing
AC_MSG_CHECKING([for netloc version])
NETLOC_VERSION="`$srcdir/config/netloc_get_version.sh $srcdir/VERSION`"
if test "$?" != "0"; then
AC_MSG_ERROR([Cannot continue])
fi
NETLOC_RELEASE_DATE="`$srcdir/config/netloc_get_version.sh $srcdir/VERSION --release-date`"
AC_SUBST(NETLOC_VERSION)
AC_SUBST(NETLOC_RELEASE_DATE)
AC_MSG_RESULT([$NETLOC_VERSION])
# Override/fixup the version numbers set by AC_INIT, since on
# developer builds, there's no good way to know what the version is
# before running configure :(. We only use the base version number
# (ie, no svn r numbers) for the version set in AC_INIT. This will
# always match reality because we add the VERSION file (the only way
# to change the major.minor.release{greek}) into the configure
# dependencies.
PACKAGE_VERSION="$NETLOC_VERSION"
PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
VERSION="${PACKAGE_VERSION}"
# For standalone configurations, we also include a .so version number.
. $srcdir/VERSION
AC_SUBST([libnetloc_so_version])
# Setup the header file
AH_TOP([/* -*- c -*-
*
* Copyright © 2013 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef NETLOC_CONFIGURE_H
#define NETLOC_CONFIGURE_H
])
AH_BOTTOM([
#endif /* NETLOC_CONFIGURE_H */
])
AC_CONFIG_HEADERS([include/private/autogen/config.h])
AC_CONFIG_HEADERS([include/netloc/autogen/config.h])
dnl AC_CONFIG_HEADERS([include/private/autogen/config.h])
# Setup C++ compiler
CXXFLAGS_save=$CXXFLAGS
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_CC_C99
CXXFLAGS=$CXXFLAGS_save
# This did not exist pre AM 1.11.x (where x is somewhere >0 and <3),
# but it is necessary in AM 1.12.x.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
#
# Ensure that we have the STL
#
AC_MSG_CHECKING([for the STL (C++11 or better)])
AC_LANG([C++])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <string>
#include <map>
using namespace std;
]], [[
map<string, string> m;
string a, b;
a = "hello";
b = "world";
m[a] = b;
b = m.at(a);]])
], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_WARN([You do not appear to have the STL])
AC_MSG_ERROR([Cannot continue])
])
#
# Setup Jansson
#
# For the moment, we can only build with the internal Jansson. It may
# be useful to also add the ability to build with an external Jansson,
# too.
#
m4_include([jansson/jansson.m4])
JANSSON_CONFIG
# Set a few flags that are used in various Makefile.am's to
# compile/link against Jansson.
JANSSON_CPPFLAGS='-I$(top_srcdir)/jansson/src -I$(top_builddir)/jansson/src'
AC_SUBST(JANSSON_CPPFLAGS)
# For the embedded Jansson, we don't need any LDFLAGS
JANSSON_LDFLAGS=
AC_SUBST(JANSSON_LDFLAGS)
JANSSON_LIBS='$(top_builddir)/jansson/src/libjansson.la'
AC_SUBST(JANSSON_LIBS)
#
# Check for compiler attributes and visibility
#
_NETLOC_C_COMPILER_VENDOR([netloc_c_vendor])
_NETLOC_CHECK_ATTRIBUTES
_NETLOC_CHECK_VISIBILITY
NETLOC_CFLAGS="$NETLOC_FLAGS $NETLOC_VISIBILITY_CFLAGS"
AS_IF([test "$NETLOC_VISIBILITY_CFLAGS" != ""],
[AC_MSG_WARN(["$NETLOC_VISIBILITY_CFLAGS" has been added to the netloc CFLAGS])])
#
# Look for hwloc; error if we can't find it
#
AC_ARG_WITH([hwloc],
AC_HELP_STRING([--with-hwloc=DIR],
[Specify the prefix of your hwloc installation]))
# Basic sanity check on the --with-hwloc value
AC_MSG_CHECKING([with --with-hwloc])
AS_IF([test "$with_hwloc" = "no"],
[AC_MSG_RESULT([bad])
AC_MSG_WARN([You cannot specify --without-hwloc])
AC_MSG_ERROR([Cannot conntinue])
])
AS_IF([test "$with_hwloc" = "yes" -o -z "$with_hwloc"],
[AC_MSG_RESULT([ok (unspecified)])],
[AS_IF([test -f "$with_hwloc/include/hwloc.h"],
[AC_MSG_RESULT([good ($with_hwloc)])
CPPFLAGS="$CPPFLAGS -I$with_hwloc/include"
LDFLAGS="$LDFLAGS -L$with_hwloc/lib"],
[AC_MSG_RESULT([bad ($with_hwloc)])
AC_MSG_WARN([$with_hwloc/include/hwloc.h not found])
AC_MSG_ERROR([Cannot continue])])
])
AC_CHECK_HEADER([hwloc.h], [:],
[AC_MSG_WARN([Cannot find hwloc.h])
AC_MSG_WARN([Perhaps you need to specify --with-hwloc, or some CPPFLAGS?])
AC_MSG_ERROR([Cannot continue])])
AC_MSG_CHECKING([for hwloc version >= 1.4.2])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hwloc.h>]],
[[
#if HWLOC_API_VERSION <= 0x00010400
#error "HWLOC_API_VERSION is less than 0x00010400"
#endif
]])],
[AC_MSG_RESULT([good])],
[AC_MSG_RESULT([bad])
AC_MSG_WARN([Version of hwloc is too old.])
AC_MSG_WARN([We require version 1.4.2 or later.])
AC_MSG_ERROR([Cannot continue])])
AC_CHECK_LIB([hwloc], [hwloc_topology_init], [:],
[AC_MSG_WARN([Cannot find libhwloc])
AC_MSG_WARN([Perhaps you need to specify --with-hwloc, or some LDFLAGS?])
AC_MSG_ERROR([Cannot continue])])
#
# SED_I
# Linux and OS X take different sed arguments.
#
AC_PROG_SED
AC_MSG_CHECKING([if the sed -i option requires an argument])
rm -f conftest
cat > conftest <<EOF
hello
EOF
$SED -i -e s/hello/goodbye/ conftest 2> /dev/null
AS_IF([test -f conftest-e],
[SED_I="$SED -i ''"
AC_MSG_RESULT([yes])],
[SED_I="$SED -i"
AC_MSG_RESULT([no])])
rm -f conftest conftest-e
AC_SUBST([SED_I])
#
# We only build documentation if this is a developer checkout.
# Distribution tarballs just install pre-built documentation that was
# included in the tarball.
#
AC_ARG_ENABLE([doxygen],
[AC_HELP_STRING([--enable-doxygen],
[enable support for building Doxygen documentation (note that this option is ONLY relevant in developer builds; Doxygen documentation is pre-built for tarball builds and this option is therefore ignored)])])
# if --disable/enable-doxygen wasn't given,
# decide based on the tree being a developer build or not
AC_MSG_CHECKING([if this is a developer build])
AS_IF([test ! -d "$srcdir/.git"],
[AC_MSG_RESULT([no (doxygen generation is optional)])
test "x$enable_doxygen" = x && enable_doxygen=no],
[AC_MSG_RESULT([yes])
test "x$enable_doxygen" = x && enable_doxygen=yes])
AC_ARG_VAR([DOXYGEN], [Location of the doxygen program (required for building the netloc doxygen documentation)])
AC_PATH_TOOL([DOXYGEN], [doxygen])
NETLOC_DOXYGEN_VERSION=`doxygen --version 2> /dev/null`
AC_ARG_VAR([PDFLATEX], [Location of the pdflatex program (required for building the netloc doxygen documentation)])
AC_PATH_TOOL([PDFLATEX], [pdflatex])
AC_ARG_VAR([MAKEINDEX], [Location of the makeindex program (required for building the netloc doxygen documentation)])
AC_PATH_TOOL([MAKEINDEX], [makeindex])
AC_ARG_VAR([GS], [Location of the gs program (required for building the netloc doxygen documentation)])
AC_PATH_TOOL([GS], [gs])
AC_MSG_CHECKING([if can build doxygen docs])
AS_IF([test "x$DOXYGEN" != "x" -a "x$PDFLATEX" != "x" -a "x$MAKEINDEX" != "x" -a "x$GS" != "x"],
[netloc_generate_doxs=yes], [netloc_generate_doxs=no])
AC_MSG_RESULT([$netloc_generate_doxs])
AS_IF([test "x$netloc_generate_doxs" = xyes -a "x$NETLOC_DOXYGEN_VERSION" = x1.6.2],
[netloc_generate_doxs="no"; AC_MSG_WARN([doxygen 1.6.2 has broken short name support, disabling])])
# If any one of the above tools is missing, we will refuse to make dist.
AC_MSG_CHECKING([if will build doxygen docs])
AS_IF([test "x$netloc_generate_doxs" = "xyes" -a "x$enable_doxygen" != "xno"],
[], [netloc_generate_doxs=no])
AC_MSG_RESULT([$netloc_generate_doxs])
# See if we want to install the doxygen docs
AC_MSG_CHECKING([if will install doxygen docs])
AS_IF([test "x$netloc_generate_doxs" = "xyes" -o \
-f "$srcdir/doc/doxygen-doc/man/man3/netloc_attach.3" -a \
-f "$srcdir/doc/doxygen-doc/netloc.pdf"],
[netloc_install_doxs=yes],
[netloc_install_doxs=no])
AC_MSG_RESULT([$netloc_install_doxs])
AM_CONDITIONAL([NETLOC_BUILD_DOXYGEN],
[test "x$netloc_generate_doxs" = "xyes"])
AM_CONDITIONAL([NETLOC_INSTALL_DOXYGEN],
[test "x$netloc_install_doxs" = "xyes"])
#
# Setup libtool, but disable C++, F77, Java and Windows Resource
# Compiler support -- we don't need that stuff.
#
AM_ENABLE_SHARED
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
LT_LANG([CXX])
AC_CONFIG_FILES([
Makefile
netloc.pc
include/Makefile
src/Makefile
tools/Makefile
tools/reader_ib/Makefile
tools/reader_of/Makefile
tools/reader_static/Makefile
tools/lsnettopo/Makefile
tools/gather_ib/Makefile
tests/Makefile
doc/Makefile
doc/doxygen-config.cfg
])
# Party on
AC_OUTPUT