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

mercurial