File: nspr.m4

package info (click to toggle)
ldapjdk 5.3.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,756 kB
  • sloc: ansic: 44,727; java: 39,706; xml: 7,623; sh: 4,497; perl: 3,774; makefile: 1,680; cpp: 979
file content (180 lines) | stat: -rw-r--r-- 5,859 bytes parent folder | download | duplicates (8)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# -*- tab-width: 4; -*-
# Configure paths for NSPR
# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
# Based upon gtk.m4 (also PD) by Owen Taylor

dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for system NSPR, and define NSPR_CFLAGS and NSPR_LIBS
AC_DEFUN([AM_PATH_NSPR],
[dnl

AC_ARG_WITH(nspr-prefix,
	[  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
	nspr_config_prefix="$withval",
	nspr_config_prefix="")

AC_ARG_WITH(nspr-exec-prefix,
	[  --with-nspr-exec-prefix=PFX
                          Exec prefix where NSPR is installed],
	nspr_config_exec_prefix="$withval",
	nspr_config_exec_prefix="")

	if test -n "$nspr_config_exec_prefix"; then
		nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
		if test -z "$NSPR_CONFIG"; then
			NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
		fi
	fi
	if test -n "$nspr_config_prefix"; then
		nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
		if test -z "$NSPR_CONFIG"; then
			NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
		fi
	fi

    if test -z "$NSPR_CONFIG" ; then
	    unset ac_cv_path_NSPR_CONFIG
	    AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
	    min_nspr_version=ifelse([$1], ,4.0.0,$1)
	    AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version (skipping))
    fi

	no_nspr=""
	if test "$NSPR_CONFIG" = "no"; then
        AC_MSG_CHECKING(nspr-config not found, trying pkg-config)
        AC_PATH_PROG(PKG_CONFIG, pkg-config)
        if test -n "$PKG_CONFIG"; then
            if $PKG_CONFIG --exists nspr; then
                AC_MSG_CHECKING(using NSPR from package nspr)
                NSPR_CFLAGS=`$PKG_CONFIG --cflags-only-I nspr`
                NSPR_LIBS=`$PKG_CONFIG --libs-only-L nspr`
            elif $PKG_CONFIG --exists mozilla-nspr; then
                AC_MSG_CHECKING(using NSPR from package mozilla-nspr)
                NSPR_CFLAGS=`$PKG_CONFIG --cflags-only-I mozilla-nspr`
                NSPR_LIBS=`$PKG_CONFIG --libs-only-L mozilla-nspr`
            else
                AC_MSG_CHECKING([system NSPR not found])
		        no_nspr="yes"
            fi
        else
		    no_nspr="yes"
        fi
	else
        AC_MSG_CHECKING(using NSPR from $NSPR_CONFIG)
		NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
		NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`

		dnl Skip version check for now
		nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \
			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
		nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \
			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
		nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \
			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
	fi

	if test -z "$no_nspr"; then
		AC_MSG_RESULT(yes)
		ifelse([$2], , :, [$2])     
	else
		AC_MSG_RESULT(no)
	fi


	AC_SUBST(NSPR_CFLAGS)
	AC_SUBST(NSPR_LIBS)

])

dnl AM_PATH_INTREE_NSPR([ROOTPATH, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for in-tree NSPR, and define NSPR_CFLAGS and NSPR_LIBS
dnl First look for path/*.OBJ/include, then look for path/include
dnl Use the cut in case there is more than one path that matches *.OBJ - just
dnl take the first one
AC_DEFUN(AM_PATH_INTREE_NSPR,
[
    AC_MSG_CHECKING(checking for in-tree NSPR from $1)
    for nsprpath in "$1" "$1"/*.OBJ ; do    
        savedir=`pwd`
        cd $nsprpath
        abs_nsprpath=`pwd`
        cd $savedir
        if test -f "$abs_nsprpath/include/nspr/nspr.h" ; then
            NSPR_CFLAGS="-I$abs_nsprpath/include/nspr"
        elif test -f "$abs_nsprpath/include/nspr.h" ; then
            NSPR_CFLAGS="-I$abs_nsprpath/include"
        fi
        if test -d "$abs_nsprpath/lib" ; then
            NSPR_LIBS="-L$abs_nsprpath/lib"
        fi
        if test -n "$NSPR_CFLAGS" -a -n "$NSPR_LIBS" ; then
            break
        fi
    done
    if test -n "$NSPR_CFLAGS" -a -n "$NSPR_LIBS" ; then
	    AC_SUBST(NSPR_CFLAGS)
	    AC_SUBST(NSPR_LIBS)
		AC_MSG_RESULT(yes)
    else
		AC_MSG_RESULT(no)
    fi    
])

dnl AM_PATH_GIVEN_NSPR(no args)
dnl Test for --with-nspr=path, --with-nspr-inc=path, and --with-nspr-lib=path
dnl Makes sure the right files/dirs are in the given paths, and sets
dnl NSPR_CFLAGS and NSPR_LIBS if successful
AC_DEFUN(AM_PATH_GIVEN_NSPR,
[
    # check for --with-nspr
    AC_MSG_CHECKING(for --with-nspr)
    AC_ARG_WITH(nspr, [  --with-nspr=PATH        Netscape Portable Runtime (NSPR) directory],
    [
        if test "$withval" = "no" ; then
            AC_MSG_RESULT(no)
            no_nspr="yes"
        elif test "$withval" = "yes" ; then
            AC_MSG_RESULT(yes)
            no_nspr="no"
        elif test -f "$withval"/include/nspr.h -a -d "$withval"/lib
        then
            AC_MSG_RESULT([using $withval])
            NSPR_CFLAGS="-I$withval/include"
            NSPR_LIBS="-L$withval/lib"
        else
            echo
            AC_MSG_ERROR([$withval not found])
        fi
    ],
    AC_MSG_RESULT(no))

    # check for --with-nspr-inc
    AC_MSG_CHECKING(for --with-nspr-inc)
    AC_ARG_WITH(nspr-inc, [  --with-nspr-inc=PATH        Netscape Portable Runtime (NSPR) include file directory],
    [
      if test -f "$withval"/nspr.h
      then
        AC_MSG_RESULT([using $withval])
        NSPR_CFLAGS="-I$withval"
      else
        echo
        AC_MSG_ERROR([$withval not found])
      fi
    ],
    AC_MSG_RESULT(no))

    # check for --with-nspr-lib
    AC_MSG_CHECKING(for --with-nspr-lib)
    AC_ARG_WITH(nspr-lib, [  --with-nspr-lib=PATH        Netscape Portable Runtime (NSPR) library directory],
    [
      if test -d "$withval"
      then
        AC_MSG_RESULT([using $withval])
        NSPR_LIBS="-L$withval"
      else
        echo
        AC_MSG_ERROR([$withval not found])
      fi
    ],
    AC_MSG_RESULT(no))
])