subconfigure.m4 20.5 KB
Newer Older
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
[#] start of __file__
dnl
dnl _PREREQ handles the former role of mpich2prereq, setup_device, etc
dnl AC_DEFUN([PAC_SUBCFG_PREREQ_src_mpid_ch3_channels_nemesis],[
dnl AC_DEFUN([PAC_SUBCFG_PREREQ_]PAC_SUBCFG_AUTO_SUFFIX,[
AC_DEFUN([PAC_SUBCFG_PREREQ_src_mpid_ch3_channels_nemesis],[
AM_CONDITIONAL([BUILD_CH3_NEMESIS],[test "X$device_name" = "Xch3" -a "X$channel_name" = "Xnemesis"])
AM_COND_IF([BUILD_CH3_NEMESIS],[
MPID_MAX_THREAD_LEVEL=MPI_THREAD_MULTIPLE

])dnl end AM_COND_IF(BUILD_CH3_NEMESIS,...)
])dnl
dnl
dnl _BODY handles the former role of configure in the subsystem
AC_DEFUN([PAC_SUBCFG_BODY_src_mpid_ch3_channels_nemesis],[

AM_COND_IF([BUILD_CH3_NEMESIS],[
AC_MSG_NOTICE([RUNNING CONFIGURE FOR ch3:nemesis])

## code that formerly lived in setup_channel.args
# Variables of interest...
#
# $with_device - device name and arguments
# $device_name - name of the device
# $device_args - contains name of channel select plus an channel args
# $channel_name - name of the channel
# $master_top_srcdir - top-level source directory
# $master_top_builddir - top-level build directory
# $ac_configure_args - all arguments passed to configure
if test -z "${channel_args}" ; then
    nemesis_networks="tcp"
else
    nemesis_networks=`echo ${channel_args} | sed -e 's/,/ /g'`
fi

## code that formerly lived in setup_channel
pathlist=""
pathlist="$pathlist src/mpid/${device_name}/channels/${channel_name}/include"
pathlist="$pathlist src/mpid/${device_name}/channels/${channel_name}/nemesis/include"
pathlist="$pathlist src/mpid/${device_name}/channels/${channel_name}/nemesis/utils/monitor"
pathlist="$pathlist src/util/wrappers"

## TODO delete all of this, these -I directives now live in the AM_CPPFLAGS in
## Makefile.mk files
##for path in $pathlist ; do
##    PAC_APPEND_FLAG([-I${master_top_builddir}/${path}], [CPPFLAGS])
##    PAC_APPEND_FLAG([-I${master_top_srcdir}/${path}], [CPPFLAGS])
##done

## below is code that formerly lived in configure.in

### Only include papi in CPPFLAGS configure will handle libs, and checking that it exists, etc.
##if test -n "${papi_dir}" ; then
##    PAC_APPEND_FLAG([-I${papi_dir}/include], [CPPFLAGS])
##fi

export nemesis_networks

dnl AC_CHECK_HEADER(net/if.h) fails on Solaris; extra header files needed
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
],,lac_cv_header_net_if_h=yes,lac_cv_header_net_if_h=no)

echo "checking for net/if.h... $lac_cv_header_net_if_h"

if test "$lac_cv_header_net_if_h" = "yes" ; then
    AC_DEFINE(HAVE_NET_IF_H, 1, [Define if you have the <net/if.h> header file.])
fi

AC_CHECK_HEADERS([ \
    assert.h       \
    netdb.h        \
    unistd.h       \
    sched.h        \
    sys/mman.h     \
    sys/ioctl.h    \
    sys/socket.h   \
    sys/sockio.h   \
    sys/types.h    \
    errno.h        \
    sys/ipc.h      \
    sys/shm.h      \
])

# netinet/in.h often requires sys/types.h first.  With AC 2.57, check_headers
# does the right thing, which is to test whether the header is found 
# by the compiler, but this can cause problems when the header needs 
# other headers.  2.57 changes the syntax (!) of check_headers to allow 
# additional headers.
AC_CACHE_CHECK([for netinet/in.h],ac_cv_header_netinet_in_h,[
AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netinet/in.h>],[int a=0;],
    ac_cv_header_netinet_in_h=yes,
    ac_cv_header_netinet_in_h=no)])
if test "$ac_cv_header_netinet_in_h" = yes ; then
    AC_DEFINE(HAVE_NETINET_IN_H,1,[Define if netinet/in.h exists])
fi

AC_ARG_ENABLE(fast, [--enable-fast - pick the appropriate options for fast execution.
This turns off error checking and timing collection],,enable_fast=no)
if test "$enable_fast" = "yes" ; then
    AC_DEFINE(ENABLE_NO_YIELD,1,[Define to remove yield()s in polling loops])
fi

# make sure we support signal
AC_CHECK_HEADERS(signal.h)
AC_CHECK_FUNCS(signal)

# Check for gm, mx, elan, psm options
PAC_SET_HEADER_LIB_PATH(gm)
PAC_SET_HEADER_LIB_PATH(mx)
PAC_SET_HEADER_LIB_PATH(elan)
PAC_SET_HEADER_LIB_PATH(psm)

#check for NewMadeleine options 
AC_ARG_WITH(newmad, [--with-newmad=path - specify path where pm2 software can be found],
if test "${with_newmad}" != "yes" -a "${with_newmad}" != "no" ; then
    LDFLAGS="$LDFLAGS `${with_newmad}/bin/pm2-config  --flavor=$PM2_FLAVOR --libs`"
    CPPFLAGS="$CPPFLAGS `${with_newmad}/bin/pm2-config  --flavor=$PM2_FLAVOR --cflags`"
fi,)

nemesis_nets_dirs=""
nemesis_nets_strings=""
nemesis_nets_array=""   
nemesis_nets_func_decl=""       
nemesis_nets_func_array=""      
nemesis_nets_macro_defs=""
net_index=0
for net in $nemesis_networks ; do
    if test ! -d $srcdir/src/mpid/ch3/channels/nemesis/nemesis/netmod/${net} ; then
        AC_MSG_ERROR([Network module ${net} is unknown "$srcdir/src/mpid/ch3/channels/nemesis/nemesis/netmod/${net}"])
    fi
    net_macro=`echo $net | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
    net_macro="MPIDI_NEM_${net_macro}"

    if test -z "$nemesis_nets_array" ; then
        nemesis_nets_array="$net_macro"
    else
        nemesis_nets_array="$nemesis_nets_array, $net_macro"
    fi

    if test -z "$nemesis_nets_strings" ; then
        nemesis_nets_strings="\"$net\""
    else
        nemesis_nets_strings="$nemesis_nets_strings, \"$net\""
    fi

    if test -z "$nemesis_nets_dirs" ; then
        nemesis_nets_dirs="${net}"
    else
        nemesis_nets_dirs="$nemesis_nets_dirs ${net}"
    fi

    if test -z "$nemesis_nets_func_decl" ; then
        nemesis_nets_func_decl="MPIDI_nem_${net}_funcs"
    else
        nemesis_nets_func_decl="${nemesis_nets_func_decl}, MPIDI_nem_${net}_funcs"
    fi

    if test -z "$nemesis_nets_func_array" ; then
        nemesis_nets_func_array="&MPIDI_nem_${net}_funcs"
    else
        nemesis_nets_func_array="${nemesis_nets_func_array}, &MPIDI_nem_${net}_funcs"
    fi

    if test -z "$nemesis_nets_macro_defs" ; then
        nemesis_nets_macro_defs="#define $net_macro $net_index"
    else
        nemesis_nets_macro_defs=`echo -e "${nemesis_nets_macro_defs}\n#define $net_macro $net_index"`
    fi

    net_index=`expr $net_index + 1`

    if test "${net}" = "gm" ; then
       PAC_CHECK_HEADER_LIB_FATAL(gm, gm.h, gm, gm_init)
    elif test "${net}" = "elan" ; then 
       echo "=== You're about to use the experimental Nemesis/Elan network module." 
       echo "=== This module has not been thoroughly tested and some performance issues remain."
       PAC_CHECK_HEADER_LIB_FATAL(elan, elan/elan.h, elan, elan_baseInit)
    elif test "${net}" = "psm" ; then 
       PAC_CHECK_HEADER_LIB_FATAL(psm, psm.h, psm_infinipath, psm_init)
    elif test "${net}" = "mx" ; then
       PAC_CHECK_HEADER_LIB_FATAL(mx, myriexpress.h, myriexpress, mx_finalize)
       AC_CHECK_HEADER([mx_extensions.h], , [
                AC_MSG_ERROR(['mx_extensions.h not found. Are you running a recent version of MX (at least 1.2.1)?'])
        ])
        AC_TRY_COMPILE([
        #include "myriexpress.h"
        #include "mx_extensions.h"
        #if MX_API < 0x301             
        #error You need at least MX 1.2.1 (MX_API >= 0x301)
        #endif],
        [int a=0;],
        mx_api_version=yes,
        mx_api_version=no)
        if test "$mx_api_version" = no ; then
           AC_MSG_ERROR(['MX API version Problem.  Are you running a recent version of MX (at least 1.2.1)?'])
        fi;
        AC_DEFINE([ENABLE_COMM_OVERRIDES], 1, [define to add per-vc function pointers to override send and recv functions])
    elif test "${net}" = "newmad" ; then
       AC_CHECK_HEADER([nm_public.h], , [
          AC_MSG_ERROR(['nm_public.h not found.  Did you specify --with-newmad= ?'])
       ])                                      
       AC_CHECK_HEADER([nm_sendrecv_interface.h], , [
          AC_MSG_ERROR(['nm_sendrecv_interface.h not found.  Did you specify --with-newmad= ?'])
       ])
       AC_CHECK_LIB(nmad,nm_core_init, , [
          AC_MSG_ERROR(['nmad library not found.  Did you specify --with-newmad= ?'])
       ])
       AC_ARG_ENABLE(newmad-multirail,
       [--enable-newmad-multirail -  enables multirail support in newmad module],,enable_multi=no)
       if test "$enable_multi" = "yes" ; then
           AC_DEFINE(MPID_MAD_MODULE_MULTIRAIL, 1, [Define to enable multirail support in newmad module])
       fi                 
       AC_DEFINE([ENABLE_COMM_OVERRIDES], 1, [define to add per-vc function pointers to override send and recv functions]) 
    fi; 

done
nemesis_nets_array_sz=$net_index

## FIXME this variable does not appear to be defined anywhere...
case "${nemesis_network}" in
     elan )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_ELAN, [Choose netmod]) ;;
     gm )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_GM, [Choose netmod]) ;;
     mx )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_MX, [Choose netmod]) ;;
     newmad )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_NEWMAD, [Choose netmod]) ;;
     tcp )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_TCP, [Choose netmod]) ;;
     psm )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_PSM, [Choose netmod]) ;;
     * )
          AC_DEFINE(MPID_NEM_NET_MODULE, MPID_NEM_NONE, [Choose netmod]) ;;
esac

AC_ARG_ENABLE(nemesis-dbg-nolocal, [--enable-nemesis-dbg-nolocal - enables debugging mode where shared-memory communication is disabled],
    AC_DEFINE(ENABLED_NO_LOCAL, 1, [Define to disable shared-memory communication for debugging]))

AC_ARG_ENABLE(nemesis-dbg-localoddeven, [--enable-nemesis-dbg-localoddeven - enables debugging mode where shared-memory communication is enabled only between even processes or odd processes on a node],
    AC_DEFINE(ENABLED_ODD_EVEN_CLIQUES, 1, [Define to enable debugging mode where shared-memory communication is done only between even procs or odd procs]))

AC_ARG_WITH(papi, [--with-papi[=path] - specify path where papi include and lib directories can be found],, with_papi=no)

if test "${with_papi}" != "no" ; then
    if test "${with_papi}" != "yes" ; then
        PAPI_INCLUDE="-I${with_papi}/include"
        CPPFLAGS="$CPPFLAGS $PAPI_INCLUDE"
#       LDFLAGS="$LDFLAGS -L${with_papi}/lib"
        LIBS="${with_papi}/lib/libpapi.a $LIBS"
        LIBS="${with_papi}/lib/libperfctr.a $LIBS"
    fi

    AC_CHECK_HEADER([papi.h], , [AC_MSG_ERROR(['papi.h not found in ${with_papi}/include.  Did you specify the correct path with --with-papi=?'])])

    echo -n "checking for papi libraries... "
    AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <papi.h>]],
                                   [[PAPI_library_init(PAPI_VER_CURRENT);]])], [echo "yes"], 
                                   [echo "yes" ; AC_MSG_ERROR(['Cannot link with papi:  Cannot find ${with_papi}/lib/libpapi.a or ${with_papi}/lib/libperfctr.a'])])


#    AC_CHECK_LIB(papi, PAPI_accum, , [AC_MSG_ERROR(['papi library not found.  Did you specify --with-papi=?'])])
#    AC_CHECK_LIB(perfctr, perfctr_info, , [AC_MSG_ERROR(['perfctr library not found.  Did you specify --with-papi=?'])])
fi

# handle missing mkstemp, or missing mkstemp declaration
AC_CHECK_FUNCS(mkstemp)
AC_CHECK_FUNCS(rand)
AC_CHECK_FUNCS(srand)

# ensure that atomic primitives are available
AC_MSG_CHECKING([for OpenPA atomic primitive availability])

# Double check that we actually have a present and working OpenPA
# configuration.  This must be AC_COMPILE_IFELSE instead of the stronger
# AC_LINK_IFELSE because the OpenPA library will typically not be
# completely built by this point.
#
# This test was taken from sanity.c in the OpenPA test suite.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <opa_primitives.h> /* will include pthread.h if present and needed */
]],[[
    OPA_int_t a, b;
    int c;
#if defined(OPA_USE_LOCK_BASED_PRIMITIVES)
    pthread_mutex_t shm_lock;
    OPA_Interprocess_lock_init(&shm_lock, 1/*isLeader*/);
#endif

    OPA_store_int(&a, 0);
    OPA_store_int(&b, 1);
    OPA_add_int(&a, 10);
    OPA_assert(10 == OPA_load_int(&a));
    c = OPA_cas_int(&a, 10, 11);
    OPA_assert(10 == c);
    c = OPA_swap_int(&a, OPA_load_int(&b));
    OPA_assert(11 == c);
    OPA_assert(1 == OPA_load_int(&a));
]])],
openpa_present_and_working=yes,
openpa_present_and_working=no)

if test "$openpa_present_and_working" = yes ; then
    AC_PREPROC_IFELSE([
    AC_LANG_SOURCE([
#include <opa_primitives.h>
#if defined(OPA_USE_LOCK_BASED_PRIMITIVES)
#error "lock-based emulation is currently in use"
#endif
    ])
],using_emulated_atomics=no,using_emulated_atomics=yes)

    if test "$using_emulated_atomics" = "yes" ; then
        AC_PREPROC_IFELSE([
        AC_LANG_SOURCE([
#include <opa_primitives.h>
/* may also be undefined in older (pre-r106) versions of OPA */
#if !defined(OPA_EXPLICIT_EMULATION)
#error "lock-based emulation was automatic, not explicit"
#endif
])
],[atomics_explicitly_emulated=yes],[atomics_explicitly_emulated=no])
        if test "$atomics_explicitly_emulated" = "yes" ; then
            AC_MSG_RESULT([yes (emulated)])
        else
            AC_MSG_RESULT([no])
            AC_MSG_ERROR([
The nemesis channel was selected yet no native atomic primitives are
available on this platform.  OpenPA can emulate atomic primitives using
locks by specifying --with-atomic-primitives=no but performance will be
very poor.  This override should only be specified for correctness
testing purposes.])
        fi
    else
        AC_MSG_RESULT([yes])
    fi
else
    AC_MSG_RESULT([no])
    AC_MSG_ERROR([
The nemesis channel was selected yet a set of working OpenPA headers
were not found.  Please check the OpenPA configure step for errors.])
fi

# check how to allocate shared memory
AC_ARG_WITH(shared-memory, [--with-shared-memory[=auto|sysv|mmap] - create shared memory using sysv or mmap (default is auto)],,
    with_shared_memory=auto)

if test "$with_shared_memory" = auto -o "$with_shared_memory" = mmap; then
    found_mmap_funcs=yes
    AC_CHECK_FUNCS(mmap munmap, , found_mmap_funcs=no)
    if test "$found_mmap_funcs" = yes ; then
        with_shared_memory=mmap
        AC_DEFINE(USE_MMAP_SHM,1,[Define if we have sysv shared memory])
        AC_MSG_NOTICE([Using a memory-mapped file for shared memory])
    elif test "$with_shared_memory" = mmap ; then
        AC_MSG_ERROR([cannot support shared memory:  mmap() or munmap() not found])
    fi
fi
if test "$with_shared_memory" = auto -o "$with_shared_memory" = sysv; then
    found_sysv_shm_funcs=yes
    AC_CHECK_FUNCS(shmget shmat shmctl shmdt, , found_sysv_shm_funcs=no)
    if test "$found_sysv_shm_funcs" = yes ; then
        AC_DEFINE(USE_SYSV_SHM,1,[Define if we have sysv shared memory])
        AC_MSG_NOTICE([Using SYSV shared memory])
    elif test "$with_shared_memory" = sysv ; then
        AC_MSG_ERROR([cannot support shared memory:  sysv shared memory functions functions not found])
    else
        AC_MSG_ERROR([cannot support shared memory:  need either sysv shared memory functions or mmap in order to support shared memory])
    fi
fi

if test "$found_sysv_shm_funcs" = yes ; then
   AC_CHECK_FUNCS(strtoll, , AC_MSG_ERROR([cannot find strtoll function needed by sysv shared memory implementation]))
fi

AC_ARG_ENABLE(nemesis-shm-collectives, [--enable-nemesis-shm-collectives - enables use of shared memory for collective comunication within a node],
    AC_DEFINE(ENABLED_SHM_COLLECTIVES, 1, [Define to enable shared-memory collectives]))


# These are defines to turn on different optimizations.  Turn them off only for testing
AC_DEFINE(MPID_NEM_INLINE,1,[Define to turn on the inlining optimizations in Nemesis code])
AC_DEFINE(PREFETCH_CELL,1,[Define to turn on the prefetching optimization in Nemesis code])     
AC_DEFINE(USE_FASTBOX,1,[Define to use the fastboxes in Nemesis code])  

# We may need this only for tcp and related netmodules
# Check for h_addr or h_addr_list
AC_CACHE_CHECK([whether struct hostent contains h_addr_list],
pac_cv_have_haddr_list,[
AC_TRY_COMPILE([
#include <netdb.h>],[struct hostent hp;hp.h_addr_list[0]=0;],
pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no)])
if test "$pac_cv_have_haddr_list" = "yes" ; then
    AC_DEFINE(HAVE_H_ADDR_LIST,1,[Define if struct hostent contains h_addr_list])
fi

# If we need the socket code, see if we can use struct ifconf
# sys/socket.h is needed on Solaris
AC_CACHE_CHECK([whether we can use struct ifconf],
pac_cv_have_struct_ifconf,[
AC_TRY_COMPILE([
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no)])

if test "$pac_cv_have_struct_ifconf" = "no" ; then
    # Try again with _SVID_SOURCE
    AC_CACHE_CHECK([whether we can use struct ifconf with _SVID_SOURCE],
pac_cv_have_struct_ifconf_with_svid,[
AC_TRY_COMPILE([
#define _SVID_SOURCE
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf_with_svid=yes,
pac_cv_have_struct_ifconf_with_svid=no)])
    if test "$pac_cv_have_struct_ifconf_with_svid" = yes ; then
        AC_DEFINE(USE_SVIDSOURCE_FOR_IFCONF,1,[Define if _SVID_SOURCE needs to be defined for struct ifconf])
    fi
fi

if test "$pac_cv_have_struct_ifconf" = "no" -a \
        "$pac_cv_have_struct_ifconf_with_svid" = "no" ; then
    # Try again with undef _POSIX_C_SOURCE
    AC_CACHE_CHECK([whether we can use struct ifconf without _POSIX_C_SOURCE],
pac_cv_have_struct_ifconf_without_posix,[
AC_TRY_COMPILE([
#undef _POSIX_C_SOURCE
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf_without_posix=yes,
pac_cv_have_struct_ifconf_without_posix=no)])
    if test "$pac_cv_have_struct_ifconf_without_posix" = yes ; then
        AC_DEFINE(USE_NOPOSIX_FOR_IFCONF,1,[Define if _POSIX_C_SOURCE needs to be undefined for struct ifconf])
    fi
fi

if test "$pac_cv_have_struct_ifconf" = "yes" -o \
        "$pac_cv_have_struct_ifconf_with_svid" = "yes" -o \
        "$pac_cv_have_struct_ifconf_without_posix" = "yes" ; then
    AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used])
fi

# Check for knem options
AC_ARG_WITH(knem, [--with-knem=path - specify path where knem include directory can be found],
if test "${with_knem}" != "yes" -a "${with_knem}" != "no" ; then
    CPPFLAGS="$CPPFLAGS -I${with_knem}/include"
fi,)
AC_ARG_WITH(knem-include, [--with-knem-include=path - specify path to knem include directory],
if test "${with_knem_include}" != "yes" -a "${with_knem_include}" != "no" ; then
    CPPFLAGS="$CPPFLAGS -I${with_knem_include}"
fi,)

AC_CHECK_HEADERS([knem_io.h], pac_cv_have_knem_io_h=yes,pac_cv_have_knem_io_h=no,)
if test "${pac_cv_have_knem_io_h}" = yes ; then
    AC_DEFINE(HAVE_KNEM_IO_H,1,[Define if you have the <knem_io.h> header file.])
fi

# allow the user to select different local LMT implementations
AC_ARG_WITH(nemesis-local-lmt, [--with-nemesis-local-lmt=method - specify an implementation for local large message transfers (LMT).  Method is one of: 'default', 'shm_copy', 'knem', or 'none'.  'default' is the same as 'shm_copy'.],,with_nemesis_local_lmt=default)
case "$with_nemesis_local_lmt" in
    shm_copy|default)
    local_lmt_impl=MPID_NEM_LOCAL_LMT_SHM_COPY
    ;;
    dma|shm_dma|knem)
    if test "${pac_cv_have_knem_io_h}" != yes ; then
        AC_MSG_ERROR([Failed to find knem_io.h for nemesis-local-lmt=knem])
    fi
    local_lmt_impl=MPID_NEM_LOCAL_LMT_DMA
    ;;
    vmsplice)
    local_lmt_impl=MPID_NEM_LOCAL_LMT_VMSPLICE
    ;;
    none)
    local_lmt_impl=MPID_NEM_LOCAL_LMT_NONE
    ;;
    *)
    AC_MSG_ERROR([Unrecognized value $with_nemesis_local_lmt for --with-nemesis-local-lmt])
    ;;
esac
AC_DEFINE_UNQUOTED([MPID_NEM_LOCAL_LMT_IMPL],$local_lmt_impl,[Method for local large message transfers.])

AC_ARG_ENABLE(nemesis-lock-free-queues,
              [--enable-nemesis-lock-free-queues - Use atomic instructions and lock-free queues for shared memory communication.  Lock-based queues will be used otherwise.  The default is enabled (lock-free).],
              , [enable_nemesis_lock_free_queues=yes])
if test "$enable_nemesis_lock_free_queues" = "yes" ; then
    AC_DEFINE(MPID_NEM_USE_LOCK_FREE_QUEUES, 1, [Define to enable lock-free communication queues])
fi

AC_SUBST(device_name)
AC_SUBST(channel_name)
AC_SUBST(nemesis_networks)
AC_SUBST(nemesis_nets_dirs)
AC_SUBST(nemesis_nets_strings)
AC_SUBST(nemesis_nets_func_decl)
AC_SUBST(nemesis_nets_func_array)
AC_SUBST(nemesis_nets_array)
AC_SUBST(nemesis_nets_array_sz)
AC_SUBST(nemesis_nets_macro_defs)

AC_SUBST(mmx_copy_s)
AC_SUBST(PAPI_INCLUDE)
AC_SUBST(AS, [as])

dnl FIXME automake has builtin support for this, need to convert to that
dnl AC_SUBST(ETAGS)

AC_CONFIG_FILES([
src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_net_module_defs.h
src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_net_array.c
])

])dnl end AM_COND_IF(BUILD_CH3_NEMESIS,...)
])dnl end _BODY
[#] end of __file__