1# -*- shell-script -*-
2#
3# Copyright © 2009      CNRS
4# Copyright © 2009-2020 Inria.  All rights reserved.
5# Copyright © 2009, 2011-2012      Université Bordeaux
6 * Copyright © 2009-2020 Cisco Systems, Inc.  All rights reserved.
7#
8# See COPYING in top-level directory.
9#
10# Additional copyrights may follow
11#
12# $HEADER$
13#
14
15####################################################################
16# Autoconf, Automake, and Libtool bootstrapping
17####################################################################
18
19AC_INIT([hwloc],
20        [m4_normalize(esyscmd([sh config/hwloc_get_version.sh VERSION --version]))],
21        [https://github.com/open-mpi/hwloc/issues], [hwloc])
22AC_PREREQ(2.63)
23AC_CONFIG_AUX_DIR(./config)
24# Note that this directory must *exactly* match what was specified via
25# -I in ACLOCAL_AMFLAGS in the top-level Makefile.am.
26AC_CONFIG_MACRO_DIR(./config)
27
28cat <<EOF
29
30###
31### Configuring hwloc distribution tarball
32### Startup tests
33###
34EOF
35
36# This must be before AM_INIT_AUTOMAKE
37AC_CANONICAL_TARGET
38
39# Init automake
40AM_INIT_AUTOMAKE([1.11 dist-bzip2 subdir-objects foreign tar-ustar parallel-tests -Wall -Werror])
41m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
42
43AC_LANG([C])
44AC_USE_SYSTEM_EXTENSIONS
45
46####################################################################
47# Setup the configure-results header file
48####################################################################
49
50AH_TOP([/* -*- c -*-
51 *
52 * Copyright © 2009, 2011, 2012 CNRS, inria., Université Bordeaux  All rights reserved.
53 * Copyright © 2009-2014 Cisco Systems, Inc.  All rights reserved.
54 * $COPYRIGHT$
55 *
56 * Additional copyrights may follow
57 *
58 * $HEADER$
59 *
60 * This file is automatically generated by configure.  Edits will be lost
61 * the next time you run configure!
62 */
63
64#ifndef HWLOC_CONFIGURE_H
65#define HWLOC_CONFIGURE_H
66])
67AH_BOTTOM([
68#endif /* HWLOC_CONFIGURE_H */
69])
70
71####################################################################
72# Setup Libtool
73####################################################################
74
75# We want new Libtool.  None of that old stuff.  Pfft.
76m4_ifdef([LT_PREREQ], [],
77         [m4_fatal([libtool version 2.2.6 or higher is required], [63])])
78LT_PREREQ([2.2.6])
79
80# Setup libtool, but disable F77, Java and Windows Resource
81# Compiler support -- we don't need that stuff.
82AM_ENABLE_SHARED
83AM_DISABLE_STATIC
84
85# This did not exist pre AM 1.11.x (where x is somewhere >0 and <3),
86# but it is necessary in AM 1.12.x.
87m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
88
89LT_INIT([dlopen win32-dll])
90LT_LANG([C])
91LT_LANG([C++])
92
93####################################################################
94# Setup C, C++ compilers
95####################################################################
96
97CFLAGS_save=$CFLAGS
98AC_PROG_CC
99AM_PROG_CC_C_O
100AC_PROG_CC_C99
101CFLAGS=$CFLAGS_save
102
103AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
104AS_IF([test -z "$CC_FOR_BUILD"],[
105    AC_SUBST([CC_FOR_BUILD], [$CC])
106])
107
108####################################################################
109# CLI arguments
110####################################################################
111
112# Define hwloc's configure arguments
113HWLOC_DEFINE_ARGS
114
115# If debug mode, add -g
116AS_IF([test "$hwloc_debug" = "1"],
117      [CFLAGS="$CFLAGS -g"])
118
119# If the user didn't specifically ask for embedding mode, default to
120# standalone mode
121AS_IF([test "$enable_embedded_mode" != "yes"],
122      [AS_IF([test ! -d "$srcdir/doc"],
123             [AC_MSG_WARN([The hwloc source tree looks incomplete for a standalone])
124              AC_MSG_WARN([build.  Perhaps this hwloc tree is intended for an embedded])
125              AC_MSG_WARN([build?  Try using the --enable-embedded-mode switch.])
126              AC_MSG_ERROR([Cannot build standalone hwloc])],
127             [HWLOC_BUILD_STANDALONE])])
128
129####################################################################
130# Setup for the hwloc API
131####################################################################
132
133AC_SUBST([libhwloc_so_version])
134
135# Setup the hwloc core
136HWLOC_SETUP_CORE([], [], [AC_MSG_ERROR([Cannot build hwloc core])], [1])
137
138####################################################################
139# Setup the netloc API
140####################################################################
141
142AC_SUBST([libnetloc_so_version])
143
144AC_ARG_ENABLE([netloc],
145              [AC_HELP_STRING([--enable-netloc],
146                              [The Netloc functionality is disabled by default. Using --enable-netloc will cause configure to abort if Netloc cannot be build (e.g., not supported on your platform).])
147              ])
148
149AS_IF([test "$enable_netloc" = "yes" -a "$hwloc_mode" = "standalone"],
150      [NETLOC_SETUP_CORE([], [],
151           [AS_IF([test "$enable_netloc" = "yes"],
152                  [AC_MSG_ERROR([Cannot build netloc core])])
153           ],
154           [1])
155      ])
156
157####################################################################
158# Version information
159####################################################################
160
161# HWLOC_VERSION was setup by HWLOC_SETUP_CORE above.
162
163# Make configure depend on the VERSION file, since it's used in AC_INIT
164AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
165
166# Override/fixup the version numbers set by AC_INIT, since on
167# developer builds, there's no good way to know what the version is
168# before running configure :(.  We only use the base version number
169# for the version set in AC_INIT.  This will always match reality
170# because we add the VERSION file (the only way to change the
171# major.minor.release{greek}) into the configure dependencies.
172PACKAGE_VERSION="$HWLOC_VERSION"
173PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
174VERSION="${PACKAGE_VERSION}"
175
176# For standalone configurations, we also include a .so version number.
177
178. $srcdir/VERSION
179
180####################################################################
181# Setup the rest of the infrastructure
182####################################################################
183
184# Setup hwloc's docs, utils, and tests
185AS_IF([test "$hwloc_mode" = "standalone"],
186      [HWLOC_SETUP_DOCS
187       HWLOC_SETUP_UTILS
188       HWLOC_SETUP_TESTS])
189
190cat <<EOF
191
192###
193### Performing final hwloc configuration
194###
195EOF
196
197# Run the AM_CONDITIONALs
198HWLOC_DO_AM_CONDITIONALS
199NETLOC_DO_AM_CONDITIONALS
200
201####################################################################
202# Final output
203####################################################################
204
205# Set the final flags
206CFLAGS="$HWLOC_EMBEDDED_CFLAGS $CFLAGS"
207CPPFLAGS="$HWLOC_EMBEDDED_CPPFLAGS $CPPFLAGS"
208LIBS="$HWLOC_EMBEDDED_LIBS $LIBS"
209
210# Party on
211AC_OUTPUT
212
213# Warn if we didn't have pkg-config
214if test "x$PKG_CONFIG" = x; then
215  cat << EOF
216
217************************************************************************
218Could not detect/enable some features such as libxml2 and Cairo support
219because pkg-config isn't available.
220************************************************************************
221EOF
222fi
223
224# Show which optional support we'll be building
225hwloc_xml_status=basic
226AS_IF([test "$hwloc_libxml2_happy" = "yes"], [hwloc_xml_status=full])
227netloc_status=no
228AS_IF([test "$netloc_happy" = "yes"], [
229  netlocscotch_status=without
230  AS_IF([test "$scotch_found_headers" = "yes"], [netlocscotch_status=with])
231  netloc_status="yes ($netlocscotch_status scotch)"
232])
233
234AS_IF([test "$enable_embedded_mode" = "yes"],
235      [hwloc_graphical_lstopo_status="no (disabled in embedded mode)"],
236      [AS_IF([test "$hwloc_windows" = "yes"],
237             [hwloc_graphical_lstopo_status="yes (Windows)"],
238             [AS_IF([test "$hwloc_cairo_happy" = "yes"],
239                    [AS_IF([test "$lstopo_have_x11" = "yes"],
240                           [hwloc_graphical_lstopo_status="yes (Cairo)"],
241                           [hwloc_graphical_lstopo_status="partial (Cairo, without X11)"])],
242                    [hwloc_graphical_lstopo_status="no"])
243             ])
244      ])
245
246# Prepare the I/O summary
247hwloc_probeio_list=
248if test "x$hwloc_pciaccess_happy" = "xyes" -o "x$hwloc_linuxpci_happy" = "xyes"; then
249  test "x$hwloc_pciaccess_happy" = "xyes" && hwloc_probepci_list=pciaccess
250  test "x$hwloc_pciaccess_happy$hwloc_linuxpci_happy" = "xyesyes" && hwloc_probepci_list="${hwloc_probepci_list}+"
251  test "x$hwloc_linuxio_happy" = "xyes" && hwloc_probepci_list="${hwloc_probepci_list}linux"
252  hwloc_probeio_list="$hwloc_probeio_list PCI($hwloc_probepci_list)"
253fi
254test "x$hwloc_linuxio_happy" = "xyes" && hwloc_probeio_list="$hwloc_probeio_list LinuxIO"
255test "x$hwloc_opencl_happy" = "xyes" && hwloc_probeio_list="$hwloc_probeio_list OpenCL"
256test "x$hwloc_have_cudart" = "xyes" && hwloc_probeio_list="$hwloc_probeio_list CUDA"
257test "x$hwloc_nvml_happy" = "xyes" && hwloc_probeio_list="$hwloc_probeio_list NVML"
258test "x$hwloc_rsmi_happy" = "xyes" && hwloc_probeio_list="$hwloc_probeio_list RSMI"
259test "x$hwloc_gl_happy" = "xyes" && hwloc_probeio_list="$hwloc_probeio_list GL"
260# if nothing, say "no"
261test "x$hwloc_probeio_list" = "x" && hwloc_probeio_list=" no"
262
263# Beginning of generic support
264cat <<EOF
265
266-----------------------------------------------------------------------------
267Hwloc optional build support status (more details can be found above):
268
269Probe / display I/O devices:$hwloc_probeio_list
270Graphical output:            $hwloc_graphical_lstopo_status
271XML input / output:          $hwloc_xml_status
272Netloc functionality:        $netloc_status
273EOF
274
275# Plugin support
276hwloc_plugin_summary=$hwloc_have_plugins
277test "x$hwloc_plugin_components" != "x" && hwloc_plugin_summary="$hwloc_plugins_load ("`echo $hwloc_plugin_components`")" # echo removes the starting space
278cat <<EOF
279Plugin support:              $hwloc_plugin_summary
280EOF
281
282# End of generic support
283cat <<EOF
284-----------------------------------------------------------------------------
285
286EOF
287