|
1 # -*- tab-width: 4; -*- |
|
2 # Configure paths for NSPR |
|
3 # Public domain - Chris Seawood <cls@seawood.org> 2001-04-05 |
|
4 # Based upon gtk.m4 (also PD) by Owen Taylor |
|
5 |
|
6 dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
|
7 dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS |
|
8 AC_DEFUN([AM_PATH_NSPR], |
|
9 [dnl |
|
10 |
|
11 AC_ARG_WITH(nspr-prefix, |
|
12 [ --with-nspr-prefix=PFX Prefix where NSPR is installed], |
|
13 nspr_config_prefix="$withval", |
|
14 nspr_config_prefix="") |
|
15 |
|
16 AC_ARG_WITH(nspr-exec-prefix, |
|
17 [ --with-nspr-exec-prefix=PFX |
|
18 Exec prefix where NSPR is installed], |
|
19 nspr_config_exec_prefix="$withval", |
|
20 nspr_config_exec_prefix="") |
|
21 |
|
22 if test -n "$nspr_config_exec_prefix"; then |
|
23 nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix" |
|
24 if test -z "$NSPR_CONFIG"; then |
|
25 NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config |
|
26 fi |
|
27 fi |
|
28 if test -n "$nspr_config_prefix"; then |
|
29 nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix" |
|
30 if test -z "$NSPR_CONFIG"; then |
|
31 NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config |
|
32 fi |
|
33 fi |
|
34 |
|
35 unset ac_cv_path_NSPR_CONFIG |
|
36 AC_PATH_PROG(NSPR_CONFIG, nspr-config, no) |
|
37 min_nspr_version=ifelse([$1], ,4.0.0,$1) |
|
38 AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version) |
|
39 |
|
40 no_nspr="" |
|
41 if test "$NSPR_CONFIG" = "no"; then |
|
42 no_nspr="yes" |
|
43 else |
|
44 NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags` |
|
45 NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs` |
|
46 |
|
47 nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \ |
|
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
|
49 nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \ |
|
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
|
51 nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \ |
|
52 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
|
53 min_nspr_major_version=`echo $min_nspr_version | \ |
|
54 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
|
55 min_nspr_minor_version=`echo $min_nspr_version | \ |
|
56 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
|
57 min_nspr_micro_version=`echo $min_nspr_version | \ |
|
58 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
|
59 if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then |
|
60 no_nspr="yes" |
|
61 elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" && |
|
62 test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then |
|
63 no_nspr="yes" |
|
64 elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" && |
|
65 test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" && |
|
66 test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then |
|
67 no_nspr="yes" |
|
68 fi |
|
69 fi |
|
70 |
|
71 if test -z "$no_nspr"; then |
|
72 AC_MSG_RESULT(yes) |
|
73 ifelse([$2], , :, [$2]) |
|
74 else |
|
75 AC_MSG_RESULT(no) |
|
76 fi |
|
77 |
|
78 |
|
79 AC_SUBST(NSPR_CFLAGS) |
|
80 AC_SUBST(NSPR_LIBS) |
|
81 |
|
82 ]) |