1#
2# $Id$
3#
4# Copyright (C) 2000-2002 Regents of the University of California
5# See ./DISCLAIMER
6#
7# This file is to be processed with autoconf to generate a configure script.
8
9AC_INIT([pdsh],
10        [2.34])
11
12AC_CONFIG_SRCDIR([pdsh])
13AC_CONFIG_AUX_DIR([config])
14AC_CONFIG_MACRO_DIR([config])
15AC_CONFIG_SRCDIR([src/pdsh/dsh.h])
16AC_CANONICAL_TARGET
17AC_GPL_LICENSED
18
19# hack to fix dejagnu.am brokenness before automake 1.6
20if test x$host_alias = x ; then
21   host_alias=$host_cpu
22fi
23
24#
25#  Automake support
26#
27AM_INIT_AUTOMAKE([no-define])
28AM_SILENT_RULES([yes])
29AC_CONFIG_HEADERS([config.h])
30AM_MAINTAINER_MODE
31AX_CODE_COVERAGE
32
33#
34# Checks for programs.
35#
36AC_PROG_CC
37AC_PROG_INSTALL
38AC_PROG_LN_S
39AC_PROG_MAKE_SET
40AC_DEBUG
41LT_INIT
42
43AM_CONDITIONAL(WITH_GNU_LD, test "$with_gnu_ld" = "yes")
44
45
46#
47# Do we want static modules?
48#
49AC_ARG_ENABLE([static-modules],
50              AS_HELP_STRING([--enable-static-modules],[Build static modules]),
51              ac_static_modules=yes)
52AM_CONDITIONAL(WITH_STATIC_MODULES, test "$ac_static_modules" = "yes")
53
54if test "$ac_static_modules" = "yes" ; then
55   AC_DEFINE_UNQUOTED(STATIC_MODULES, [1], [Use Static Modules])
56   AC_STATIC_MODULES_INIT
57else
58   case "$host" in
59   *-*-aix*)
60     LDFLAGS="$LDFLAGS -Wl,-brtl -Wl,-bexpall"
61	 AIX_PDSH_LDFLAGS="-Wl,-bgcbypass:1000" # hack to ensure no gc in libcommon
62	 AC_DEFINE(_AIX, 1, [Define if on AIX])
63   ;;
64   *-*-solaris*)
65   	 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [POSIX pthread semantics on Solaris])
66   ;;
67   *-*-hpux*)
68     LDFLAGS="$LDFLAGS -Wl,-E"
69   ;;
70   esac
71fi
72AC_SUBST(AIX_PDSH_LDFLAGS)
73
74
75# Checks for libraries.
76AC_CHECK_LIB([socket], [socket], LIBS="-lsocket -lnsl $LIBS",, [-lsocket -lnsl])
77
78# Check for how to compile pthread programs:
79ACX_PTHREAD
80if test x"$acx_pthread_ok" = "xno"; then
81    AC_MSG_ERROR([Could not figure out how to compile with pthreads.])
82fi
83AC_DEFINE(WITH_PTHREADS, 1, [Define if you have pthreads])
84
85# PTHREAD_CFLAGS needs to be appended to both LDFLAGS and CPPFLAGS or some
86# checks for headers may fail later on (e.g. on OSF systems where -pthread
87# is required in order to include pthread.h)
88LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
89CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS"
90LIBS="$PTHREAD_LIBS $LIBS"
91
92# Checks for header files.
93AC_CHECK_HEADERS([fcntl.h strings.h sys/file.h unistd.h features.h \
94                  pthread.h poll.h sys/poll.h sys/sysmacros.h, sys/uio.h])
95
96# Checks for typedefs, structures, and compiler characteristics.
97TYPE_SOCKLEN_T
98AC_SYS_LARGEFILE
99AC_MSGHDR_ACCRIGHTS
100
101# Checks for library functions.
102dnl AC_FUNC_MALLOC
103AC_FUNC_STRERROR_R
104AC_CHECK_FUNCS([strerror pthread_sigmask sigthreadmask rresvport rresvport_af atoi])
105
106#
107# Check for poll vs. select()
108#
109AC_POLLSELECT
110
111#
112# Test for default pdsh fanout and connect timeout
113#
114AC_FANOUT
115AC_CONNECT_TIMEOUT
116
117#
118# Test for inclusion of standard "rsh" module
119#
120AC_RSH
121AM_CONDITIONAL(WITH_RSH, [test "$ac_with_rsh" = "yes"])
122
123#
124# Test for inclusion of standard "xcpu" module
125#
126AC_XCPU
127AM_CONDITIONAL(WITH_XCPU, [test "$ac_with_xcpu" = "yes"])
128
129#
130# Test for ssh
131#
132AC_SSH
133AM_CONDITIONAL(WITH_SSH, test  "$ac_have_ssh"   =  "yes")
134
135#
136# Test for exec
137#
138AC_EXEC
139AM_CONDITIONAL(WITH_EXEC, test  "$ac_have_exec"   =  "yes")
140
141
142#
143# Test for kerberos
144#
145AC_KRB4
146AM_CONDITIONAL(WITH_KRB4, test  "$ac_have_krb4" =  "yes")
147
148#
149# Test for whether to build "machines" module.
150#
151AC_MACHINES
152AM_CONDITIONAL(WITH_MACHINES, [test "$ac_have_machines" = "yes"])
153
154#
155# Check for genders
156#
157AC_GENDERS
158AM_CONDITIONAL(WITH_LIBGENDERS, [test "$ac_have_libgenders"    = "yes"])
159
160#
161# Check for nodeupdown
162#
163AC_NODEUPDOWN
164AM_CONDITIONAL(WITH_NODEUPDOWN, [test "$ac_have_libnodeupdown" = "yes"])
165
166#
167# Check for libmunge and mrsh
168#
169AC_MRSH
170AM_CONDITIONAL(WITH_LIBMUNGE,   [test "$ac_have_libmunge"      = "yes"])
171AM_CONDITIONAL(WITH_MRSH,       [test "$ac_have_mrsh"          = "yes"])
172
173#
174# Determine whether to build SLURM module (support running under SLURM jobid
175#
176AC_SLURM
177AM_CONDITIONAL([WITH_SLURM], [test "$ac_have_slurm" = "yes"])
178
179#
180# Determine whether to to build Torque mudule (support running under Torque jobid)
181#
182AC_TORQUE
183AM_CONDITIONAL([WITH_TORQUE], [test "$ac_have_torque" = "yes"])
184
185#
186# Determine whether to build dshgroup module
187# (support dsh-style /etc/dsh/group/%s ~/.dsh/group/%s files)
188#
189AC_DSHGROUP
190AM_CONDITIONAL([WITH_DSHGROUP], [test "$ac_with_dshgroup" = "yes"])
191
192AC_NETGROUP
193AM_CONDITIONAL([WITH_NETGROUP], [test "$ac_with_netgroup" = "yes"])
194
195dnl
196dnl check for whether to include readline support
197dnl
198AC_READLINE
199AM_CONDITIONAL([WITH_READLINE], [test "$ac_with_readline" = "yes"])
200
201dnl
202dnl check for inclusion of Dmalloc.
203dnl Note: this macro defines WITH_DMALLOC for us.
204dnl
205AC_DMALLOC
206
207#
208#  Check for alternate rcmd rank list:
209#
210AC_RCMD_RANK_LIST
211
212if test "$ac_static_modules" = "yes" ; then
213   AC_STATIC_MODULES_EXIT
214fi
215
216#
217# Build PDSH_VERSION string
218#
219test "$ac_static_modules" = "yes" && EXTRA_VERS="+static-modules"
220test "$ac_with_readline"  = "yes" && EXTRA_VERS="${EXTRA_VERS}+readline"
221test "$ac_debug"          = "yes" && EXTRA_VERS="${EXTRA_VERS}+debug"
222test "$ac_with_dmalloc"   = "yes" && EXTRA_VERS="${EXTRA_VERS}+dmalloc"
223
224if test -n "$EXTRA_VERS" ; then
225   PDSH_VERSION_FULL="$PACKAGE_NAME-$PACKAGE_VERSION ($EXTRA_VERS)"
226else
227   PDSH_VERSION_FULL="$PACKAGE_NAME-$PACKAGE_VERSION"
228fi
229
230AC_SUBST(PDSH_VERSION)
231AC_SUBST(PDSH_VERSION_FULL)
232
233
234AC_DEFINE(WITH_LSD_FATAL_ERROR_FUNC, 1, [Have definition of lsd_fatal_error])
235AC_DEFINE(WITH_LSD_NOMEM_FUNC, 1, [Have definition of lsd_nomem_error])
236
237
238AH_BOTTOM(
239[#ifdef WITH_DMALLOC
240#  include <stdlib.h>
241#  include <dmalloc.h>
242#endif /* WITH_DMALLOC */]
243)
244
245# Should probably be defining tests for these - cheat for now
246AH_BOTTOM(
247[#ifdef _AIX
248#  define HAVE_MTSAFE_GETHOSTBYNAME 1
249#  define HAVE_MAGIC_RSHELL_CLEANUP 1
250#  define WANT_RECKLESS_HOSTRANGE_EXPANSION 1
251#else
252#  define HAVE_MTSAFE_GETHOSTBYNAME 0
253#  define HAVE_MAGIC_RSHELL_CLEANUP 0
254#  define WANT_RECKLESS_HOSTRANGE_EXPANSION 0
255#endif /* _AIX */]
256)
257
258AC_CONFIG_FILES([
259  Makefile
260  config/Makefile
261  src/Makefile
262  src/common/Makefile
263  src/pdsh/Makefile
264  src/modules/Makefile
265  doc/Makefile
266  scripts/Makefile
267  tests/Makefile
268  tests/test-modules/Makefile
269  doc/pdcp.1
270  doc/pdsh.1
271 ]
272)
273AC_OUTPUT
274