Bug 575870 - Enable the firefox button on xp themed, classic, and aero basic. r=dao...
[mozilla-central.git] / build / autoconf / nspr.m4
blobfa3564ce3b3448f1404c59735c1c4d7409bac081
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
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 dnl
9 dnl If the nspr-config script is available, use it to find the
10 dnl appropriate CFLAGS and LIBS, and to check for the required
11 dnl version, and run ACTION-IF-FOUND.
12 dnl
13 dnl Otherwise, if NO_NSPR_CONFIG_SYSTEM_VERSION is set, we use it,
14 dnl NO_NSPR_CONFIG_SYSTEM_CFLAGS, and NO_NSPR_CONFIG_SYSTEM_LIBS to
15 dnl provide default values, and run ACTION-IF-FOUND.  (Some systems
16 dnl ship NSPR without nspr-config, but can glean the appropriate flags
17 dnl and version.)
18 dnl
19 dnl Otherwise, run ACTION-IF-NOT-FOUND.
20 AC_DEFUN([AM_PATH_NSPR],
21 [dnl
23 AC_ARG_WITH(nspr-prefix,
24         [  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
25         nspr_config_prefix="$withval",
26         nspr_config_prefix="")
28 AC_ARG_WITH(nspr-exec-prefix,
29         [  --with-nspr-exec-prefix=PFX
30                           Exec prefix where NSPR is installed],
31         nspr_config_exec_prefix="$withval",
32         nspr_config_exec_prefix="")
34         if test -n "$nspr_config_exec_prefix"; then
35                 nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
36                 if test -z "$NSPR_CONFIG"; then
37                         NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
38                 fi
39         fi
40         if test -n "$nspr_config_prefix"; then
41                 nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
42                 if test -z "$NSPR_CONFIG"; then
43                         NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
44                 fi
45         fi
47         unset ac_cv_path_NSPR_CONFIG
48         AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
49         min_nspr_version=ifelse([$1], ,4.0.0,$1)
50         AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
52         no_nspr=""
53         if test "$NSPR_CONFIG" != "no"; then
54                 NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
55                 NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
56                 NSPR_VERSION_STRING=`$NSPR_CONFIG $nspr_config_args --version`  
57         elif test -n "${NO_NSPR_CONFIG_SYSTEM_VERSION}"; then
58             NSPR_CFLAGS="${NO_NSPR_CONFIG_SYSTEM_CFLAGS}"
59                 NSPR_LIBS="${NO_NSPR_CONFIG_SYSTEM_LDFLAGS}"
60                 NSPR_VERSION_STRING="$NO_NSPR_CONFIG_SYSTEM_VERSION"
61         else
62             no_nspr="yes"
63         fi
65         if test -z "$no_nspr"; then
66                 nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
67                         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
68                 nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
69                         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
70                 nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
71                         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
72                 min_nspr_major_version=`echo $min_nspr_version | \
73                         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
74                 min_nspr_minor_version=`echo $min_nspr_version | \
75                         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
76                 min_nspr_micro_version=`echo $min_nspr_version | \
77                         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
78                 if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
79                         no_nspr="yes"
80                 elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
81                      test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then
82                         no_nspr="yes"
83                 elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
84                      test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" &&
85                      test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then
86                         no_nspr="yes"
87                 fi
88         fi
90         if test -z "$no_nspr"; then
91                 AC_MSG_RESULT(yes)
92                 ifelse([$2], , :, [$2])     
93         else
94                 AC_MSG_RESULT(no)
95         fi
98         AC_SUBST(NSPR_CFLAGS)
99         AC_SUBST(NSPR_LIBS)