1dnl -*- shell-script -*-
2dnl
3dnl Copyright (c) 2013      Mellanox Technologies, Inc.
4dnl                         All rights reserved.
5dnl Copyright (c) 2013-2014 Cisco Systems, Inc.  All rights reserved.
6dnl Copyright (c) 2014      Intel, Inc. All rights reserved
7dnl Copyright (c) 2014-2015 Research Organization for Information Science
8dnl                         and Technology (RIST). All rights reserved.
9dnl $COPYRIGHT$
10dnl
11dnl Additional copyrights may follow
12dnl
13dnl $HEADER$
14dnl
15
16AC_DEFUN([OSHMEM_CONFIGURE_OPTIONS],[
17opal_show_subtitle "OSHMEM Configuration options"
18
19AC_SUBST(OSHMEM_LIBSHMEM_EXTRA_LIBS)
20AC_SUBST(OSHMEM_LIBSHMEM_EXTRA_LDFLAGS)
21
22#
23# Disable Open SHMEM?
24#
25AC_MSG_CHECKING([if want oshmem])
26AC_ARG_ENABLE([oshmem],
27              [AC_HELP_STRING([--enable-oshmem],
28                              [Enable building the OpenSHMEM interface (available on Linux only, where it is enabled by default)])],
29              [oshmem_arg_given=yes],
30              [oshmem_arg_given=no])
31if test "$oshmem_arg_given" = "yes"; then
32    if test "$enable_oshmem" = "yes"; then
33        AC_MSG_RESULT([yes])
34        if test "$opal_found_linux" != "yes"; then
35            AC_MSG_WARN([OpenSHMEM support was requested, but currently])
36            AC_MSG_WARN([only supports Linux.])
37            AC_MSG_ERROR([Cannot continue])
38        fi
39    else
40        AC_MSG_RESULT([no])
41    fi
42else
43    if test "$opal_found_linux" = "yes"; then
44        enable_oshmem=yes
45        AC_MSG_RESULT([yes])
46    else
47        enable_oshmem=no
48        AC_MSG_RESULT([not supported on this platform])
49    fi
50fi
51
52#
53# Enable compatibility mode
54#
55AC_MSG_CHECKING([if want SGI/Quadrics compatibility mode])
56AC_ARG_ENABLE(oshmem-compat,
57        AC_HELP_STRING([--enable-oshmem-compat],
58            [enable compatibility mode (default: enabled)]))
59if test "$enable_oshmem" != "no" && test "$enable_oshmem_compat" != "no"; then
60    AC_MSG_RESULT([yes])
61    OSHMEM_SPEC_COMPAT=1
62else
63    AC_MSG_RESULT([no])
64    OSHMEM_SPEC_COMPAT=0
65fi
66AC_DEFINE_UNQUOTED([OSHMEM_SPEC_COMPAT], [$OSHMEM_SPEC_COMPAT],
67                   [Whether user wants OSHMEM in compatibility mode or not])
68
69
70
71#
72# Do we want to disable OSHMEM parameter checking at run-time?
73#
74AC_MSG_CHECKING([if want OSHMEM API parameter checking])
75AC_ARG_WITH(oshmem-param-check,
76    AC_HELP_STRING([--with-oshmem-param-check(=VALUE)],
77                   [behavior of OSHMEM API function parameter checking.  Valid values are: always, never.  If --with-oshmem-param-check is specified with no VALUE argument, it is equivalent to a VALUE of "always"; --without-oshmem-param-check is equivalent to "never" (default: always).]))
78if test "$enable_oshmem" != "no"; then
79    if test "$with_oshmem_param_check" = "no" || \
80       test "$with_oshmem_param_check" = "never"; then
81        shmem_param_check=0
82        AC_MSG_RESULT([never])
83    elif test "$with_oshmem_param_check" = "yes" || \
84         test "$with_oshmem_param_check" = "always" || \
85         test -z "$with_oshmem_param_check"; then
86        shmem_param_check=1
87        AC_MSG_RESULT([always])
88    else
89        shmem_param_check=1
90        AC_MSG_RESULT([unknown])
91        AC_MSG_WARN([*** Unrecognized --with-oshmem-param-check value])
92        AC_MSG_WARN([*** See "configure --help" output])
93        AC_MSG_WARN([*** Defaulting to "always"])
94    fi
95else
96    shmem_param_check=0
97    AC_MSG_RESULT([no])
98fi
99AC_DEFINE_UNQUOTED(OSHMEM_PARAM_CHECK, $shmem_param_check,
100    [Whether we want to check OSHMEM parameters always or never])
101
102#
103# check for on_exit
104#
105AC_CHECK_FUNCS([on_exit])
106
107#
108#  OSHMEM profiling support
109#
110AC_ARG_ENABLE(oshmem-profile,
111    AC_HELP_STRING([--enable-oshmem-profile],
112                   [enable OSHMEM profiling (default: enabled)]))
113AC_MSG_CHECKING([if want pshmem])
114AS_IF([test "$enable_oshmem_profile" != "no"],
115      [AC_MSG_RESULT([yes])],
116      [AC_MSG_RESULT([no])])
117
118# Bozo check
119AS_IF([test "$enable_oshmem" = "no" && \
120       test "$enable_oshmem_profile" = "yes"],
121      [AC_MSG_WARN([OpenSHMEM profiling was requested, but OpenSHMEM has been explicitly disabled])
122       AC_MSG_ERROR([Cannot continue])])
123
124# Cannot check if we can enable profiling because it is not yet
125# known whether the compiler supports weak symbols.
126
127
128#
129# Fortran bindings
130#
131AC_MSG_CHECKING([if want to build OSHMEM fortran bindings])
132AC_ARG_ENABLE(oshmem-fortran,
133AC_HELP_STRING([--enable-oshmem-fortran],
134               [enable OSHMEM Fortran bindings (default: enabled if Fortran compiler found)]))
135if test "$enable_oshmem" != "no" && test "$enable_oshmem_fortran" != "no"; then
136# If no OMPI FORTRAN, bail
137   AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -eq $OMPI_FORTRAN_NO_BINDINGS && \
138          test "$enable_oshmem_fortran" = "yes"],
139               [AC_MSG_RESULT([bad value OMPI_TRY_FORTRAN_BINDINGS: ($OMPI_TRY_FORTRAN_BINDINGS)])
140                AC_MSG_WARN([Your request to --enable-oshmem-fortran can only be satisfied if fortran support is enabled in OMPI.
141You see this message because OMPI fortran support has been explicitly disabled via --disable-mpi-fortran and OSHMEM fortran support was explicitly enabled with --enable-oshmem-fortran.
142Configure will abort because you, a human, have asked for something that cannot be provided.])
143                AC_MSG_ERROR([Cannot continue])])
144    if test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS; then
145        AC_MSG_RESULT([yes])
146    else
147        AC_MSG_RESULT([no])
148    fi
149else
150    enable_oshmem_fortran=no
151    AC_MSG_RESULT([no])
152fi
153
154#
155# We can't set am_conditional here since it's yet unknown if there is
156# valid Fortran compiler avaliable
157#
158
159]) dnl
160