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_WITH_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE])
17 dnl MOZ_ARG_WITH_STRING( NAME, HELP, IF-SET [, ELSE])
18 dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
20 define([MOZ_DIVERSION_ARGS], 12)
22 AC_DEFUN([MOZ_ARG],[dnl
23 AC_DIVERT_PUSH(MOZ_DIVERSION_ARGS)dnl
27 AC_DEFUN([MOZ_AC_ARG_ENABLE],[MOZ_ARG([--enable-]translit([$1],[_],[-]))AC_ARG_ENABLE([$1], [$2], [$3], [$4])])
28 AC_DEFUN([MOZ_AC_ARG_WITH],[MOZ_ARG([--with-]translit([$1],[_],[-]))AC_ARG_WITH([$1], [$2], [$3], [$4])])
30 dnl MOZ_TWO_STRING_TEST(NAME, VAL, STR1, IF-STR1, STR2, IF-STR2 [, ELSE])
31 AC_DEFUN([MOZ_TWO_STRING_TEST],
32 [if test "[$2]" = "[$3]"; then
33 ifelse([$4], , :, [$4])
34 elif test "[$2]" = "[$5]"; then
35 ifelse([$6], , :, [$6])
38 [AC_MSG_ERROR([Option, [$1], does not take an argument ([$2]).])],
42 dnl MOZ_ARG_ENABLE_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE]])
43 AC_DEFUN([MOZ_ARG_ENABLE_BOOL],
44 [MOZ_AC_ARG_ENABLE([$1], [$2],
45 [MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4])],
48 dnl MOZ_ARG_DISABLE_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE]])
49 AC_DEFUN([MOZ_ARG_DISABLE_BOOL],
50 [MOZ_AC_ARG_ENABLE([$1], [$2],
51 [MOZ_TWO_STRING_TEST([$1], [$enableval], no, [$3], yes, [$4])],
54 dnl MOZ_ARG_ENABLE_STRING(NAME, HELP, IF-SET [, ELSE])
55 AC_DEFUN([MOZ_ARG_ENABLE_STRING],
56 [MOZ_AC_ARG_ENABLE([$1], [$2], [$3], [$4])])
58 dnl MOZ_ARG_WITH_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE])
59 AC_DEFUN([MOZ_ARG_WITH_BOOL],
60 [MOZ_AC_ARG_WITH([$1], [$2],
61 [MOZ_TWO_STRING_TEST([$1], [$withval], yes, [$3], no, [$4])],
64 dnl MOZ_ARG_WITH_STRING(NAME, HELP, IF-SET [, ELSE])
65 AC_DEFUN([MOZ_ARG_WITH_STRING],
66 [MOZ_AC_ARG_WITH([$1], [$2], [$3], [$4])])
68 dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
69 AC_DEFUN([MOZ_READ_MOZCONFIG],
70 [AC_REQUIRE([AC_INIT_BINSH])dnl