File: ac_dimes.m4

package info (click to toggle)
adios 1.3-11
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 7,376 kB
  • sloc: ansic: 48,186; sh: 9,682; cpp: 2,662; f90: 1,390; makefile: 895; python: 372; xml: 301
file content (119 lines) | stat: -rw-r--r-- 3,593 bytes parent folder | download
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
#
#
# AC_PROG_DIMES
#
# Test for DIMES installation
# and set $DIMES to the correct value.
#
#

dnl @synopsis AC_PROG_DIMES
dnl
dnl This macro test if DIMES is installed. If DIMES
dnl is installed, it set $DIMES to the right value
dnl
dnl @version 1.0
dnl @author Fan Zhang,  zhangfan@cac.rutgers.edu
dnl @author Norbert Podhorszki, pnorbert@ornl.gov
dnl
AC_DEFUN([AC_PROG_DIMES],[

AM_CONDITIONAL(HAVE_DIMES,true)

AC_ARG_WITH(dimes,
        [AS_HELP_STRING([--with-dimes=DIR],
           [Build the DIMES transport method. Point to the DIMES installation.])],
        [DIMES_LDFLAGS="-L$withval/lib";
         DIMES_CPPFLAGS="-I$withval/include";],
        [with_dimes=check])

dnl If --without-dimes was given set HAVE_DIMES to false and do nothing more
if test "x$with_dimes" == "xno"; then

   AM_CONDITIONAL(HAVE_DIMES,false)

else

    dnl allow args --with-dimes incdir and --with-dimes-libdir
    AC_ARG_WITH(dimes-incdir,
                [  --with-dimes-incdir=<location of dimes includes>],
                [DIMES_INCDIR=$withval
                 with_dimes=detailed])
    
    AC_ARG_WITH(dimes-libdir,
                [  --with-dimes-libdir=<location of dimes library>],
                [DIMES_LIBDIR=$withval
                 with_dimes=detailed])
    
    
    dnl If we know DIMES_DIR, then we can know DIMES_INCDIR.
    dnl We don't overwrite DIMES_INCDIR.
    if test -n "${DIMES_DIR}" -a -z "${DIMES_INCDIR}"; then
            DIMES_INCDIR="${DIMES_DIR}/include";
    dnl We may have DIMES denoting the dir (e.g. on ewok BUT on franklin it contains all flags)
    elif test -n "${DIMES}" -a -d "${DIMES}"; then
            DIMES_INCDIR="${DIMES}/include"
    fi

    dnl If we know DIMES_DIR, then we can know DIMES_LIBDIR.
    dnl We don't overwrite DIMES_LIBDIR.
    if test -n "${DIMES_DIR}" -a -z "${DIMES_LIBDIR}"; then
            DIMES_LIBDIR="${DIMES_DIR}/lib";
    dnl We may have DIMES denoting the dir (e.g. on ewok BUT on franklin it contains all flags)
    elif test -n "${DIMES}" -a -d "${DIMES}"; then
            DIMES_LIBDIR="${DIMES}/lib"
    fi

    dnl Add "-I" to DIMES_INCDIR.
    if test -n "${DIMES_INCDIR}"; then
            DIMES_CPPFLAGS="-I${DIMES_INCDIR}"
    else
            ac_dimes_ok=no
    fi

    dnl Add "-L" to DIMES_LIBDIR.
    if test -n "${DIMES_LIBDIR}"; then
            DIMES_LDFLAGS="-L${DIMES_LIBDIR}"
    else
            ac_dimes_ok=no
    fi

    save_CPPFLAGS="$CPPFLAGS"
    save_LIBS="$LIBS"
    save_LDFLAGS="$LDFLAGS"
    LIBS="$LIBS -ldimes_portals -lspaces"
    LDFLAGS="$LDFLAGS $DIMES_LDFLAGS"
    CPPFLAGS="$CPPFLAGS $DIMES_CPPFLAGS"
    
    if test -z "${HAVE_DIMES_TRUE}"; then
            AC_CHECK_HEADERS(dimes.h,
                    ,
                    [AM_CONDITIONAL(HAVE_DIMES,false)])
    fi
    
    # Check for the Mini-XML library and headers
    AC_TRY_COMPILE([#include "dimes.h"],
            [int err; err = dimes_init(1,1,1);],
            [DIMES_LIBS="-ldimes_portals -lspaces"],
            [AM_CONDITIONAL(HAVE_DIMES,false)])
    
    LIBS="$save_LIBS"
    LDFLAGS="$save_LDFLAGS"
    CPPFLAGS="$save_CPPFLAGS"
    
    AC_SUBST(DIMES_LIBS)
    AC_SUBST(DIMES_LDFLAGS)
    AC_SUBST(DIMES_CPPFLAGS)
    
    # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
    if test -z "${HAVE_DIMES_TRUE}"; then
            ifelse([$1],,[AC_DEFINE(HAVE_DIMES,1,[Define if you have the DIMES.])],[$1])
            :
    else
            $2
            :
    fi

fi
])dnl AC_DIMES