build/autoconf/nspr.m4

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # -*- tab-width: 4; -*-
michael@0 2 # Configure paths for NSPR
michael@0 3 # Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
michael@0 4 # Based upon gtk.m4 (also PD) by Owen Taylor
michael@0 5
michael@0 6 dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
michael@0 7 dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
michael@0 8 dnl
michael@0 9 dnl If the nspr-config script is available, use it to find the
michael@0 10 dnl appropriate CFLAGS and LIBS, and to check for the required
michael@0 11 dnl version, and run ACTION-IF-FOUND.
michael@0 12 dnl
michael@0 13 dnl Otherwise, if NO_NSPR_CONFIG_SYSTEM_VERSION is set, we use it,
michael@0 14 dnl NO_NSPR_CONFIG_SYSTEM_CFLAGS, and NO_NSPR_CONFIG_SYSTEM_LIBS to
michael@0 15 dnl provide default values, and run ACTION-IF-FOUND. (Some systems
michael@0 16 dnl ship NSPR without nspr-config, but can glean the appropriate flags
michael@0 17 dnl and version.)
michael@0 18 dnl
michael@0 19 dnl Otherwise, run ACTION-IF-NOT-FOUND.
michael@0 20 AC_DEFUN([AM_PATH_NSPR],
michael@0 21 [dnl
michael@0 22
michael@0 23 AC_ARG_WITH(nspr-prefix,
michael@0 24 [ --with-nspr-prefix=PFX Prefix where NSPR is installed],
michael@0 25 nspr_config_prefix="$withval",
michael@0 26 nspr_config_prefix="")
michael@0 27
michael@0 28 AC_ARG_WITH(nspr-exec-prefix,
michael@0 29 [ --with-nspr-exec-prefix=PFX
michael@0 30 Exec prefix where NSPR is installed],
michael@0 31 nspr_config_exec_prefix="$withval",
michael@0 32 nspr_config_exec_prefix="")
michael@0 33
michael@0 34 if test -n "$nspr_config_exec_prefix"; then
michael@0 35 nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
michael@0 36 if test -z "$NSPR_CONFIG"; then
michael@0 37 NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
michael@0 38 fi
michael@0 39 fi
michael@0 40 if test -n "$nspr_config_prefix"; then
michael@0 41 nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
michael@0 42 if test -z "$NSPR_CONFIG"; then
michael@0 43 NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
michael@0 44 fi
michael@0 45 fi
michael@0 46
michael@0 47 unset ac_cv_path_NSPR_CONFIG
michael@0 48 AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
michael@0 49 min_nspr_version=ifelse([$1], ,4.0.0,$1)
michael@0 50 AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
michael@0 51
michael@0 52 no_nspr=""
michael@0 53 if test "$NSPR_CONFIG" != "no"; then
michael@0 54 NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
michael@0 55 NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
michael@0 56 NSPR_VERSION_STRING=`$NSPR_CONFIG $nspr_config_args --version`
michael@0 57 elif test -n "${NO_NSPR_CONFIG_SYSTEM_VERSION}"; then
michael@0 58 NSPR_CFLAGS="${NO_NSPR_CONFIG_SYSTEM_CFLAGS}"
michael@0 59 NSPR_LIBS="${NO_NSPR_CONFIG_SYSTEM_LDFLAGS}"
michael@0 60 NSPR_VERSION_STRING="$NO_NSPR_CONFIG_SYSTEM_VERSION"
michael@0 61 else
michael@0 62 no_nspr="yes"
michael@0 63 fi
michael@0 64
michael@0 65 if test -z "$no_nspr"; then
michael@0 66 nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
michael@0 67 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
michael@0 68 nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
michael@0 69 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
michael@0 70 nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
michael@0 71 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
michael@0 72 min_nspr_major_version=`echo $min_nspr_version | \
michael@0 73 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
michael@0 74 min_nspr_minor_version=`echo $min_nspr_version | \
michael@0 75 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
michael@0 76 min_nspr_micro_version=`echo $min_nspr_version | \
michael@0 77 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
michael@0 78 if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
michael@0 79 no_nspr="yes"
michael@0 80 elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
michael@0 81 test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then
michael@0 82 no_nspr="yes"
michael@0 83 elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
michael@0 84 test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" &&
michael@0 85 test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then
michael@0 86 no_nspr="yes"
michael@0 87 fi
michael@0 88 fi
michael@0 89
michael@0 90 if test -z "$no_nspr"; then
michael@0 91 AC_MSG_RESULT(yes)
michael@0 92 ifelse([$2], , :, [$2])
michael@0 93 else
michael@0 94 AC_MSG_RESULT(no)
michael@0 95 ifelse([$3], , :, [$3])
michael@0 96 fi
michael@0 97
michael@0 98
michael@0 99 AC_SUBST(NSPR_CFLAGS)
michael@0 100 AC_SUBST(NSPR_LIBS)
michael@0 101
michael@0 102 ])

mercurial