1##*****************************************************************************
2#  AUTHOR:
3#    Nathan Rini <nate@schedmd.com>
4#
5#  SYNOPSIS:
6#    Control compiling of slurmrestd
7#
8##*****************************************************************************
9
10
11AC_DEFUN([X_AC_SLURMRESTD],
12[
13  dnl
14  dnl Check if slurmrestd is requested and define BUILD_SLURMRESTD
15  dnl if it is.
16  dnl
17  AC_MSG_CHECKING([whether to compile slurmrestd])
18  AC_ARG_ENABLE(
19    [slurmrestd],
20    AS_HELP_STRING(--disable-slurmrestd,disable slurmrestd support),
21    [ case "$enableval" in
22        yes) x_ac_slurmrestd=yes ;;
23         no) x_ac_slurmrestd=no ;;
24          *) AC_MSG_RESULT([doh!])
25             AC_MSG_ERROR([bad value "$enableval" for --enable-slurmrested])
26      esac
27    ]
28  )
29
30  if test "x$x_ac_slurmrestd" != "xno"; then
31    if test -n "$x_ac_cv_http_parser_dir" && test -n "$x_ac_cv_json_dir"; then
32      x_ac_slurmrestd=yes
33    else
34      if test "x$x_ac_slurmrestd" = "xyes"; then
35        AC_MSG_ERROR([unable to build slurmrestd without http-parser and json libraries])
36      else
37        x_ac_slurmrestd=no
38      fi
39    fi
40  fi
41
42  AC_MSG_RESULT([$x_ac_slurmrestd])
43  AM_CONDITIONAL(WITH_SLURMRESTD, test "x$x_ac_slurmrestd" = "xyes")
44
45  AC_MSG_CHECKING(for slurmrestd default port)
46  AC_ARG_WITH(
47    [slurmrestd-port],
48    AS_HELP_STRING(--with-slurmrestd-port=N,set slurmrestd default port [[6820]]),
49    [
50      if test `expr match "$withval" '[[0-9]]*$'` -gt 0; then
51        slurmrestdport="$withval"
52      fi
53    ]
54  )
55  AC_MSG_RESULT(${slurmrestdport=$1})
56  AC_DEFINE_UNQUOTED(SLURMRESTD_PORT, [$slurmrestdport],
57                     [Define the default port number for slurmrestd])
58  AC_SUBST(SLURMRESTD_PORT)
59])
60