1[#] start of __file__
2dnl MPICH_SUBCFG_BEFORE=src/pm/util
3
4AC_DEFUN([PAC_SUBCFG_PREREQ_]PAC_SUBCFG_AUTO_SUFFIX,[
5])
6
7dnl _BODY handles the former role of configure in the subsystem
8AC_DEFUN([PAC_SUBCFG_BODY_]PAC_SUBCFG_AUTO_SUFFIX,[
9
10# the pm_names variable is set by the top level configure
11build_remshell=no
12for pm_name in $pm_names ; do
13    if test "X$pm_name" = "Xremshell" ; then
14        build_remshell=yes
15    fi
16done
17AM_CONDITIONAL([BUILD_PM_REMSHELL],[test "X$build_remshell" = "Xyes"])
18
19# first_pm_name is set by the top level configure
20AM_CONDITIONAL([PRIMARY_PM_REMSHELL],[test "X$first_pm_name" = "Xremshell"])
21
22AM_COND_IF([BUILD_PM_REMSHELL],[
23AC_MSG_NOTICE([RUNNING CONFIGURE FOR src/pm/remshell])
24
25# Check that we are using the simple PMI implementation
26# (Selecting multiple PMs may require incompatible PMI implementations
27# (e.g., remshell and SMPD).
28if test -z "$PM_REQUIRES_PMI" ; then
29    PM_REQUIRES_PMI=simple
30elif test "$PM_REQUIRES_PMI" != "simple" ; then
31    echo "remshell requires the simple PMI implementation; $PM_REQUIRES_PMI has already been selected"
32    exit 1
33fi
34
35# tell src/pm/util to configure itself
36build_pm_util=yes
37
38AC_ARG_ENABLE([allowport],
39              [AS_HELP_STRING([--enable-allowport],
40                              [Turn on use of a port for communicating with the processes started by mpiexec])],
41              [],
42              [enable_allowport=yes])
43AC_ARG_ENABLE([onsig],
44              [AS_HELP_STRING([--enable-onsig],
45                              [Control the handling of processes that signal
46                               (e.g., SEGV) using ptrace.  Disabled by default])],
47              [],
48              [enable_onsig=no])
49AC_ARG_ENABLE([newsession],
50              [AS_HELP_STRING([--enable-newsession],
51                              [Create a new process group session if standard
52                               in is not connected to a terminal])],
53              [],
54              [enable_newsession=yes])
55
56dnl check for library functions
57
58dnl
59dnl Check for special compile characteristics
60dnl
61dnl Is there libnsl needed for gethostbyname?
62dnl AC_SEARCH_LIBS(gethostbyname,nsl)
63AC_SEARCH_LIBS([socketpair],[socket])
64dnl
65dnl Check for a specific header
66AC_CHECK_HEADERS([sys/types.h signal.h sys/ptrace.h])
67dnl
68dnl Check for functions.  This invokes another test if the function is
69dnl found.  The braces around the second test are essential.
70dnl AC_CHECK_FUNC(setpgrp,[AC_FUNC_SETPGRP])
71AC_CHECK_FUNCS([strsignal])
72dnl
73dnl Check for signal handlers
74AC_CHECK_FUNCS([sigaction signal sigset])
75sigaction_ok=no
76if test "$ac_cv_func_sigaction" = "yes" ; then
77    AC_CACHE_CHECK([for struct sigaction],pac_cv_struct_sigaction,[
78    AC_TRY_COMPILE([#include <signal.h>],[
79struct sigaction act; sigaddset( &act.sa_mask, SIGINT );],
80    pac_cv_struct_sigaction="yes",pac_cv_struct_sigaction="no")])
81    if test "$pac_cv_struct_sigaction" = "no" ; then
82        AC_CACHE_CHECK([for struct sigaction with _POSIX_SOURCE],
83	pac_cv_struct_sigaction_needs_posix,[
84        AC_TRY_COMPILE([#define _POSIX_SOURCE
85#include <signal.h>],[
86struct sigaction act; sigaddset( &act.sa_mask, SIGINT );],
87       pac_cv_struct_sigaction_needs_posix="yes",
88       pac_cv_struct_sigaction_needs_posix="no")])
89        if test "$pac_cv_struct_sigaction_needs_posix" = "yes" ; then
90            sigaction_ok=yes
91	fi
92    else
93        sigaction_ok=yes
94    fi
95fi
96dnl
97# Decide on the signal handler to use
98if test "$ac_cv_func_sigaction" = "yes" -a "$sigaction_ok" = "yes" ; then
99    # FIXME DJG: where should this get set?
100    if test "$pac_struct_sigaction_needs_posix" = yes ; then
101        AC_DEFINE(NEEDS_POSIX_FOR_SIGACTION,1,[Define if _POSIX_SOURCE needed to get sigaction])
102    fi
103    AC_DEFINE(USE_SIGACTION,1,[Define if sigaction should be used to set signals])
104elif test "$ac_cv_func_signal" = "yes" ; then
105    AC_DEFINE(USE_SIGNAL,1,[Define if signal should be used to set signals])
106fi
107dnl
108if test "$enable_allowport" = "yes" ; then
109   AC_DEFINE(MPIEXEC_ALLOW_PORT,1,[Define if a port may be used to communicate with the processes])
110fi
111
112# some of these may be redundant with the upper level code, although the caching
113# should detect it and make the performance impact a non-issue
114AC_CHECK_HEADERS([string.h sys/time.h unistd.h stdlib.h sys/socket.h wait.h errno.h])
115
116AC_CHECK_FUNCS([ptrace])
117# It isn't enough to find ptrace.  We also need the ptrace
118# parameters, which some systems, such as IRIX, do not define.
119if test "$ac_cv_func_ptrace" = yes ; then
120    AC_CACHE_CHECK([for ptrace named parameters],
121[pac_cv_has_ptrace_parms],[
122    AC_TRY_COMPILE([
123#include <sys/types.h>
124#include <sys/ptrace.h>],[int i = PTRACE_CONT;],[pac_cv_has_ptrace_parms=yes],
125[pac_cv_has_ptrace_parms=no])])
126    if test "$pac_cv_has_ptrace_parms" = "yes" ; then
127        AC_DEFINE([HAVE_PTRACE_CONT],[],[Define if ptrace parameters available])
128    fi
129fi
130
131dnl The test for getsid etc is in src/pm/util (see the subconfigure.m4 there)
132dnl AC_CHECK_FUNCS([setsid isatty getsid])
133if test "$enable_newsession" = "yes" ; then
134    AC_DEFINE([USE_NEW_SESSION],[1],[Define if mpiexec should create a new process group session])
135fi
136
137AC_PATH_PROG([SSH],[ssh])
138AC_PATH_PROG([RSH],[rsh])
139if test -z "$SSH" && test -n "$RSH" ; then
140    remshell="$RSH"
141else
142    remshell="$SSH"
143fi
144
145AC_DEFINE_UNQUOTED(DEFAULT_MACHINES_PATH,"$eval_datadir:.",[Define the search path for machines files])
146AC_DEFINE_UNQUOTED(DEFAULT_REMOTE_SHELL,"$remshell",[Define the default remote shell program to use])
147
148
149])dnl end AM_COND_IF(BUILD_PM_REMSHELL,...)
150])dnl end _BODY
151dnl
152[#] end of __file__
153