File: aclocal_modules.m4

package info (click to toggle)
mpich 4.3.0%2Breally4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 419,120 kB
  • sloc: ansic: 1,215,557; cpp: 74,755; javascript: 40,763; f90: 20,649; sh: 18,463; xml: 14,418; python: 14,397; perl: 13,772; makefile: 9,279; fortran: 8,063; java: 4,553; asm: 324; ruby: 176; lisp: 19; php: 8; sed: 4
file content (135 lines) | stat: -rw-r--r-- 6,487 bytes parent folder | download | duplicates (12)
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
dnl ==== mpl ====

dnl internal routine
AC_DEFUN([PAC_CONFIG_MPL_EMBEDDED],[
    mpl_subdir_args="--disable-versioning --enable-embedded"
    PAC_PUSH_FLAG([CFLAGS])
    if test -n "$VISIBILITY_CFLAGS" ; then
        CFLAGS="$CFLAGS $VISIBILITY_CFLAGS -DHAVE_VISIBILITY"
    fi
    PAC_CONFIG_SUBDIR_ARGS(mpl_embedded_dir,[$mpl_subdir_args],[],[AC_MSG_ERROR(MPL configure failed)])
    PAC_POP_FLAG([CFLAGS])
])

AC_DEFUN([PAC_CONFIG_MPL],[
    dnl NOTE: we only support embedded mpl
    m4_ifdef([MPICH_CONFIGURE], [
        dnl ---- the main MPICH configure ----
        PAC_CONFIG_MPL_EMBEDDED
        PAC_APPEND_FLAG([-I${main_top_builddir}/src/mpl/include], [CPPFLAGS])
        PAC_APPEND_FLAG([-I${use_top_srcdir}/src/mpl/include], [CPPFLAGS])
        mplsrcdir="src/mpl"
        mpllib="src/mpl/libmpl.la"
    ], [
        dnl ---- sub-configure (e.g. hydra, romio) ----
        if test "$FROM_MPICH" = "yes"; then
            dnl skip ROMIO since mpich already links libmpl.la
            if test "$pac_skip_mpl_lib" != "yes" ; then
                mpl_lib="$main_top_builddir/src/mpl/libmpl.la"
            fi
            mpl_includedir="-I$main_top_builddir/src/mpl/include -I$main_top_srcdir/src/mpl/include"
            # source variables that are configured by MPL
            AC_MSG_NOTICE([sourcing $main_top_builddir/src/mpl/localdefs])
            . $main_top_builddir/src/mpl/localdefs
        elif test "$FROM_HYDRA" = "yes"; then
            m4_ifdef([HYDRA_CONFIGURE], [
                PAC_CONFIG_MPL_EMBEDDED
                mpl_srcdir="mpl_embedded_dir"
                mpl_dist_srcdir="mpl_embedded_dir"
                mpl_lib="mpl_embedded_dir/libmpl.la"
                mpl_includedir='-I$(top_builddir)/mpl_embedded_dir/include -I$(top_srcdir)/mpl_embedded_dir/include'
            ], [
                dnl both mpl and pmi are in modules/
                mpl_includedir="-I$srcdir/../mpl/include -I../mpl/include"
                AC_MSG_NOTICE([sourcing ../mpl/localdefs])
                . ../mpl/localdefs
            ])
        else
            PAC_CONFIG_MPL_EMBEDDED
            mpl_srcdir="mpl_embedded_dir"
            mpl_dist_srcdir="mpl_embedded_dir"
            mpl_lib="mpl_embedded_dir/libmpl.la"
            mpl_includedir='-I$(top_builddir)/mpl_embedded_dir/include -I$(top_srcdir)/mpl_embedded_dir/include'
        fi
    ])
])

dnl ==== hwloc ====

dnl internal routine, $1 is the extra cflags, hwloc_embedded_dir is m4 macro
dnl defined to be the path to embedded hwloc.
AC_DEFUN([PAC_CONFIG_HWLOC_EMBEDDED],[
    PAC_PUSH_FLAG([CFLAGS])
    CFLAGS="$USER_CFLAGS $1"
    hwloc_config_args="--enable-embedded-mode --disable-visibility"
    hwloc_config_args="$hwloc_config_args --disable-gl"
    hwloc_config_args="$hwloc_config_args --disable-libxml2"
    hwloc_config_args="$hwloc_config_args --disable-nvml"
    hwloc_config_args="$hwloc_config_args --disable-cuda"
    hwloc_config_args="$hwloc_config_args --disable-opencl"
    hwloc_config_args="$hwloc_config_args --disable-rsmi"
    PAC_CONFIG_SUBDIR_ARGS(hwloc_embedded_dir, [$hwloc_config_args],[], [AC_MSG_ERROR(embedded hwloc configure failed)])
    PAC_POP_FLAG([CFLAGS])
])

