configure.in 5.72 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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(ch3usockconf.h)
AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*  
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */
#ifndef MPIDI_CH3USOCKCONF_H_INCLUDED
#define MPIDI_CH3USOCKCONF_H_INCLUDED
])
AH_BOTTOM([#endif])

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

echo "RUNNING CONFIGURE FOR CH3 UTIL SOCK ROUTINES"

# 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
# -----------------------------------------------------------------------------

PAC_PROG_MAKE
AC_CHECK_PROGS(AR,ar)
if test -z "$AR" ; then
    AC_MSG_ERROR([The program ar is required for building MPICH2.  Make sure that your path includes ar])
fi
# Note that we set RANLIB to true if we don't find it (some systems neither
# need it nor provide it)
AC_CHECK_PROGS(RANLIB,ranlib,true)

AC_CHECK_HEADERS(assert.h limits.h string.h sys/types.h sys/uio.h \
    time.h ctype.h unistd.h arpa/inet.h sys/socket.h net/if.h)

# 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

dnl AC_CHECK_FUNCS(CFUUIDCreate uuid_generate time)
dnl AC_SEARCH_LIBS(uuid_generate, uuid)

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
# 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;],
pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no)])

if test "$pac_cv_have_struct_ifconf" = "no" ; then
    # 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;],
pac_cv_have_struct_ifconf_with_svid=yes,
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

if test "$pac_cv_have_struct_ifconf" = "no" -a \
        "$pac_cv_have_struct_ifconf_with_svid" = "no" ; then
    # 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;],
pac_cv_have_struct_ifconf_without_posix=yes,
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

if test "$pac_cv_have_struct_ifconf" = "yes" -o \
        "$pac_cv_have_struct_ifconf_with_svid" = "yes" -o \
        "$pac_cv_have_struct_ifconf_without_posix" ; then
    AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used])
fi

139
140
141
# AR_FLAGS provides a way to potentially improve build performance on Mac OSX
if test -z "$AR_FLAGS" ; then AR_FLAGS=cr ; fi

142
AC_SUBST(AR)
143
AC_SUBST(AR_FLAGS)
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
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

dnl Note that once dependencies are enabled, we always try to
dnl update the dependencies (that is usually the desired behavior)
dnl    find . -type d -exec sh -c '(cd {} && grep MAKE_DEPEND_C Makefile >/dev/null 2>&1 && ( test -d .deps || mkdir .deps ) && touch .deps/alldeps )' \;
dnl We only apply this to src, as that is the only directory that 
dnl contains the source files for MPICH2; this avoids running through the
dnl test directories, for example.
AC_OUTPUT_COMMANDS([if grep 'dependencies:' Makefile >/dev/null 2>&1 ; then
    echo "Updating dependency directories .deps" 
    find . -type d -print | sed -e 's%\(.*\)%(cd \1 \&\& grep MAKE_DEPEND_C Makefile >/dev/null 2>\&1 \&\& ( test -d .deps || mkdir .deps) \&\& touch .deps/alldeps)%g' | sh
fi])

AC_OUTPUT(Makefile)

PAC_SUBDIR_CACHE_CLEANUP