File: x_ac_oneapi.m4

package info (click to toggle)
slurm-wlm-contrib 24.11.5-2
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 50,596 kB
  • sloc: ansic: 529,598; exp: 64,795; python: 17,051; sh: 9,411; javascript: 6,528; makefile: 4,030; perl: 3,762; pascal: 131
file content (73 lines) | stat: -rw-r--r-- 2,392 bytes parent folder | download | duplicates (5)
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
##*****************************************************************************
#  AUTHOR:
#    Kemp Ke <kemp.ke@intel.com>
#
#  SYNOPSIS:
#    X_AC_ONEAPI
#
#  DESCRIPTION:
#    Determine if Intel's oneAPI library exists
##*****************************************************************************

AC_DEFUN([X_AC_ONEAPI],
[

  _x_ac_oneapi_dirs="/usr /usr/local"
  _x_ac_oneapi_lib_dirs="x86_64-linux-gnu lib64 lib"

  AC_ARG_WITH(
    [oneapi],
    AS_HELP_STRING(--with-oneapi=PATH, Specify path to oneAPI installation),
    [AS_IF([test "x$with_oneapi" != xno && test "x$with_oneapi" != xyes],
           [_x_ac_oneapi_dirs="$with_oneapi"])])

  if [test "x$with_oneapi" = xno]; then
     AC_MSG_NOTICE([support for oneapi disabled])
  else
    AC_MSG_CHECKING([whether oneAPI in installed in this system])
    # Check for oneAPI header and library in the default location
    # or in the location specified during configure
    #
    # NOTE: Just because this is where we are looking and finding the
    # libraries they must be in the ldcache when running as that is what the
    # card will be using.
    AC_MSG_RESULT([])
    cppflags_save="$CPPFLAGS"
    ldflags_save="$LDFLAGS"
    for _x_ac_oneapi_dir in $_x_ac_oneapi_dirs; do
      ONEAPI_CPPFLAGS="-I$_x_ac_oneapi_dir/include/level_zero"
      CPPFLAGS="$ONEAPI_CPPFLAGS"
      AS_UNSET([ac_cv_header_ze_api_h])
      AC_CHECK_HEADER([ze_api.h], [ac_oneapi_h=yes], [ac_oneapi_h=no])
      if test "$ac_oneapi_h" = "no"; then
	continue
      fi
      for _x_ac_oneapi_lib_dir in $_x_ac_oneapi_lib_dirs; do
	ONEAPI_LIB_DIR="$_x_ac_oneapi_dir/$_x_ac_oneapi_lib_dir"
	LDFLAGS="-L$ONEAPI_LIB_DIR"
	AS_UNSET([ac_cv_lib_ze_loader_zeInit])
	AC_CHECK_LIB([ze_loader], [zeInit], [ac_oneapi=yes], [ac_oneapi=no])
        if test "$ac_oneapi" = "yes"; then
          AC_DEFINE(HAVE_ONEAPI, 1, [Define to 1 if oneAPI library found])
	  AC_SUBST(ONEAPI_CPPFLAGS)
          break;
        fi
      done
      if test "$ac_oneapi" = "yes"; then
	break;
      fi
    done

    CPPFLAGS="$cppflags_save"
    LDFLAGS="$ldflags_save"

    if test "$ac_oneapi" != "yes"; then
      if test -z "$with_oneapi"; then
	AC_MSG_WARN([unable to locate libze_loader.so and/or ze_api.h])
      else
        AC_MSG_ERROR([unable to locate libze_loader.so and/or ze_api.h])
      fi
    fi
  fi
  AM_CONDITIONAL(BUILD_ONEAPI, test "$ac_oneapi" = "yes")
])