summaryrefslogtreecommitdiffhomepage
path: root/auto/njs
blob: c0c43f193c83edc86bebd13041b93e529c57c268 (plain) (blame)
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

# Copyright (C) NGINX, Inc.


nxt_found=no
NXT_HAVE_NJS=NO

if /bin/sh -c "(pkg-config njs --exists)" >> $NXT_AUTOCONF_ERR 2>&1;
then
    NXT_NJS_AUX_CFLAGS=
    NXT_NJS_AUX_LIBS=
    NXT_NJS_CFLAGS=`pkg-config njs --cflags`
    NXT_NJS_LIBS=`pkg-config njs --libs`
else
    NXT_NJS_AUX_CFLAGS=
    NXT_NJS_AUX_LIBS="$NXT_LIBM $NXT_LIB_AUX_LIBS"
    NXT_NJS_CFLAGS=
    NXT_NJS_LIBS="-lnjs"
fi

nxt_feature="NJS"
nxt_feature_name=NXT_HAVE_NJS
nxt_feature_run=no
nxt_feature_incs="$NXT_NJS_CFLAGS $NXT_NJS_AUX_CFLAGS"
nxt_feature_libs="$NXT_NJS_LIBS $NXT_NJS_AUX_LIBS"
nxt_feature_test="#include <njs.h>

                  int main(void) {
                      njs_vm_t      *vm;
                      njs_vm_opt_t  opts;

                      njs_vm_opt_init(&opts);

                      vm = njs_vm_create(&opts);
                      if (vm == NULL)
                          return 1;
                      return 0;
                  }"
. auto/feature

if [ $nxt_found = no ]; then
    $echo
    $echo $0: error: no NJS library found.
    $echo
    exit 1;
fi

NXT_LIB_AUX_CFLAGS="$NXT_LIB_AUX_CFLAGS $NXT_NJS_CFLAGS"
NXT_LIB_AUX_LIBS="$NXT_NJS_LIBS $NXT_LIB_AUX_LIBS"