build/autoconf/nspr.m4

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/autoconf/nspr.m4	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,102 @@
     1.4 +# -*- tab-width: 4; -*-
     1.5 +# Configure paths for NSPR
     1.6 +# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
     1.7 +# Based upon gtk.m4 (also PD) by Owen Taylor
     1.8 +
     1.9 +dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
    1.10 +dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
    1.11 +dnl
    1.12 +dnl If the nspr-config script is available, use it to find the
    1.13 +dnl appropriate CFLAGS and LIBS, and to check for the required
    1.14 +dnl version, and run ACTION-IF-FOUND.
    1.15 +dnl
    1.16 +dnl Otherwise, if NO_NSPR_CONFIG_SYSTEM_VERSION is set, we use it,
    1.17 +dnl NO_NSPR_CONFIG_SYSTEM_CFLAGS, and NO_NSPR_CONFIG_SYSTEM_LIBS to
    1.18 +dnl provide default values, and run ACTION-IF-FOUND.  (Some systems
    1.19 +dnl ship NSPR without nspr-config, but can glean the appropriate flags
    1.20 +dnl and version.)
    1.21 +dnl
    1.22 +dnl Otherwise, run ACTION-IF-NOT-FOUND.
    1.23 +AC_DEFUN([AM_PATH_NSPR],
    1.24 +[dnl
    1.25 +
    1.26 +AC_ARG_WITH(nspr-prefix,
    1.27 +	[  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
    1.28 +	nspr_config_prefix="$withval",
    1.29 +	nspr_config_prefix="")
    1.30 +
    1.31 +AC_ARG_WITH(nspr-exec-prefix,
    1.32 +	[  --with-nspr-exec-prefix=PFX
    1.33 +                          Exec prefix where NSPR is installed],
    1.34 +	nspr_config_exec_prefix="$withval",
    1.35 +	nspr_config_exec_prefix="")
    1.36 +
    1.37 +	if test -n "$nspr_config_exec_prefix"; then
    1.38 +		nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
    1.39 +		if test -z "$NSPR_CONFIG"; then
    1.40 +			NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
    1.41 +		fi
    1.42 +	fi
    1.43 +	if test -n "$nspr_config_prefix"; then
    1.44 +		nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
    1.45 +		if test -z "$NSPR_CONFIG"; then
    1.46 +			NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
    1.47 +		fi
    1.48 +	fi
    1.49 +
    1.50 +	unset ac_cv_path_NSPR_CONFIG
    1.51 +	AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
    1.52 +	min_nspr_version=ifelse([$1], ,4.0.0,$1)
    1.53 +	AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
    1.54 +
    1.55 +	no_nspr=""
    1.56 +	if test "$NSPR_CONFIG" != "no"; then
    1.57 +		NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
    1.58 +		NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
    1.59 +		NSPR_VERSION_STRING=`$NSPR_CONFIG $nspr_config_args --version`	
    1.60 +	elif test -n "${NO_NSPR_CONFIG_SYSTEM_VERSION}"; then
    1.61 +	    NSPR_CFLAGS="${NO_NSPR_CONFIG_SYSTEM_CFLAGS}"
    1.62 +		NSPR_LIBS="${NO_NSPR_CONFIG_SYSTEM_LDFLAGS}"
    1.63 +		NSPR_VERSION_STRING="$NO_NSPR_CONFIG_SYSTEM_VERSION"
    1.64 +	else
    1.65 +	    no_nspr="yes"
    1.66 +	fi
    1.67 +
    1.68 +	if test -z "$no_nspr"; then
    1.69 +		nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
    1.70 +			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    1.71 +		nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
    1.72 +			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
    1.73 +		nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
    1.74 +			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
    1.75 +		min_nspr_major_version=`echo $min_nspr_version | \
    1.76 +			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    1.77 +		min_nspr_minor_version=`echo $min_nspr_version | \
    1.78 +			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
    1.79 +		min_nspr_micro_version=`echo $min_nspr_version | \
    1.80 +			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
    1.81 +		if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
    1.82 +			no_nspr="yes"
    1.83 +		elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
    1.84 +		     test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then
    1.85 +			no_nspr="yes"
    1.86 +		elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
    1.87 +		     test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" &&
    1.88 +		     test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then
    1.89 +			no_nspr="yes"
    1.90 +		fi
    1.91 +	fi
    1.92 +
    1.93 +	if test -z "$no_nspr"; then
    1.94 +		AC_MSG_RESULT(yes)
    1.95 +		ifelse([$2], , :, [$2])     
    1.96 +	else
    1.97 +		AC_MSG_RESULT(no)
    1.98 +		ifelse([$3], , :, [$3])
    1.99 +	fi
   1.100 +
   1.101 +
   1.102 +	AC_SUBST(NSPR_CFLAGS)
   1.103 +	AC_SUBST(NSPR_LIBS)
   1.104 +
   1.105 +])

mercurial