Commit 75a2ddb9 authored by Xin Wang's avatar Xin Wang

update with master branch to fix ROSS instrumentation issue

parents b4aa6ce8 84bd42a0
......@@ -13,6 +13,8 @@ EXTRA_PROGRAMS =
CLEANFILES = $(bin_SCRIPTS)
EXTRA_DIST =
BUILT_SOURCES =
AM_LDFLAGS =
# pkgconfig files
pkgconfigdir = $(libdir)/pkgconfig
......@@ -47,7 +49,7 @@ endif
if USE_DARSHAN
AM_CPPFLAGS += ${DARSHAN_CFLAGS} -DUSE_DARSHAN=1
src_libcodes_la_SOURCES += src/workload/methods/codes-darshan-io-wrkld.c
src_libcodes_la_SOURCES += src/workload/methods/codes-darshan3-io-wrkld.c
LDADD += ${DARSHAN_LIBS}
TESTS += tests/workload/darshan-dump.sh
endif
......@@ -91,3 +93,7 @@ endif
LDADD += ${DUMPI_LIBS}
endif
if USE_RDAMARIS
AM_CPPFLAGS += ${ROSS_Damaris_CFLAGS} -DUSE_RDAMARIS=1
LDADD += ${ROSS_Damaris_LIBS}
endif
## README for using ROSS instrumentation with CODES
For details about the ROSS instrumentation, see the [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/feature/instrumentation.html)
For details about the ROSS instrumentation, see the [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/instrumentation/instrumentation.html)
on the ROSS webpage.
There are currently 3 types of instrumentation: GVT-based, real time, and event tracing. See the ROSS documentation for more info on
the specific options or use `--help` with your model. To collect data about the simulation engine, no changes are needed to model code
for any of the instrumentation modes. Some additions to the model code is needed in order to turn on any model-level data collection.
See the "Model-level data sampling" section on [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/feature/instrumentation.html).
There are currently 4 types of instrumentation: GVT-based, real time sampling, virtual time sampling, and event tracing.
See the ROSS documentation for more info on the specific options or use `--help` with your model.
To collect data about the simulation engine, no changes are needed to model code for any of the instrumentation modes.
Some additions to the model code is needed in order to turn on any model-level data collection.
See the "Model-level data sampling" section on [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/instrumentation/instrumentation.html).
Here we describe CODES specific details.
### Register Instrumentation Callback Functions
......@@ -17,15 +18,11 @@ The examples here are based on the dragonfly router and terminal LPs (`src/netwo
As described in the ROSS Vis documentation, we need to create a `st_model_types` struct with the pointer and size information.
```C
st_model_types dragonfly_model_types[] = {
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) dragonfly_event_collect,
{(ev_trace_f) dragonfly_event_collect,
sizeof(int),
(model_stat_f) dragonfly_model_stat_collect,
sizeof(tw_lpid) + sizeof(long) * 2 + sizeof(double) + sizeof(tw_stime) * 2},
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) dragonfly_event_collect,
{(ev_trace_f) dragonfly_event_collect,
sizeof(int),
(model_stat_f) dfly_router_model_stat_collect,
0}, // updated in router_setup()
......@@ -33,20 +30,17 @@ st_model_types dragonfly_model_types[] = {
}
```
`dragonfly_model_types[0]` is the function pointers for the terminal LP and `dragonfly_model_types[1]` is for the router LP.
For the first two function pointers for each LP, we use the same `dragonfly_event_collec()` because right now we just collect the event type, so
it's the same for both of these LPs. You can change these if you want to use different functions for different LP types or if you want a different
function for the full event tracing than that used for the rollback event trace (`rbev_trace_f` is for the event tracing of rollback triggering events only,
while `ev_trace_f` is for the full event tracing).
The number following each function pointer is the size of the data that will be saved when the function is called.
The third pointer is for the data to be sampled at the GVT or real time sampling points.
For the first function pointer for each LP type, we use the same `dragonfly_event_collect()` because right now we just collect the event type, so it's the same for both of these LP types.
You can change these if you want to use different functions for different LP types.
The number following that function pointer is the size of the data that will be saved when the function is called.
The second pointer is for the data to be sampled at the GVT or real time sampling points.
In this case the LPs have different function pointers since we want to collect different types of data for the two LP types.
For the terminal, I set the appropriate size of the data to be collected, but for the router, the size of the data is dependent on the radix for the
dragonfly configuration being used, which isn't known until runtime.
For the terminal, I set the appropriate size of the data to be collected, but for the router, the size of the data is dependent on the radix for the dragonfly configuration being used, which isn't known until runtime.
*Note*: You can only reuse the function for event tracing for LPs that use the same type of message struct.
For example, the dragonfly terminal and router LPs both use the `terminal_message` struct, so they can
use the same functions for event tracing. However the model net base LP uses the `model_net_wrap_msg` struct, so it gets its own event collection function and
`st_trace_type` struct, in order to read the event type correctly from the model.
use the same functions for event tracing.
However the model net base LP uses the `model_net_wrap_msg` struct, so it gets its own event collection function and `st_trace_type` struct, in order to read the event type correctly from the model.
In the ROSS instrumentation documentation, there are two methods provided for letting ROSS know about these `st_model_types` structs.
In CODES, this step is a little different, as `codes_mapping_setup()` calls `tw_lp_settype()`.
......@@ -106,9 +100,7 @@ Using the synthetic workload LP for dragonfly as an example (`src/network-worklo
In the main function, you call the register function *before* calling `codes_mapping_setup()`.
```C
st_model_types svr_model_types[] = {
{(rbev_trace_f) svr_event_collect,
sizeof(int),
(ev_trace_f) svr_event_collect,
{(ev_trace_f) svr_event_collect,
sizeof(int),
(model_stat_f) svr_model_stat_collect,
0}, // at the moment, we're not actually collecting any data about this LP
......@@ -143,10 +135,13 @@ modes are collecting model-level data as well.
### CODES LPs that currently have event type collection implemented:
If you're using any of the following CODES models, you don't have to add anything, unless you want to change the data that's being collected.
- nw-lp (model-net-mpi-replay.c)
- original dragonfly router and terminal LPs (dragonfly.c)
- dfly server LP (model-net-synthetic.c)
- model-net-base-lp (model-net-lp.c)
- custom dfly server LP (model-net-synthetic-custom-dfly.c)
- fat tree server LP (model-net-synthetic-fattree.c)
- slimfly server LP (model-net-synthetic-slimfly.c)
- original dragonfly router and terminal LPs (dragonfly.c)
- dragonfly custom router and terminal LPs (dragonfly-custom.C)
- slimfly router and terminal LPs (slimfly.c)
- fat tree switch and terminal LPs (fat-tree.c)
- model-net-base-lp (model-net-lp.c)
The fat-tree terminal and switch LPs (fattree.c) are only partially implemented at the moment. It needs two `model_net_method` structs to fully implement,
but currently both terminal and switch LPs use the same `fattree_method` struct.
......@@ -61,7 +61,7 @@ struct iolang_params
struct darshan_params
{
char log_file_path[MAX_NAME_LENGTH_WKLD];
int64_t aggregator_cnt;
int app_cnt;
};
struct recorder_params
......@@ -155,7 +155,24 @@ enum codes_workload_op_type
/* for workloads that have events not yet handled
* (eg the workload language) */
CODES_WK_IGNORE
CODES_WK_IGNORE,
/* extended IO workload operations: MPI */
/* open */
CODES_WK_MPI_OPEN,
/* close */
CODES_WK_MPI_CLOSE,
/* write */
CODES_WK_MPI_WRITE,
/* read */
CODES_WK_MPI_READ,
/* collective open */
CODES_WK_MPI_COLL_OPEN,
/* collective_write */
CODES_WK_MPI_COLL_WRITE,
/* collective_read */
CODES_WK_MPI_COLL_READ,
};
/* I/O operation paramaters */
......@@ -166,7 +183,7 @@ struct codes_workload_op
*/
/* what type of operation this is */
int op_type;
enum codes_workload_op_type op_type;
/* currently only used by network workloads */
double start_time;
double end_time;
......@@ -329,6 +346,11 @@ void codes_workload_print_op(
int app_id,
int rank);
int codes_workload_get_time(const char *type,
const char * params,
int app_id,
int rank, double *read_time, double *write_time, int64_t *read_bytes, int64_t *written_bytes);
/* implementation structure */
struct codes_workload_method
{
......@@ -341,6 +363,8 @@ struct codes_workload_method
void (*codes_workload_get_next_rc2)(int app_id, int rank);
int (*codes_workload_get_rank_cnt)(const char* params, int app_id);
int (*codes_workload_finalize)(const char* params, int app_id, int rank);
/* added for get all read or write time */
int (*codes_workload_get_time)(const char * params, int app_id, int rank, double *read_time, double *write_time, int64_t *read_bytes, int64_t *written_bytes);
};
......
......@@ -97,6 +97,8 @@ static inline void codes_local_latency_reverse(tw_lp *lp)
return;
}
void codes_comm_update();
#ifdef __cplusplus
}
#endif
......
This diff is collapsed.
......@@ -6,11 +6,11 @@
/* This is the base model-net LP that all events pass through before
* performing any topology-specific work. Packet scheduling, dealing with
* packet loss (potentially), etc. happens here.
* Additionally includes wrapper event "send" function that all
* packet loss (potentially), etc. happens here.
* Additionally includes wrapper event "send" function that all
* events for underlying models must go through */
#ifndef MODEL_NET_LP_H
#ifndef MODEL_NET_LP_H
#define MODEL_NET_LP_H
#ifdef __cplusplus
......@@ -23,6 +23,7 @@ extern "C" {
#include "model-net-sched.h"
#include "net/dragonfly.h"
#include "net/dragonfly-custom.h"
#include "net/dragonfly-plus.h"
#include "net/slimfly.h"
#include "net/fattree.h"
#include "net/loggp.h"
......@@ -43,10 +44,10 @@ void model_net_base_configure();
/// model developers
// Construct a model-net-specific event, analagous to a tw_event_new and
// codes_event_new. The difference here is that we return pointers to
// codes_event_new. The difference here is that we return pointers to
// both the message data (to be cast into the appropriate type) and the
// pointer to the end of the event struct.
//
//
// This function is expected to be called within each specific model-net
// method - strange and disturbing things will happen otherwise
tw_event * model_net_method_event_new(
......@@ -131,6 +132,7 @@ typedef struct model_net_wrap_msg {
model_net_base_msg m_base; // base lp
terminal_message m_dfly; // dragonfly
terminal_custom_message m_custom_dfly; // dragonfly-custom
terminal_plus_message m_dfly_plus; // dragonfly plus
slim_terminal_message m_slim; // slimfly
fattree_message m_fat; // fattree
loggp_message m_loggp; // loggp
......
......@@ -41,7 +41,7 @@ extern "C" {
/* HACK: there is currently no scheduling fidelity across multiple
* model_net_event calls. Hence, problems arise when some LP sends multiple
* messages as part of an event and expects FCFS ordering. A proper fix which
* involves model-net LP-level scheduling of requests is ideal, but not
* involves model-net LP-level scheduling of requests is ideal, but not
* feasible for now (would basically have to redesign model-net), so expose
* explicit start-sequence and stop-sequence markers as a workaround
*/
......@@ -74,6 +74,8 @@ typedef struct mn_stats mn_stats;
X(LOGGP, "modelnet_loggp", "loggp", &loggp_method)\
X(EXPRESS_MESH, "modelnet_express_mesh", "express_mesh", &express_mesh_method)\
X(EXPRESS_MESH_ROUTER, "modelnet_express_mesh_router", "express_mesh_router", &express_mesh_router_method)\
X(DRAGONFLY_PLUS, "modelnet_dragonfly_plus", "dragonfly_plus", &dragonfly_plus_method)\
X(DRAGONFLY_PLUS_ROUTER, "modelnet_dragonfly_plus_router", "dragonfly_plus_router", &dragonfly_plus_router_method)\
X(MAX_NETS, NULL, NULL, NULL)
#define X(a,b,c,d) a,
......@@ -144,7 +146,7 @@ struct mn_stats
long max_event_size;
};
/* Registers all model-net LPs in ROSS. Should be called after
/* Registers all model-net LPs in ROSS. Should be called after
* configuration_load, but before codes_mapping_setup */
void model_net_register();
......@@ -166,8 +168,8 @@ void model_net_enable_sampling(tw_stime interval, tw_stime end);
int model_net_sampling_enabled(void);
/* Initialize/configure the network(s) based on the CODES configuration.
* returns an array of the network ids, indexed in the order given by the
* modelnet_order configuration parameter
* returns an array of the network ids, indexed in the order given by the
* modelnet_order configuration parameter
* OUTPUT id_count - the output number of networks */
int* model_net_set_params(int *id_count);
......@@ -189,7 +191,7 @@ void model_net_event_collective_rc(
int message_size,
tw_lp *sender);
/* allocate and transmit a new event that will pass through model_net to
/* allocate and transmit a new event that will pass through model_net to
* arrive at its destination:
*
* - net_id: the type of network to send this message through. The set of
......@@ -231,9 +233,9 @@ void model_net_event_collective_rc(
// first argument becomes the network ID
model_net_event_return model_net_event(
int net_id,
char const * category,
tw_lpid final_dest_lp,
uint64_t message_size,
char const * category,
tw_lpid final_dest_lp,
uint64_t message_size,
tw_stime offset,
int remote_event_size,
void const * remote_event,
......@@ -251,9 +253,9 @@ model_net_event_return model_net_event(
model_net_event_return model_net_event_annotated(
int net_id,
char const * annotation,
char const * category,
tw_lpid final_dest_lp,
uint64_t message_size,
char const * category,
tw_lpid final_dest_lp,
uint64_t message_size,
tw_stime offset,
int remote_event_size,
void const * remote_event,
......@@ -270,9 +272,9 @@ model_net_event_return model_net_event_mctx(
int net_id,
struct codes_mctx const * send_map_ctx,
struct codes_mctx const * recv_map_ctx,
char const * category,
tw_lpid final_dest_lp,
uint64_t message_size,
char const * category,
tw_lpid final_dest_lp,
uint64_t message_size,
tw_stime offset,
int remote_event_size,
void const * remote_event,
......@@ -309,7 +311,7 @@ int model_net_get_msg_sz(int net_id);
* identical to the sender argument to tw_event_new().
*/
/* NOTE: we may end up needing additoinal arguments here to track state for
* reverse computation; add as needed
* reverse computation; add as needed
*/
DEPRECATED
void model_net_event_rc(
......@@ -333,7 +335,7 @@ void model_net_event_rc2(
* Parameters are largely the same as model_net_event, with the following
* exceptions:
* - final_dest_lp is the lp to pull data from
* - self_event_size, self_event are applied at the requester upon receipt of
* - self_event_size, self_event are applied at the requester upon receipt of
* the payload from the dest
*/
model_net_event_return model_net_pull_event(
......@@ -383,7 +385,7 @@ void model_net_pull_event_rc(
* model-net implementation (currently implemented as a set of translation-unit
* globals). Upon a subsequent model_net_*event* call, the context is consumed
* and reset to an unused state.
*
*
* NOTE: this call MUST be placed in the same calling context as the subsequent
* model_net_*event* call. Otherwise, the parameters are not guaranteed to work
* on the intended event, and may possibly be consumed by another, unrelated
......
......@@ -85,6 +85,8 @@ struct terminal_custom_message
tw_stime saved_total_time;
tw_stime saved_sample_time;
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
};
#ifdef __cplusplus
......
/*
* Copyright (C) 2014 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef DRAGONFLY_PLUS_H
#define DRAGONFLY_PLUS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <ross.h>
typedef struct terminal_plus_message terminal_plus_message;
/* this message is used for both dragonfly compute nodes and routers */
struct terminal_plus_message
{
/* magic number */
int magic;
/* flit travel start time*/
tw_stime travel_start_time;
/* packet ID of the flit */
unsigned long long packet_ID;
/* event type of the flit */
short type;
/* category: comes from codes */
char category[CATEGORY_NAME_MAX];
/* store category hash in the event */
uint32_t category_hash;
/* final destination LP ID, this comes from codes can be a server or any other LP type*/
tw_lpid final_dest_gid;
/*sending LP ID from CODES, can be a server or any other LP type */
tw_lpid sender_lp;
tw_lpid sender_mn_lp; // source modelnet id
/* destination terminal ID of the dragonfly */
tw_lpid dest_terminal_id;
/* source terminal ID of the dragonfly */
unsigned int src_terminal_id;
/* message originating router id. MM: Can we calculate it through
* sender_mn_lp??*/
unsigned int origin_router_id;
/* number of hops traversed by the packet */
short my_N_hop;
short my_l_hop, my_g_hop;
short saved_channel;
short saved_vc;
int next_stop;
short nonmin_done;
/* Intermediate LP ID from which this message is coming */
unsigned int intm_lp_id;
/* last hop of the message, can be a terminal, local router or global router */
short last_hop;
/* For routing */
int saved_src_dest;
int saved_src_chan;
//DFP Specific Routing
int intm_rtr_id; //Router ID of the intermediate router for nonminimal routes
int intm_group_id; //Group ID of the intermediate router for nonminimal routes
short dfp_upward_channel_flag;
int dfp_dest_terminal_id; //this is the terminal id in the dfp network in range [0-total_num_terminals)
uint32_t chunk_id;
uint32_t packet_size;
uint32_t message_id;
uint32_t total_size;
int remote_event_size_bytes;
int local_event_size_bytes;
// For buffer message
short vc_index;
int output_chan;
model_net_event_return event_rc;
int is_pull;
uint32_t pull_size;
/* for reverse computation */
int path_type;
tw_stime saved_available_time;
tw_stime saved_avg_time;
tw_stime saved_rcv_time;
tw_stime saved_busy_time;
tw_stime saved_total_time;
tw_stime saved_sample_time;
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
};
#ifdef __cplusplus
}
#endif
#endif /* end of include guard: DRAGONFLY_H */
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
*/
......@@ -2,9 +2,13 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([codes], [0.6.0], [http://trac.mcs.anl.gov/projects/codes/newticket],[],[http://www.mcs.anl.gov/projects/codes/])
AC_INIT([codes], [1.0.0], [http://trac.mcs.anl.gov/projects/codes/newticket],[],[http://www.mcs.anl.gov/projects/codes/])
LT_INIT
#WRAP SOME OPTION AROUND THIS - IT'S NOT REQUIRED FOR 99% OF CODES
AX_BOOST_BASE([1.66])
AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
......@@ -26,6 +30,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
AC_PROG_RANLIB
PKG_PROG_PKG_CONFIG
......@@ -84,6 +89,16 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)],
PKG_CHECK_MODULES_STATIC([ROSS], [ross], [],
[AC_MSG_ERROR([Could not find working ross installation via pkg-config])])
#check for Damaris
AC_ARG_WITH([damaris],[AS_HELP_STRING([--with-damaris],
[build with ROSS-Damaris in situ analysis support])],
[use_rdamaris=yes],[use_rdamaris=no])
if test "x${use_rdamaris}" = xyes ; then
PKG_CHECK_MODULES_STATIC([ROSS_Damaris], [ross-damaris], [],
[AC_MSG_ERROR([Could not find working ROSS-Damaris installation via pkg-config])])
fi
AM_CONDITIONAL(USE_RDAMARIS, [test "x${use_rdamaris}" = xyes])
# check for enable-g
AC_ARG_ENABLE([g],[AS_HELP_STRING([--enable-g],
[Build with GDB symbols])],
......@@ -108,7 +123,7 @@ AM_CONDITIONAL(USE_DARSHAN, [test "x${use_darshan}" = xyes])
AC_ARG_WITH([online],[AS_HELP_STRING([--with-online@<:@=DIR@:>@],
[Build with the online workloads and argobots support])],
[use_online=yes],[use_online=no])
if test "x${use_online}" != "x" ; then
if test "x${use_online}" != "xno" ; then
AM_CONDITIONAL(USE_ONLINE, true)
PKG_CHECK_MODULES_STATIC([ARGOBOTS], [argobots], [],
[AC_MSG_ERROR([Could not find working argobots installation via pkg-config])])
......
......@@ -187,6 +187,10 @@ TODO...
=== Network
There has been an addition of online workload generator that replays calls
similar to MPI on the network models. The SWM workloads are closed-source right
now but integration with conceptual communication library is in progress.
Our primary network workload generator is via the DUMPI tool
(http://sst.sandia.gov/about_dumpi.html). DUMPI collects and reads events from
MPI applications. See the DUMPI documentation for how to generate traces. There
......
1.0.0 (July 12, 2018)
general:
=======
Adding support for dragonfly-plus network model. Multiple forms of routing
(progressive adaptive, minimal, non-minimal-spine and leaf) have been
implemented.
https://xgitlab.cels.anl.gov/codes/codes/wikis/dragonfly-plus
Adding support for express mesh network model, which can be configured as
hyperX.
Adding support for Multi-plane/rail in fat-tree via multiple single port NICs
per compute node or one multi-port NIC per node.
Adding a generic template for building new network models. For simplest case,
only 2 functions and premable changes should suffice to add a new network.
Updated Express Mesh network model to serve as an example. For details, see
Darshan workload generator has been updated to use Darshan version 3.x.
Network models updated to capture simulation statistics over virtual time using
ROSS/CODES instrumentation. For details, see:
https://xgitlab.cels.anl.gov/codes/codes/wikis/Using-ROSS-Instrumentation-with-CODES
Compatible with ROSS version that enables statistics collection of simulation
performance. For details see:
http://carothersc.github.io/ROSS/instrumentation/instrumentation.html
Online workload replay functionality has been added that allows SWM workloads
to be simulated insitu on the network models. WIP to integrate Conceptual
domain specific language for network communication.
Multiple traffic patterns were added in the background traffic generation
including stencil, all-to-all and random permutation.
Performance tuning enabled for optimistic mode. For details, see:
https://xgitlab.cels.anl.gov/codes/codes/wikis/Optimistic-Performance-Tuning-Tips
0.6.0 (July 03, 2017)
general:
......
This diff is collapsed.
This diff is collapsed.
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_FILESYSTEM
#
# DESCRIPTION
#
# Test for Filesystem library from the Boost C++ libraries. The macro
# requires a preceding call to AX_BOOST_BASE. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_FILESYSTEM_LIB)
#
# And sets:
#
# HAVE_BOOST_FILESYSTEM
#
# LICENSE
#
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Michael Tindal
# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 27
AC_DEFUN([AX_BOOST_FILESYSTEM],
[
AC_ARG_WITH([boost-filesystem],
AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
[use the Filesystem library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_filesystem_lib=""
else
want_boost="yes"
ax_boost_user_filesystem_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
LIBS_SAVED=$LIBS
LIBS="$LIBS $BOOST_SYSTEM_LIB"
export LIBS
AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
ax_cv_boost_filesystem,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
[[using namespace boost::filesystem;
path my_path( "foo/bar/data.txt" );
return 0;]])],
ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_filesystem" = "xyes"; then
AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
if test "x$ax_boost_user_filesystem_lib" = "x"; then
for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
if test "x$link_filesystem" != "xyes"; then
for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
fi
else
for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
[link_filesystem="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_filesystem" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
LIBS="$LIBS_SAVED"
fi
])
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_boost_system.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_SYSTEM
#
# DESCRIPTION
#
# Test for System library from the Boost C++ libraries. The macro requires
# a preceding call to AX_BOOST_BASE. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_SYSTEM_LIB)
#
# And sets:
#
# HAVE_BOOST_SYSTEM
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2008 Michael Tindal
# Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 19
AC_DEFUN([AX_BOOST_SYSTEM],