configure.in 8.64 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
AC_INIT(configure.in)

dnl
dnl Set the directory that contains support scripts such as install-sh and
dnl config.guess
dnl
AC_CONFIG_AUX_DIR(../../../confdb)

dnl Definitions will be placed in this file rather than in the DEFS variable
dnl
AC_CONFIG_HEADER(include/mpidi_ch3_conf.h)
AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*  
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */
#ifndef MPIDI_CH3_CONF_H_INCLUDED
#define MPIDI_CH3_CONF_H_INCLUDED
])
AH_BOTTOM([#endif])

AC_DEFINE(HAVE_MPIDI_CH3_CONF,1,[Define so that we can test whether the mpidi_ch3_conf.h file has been included])

echo "RUNNING CONFIGURE FOR CH3 DEVICE"

# First check that we have a clean build if we are doing a VPATH build
PAC_VPATH_CHECK()

# -----------------------------------------------------------------------------
# experiment with creating a cache file.  Load if it exists
#if test -n "$CONF_BASE_CACHEFILE" -a -s "$CONF_BASE_CACHEFILE" ; then
#    echo "Loading base cachefile $CONF_BASE_CACHEFILE"
#    . $CONF_BASE_CACHEFILE
#    export CONF_BASE_CACHEFILE
#fi
PAC_LOAD_BASE_CACHE
# -----------------------------------------------------------------------------

# Extract the device and channel name
file=${master_top_srcdir}/src/mpid/${device_name}/setup_device.args
if test -f ${file} ; then 
    . ${file}
else
    echo "ERROR: ${file} not found"
    exit 1
fi
export channel_name
export channel_args
AC_SUBST(device_name)
AC_SUBST(channel_name)

if test ! -d $srcdir/channels/${channel_name} ; then
    AC_MSG_ERROR([Channel ${channel_name} is unknown])
elif test ! -x $srcdir/channels/${channel_name}/configure ; then
    AC_MSG_ERROR([Channel ${channel_name} has no configure])
fi

PAC_PROG_MAKE

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# ----------------------------------------------------------------------------
# include ftb functionality
# ----------------------------------------------------------------------------

ftb_dir=
AC_ARG_ENABLE([ftb],
  [AS_HELP_STRING([[--enable-ftb]],
    [Enable FTB support (default is no)])],
  [AC_DEFINE([ENABLE_FTB], 1, [Define if FTB is enabled])
  ftb_dir=ftb
  PAC_SET_HEADER_LIB_PATH(ftb)
  PAC_CHECK_HEADER_LIB_FATAL(ftb, libftb.h, ftb, FTB_Connect)]
)
AC_SUBST(ftb_dir)
export LDFLAGS
export LIBS
export CFLAGS
export CPPFLAGS

79
80
81
82
83
84
85
# Some channels will make use of common utility routines (in ch3/src/util)
# For modularity, the channel can specify these here
# FIXME: Some utility routines are specified at the top level (devsubsystem)
# even though their scope is really ch3 in practice.  We haven't resolved
# the best way to handle these systems
# Note that the "setup_<channelname>" script must also set 
#   needs_sock=yes
86
# if util/sock is used
87
88
89
90
91
92
93
94
95
if test -s $srcdir/channels/$channel_name/setup_$channel_name ; then
    # Typically, this will set ch3subsystems.  For now,
    # we use this configure to create the configuration file
    # for those subsystems.  Eventually, they may have their	
    # own configure
    . $srcdir/channels/$channel_name/setup_$channel_name
    if test "$needs_sock" = yes ; then
        AC_DEFINE(HAVE_UTIL_SOCK,1,[Define if the channel needs util/sock])
	CPPFLAGS="${CPPFLAGS} -I${master_top_srcdir}/src/mpid/ch3/util/sock"
96
	PAC_CONFIG_SUBDIR(util/sock,,AC_ERROR(util/sock configure failed))
97
98
99
100
    fi				   	
fi
AC_SUBST(ch3subsystems)

101
102
103
AC_ARG_WITH(ch3-rank-bits, [--with-ch3-rank-bits=16/32     Number of bits allocated to the rank field (16 or 32)],
			   [ rankbits=$withval ],
			   [ rankbits=16 ])
104
if test "$rankbits" != "16" -a "$rankbits" != "32" ; then
105
106
   AC_MSG_ERROR(Only 16 or 32-bit ranks are supported)
fi
107
AC_DEFINE_UNQUOTED(CH3_RANK_BITS,$rankbits,[Define the number of CH3_RANK_BITS])
108

109
AC_CHECK_HEADERS(assert.h limits.h string.h sys/types.h sys/uio.h uuid/uuid.h \
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    time.h ctype.h unistd.h arpa/inet.h sys/socket.h)

# net/if.h requires special handling on darwin.  The following code is
# straight out of the autoconf-2.63 manual.  Also, sys/socket.h (above)
# is a prerequisite.
AC_CHECK_HEADERS([net/if.h], [], [],
[#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
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

# Check for special types
AC_TYPE_PID_T

# Check for functions
AC_CHECK_FUNCS(inet_pton)
AC_CHECK_FUNCS(gethostname)
if test "$ac_cv_func_gethostname" = "yes" ; then
    # Do we need to declare gethostname?
    PAC_FUNC_NEEDS_DECL([#include <unistd.h>],gethostname)
fi

AC_CHECK_FUNCS(CFUUIDCreate uuid_generate time)

AC_CACHE_CHECK([whether CPP accepts variable length argument lists],
pac_cv_have_cpp_varargs,[
AC_TRY_COMPILE([
#include <stdio.h>
#define MY_PRINTF(rank, fmt, args...)  printf("%d: " fmt, rank, ## args)
],[
MY_PRINTF(0, "hello");
MY_PRINTF(1, "world %d", 3);
], pac_cv_have_cpp_varargs=yes, pac_cv_have_cpp_varargs=no)
])
if test $pac_cv_have_cpp_varargs = "yes" ; then
    AC_DEFINE(HAVE_CPP_VARARGS,,[Define if CPP supports macros with a variable number arguments])
fi

AC_C_BIGENDIAN

# If we need the socket code, see if we can use struct ifconf
160
161
162
163
164
165
166
167
# Some systems require special compile options or definitions, or 
# special header files.
#
# To simplify this sequence of tests, we set
#   pac_found_struct_ifconf 
# to yes when we figure out how to get struct ifconf
pac_found_struct_ifconf=no
#
168
169
170
171
172
173
174
175
176
177
# 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;],
178
179
[pac_cv_have_struct_ifconf=yes;pac_found_struct_ifconf=yes],
 pac_cv_have_struct_ifconf=no)])
180

181
if test "$pac_found_struct_ifconf" = "no" ; then
182
183
184
185
186
187
188
189
190
191
192
    # 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;],
193
pac_cv_have_struct_ifconf_with_svid=yes;pac_found_struct_ifconf=yes,
194
195
196
197
198
199
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

200
if test "$pac_found_struct_ifconf" = "no" ; then
201
202
203
204
205
206
207
208
209
210
211
    # 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;],
212
pac_cv_have_struct_ifconf_without_posix=yes;pac_found_struct_ifconf=yes,
213
214
215
216
217
218
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

219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
if test "$pac_found_struct_ifconf" = "no" ; then
    # Try again with _ALL_SOURCE
    AC_CACHE_CHECK([whether we can use struct ifconf with _ALL_SOURCE],
pac_cv_have_struct_ifconf_with_svid,[
AC_TRY_COMPILE([
#define _ALL_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_all_source=yes;pac_found_struct_ifconf=yes,
pac_cv_have_struct_ifconf_with_all_source=no)])
    if test "$pac_cv_have_struct_ifconf_with_all_source" = yes ; then
        AC_DEFINE(USE_ALL_SOURCE_FOR_IFCONF,1,[Define if _ALL_SOURCE needs to be defined for struct ifconf])
    fi
fi

if test "$pac_found_struct_ifconf" = "yes" ; then
239
240
241
242
243
244
245
246
247
248
    AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used])
fi

#
# bring in the default implementation of the MPID_Thread package
#
MPID_THREAD_SRCDIR="../common/thread"
builtin(include,../common/thread/mpid_thread.m4)

AC_SUBST(AR)
249
AC_SUBST(AR_FLAGS)
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
AC_SUBST(RANLIB)
AC_SUBST(MPILIBNAME)
AC_SUBST(CC)
AC_SUBST(DEFS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
PAC_CC_SUBDIR_SHLIBS
AC_SUBST(master_top_srcdir)
# Master_top_builddir is imported from the top; use it for the "top"
AC_SUBST(master_top_builddir)
export master_top_builddir
dnl Dependency handling
AC_SUBST(MAKE_DEPEND_C)

AC_SUBST(EXTRA_LIBS)

PAC_SUBDIR_CACHE

PAC_UPDATE_BASE_CACHE

# Ensure that all subdir configures get the shared library items
export CC_SHL
export C_LINK_SHL
export C_LINKPATH_SHL
export SHLIB_EXT
export ENABLE_SHLIB
export LIBTOOL

278
PAC_CONFIG_SUBDIR(channels/${channel_name},,AC_ERROR(channels/${channel_name} configure failed))
279

280
AC_OUTPUT(Makefile src/Makefile util/Makefile channels/Makefile util/ftb/Makefile localdefs $MPID_THREAD_OUTPUT_FILES)
281
282

PAC_SUBDIR_CACHE_CLEANUP