AC_DEFUN([PAC_CONFIG_HWLOC],[
    dnl minor difference from e.g. mpl -- we'll prioritize system hwloc by default
    PAC_CHECK_HEADER_LIB_OPTIONAL([hwloc],[hwloc.h],[hwloc],[hwloc_topology_set_pid])
    if test "$pac_have_hwloc" = "yes" -a "$with_hwloc" != "embedded"; then
        AC_MSG_CHECKING([if hwloc meets minimum version requirement])
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <hwloc.h>], [
                        #if HWLOC_API_VERSION < 0x00020000
                        #error
                        #endif
                        return 0;])],[],[pac_have_hwloc=no])
        AC_MSG_RESULT([$pac_have_hwloc])

        # if an old hwloc was specified by the user, throw an error
        if test "$pac_have_hwloc" = "no" -a -n "$with_hwloc" -a "$with_hwloc" != "yes" ; then
            AC_MSG_ERROR([hwloc installation does not meet minimum version requirement (2.0). Please update your hwloc installation or use --with-hwloc=embedded.])
        fi
    fi
    if test "$pac_have_hwloc" = "no" -a "$with_hwloc" != "no"; then
        with_hwloc=embedded
        pac_have_hwloc=yes
        # make sure subsystems such as hydra will use embedded hwloc consistently
        subsys_config_args="$subsys_config_args --with-hwloc=embedded"
    fi

    if test "$with_hwloc" = "embedded" ; then
        m4_ifdef([MPICH_CONFIGURE], [
            dnl ---- the main MPICH configure ----
            hwloclib="modules/hwloc/hwloc/libhwloc_embedded.la"
            if test -e "${use_top_srcdir}/modules/PREBUILT" -a -e "$hwloclib"; then
                hwlocsrcdir=""
            else
                hwlocsrcdir="${main_top_builddir}/modules/hwloc"
                PAC_CONFIG_HWLOC_EMBEDDED([$VISIBILITY_CFLAGS])
            fi
            PAC_APPEND_FLAG([-I${use_top_srcdir}/modules/hwloc/include],[CPPFLAGS])
            PAC_APPEND_FLAG([-I${main_top_builddir}/modules/hwloc/include],[CPPFLAGS])
            hwloc_config_status="${main_top_builddir}/modules/hwloc/config.status"
        ], [
            dnl ---- sub-configure (hydra) ----
            if test "$FROM_MPICH" = "yes"; then
                hwloc_includedir="-I${main_top_srcdir}/modules/hwloc/include -I${main_top_builddir}/modules/hwloc/include"
                hwloc_lib="${main_top_builddir}/modules/hwloc/hwloc/libhwloc_embedded.la"
                hwloc_config_status="${main_top_builddir}/modules/hwloc/config.status"
            else
                PAC_CONFIG_HWLOC_EMBEDDED()
                dnl Note that single quote is intentional to pass the variable as is
                hwloc_srcdir="hwloc_embedded_dir"
                hwloc_includedir='-I${srcdir}/${hwloc_srcdir}/include -I${builddir}/${hwloc_srcdir}/include'
                hwloc_lib='${builddir}/${hwloc_srcdir}/hwloc/libhwloc_embedded.la'
                hwloc_config_status="${builddir}/${hwloc_srcdir}/config.status"
            fi
        ])

        # capture the line -- S["HWLOC_DARWIN_LDFLAGS"]=" -framework Foundation -framework IOKit"
        hwloc_darwin_ldflags=$(awk -F'"' '/^S."HWLOC_DARWIN_LDFLAGS"/ {print $[]4}' "$hwloc_config_status")
        if test -n "$hwloc_darwin_ldflags" ; then
            echo "hwloc_darwin_ldflags = $hwloc_darwin_ldflags"
            PAC_APPEND_FLAG([$hwloc_darwin_ldflags], [LDFLAGS])
        fi
    fi
])