configure.in 9.89 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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
# if util/sock is used, and
#   needs_shm=yes
# if util/shm is used.
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"
        AC_CONFIG_SUBDIRS(util/sock)
    fi				   	
    if test "$needs_shm" = yes ; then
        AC_DEFINE(HAVE_UTIL_SHM,1,[Define if the channel needs util/shm])
	#CPPFLAGS="${CPPFLAGS} -I${master_top_srcdir}/src/mpid/ch3/util/shm"
    fi				   	
fi
AC_SUBST(ch3subsystems)

107
108
109
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 ])
110
if test "$rankbits" != "16" -a "$rankbits" != "32" ; then
111
112
   AC_MSG_ERROR(Only 16 or 32-bit ranks are supported)
fi
113
AC_DEFINE_UNQUOTED(CH3_RANK_BITS,$rankbits,[Define the number of CH3_RANK_BITS])
114

115
AC_CHECK_HEADERS(assert.h limits.h string.h sys/types.h sys/uio.h uuid/uuid.h \
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
    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
])
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

# 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
166
167
168
169
170
171
172
173
# 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
#
174
175
176
177
178
179
180
181
182
183
# 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;],
184
185
[pac_cv_have_struct_ifconf=yes;pac_found_struct_ifconf=yes],
 pac_cv_have_struct_ifconf=no)])
186

187
if test "$pac_found_struct_ifconf" = "no" ; then
188
189
190
191
192
193
194
195
196
197
198
    # 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;],
199
pac_cv_have_struct_ifconf_with_svid=yes;pac_found_struct_ifconf=yes,
200
201
202
203
204
205
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

206
if test "$pac_found_struct_ifconf" = "no" ; then
207
208
209
210
211
212
213
214
215
216
217
    # 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;],
218
pac_cv_have_struct_ifconf_without_posix=yes;pac_found_struct_ifconf=yes,
219
220
221
222
223
224
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

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
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
245
246
247
248
    AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used])
fi
#
# We need to know whether to use %d or %ld for writing out MPI_Aint values
249
250
251
252
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(void *)
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
if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_void_p" ; then
    :
elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_void_p" ; then
    AC_DEFINE(MPI_AINT_IS_LONG_INT,1,[Define if the size of an MPI_Aint is long])
elif test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_void_p" ; then
    AC_DEFINE(MPI_AINT_IS_LONG_LONG_INT,1,[Define if the size of an MPI_Aint is long long])
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)
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

Pavan Balaji's avatar
Pavan Balaji committed
296
297
298
299
300
# TERRIBLE HACK: For some reason, anything added to LIBS by this
# configure is lost in the subconfigure.  So we save it in another
# variable then restore it in the subconfigure.  Note that this
# doesn't happen with LDFLAGS!
# FIXME: Figure out what's going on.
301
302
MY_EXPORTED_LIBS="$LIBS"
export MY_EXPORTED_LIBS
Pavan Balaji's avatar
Pavan Balaji committed
303

304
# FIXME shouldn't put var in _SUBDIRS
305
306
307
308
309
310
311
AC_CONFIG_SUBDIRS(channels/${channel_name})

# Add the MPICH2 include flags to CPPFLAGS.  See the discussion above about
# which include flags should start in MPICH2_INCLUDE_FLAGS and which in 
# CPPFLAGS
CPPFLAGS="$CPPFLAGS $MPICH2_INCLUDE_FLAGS"

312
AC_OUTPUT(Makefile src/Makefile util/Makefile util/shm/Makefile util/shmbase/Makefile channels/Makefile util/ftb/Makefile localdefs $MPID_THREAD_OUTPUT_FILES)
313
314

PAC_SUBDIR_CACHE_CLEANUP