-
Notifications
You must be signed in to change notification settings - Fork 14
/
acinclude.m4
100 lines (100 loc) · 3.54 KB
/
acinclude.m4
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
dnl George Fleming, 12/12/2002
dnl
dnl Stole this from mpich-1.2.4/mpe
dnl
dnl PAC_MPI_LINK_CC_FUNC( MPI_CC, MPI_CFLAGS, MPI_LIBS,
dnl MPI_VARS, MPI_FUNC,
dnl [action if working], [action if not working] )
dnl - MPI_CFLAGS is the extra CFLAGS to CC, like "-I/usr/include" for mpi.h
dnl - MPI_LDFLAGS is the extra LDFLAGS to CC, like "-L/usr/lib" for libmpi.a
dnl - MPI_LIBS is the LIBS to CC, like "-lmpi" for libmpi.a
dnl - MPI_VARS is the the declaration of variables needed to call MPI_FUNC
dnl - MPI_FUNC is the body of MPI function call to be checked for existence
dnl e.g. MPI_VARS="MPI_Request request; MPI_Fint a;"
dnl MPI_FUNC="a = MPI_Request_c2f( request );"
dnl if MPI_FUNC is empty, assume linking with basic MPI program.
dnl i.e. check if MPI definitions are valid
dnl
AC_DEFUN([PAC_MPI_LINK_CC_FUNC],[
dnl - set local parallel compiler environments
dnl so input variables can be CFLAGS, LDFLAGS or LIBS
pac_MPI_CFLAGS="$1"
pac_MPI_LDFLAGS="$2"
pac_MPI_LIBS="$3"
AC_LANG_SAVE
AC_LANG_C
dnl - save the original environment
pac_saved_CFLAGS="$CFLAGS"
pac_saved_LDFLAGS="$LDFLAGS"
pac_saved_LIBS="$LIBS"
dnl - set the parallel compiler environment
CFLAGS="$CFLAGS $pac_MPI_CFLAGS"
LDFLAGS="$LDFLAGS $pac_MPI_LDFLAGS"
LIBS="$LIBS $pac_MPI_LIBS"
AC_TRY_LINK( [#include "mpi.h"], [
int argc; char **argv;
$4 ;
MPI_Init(&argc, &argv);
$5 ;
MPI_Finalize();
], pac_mpi_working=yes, pac_mpi_working=no )
CFLAGS="$pac_saved_CFLAGS"
LDFLAGS="$pac_saved_LDFLAGS"
LIBS="$pac_saved_LIBS"
AC_LANG_RESTORE
if test "$pac_mpi_working" = "yes" ; then
ifelse([$6],,:,[$6])
else
ifelse([$7],,:,[$7])
fi
])
dnl
dnl Balint Joo, 12/01/2003
dnl
dnl Stole this from mpich-1.2.4/mpe
dnl
dnl PAC_GM_LINK_CC_FUNC( GM_CC, GM_CFLAGS, GM_LIBS,
dnl GM_VARS, GM_FUNC,
dnl [action if working], [action if not working] )
dnl - GM_CFLAGS is the extra CFLAGS to CC, like "-I/usr/include" for gm.h
dnl - GM_LDFLAGS is the extra LDFLAGS to CC, like "-L/usr/lib" for libgm.a
dnl - GM_LIBS is the LIBS to CC, like "-lgm" for libgm.a
dnl - GM_VARS is the the declaration of variables needed to call GM_FUNC
dnl - GM_FUNC is the body of MPI function call to be checked for existence
dnl e.g. GM_VARS="gm_status_t status;"
dnl GM_FUNC="status = gm_open(....)"
dnl if GM_FUNC is empty, assume linking with basic GM program.
dnl i.e. check if definitions are valid -- try linking gm_init()
dnl
AC_DEFUN([PAC_GM_LINK_CC_FUNC],[
dnl - set local parallel compiler environments
dnl so input variables can be CFLAGS, LDFLAGS or LIBS
pac_GM_CFLAGS="$1"
pac_GM_LDFLAGS="$2"
pac_GM_LIBS="$3"
AC_LANG_SAVE
AC_LANG_C
dnl - save the original environment
pac_saved_CFLAGS="$CFLAGS"
pac_saved_LDFLAGS="$LDFLAGS"
pac_saved_LIBS="$LIBS"
dnl - set the parallel compiler environment
CFLAGS="$CFLAGS $pac_GM_CFLAGS"
LDFLAGS="$LDFLAGS $pac_GM_LDFLAGS"
LIBS="$LIBS $pac_GM_LIBS"
AC_TRY_LINK( [#include <gm.h>], [
int argc; char **argv;
$4 ;
gm_init();
$5 ;
gm_finalize();], pac_gm_working=yes, pac_gm_working=no )
CFLAGS="$pac_saved_CFLAGS"
LDFLAGS="$pac_saved_LDFLAGS"
LIBS="$pac_saved_LIBS"
AC_LANG_RESTORE
if test "$pac_gm_working" = "yes" ; then
ifelse([$6],,:,[$6])
else
ifelse([$7],,:,[$7])
fi
])