build: make --enable-help properly depend on --enable-multibuffer

And in the process transform the token DISABLE_HELP to ENABLE_HELP.
master
Benno Schulenberg 2017-04-25 17:51:45 +02:00
parent 9cff7a1689
commit 46430999d5
10 changed files with 52 additions and 32 deletions

View File

@ -106,9 +106,28 @@ if test "x$enable_extra" = xno; then
fi
AC_ARG_ENABLE(help,
AS_HELP_STRING([--disable-help], [Disable help functions]))
if test "x$enable_help" = xno; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
AS_HELP_STRING([--disable-help], [Disable built-in help texts]))
if test "x$enable_tiny" = xyes; then
if test "x$enable_help" = xyes; then
if test "x$enable_multibuffer" != xyes; then
AC_MSG_ERROR([--enable-help cannot work without --enable-multibuffer])
fi
else
enable_help=no
fi
fi
if test "x$enable_multibuffer" = xno; then
if test "x$enable_help" = xyes; then
AC_MSG_ERROR([--enable-help cannot work with --disable-multibuffer])
else
# Disabling multibuffer silently disables the help texts.
enable_help=no
fi
fi
if test "x$disable_help" != xyes; then
if test "x$enable_help" != xno; then
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
fi
fi
AC_ARG_ENABLE(histories,
@ -230,9 +249,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_extra" != xyes; then
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
fi
if test "x$enable_help" != xyes; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
fi
if test "x$enable_histories" != xyes; then
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
fi

View File

@ -162,7 +162,7 @@ char *do_browser(char *path)
kbinput = KEY_WINCH;
#endif
} else if (func == do_help_void) {
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
do_help_void();
#ifndef NANO_TINY
/* The window dimensions might have changed, so act as if. */

View File

@ -314,7 +314,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
f->menus = menus;
f->desc = desc;
f->viewok = viewok;
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
f->help = help;
f->blank_after = blank_after;
#endif
@ -480,7 +480,7 @@ void shortcut_init(void)
/* TRANSLATORS: Try to keep this string at most 12 characters. */
const char *whereis_next_tag = N_("WhereIs Next");
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
#ifndef DISABLE_JUSTIFY
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
* they are best kept shorter than 56 characters, but may be longer. */
@ -642,9 +642,9 @@ void shortcut_init(void)
const char *nano_formatter_msg = N_("Invoke formatter, if available");
#endif
#endif
#endif /* !DISABLE_HELP */
#endif /* ENABLE_HELP */
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
#define IFSCHELP(help) help
#else
#define IFSCHELP(help) ""
@ -709,7 +709,7 @@ void shortcut_init(void)
N_("Go To Dir"), IFSCHELP(nano_gotodir_msg), BLANKAFTER, VIEW);
#endif
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
/* The description ("x") and blank_after (0) are irrelevant,
* because the help viewer does not have a help text. */
add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW);
@ -1290,7 +1290,7 @@ void shortcut_init(void)
#ifndef DISABLE_BROWSER
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
#endif
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0);
add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0);
@ -1403,7 +1403,7 @@ sc *strtosc(const char *input)
s->toggle = 0;
#endif
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
if (!strcasecmp(input, "help"))
s->scfunc = do_help_void;
else
@ -1681,7 +1681,7 @@ int strtomenu(const char *input)
else if (!strcasecmp(input, "externalcmd") ||
!strcasecmp(input, "extcmd"))
return MEXTCMD;
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
else if (!strcasecmp(input, "help"))
return MHELP;
#endif

View File

@ -26,7 +26,7 @@
#include <ctype.h>
#include <errno.h>
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
static char *help_text = NULL;
/* The text displayed in the help window. */
@ -631,17 +631,17 @@ size_t help_line_len(const char *ptr)
return 0;
}
#endif /* !DISABLE_HELP */
#endif /* ENABLE_HELP */
/* Start the help viewer. */
void do_help_void(void)
{
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
do_help();
#else
if (currmenu == MMAIN)
say_there_is_no_help();
else
beep();
#endif /* !DISABLE_HELP */
#endif
}

View File

@ -539,7 +539,7 @@ void show_restricted_warning(void)
beep();
}
#ifdef DISABLE_HELP
#ifndef ENABLE_HELP
/* Indicate that help texts are unavailable. */
void say_there_is_no_help(void)
{
@ -928,7 +928,7 @@ void version(void)
#ifndef DISABLE_EXTRA
printf(" --enable-extra");
#endif
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
printf(" --enable-help");
#endif
#ifndef DISABLE_HISTORIES
@ -977,7 +977,7 @@ void version(void)
#ifdef DISABLE_EXTRA
printf(" --disable-extra");
#endif
#ifdef DISABLE_HELP
#ifndef ENABLE_HELP
printf(" --disable-help");
#endif
#ifdef DISABLE_HISTORIES

View File

@ -442,7 +442,7 @@ typedef struct subnfunc {
/* In what menus this function applies. */
const char *desc;
/* The function's short description, for example "Where Is". */
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
const char *help;
/* The help-screen text for this function. */
bool blank_after;

View File

@ -340,7 +340,7 @@ void thanks_for_all_the_fish(void);
#endif
/* All functions in help.c. */
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
void display_the_help_text(bool redisplaying);
void do_help(void);
void help_init(void);
@ -401,7 +401,7 @@ void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
void print_view_warning(void);
void show_restricted_warning(void);
#ifdef DISABLE_HELP
#ifndef ENABLE_HELP
void say_there_is_no_help(void);
#endif
void finish(void);
@ -545,7 +545,7 @@ void update_undo(undo_type action);
void wrap_reset(void);
bool do_wrap(filestruct *line);
#endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
@ -601,8 +601,10 @@ size_t actual_x(const char *s, size_t column);
size_t strnlenpt(const char *s, size_t maxlen);
size_t strlenpt(const char *s);
void new_magicline(void);
#ifndef NANO_TINY
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
void remove_magicline(void);
#endif
#ifndef NANO_TINY
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
#endif

View File

@ -1608,7 +1608,7 @@ bool do_wrap(filestruct *line)
}
#endif /* !DISABLE_WRAPPING */
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
/* We are trying to break a chunk off line. We find the last blank such
* that the display length to there is at most (goal + 1). If there is
* no such blank, then we find the first blank. We then take the last
@ -1643,7 +1643,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
if (column <= goal)
return index;
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
/* If we're wrapping a help text and no blank was found, or was
* found only as the first character, force a line break. */
if (snap_at_nl && lastblank < 1)
@ -1680,7 +1680,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
return lastblank;
}
#endif /* !DISABLE_HELP || !DISABLE_WRAPJUSTIFY */
#endif /* ENABLE_HELP || !DISABLE_WRAPJUSTIFY */
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
/* The "indentation" of a line is the whitespace between the quote part

View File

@ -452,7 +452,7 @@ void new_magicline(void)
openfile->totsize++;
}
#ifndef NANO_TINY
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
/* Remove the magicline from filebot, if there is one and it isn't the
* only line in the file. Assume that edittop and current are not at
* filebot. */
@ -466,7 +466,9 @@ void remove_magicline(void)
openfile->totsize--;
}
}
#endif
#ifndef NANO_TINY
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
* respectively, based on the locations of top and bot. If
* right_side_up isn't NULL, set it to TRUE if the mark begins with

View File

@ -3145,7 +3145,7 @@ void total_refresh(void)
{
total_redraw();
titlebar(title);
#ifndef DISABLE_HELP
#ifdef ENABLE_HELP
if (inhelp)
display_the_help_text(TRUE);
else