aboutsummaryrefslogtreecommitdiff
path: root/auto/libxml2
blob: 448837c8ba8fe3301bec6c329e508809269e269b (plain)
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
# Copyright (C) Dmitry Volyntsev
# Copyright (C) NGINX, Inc.

NJS_LIBXML2_LIB=
NJS_HAVE_LIBXML2=NO

if [ $NJS_LIBXML2 = YES ]; then
    njs_found=no
    njs_feature_name=NJS_HAVE_LIBXML2
    njs_feature_run=no
    njs_feature_test="#include <libxml/parser.h>
                      #include <libxml/tree.h>

                      int main() {
                          xmlDocPtr  tree;
                          tree = xmlReadMemory(NULL, 0, NULL, NULL, 0);
                          xmlFreeDoc(tree);
                          xmlCleanupParser();
                          return 0;
                      }"


    if /bin/sh -c "(pkg-config libxml-2.0 --exists)" >> $NJS_AUTOCONF_ERR 2>&1; then

        # pkg-config

        njs_feature="libxml2 via pkg-config"
        njs_feature_incs=`pkg-config libxml-2.0 --cflags | sed -n -e 's#.*-I *\([^ ][^ ]*\).*#\1#p'`
        njs_feature_libs=`pkg-config libxml-2.0 --libs`

        . auto/feature
    fi

    if [ $njs_found = no ]; then

        njs_feature="libxml2"
        njs_feature_incs="/usr/include/libxml2"
        njs_feature_libs="-lxml2"

        . auto/feature
    fi

    if [ $njs_found = no ]; then

        # FreeBSD port

        njs_feature="libxml2 in /usr/local/"
        njs_feature_incs="/usr/local/include/libxml2 /usr/local/include"
        njs_feature_libs="-L/usr/local/lib -lxml2"

        . auto/feature
    fi

    if [ $njs_found = no ]; then

        # NetBSD port

        njs_feature="libxml2 in /usr/pkg/"
        njs_feature_incs="/usr/pkg/include/libxml2 /usr/pkg/include"
        njs_feature_libs="-L/usr/pkg/lib -lxml2"

        . auto/feature
    fi

    if [ $njs_found = no ]; then

        # MacPorts

        njs_feature="libxml2 in /opt/local/"
        njs_feature_incs="/opt/local/include/libxml2 /opt/local/include"
        njs_feature_libs="-L/opt/local/lib -lxml2 -lxslt"

        . auto/feature
    fi

    if [ $njs_found = yes ]; then
        njs_feature="libxml2 version"
        njs_feature_name=NJS_LIBXML2_VERSION
        njs_feature_run=value
        njs_feature_test="#include <libxml/xmlversion.h>
                          #include <stdio.h>

                          int main() {
                              printf(\"\\\"%s\\\"\", LIBXML_DOTTED_VERSION);
                              return 0;
                          }"
        . auto/feature

        NJS_HAVE_LIBXML2=YES
        NJS_LIBXML2_LIB="$njs_feature_libs"
        NJS_LIB_INCS="$NJS_LIB_INCS $njs_feature_incs"
        NJS_LIB_AUX_LIBS="$NJS_LIB_AUX_LIBS $njs_feature_libs"
    fi
fi