build/autoconf/altoptions.m4

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 dnl This Source Code Form is subject to the terms of the Mozilla Public
     2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 dnl altoptions.m4 - An alternative way of specifying command-line options.
     6 dnl    These macros are needed to support a menu-based configurator.
     7 dnl    This file also includes the macro, AM_READ_MYCONFIG, for reading
     8 dnl    the 'myconfig.m4' file.
    10 dnl Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
    13 dnl MOZ_ARG_ENABLE_BOOL(           NAME, HELP, IF-YES [, IF-NO [, ELSE]])
    14 dnl MOZ_ARG_DISABLE_BOOL(          NAME, HELP, IF-NO [, IF-YES [, ELSE]])
    15 dnl MOZ_ARG_ENABLE_STRING(         NAME, HELP, IF-SET [, ELSE])
    16 dnl MOZ_ARG_ENABLE_BOOL_OR_STRING( NAME, HELP, IF-YES, IF-NO, IF-SET[, ELSE]]])
    17 dnl MOZ_ARG_WITH_BOOL(             NAME, HELP, IF-YES [, IF-NO [, ELSE])
    18 dnl MOZ_ARG_WITHOUT_BOOL(          NAME, HELP, IF-NO [, IF-YES [, ELSE])
    19 dnl MOZ_ARG_WITH_STRING(           NAME, HELP, IF-SET [, ELSE])
    20 dnl MOZ_ARG_HEADER(Comment)
    21 dnl MOZ_CHECK_PTHREADS(            NAME, IF-YES [, ELSE ])
    22 dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
    25 dnl MOZ_TWO_STRING_TEST(NAME, VAL, STR1, IF-STR1, STR2, IF-STR2 [, ELSE])
    26 AC_DEFUN([MOZ_TWO_STRING_TEST],
    27 [if test "[$2]" = "[$3]"; then
    28     ifelse([$4], , :, [$4])
    29   elif test "[$2]" = "[$5]"; then
    30     ifelse([$6], , :, [$6])
    31   else
    32     ifelse([$7], ,
    33       [AC_MSG_ERROR([Option, [$1], does not take an argument ([$2]).])],
    34       [$7])
    35   fi])
    37 dnl MOZ_ARG_ENABLE_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE]])
    38 AC_DEFUN([MOZ_ARG_ENABLE_BOOL],
    39 [AC_ARG_ENABLE([$1], [$2], 
    40  [MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4])],
    41  [$5])])
    43 dnl MOZ_ARG_DISABLE_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE]])
    44 AC_DEFUN([MOZ_ARG_DISABLE_BOOL],
    45 [AC_ARG_ENABLE([$1], [$2],
    46  [MOZ_TWO_STRING_TEST([$1], [$enableval], no, [$3], yes, [$4])],
    47  [$5])])
    49 dnl MOZ_ARG_ENABLE_STRING(NAME, HELP, IF-SET [, ELSE])
    50 AC_DEFUN([MOZ_ARG_ENABLE_STRING],
    51 [AC_ARG_ENABLE([$1], [$2], [$3], [$4])])
    53 dnl MOZ_ARG_ENABLE_BOOL_OR_STRING(NAME, HELP, IF-YES, IF-NO, IF-SET[, ELSE]]])
    54 AC_DEFUN([MOZ_ARG_ENABLE_BOOL_OR_STRING],
    55 [ifelse([$5], , 
    56  [errprint([Option, $1, needs an "IF-SET" argument.
    57 ])
    58   m4exit(1)],
    59  [AC_ARG_ENABLE([$1], [$2],
    60   [MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4], [$5])],
    61   [$6])])])
    63 dnl MOZ_ARG_WITH_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE])
    64 AC_DEFUN([MOZ_ARG_WITH_BOOL],
    65 [AC_ARG_WITH([$1], [$2],
    66  [MOZ_TWO_STRING_TEST([$1], [$withval], yes, [$3], no, [$4])],
    67  [$5])])
    69 dnl MOZ_ARG_WITHOUT_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE])
    70 AC_DEFUN([MOZ_ARG_WITHOUT_BOOL],
    71 [AC_ARG_WITH([$1], [$2],
    72  [MOZ_TWO_STRING_TEST([$1], [$withval], no, [$3], yes, [$4])],
    73  [$5])])
    75 dnl MOZ_ARG_WITH_STRING(NAME, HELP, IF-SET [, ELSE])
    76 AC_DEFUN([MOZ_ARG_WITH_STRING],
    77 [AC_ARG_WITH([$1], [$2], [$3], [$4])])
    79 dnl MOZ_ARG_HEADER(Comment)
    80 dnl This is used by webconfig to group options
    81 define(MOZ_ARG_HEADER, [# $1])
    83 dnl
    84 dnl Apparently, some systems cannot properly check for the pthread
    85 dnl library unless <pthread.h> is included so we need to test
    86 dnl using it
    87 dnl
    88 dnl MOZ_CHECK_PTHREADS(lib, success, failure)
    89 AC_DEFUN([MOZ_CHECK_PTHREADS],
    90 [
    91 AC_MSG_CHECKING([for pthread_create in -l$1])
    92 echo "
    93     #include <pthread.h>
    94     #include <stdlib.h>
    95     void *foo(void *v) { int a = 1;  } 
    96     int main() { 
    97         pthread_t t;
    98         if (!pthread_create(&t, 0, &foo, 0)) {
    99             pthread_join(t, 0);
   100         }
   101         exit(0);
   102     }" > dummy.c ;
   103     echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
   104     ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
   105     _res=$? ;
   106     rm -f dummy.c dummy${ac_exeext} ;
   107     if test "$_res" = "0"; then
   108         AC_MSG_RESULT([yes])
   109         [$2]
   110     else
   111         AC_MSG_RESULT([no])
   112         [$3]
   113     fi
   114 ])
   116 dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
   117 AC_DEFUN([MOZ_READ_MOZCONFIG],
   118 [AC_REQUIRE([AC_INIT_BINSH])dnl
   119 # Read in '.mozconfig' script to set the initial options.
   120 # See the mozconfig2configure script for more details.
   121 _AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf
   122 . $_AUTOCONF_TOOLS_DIR/mozconfig2configure])

mercurial