From 6b87459a58190a4643ac60e59151ceee8d4e5c7e Mon Sep 17 00:00:00 2001 From: david Date: Thu, 5 Nov 2009 19:50:33 +0000 Subject: [PATCH] Add --enable-nls and --disable-nls options to configure. These are used to control whether translations of man pages are installed (by default they will be). Even though we're not using gettext for translations, I tried to make this interface as similar as possible to the gettext configuration interface. Use can use the environment variable LINGUAS to control which man pages get installed if you don't want all of them, for example LINGUAS="es de". The translated man pages are not yet committed. --- Makefile.in | 17 +++++++++++++++++ aclocal.m4 | 32 ++++++++++++++++++++++++++++++++ configure | 23 +++++++++++++++++++++++ configure.ac | 4 ++++ 4 files changed, 76 insertions(+) diff --git a/Makefile.in b/Makefile.in index d08b9d899..eb0f64105 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,6 +51,16 @@ LIBS = @LIBNBASE_LIBS@ @LIBNSOCK_LIBS@ @LIBPCRE_LIBS@ @LIBPCAP_LIBS@ @OPENSSL_L INSTALL = @INSTALL@ # MAKEDEPEND = @MAKEDEPEND@ export RPMTDIR=$(HOME)/rpm +# Whether the user wants to install translated man pages. If "yes", then +# all translated man pages are installed, unless a subset is specified +# with the LINGUAS environment variable. +USE_NLS = @USE_NLS@ +# A space-separated list of language codes supported (for man page +# installation). The user can install a subset of these with the LINGUAS +# environment variable or none of them with --disable-nls. +ALL_LINGUAS = +# A space-separated list of language codes requested by the user. +LINGUAS ?= $(ALL_LINGUAS) # DESTDIR is used by some package maintainers to install Nmap under @@ -203,6 +213,12 @@ install-nmap: $(TARGET) # http://seclists.org/nmap-dev/2007/q4/0272.html. $(STRIP) -x $(DESTDIR)$(bindir)/nmap $(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/ + if [ "$(USE_NLS)" = "yes" ]; then \ + for ll in $(LINGUAS); do \ + $(INSTALL) -d $(DESTDIR)$(mandir)/$$ll/man1; \ + $(INSTALL) -c -m 644 docs/$(TARGET)-$$ll.1 $(DESTDIR)$(mandir)/$$ll/man1/$(TARGET).1; \ + done; \ + fi $(INSTALL) -c -m 644 docs/nmap.xsl $(DESTDIR)$(nmapdatadir)/ $(INSTALL) -c -m 644 docs/nmap.dtd $(DESTDIR)$(nmapdatadir)/ $(INSTALL) -c -m 644 nmap-services $(DESTDIR)$(nmapdatadir)/ @@ -277,6 +293,7 @@ uninstall: uninstall-nmap $(UNINSTALLZENMAP) @NCAT_UNINSTALL@ uninstall-nmap: rm -f $(DESTDIR)$(bindir)/$(TARGET) rm -f $(DESTDIR)$(mandir)/man1/$(TARGET).1 + rm -f $(DESTDIR)$(mandir)/*/man1/$(TARGET).1 rm -rf $(DESTDIR)$(nmapdatadir) uninstall-zenmap: diff --git a/aclocal.m4 b/aclocal.m4 index 19765c019..2e9e87bc7 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -11,6 +11,38 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +# nls.m4 serial 3 (gettext-0.15) +dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ(2.50) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) + # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 # Free Software Foundation, Inc. # diff --git a/configure b/configure index 0281a256f..5530942b6 100755 --- a/configure +++ b/configure @@ -724,6 +724,7 @@ build_cpu build pcredir libpcapdir +USE_NLS target_alias host_alias build_alias @@ -764,6 +765,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +enable_nls with_localdirs with_ndiff with_zenmap @@ -1412,6 +1414,12 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-nls do not use Native Language Support + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) @@ -1894,6 +1902,21 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + { $as_echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + # Check whether --with-localdirs was given. if test "${with_localdirs+set}" = set; then withval=$with_localdirs; case "$with_localdirs" in diff --git a/configure.ac b/configure.ac index 2538308b1..67e9387d5 100644 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,10 @@ AC_PREREQ(2.13) dnl Process this file with autoconf to produce a configure script. AC_INIT(nmap.cc) +dnl Give us the --enable-nls option, to choose which translated man pages get +dnl installed. This gets replaced with AM_GNU_GETTEXT for full gettext support. +AM_NLS + AC_ARG_WITH(localdirs, AC_HELP_STRING([--with-localdirs], [Explicitly ask compiler to use /usr/local/{include,libs} if they exist ]), [ case "$with_localdirs" in