1[#] start of __file__ 2dnl 3dnl _PREREQ handles the former role of mpich2prereq, setup_device, etc 4AC_DEFUN([PAC_SUBCFG_PREREQ_]PAC_SUBCFG_AUTO_SUFFIX,[ 5AM_CONDITIONAL([BUILD_CH3_NEMESIS],[test "X$device_name" = "Xch3" -a "X$channel_name" = "Xnemesis"]) 6AM_COND_IF([BUILD_CH3_NEMESIS],[ 7AC_MSG_NOTICE([RUNNING PREREQ FOR ch3:nemesis]) 8MPID_MAX_THREAD_LEVEL=MPI_THREAD_MULTIPLE 9 10## code that formerly lived in setup_channel.args 11# Variables of interest... 12# 13# $with_device - device name and arguments 14# $device_name - name of the device 15# $device_args - contains name of channel select plus an channel args 16# $channel_name - name of the channel 17# $master_top_srcdir - top-level source directory 18# $master_top_builddir - top-level build directory 19# $ac_configure_args - all arguments passed to configure 20if test -z "${channel_args}" ; then 21 nemesis_networks="tcp" 22else 23 nemesis_networks=`echo ${channel_args} | sed -e 's/,/ /g'` 24fi 25export nemesis_networks 26 27])dnl end AM_COND_IF(BUILD_CH3_NEMESIS,...) 28])dnl 29dnl 30dnl _BODY handles the former role of configure in the subsystem 31AC_DEFUN([PAC_SUBCFG_BODY_]PAC_SUBCFG_AUTO_SUFFIX,[ 32 33AM_COND_IF([BUILD_CH3_NEMESIS],[ 34AC_MSG_NOTICE([RUNNING CONFIGURE FOR ch3:nemesis]) 35 36## below is code that formerly lived in configure.ac 37 38### Only include papi in CPPFLAGS configure will handle libs, and checking that it exists, etc. 39##if test -n "${papi_dir}" ; then 40## PAC_APPEND_FLAG([-I${papi_dir}/include], [CPPFLAGS]) 41##fi 42 43dnl AC_CHECK_HEADER(net/if.h) fails on Solaris; extra header files needed 44AC_TRY_COMPILE([ 45#include <sys/types.h> 46#include <sys/socket.h> 47#include <net/if.h> 48],,lac_cv_header_net_if_h=yes,lac_cv_header_net_if_h=no) 49 50echo "checking for net/if.h... $lac_cv_header_net_if_h" 51 52if test "$lac_cv_header_net_if_h" = "yes" ; then 53 AC_DEFINE(HAVE_NET_IF_H, 1, [Define if you have the <net/if.h> header file.]) 54fi 55 56AC_CHECK_HEADERS([ \ 57 assert.h \ 58 netdb.h \ 59 unistd.h \ 60 sched.h \ 61 sys/mman.h \ 62 sys/ioctl.h \ 63 sys/socket.h \ 64 sys/sockio.h \ 65 sys/types.h \ 66 errno.h \ 67 sys/ipc.h \ 68 sys/shm.h \ 69]) 70 71# netinet/in.h often requires sys/types.h first. With AC 2.57, check_headers 72# does the right thing, which is to test whether the header is found 73# by the compiler, but this can cause problems when the header needs 74# other headers. 2.57 changes the syntax (!) of check_headers to allow 75# additional headers. 76AC_CACHE_CHECK([for netinet/in.h],ac_cv_header_netinet_in_h,[ 77AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H 78#include <sys/types.h> 79#endif 80#include <netinet/in.h>],[int a=0;], 81 ac_cv_header_netinet_in_h=yes, 82 ac_cv_header_netinet_in_h=no)]) 83if test "$ac_cv_header_netinet_in_h" = yes ; then 84 AC_DEFINE(HAVE_NETINET_IN_H,1,[Define if netinet/in.h exists]) 85fi 86 87AC_ARG_ENABLE(fast, [--enable-fast - pick the appropriate options for fast execution. 88This turns off error checking and timing collection],,enable_fast=no) 89 90# make sure we support signal 91AC_CHECK_HEADERS(signal.h) 92AC_CHECK_FUNCS(signal) 93 94# Check for netmod relevant headers and libraries 95PAC_SET_HEADER_LIB_PATH(gm) 96PAC_SET_HEADER_LIB_PATH(mx) 97PAC_SET_HEADER_LIB_PATH(elan) 98PAC_SET_HEADER_LIB_PATH(scif) 99 100nemesis_nets_dirs="" 101nemesis_nets_strings="" 102nemesis_nets_array="" 103nemesis_nets_func_decl="" 104nemesis_nets_func_array="" 105nemesis_nets_macro_defs="" 106net_index=0 107for net in $nemesis_networks ; do 108 if test ! -d $srcdir/src/mpid/ch3/channels/nemesis/netmod/${net} ; then 109 AC_MSG_ERROR([Network module ${net} is unknown "$srcdir/src/mpid/ch3/channels/nemesis/netmod/${net}"]) 110 fi 111 net_macro=`echo $net | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 112 net_macro="MPIDI_NEM_${net_macro}" 113 114 if test -z "$nemesis_nets_array" ; then 115 nemesis_nets_array="$net_macro" 116 else 117 nemesis_nets_array="$nemesis_nets_array, $net_macro" 118 fi 119 120 if test -z "$nemesis_nets_strings" ; then 121 nemesis_nets_strings="\"$net\"" 122 else 123 nemesis_nets_strings="$nemesis_nets_strings, \"$net\"" 124 fi 125 126 if test -z "$nemesis_nets_dirs" ; then 127 nemesis_nets_dirs="${net}" 128 else 129 nemesis_nets_dirs="$nemesis_nets_dirs ${net}" 130 fi 131 132 if test -z "$nemesis_nets_func_decl" ; then 133 nemesis_nets_func_decl="MPIDI_nem_${net}_funcs" 134 else 135 nemesis_nets_func_decl="${nemesis_nets_func_decl}, MPIDI_nem_${net}_funcs" 136 fi 137 138 if test -z "$nemesis_nets_func_array" ; then 139 nemesis_nets_func_array="&MPIDI_nem_${net}_funcs" 140 else 141 nemesis_nets_func_array="${nemesis_nets_func_array}, &MPIDI_nem_${net}_funcs" 142 fi 143 144 if test -z "$nemesis_nets_macro_defs" ; then 145 nemesis_nets_macro_defs="#define $net_macro $net_index" 146 else 147 nemesis_nets_macro_defs=`printf "${nemesis_nets_macro_defs}\n#define $net_macro $net_index"` 148 fi 149 150 net_index=`expr $net_index + 1` 151 152done 153nemesis_nets_array_sz=$net_index 154 155AC_ARG_ENABLE(nemesis-dbg-nolocal, [--enable-nemesis-dbg-nolocal - enables debugging mode where shared-memory communication is disabled], 156 AC_DEFINE(ENABLED_NO_LOCAL, 1, [Define to disable shared-memory communication for debugging])) 157 158AC_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], 159 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])) 160 161AC_ARG_WITH(papi, [--with-papi[=path] - specify path where papi include and lib directories can be found],, with_papi=no) 162 163if test "${with_papi}" != "no" ; then 164 if test "${with_papi}" != "yes" ; then 165 PAPI_INCLUDE="-I${with_papi}/include" 166 CPPFLAGS="$CPPFLAGS $PAPI_INCLUDE" 167# LDFLAGS="$LDFLAGS -L${with_papi}/lib" 168 LIBS="${with_papi}/lib/libpapi.a $LIBS" 169 LIBS="${with_papi}/lib/libperfctr.a $LIBS" 170 fi 171 172 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=?'])]) 173 174 echo -n "checking for papi libraries... " 175 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <papi.h>]], 176 [[PAPI_library_init(PAPI_VER_CURRENT);]])], [echo "yes"], 177 [echo "yes" ; AC_MSG_ERROR(['Cannot link with papi: Cannot find ${with_papi}/lib/libpapi.a or ${with_papi}/lib/libperfctr.a'])]) 178 179 180# AC_CHECK_LIB(papi, PAPI_accum, , [AC_MSG_ERROR(['papi library not found. Did you specify --with-papi=?'])]) 181# AC_CHECK_LIB(perfctr, perfctr_info, , [AC_MSG_ERROR(['perfctr library not found. Did you specify --with-papi=?'])]) 182fi 183 184# handle missing mkstemp, or missing mkstemp declaration 185AC_CHECK_FUNCS(mkstemp) 186AC_CHECK_FUNCS(rand) 187AC_CHECK_FUNCS(srand) 188 189# check how to allocate shared memory 190AC_ARG_WITH(shared-memory, [--with-shared-memory[=auto|sysv|mmap] - create shared memory using sysv or mmap (default is auto)],, 191 with_shared_memory=auto) 192 193if test "$with_shared_memory" = auto -o "$with_shared_memory" = mmap; then 194 found_mmap_funcs=yes 195 AC_CHECK_FUNCS(mmap munmap, , found_mmap_funcs=no) 196 if test "$found_mmap_funcs" = yes ; then 197 with_shared_memory=mmap 198 AC_DEFINE(USE_MMAP_SHM,1,[Define if we have sysv shared memory]) 199 AC_MSG_NOTICE([Using a memory-mapped file for shared memory]) 200 elif test "$with_shared_memory" = mmap ; then 201 AC_MSG_ERROR([cannot support shared memory: mmap() or munmap() not found]) 202 fi 203fi 204if test "$with_shared_memory" = auto -o "$with_shared_memory" = sysv; then 205 found_sysv_shm_funcs=yes 206 AC_CHECK_FUNCS(shmget shmat shmctl shmdt, , found_sysv_shm_funcs=no) 207 if test "$found_sysv_shm_funcs" = yes ; then 208 AC_DEFINE(USE_SYSV_SHM,1,[Define if we have sysv shared memory]) 209 AC_MSG_NOTICE([Using SYSV shared memory]) 210 elif test "$with_shared_memory" = sysv ; then 211 AC_MSG_ERROR([cannot support shared memory: sysv shared memory functions functions not found]) 212 else 213 AC_MSG_ERROR([cannot support shared memory: need either sysv shared memory functions or mmap in order to support shared memory]) 214 fi 215fi 216 217if test "$found_sysv_shm_funcs" = yes ; then 218 AC_CHECK_FUNCS(strtoll, , AC_MSG_ERROR([cannot find strtoll function needed by sysv shared memory implementation])) 219fi 220 221AC_ARG_ENABLE(nemesis-shm-collectives, [--enable-nemesis-shm-collectives - enables use of shared memory for collective comunication within a node], 222 AC_DEFINE(ENABLED_SHM_COLLECTIVES, 1, [Define to enable shared-memory collectives])) 223 224 225# These are defines to turn on different optimizations. Turn them off only for testing 226AC_DEFINE(MPID_NEM_INLINE,1,[Define to turn on the inlining optimizations in Nemesis code]) 227AC_DEFINE(PREFETCH_CELL,1,[Define to turn on the prefetching optimization in Nemesis code]) 228AC_DEFINE(USE_FASTBOX,1,[Define to use the fastboxes in Nemesis code]) 229 230# We may need this only for tcp and related netmodules 231# Check for h_addr or h_addr_list 232AC_CACHE_CHECK([whether struct hostent contains h_addr_list], 233pac_cv_have_haddr_list,[ 234AC_TRY_COMPILE([ 235#include <netdb.h>],[struct hostent hp;hp.h_addr_list[0]=0;], 236pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no)]) 237if test "$pac_cv_have_haddr_list" = "yes" ; then 238 AC_DEFINE(HAVE_H_ADDR_LIST,1,[Define if struct hostent contains h_addr_list]) 239fi 240 241# If we need the socket code, see if we can use struct ifconf 242# sys/socket.h is needed on Solaris 243AC_CACHE_CHECK([whether we can use struct ifconf], 244pac_cv_have_struct_ifconf,[ 245AC_TRY_COMPILE([ 246#include <sys/types.h> 247#ifdef HAVE_SYS_SOCKET_H 248#include <sys/socket.h> 249#endif 250#include <net/if.h> 251],[struct ifconf conftest; int s; s = sizeof(conftest);], 252pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no)]) 253 254# Intentionally not testing whether _SVID_SOURCE or _POSIX_C_SOURCE affects 255# ifconf availability. Making those sort of modifications at this stage 256# invalidates nearly all of our previous tests, since those macros fundamentally 257# change many features of the compiler on most platforms. See ticket #1568. 258 259if test "$pac_cv_have_struct_ifconf" = "yes" ; then 260 AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used]) 261fi 262 263AC_CACHE_CHECK([whether we can use struct ifreq], 264pac_cv_have_struct_ifreq,[ 265AC_TRY_COMPILE([ 266#include <sys/types.h> 267#ifdef HAVE_SYS_SOCKET_H 268#include <sys/socket.h> 269#endif 270#include <net/if.h> 271],[struct ifreq conftest; int s; s = sizeof(conftest);], 272pac_cv_have_struct_ifreq=yes,pac_cv_have_struct_ifreq=no)]) 273 274if test "$pac_cv_have_struct_ifreq" = "yes" ; then 275 AC_DEFINE(HAVE_STRUCT_IFREQ,1,[Define if struct ifreq can be used]) 276fi 277 278# Check for knem options 279AC_ARG_WITH(knem, [--with-knem=path - specify path where knem include directory can be found], 280if test "${with_knem}" != "yes" -a "${with_knem}" != "no" ; then 281 CPPFLAGS="$CPPFLAGS -I${with_knem}/include" 282fi,) 283AC_ARG_WITH(knem-include, [--with-knem-include=path - specify path to knem include directory], 284if test "${with_knem_include}" != "yes" -a "${with_knem_include}" != "no" ; then 285 CPPFLAGS="$CPPFLAGS -I${with_knem_include}" 286fi,) 287 288AC_CHECK_HEADERS([knem_io.h], pac_cv_have_knem_io_h=yes,pac_cv_have_knem_io_h=no,) 289if test "${pac_cv_have_knem_io_h}" = yes ; then 290 AC_DEFINE(HAVE_KNEM_IO_H,1,[Define if you have the <knem_io.h> header file.]) 291fi 292 293# allow the user to select different local LMT implementations 294AC_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) 295case "$with_nemesis_local_lmt" in 296 shm_copy|default) 297 local_lmt_impl=MPID_NEM_LOCAL_LMT_SHM_COPY 298 ;; 299 dma|shm_dma|knem) 300 if test "${pac_cv_have_knem_io_h}" != yes ; then 301 AC_MSG_ERROR([Failed to find knem_io.h for nemesis-local-lmt=knem]) 302 fi 303 local_lmt_impl=MPID_NEM_LOCAL_LMT_DMA 304 ;; 305 vmsplice) 306 local_lmt_impl=MPID_NEM_LOCAL_LMT_VMSPLICE 307 ;; 308 none) 309 local_lmt_impl=MPID_NEM_LOCAL_LMT_NONE 310 ;; 311 *) 312 AC_MSG_ERROR([Unrecognized value $with_nemesis_local_lmt for --with-nemesis-local-lmt]) 313 ;; 314esac 315AC_DEFINE_UNQUOTED([MPID_NEM_LOCAL_LMT_IMPL],$local_lmt_impl,[Method for local large message transfers.]) 316 317AC_ARG_ENABLE(nemesis-lock-free-queues, 318 [--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).], 319 , [enable_nemesis_lock_free_queues=yes]) 320if test "$enable_nemesis_lock_free_queues" = "yes" ; then 321 AC_DEFINE(MPID_NEM_USE_LOCK_FREE_QUEUES, 1, [Define to enable lock-free communication queues]) 322fi 323 324AC_SUBST(device_name) 325AC_SUBST(channel_name) 326AC_SUBST(nemesis_networks) 327AC_SUBST(nemesis_nets_dirs) 328AC_SUBST(nemesis_nets_strings) 329AC_SUBST(nemesis_nets_func_decl) 330AC_SUBST(nemesis_nets_func_array) 331AC_SUBST(nemesis_nets_array) 332AC_SUBST(nemesis_nets_array_sz) 333AC_SUBST(nemesis_nets_macro_defs) 334 335AC_SUBST(mmx_copy_s) 336AC_SUBST(PAPI_INCLUDE) 337AC_SUBST(AS, [as]) 338 339AC_CONFIG_FILES([ 340src/mpid/ch3/channels/nemesis/include/mpid_nem_net_module_defs.h 341src/mpid/ch3/channels/nemesis/src/mpid_nem_net_array.c 342]) 343 344])dnl end AM_COND_IF(BUILD_CH3_NEMESIS,...) 345])dnl end _BODY 346[#] end of __file__ 347