configure.in based bin/linuxdoc.in replacements. Use new ldt_which function.

- Use a configure.in based system for replacements in bin/linuxdoc.in.
- bin/linuxdoc.in: New ldt_which function to search for executables in PATH.
- Remove no longer used sgmlswhich and awkwhich functions along with their calls.
parent dd2d980a
......@@ -12,7 +12,7 @@ datadir = @datadir@
mandir = @mandir@
PERL = @PERL@
pkgdatadir = $(datadir)/linuxdoc-tools
pkgdatadir = @pkgdatadir@
docdir = $(prefix)/share/doc/linuxdoc-tools
man1dir = $(mandir)/man1
texdir = $(pkgdatadir)
......@@ -38,12 +38,11 @@ perl5lib_ddir = $(DESTDIR)$(perl5libdir)
pkgdata_ddir = $(DESTDIR)$(pkgdatadir)
tex_ddir = $(DESTDIR)$(texdir)
GENFILES := bin/linuxdoc
progs := sgml2html sgml2info sgml2latex sgml2lyx sgml2rtf sgml2txt sgmlcheck
OPTIMIZE=-O
OPTIMIZE = -O
all: gen
all:
ifeq ($(BUILD_SGMLSASP), true)
@echo "Compiling the SGML translator tools (in sgmls-1.1/)..."
( cd sgmls-1.1 ; \
......@@ -157,7 +156,7 @@ endif
(cd doc; \
PATH=${PATH}:$(bin_ddir) \
PREFIX=$(prefix) \
BINDIR=$(auxbin_ddir) \
AUXBINDIR=$(auxbin_ddir) \
PKGPERL5LIB=$(perl5lib_ddir) \
PKGDATADIR=$(pkgdata_ddir) \
bash Makedoc.sh)
......@@ -186,7 +185,7 @@ ifeq ($(BUILD_ISO_ENTITIES), true)
endif
clean::
-rm -f *~ bin/*~
-rm -f *~ bin/*~ bin/linuxdoc
for d in $(DDIRS) $(MDIRS) rtf-fix; do $(MAKE) -C $$d clean; done
(cd sgmlpre ; rm -f sgmlpre.o sgmlpre)
-rm -rf genman/
......@@ -202,27 +201,3 @@ distclean:: clean
doc/guide.info doc/guide.lyx doc/html/guide*.html \
$(GENFILES)
rm -rf doc/rtf
gen : $(GENFILES)
#
# Not very clean, I know. But it works for now. Any better
# solutions to this are gladly accepted - CdG
#
% : %.in config.status
@ [ $< = Makefile.in ] || ( \
echo Creating $@ ... ; \
rm -f $@ 2>/dev/null; cat $< | sed \
-e 's!\@prefix\@!@prefix@!' \
-e 's!\@DATADIR\@!@datadir@/linuxdoc-tools!' \
-e 's!\@auxbindir\@!@auxbindir@!' \
-e 's!\@NSGMLS\@!@NSGMLS@!' \
-e 's!\@SGMLSASP\@!@SGMLSASP@!' \
-e 's!\@GROFF\@!@GROFF@!' \
-e 's!\@GROFFMACRO\@!@GROFFMACRO@!' \
-e 's!\@AWK\@!@AWK@!' \
-e 's!\@NKF\@!@NKF@!' \
-e 's!\@PERL\@!@PERL@!' \
-e 's!\@PERLWARN\@!@PERLWARN@!' \
>$@ )
......@@ -2,8 +2,6 @@
#
# linuxdoc.in
#
# $Id: linuxdoc.in,v 1.3 2001/09/01 14:16:28 sano Exp $
#
# LinuxDoc-Tools driver. Calls all other LinuxDoc-Tools components,
# contains configuration information, etcetera.
# -------------------------------------------------------------------
......@@ -19,22 +17,41 @@ use strict;
use vars qw($prefix $DataDir $AuxBinDir $progs);
$prefix = "@prefix@";
$DataDir = "@DATADIR@";
$DataDir = "@pkgdatadir@";
$AuxBinDir = "@auxbindir@";
use lib "@DATADIR@";
use lib "@pkgdatadir@";
use lib "@prefix@/perl5";
use lib "@prefix@/lib/perl5";
use lib "@prefix@/share/perl5";
# ---------------------------------------------------------------------
sub ldt_which {
# ---------------------------------------------------------------------
# ---------------------------------------------------------------------
die "ldt_which: No filename(s) array given. Aborting ...\n" unless scalar @_;
foreach my $file ( @_ ){
if ( $file =~ m/\// ) {
return $file if -x $file;
} else {
foreach my $path ( split(':',$ENV{'PATH'}) ){
$path =~ s/\/+$//;
return $file if -x "$path/$file";
}
}
}
die "No executable found in path for (", join(' ',@_) ,"). Aborting ...\n";
}
$progs = {
"NSGMLS" => "@NSGMLS@",
"SGMLSASP" => "@SGMLSASP@",
"GROFF" => "@GROFF@",
"SGMLSASP" => ldt_which("sgmlsasp"),
"NSGMLS" => ldt_which("nsgmls","onsgmls"),
"AWK" => ldt_which("gawk","mawk","nawk"),
"GROFF" => ldt_which("groff"),
"GROFFMACRO" => "@GROFFMACRO@",
"AWK" => "@AWK@"
# "NKF" => "@NKF@"
};
};
require LinuxDocTools;
&LinuxDocTools::init;
......
......@@ -12,16 +12,19 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--with-perl-w use perl -w option"
--with-perl-w use perl -w option"
ac_help="$ac_help
--with-auxbindir=dir dir for internal use programs
(default: ${exec_prefix}/bin)"
--with-installed-sgmlsasp use installed sgmlsasp"
ac_help="$ac_help
--with-installed-sgmlsasp use installed sgmlsasp"
ac_help="$ac_help
--with-installed-entity-map use installed entity-map"
--with-installed-entity-map use installed entity-map"
ac_help="$ac_help
--with-installed-iso-entities use installed iso-entities"
ac_help="$ac_help
--with-auxbindir=dir dir for internal use programs
(default: EPREFIX/bin)"
ac_help="$ac_help
--with-pkgdatadir=dir dir for package libraries
(default: PREFIX/share/linuxdoc-tools)"
# Initialize some variables set by options.
# The variables have the same names as the options, with
......@@ -564,7 +567,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:568: checking for a BSD compatible install" >&5
echo "configure:571: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -620,7 +623,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:624: checking for $ac_word" >&5
echo "configure:627: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -653,6 +656,7 @@ else
fi
if echo 'require 5.004;exit' | $PERL
then
: # Solaris and OSF/1 /bin/sh don't know about negation operators...
......@@ -671,22 +675,11 @@ else
fi
# Check whether --with-auxbindir or --without-auxbindir was given.
if test "${with_auxbindir+set}" = set; then
withval="$with_auxbindir"
auxbindir="$withval"
else
auxbindir="\${exec_prefix}/bin"
fi
# Extract the first word of "groff", so it can be a program name with args.
set dummy groff; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:690: checking for $ac_word" >&5
echo "configure:683: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GROFF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -720,9 +713,8 @@ fi
echo $ac_n "checking whether ${GROFF} accepts -mgs""... $ac_c" 1>&6
echo "configure:726: checking whether ${GROFF} accepts -mgs" >&5
echo "configure:718: checking whether ${GROFF} accepts -mgs" >&5
if eval "test \"`echo '$''{'ac_cv_linuxdoctools_groff_mgs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -748,7 +740,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:752: checking for $ac_word" >&5
echo "configure:744: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AWK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -792,7 +784,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:796: checking for $ac_word" >&5
echo "configure:788: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_NSGMLS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -836,7 +828,7 @@ test -n "$NSGMLS" || NSGMLS="notfound"
# Extract the first word of "sgmlsasp", so it can be a program name with args.
set dummy sgmlsasp; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:840: checking for $ac_word" >&5
echo "configure:832: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SGMLSASP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -904,6 +896,28 @@ fi
# Check whether --with-auxbindir or --without-auxbindir was given.
if test "${with_auxbindir+set}" = set; then
withval="$with_auxbindir"
auxbindir="$withval"
else
auxbindir="\${exec_prefix}/bin"
fi
# Check whether --with-pkgdatadirdir or --without-pkgdatadirdir was given.
if test "${with_pkgdatadirdir+set}" = set; then
withval="$with_pkgdatadirdir"
pkgdatadir="$withval"
else
pkgdatadir="\${prefix}/share/linuxdoc-tools"
fi
if test "$BUILD_NSGMLS" = "true"
then
SUB=sp
......@@ -1034,7 +1048,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
trap 'rm -fr `echo "Makefile bin/linuxdoc" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
......@@ -1071,7 +1085,6 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@PERL@%$PERL%g
s%@PERLWARN@%$PERLWARN%g
s%@auxbindir@%$auxbindir%g
s%@GROFF@%$GROFF%g
s%@GROFFMACRO@%$GROFFMACRO%g
s%@AWK@%$AWK%g
......@@ -1081,6 +1094,8 @@ s%@SGMLSASP@%$SGMLSASP%g
s%@BUILD_SGMLSASP@%$BUILD_SGMLSASP%g
s%@BUILD_ENTITY_MAP@%$BUILD_ENTITY_MAP%g
s%@BUILD_ISO_ENTITIES@%$BUILD_ISO_ENTITIES%g
s%@auxbindir@%$auxbindir%g
s%@pkgdatadir@%$pkgdatadir%g
s%@subdirs@%$subdirs%g
CEOF
......@@ -1123,7 +1138,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
CONFIG_FILES=\${CONFIG_FILES-"Makefile bin/linuxdoc"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
......
dnl
dnl configure.in
dnl
dnl $Id: configure.in,v 1.6 2001/12/02 02:32:06 sano Exp $
dnl Copyright (C) 2000-2001 Taketoshi Sano <sano@debian.org>
dnl Copyright (C) 2008 Agustin Martin <agmartin@debian.org>
dnl
dnl Process this file with autoconf to produce a configure script.
......@@ -11,6 +12,8 @@ AC_PROG_INSTALL
AC_PATH_PROG(PERL, perl)
AC_SUBST(PERL)
dnl ------ Check if we have at least perl 5.004 ---------
if echo 'require 5.004;exit' | $PERL
then
: # Solaris and OSF/1 /bin/sh don't know about negation operators...
......@@ -19,27 +22,19 @@ else
exit 1
fi
dnl ------ Make perl a bit more verbose if desired ---------
AC_ARG_WITH(perl-w,
[ --with-perl-w use perl -w option],
[ --with-perl-w use perl -w option],
PERLWARN=-w,
PERLWARN=
)
dnl ------ Set dir for auxiliary programs like sgmlpre -----
AC_ARG_WITH(auxbindir,
[ --with-auxbindir=dir dir for internal use programs]
[ (default: ${exec_prefix}/bin)],
auxbindir="$withval",
auxbindir="\${exec_prefix}/bin"
)
AC_SUBST(PERLWARN)
AC_SUBST(auxbindir)
dnl ------ Check if groff is available ---------------------
AC_PATH_PROG(GROFF, groff)
AC_SUBST(GROFF)
dnl Check if groff should take -mgs or -ms
dnl ------ Check if groff should take -mgs or -ms ----------
AC_CACHE_CHECK(whether ${GROFF} accepts -mgs, ac_cv_linuxdoctools_groff_mgs,
[ if test -z "`${GROFF} -mgs < /dev/null 2>&1`"; then
ac_cv_linuxdoctools_groff_mgs=yes
......@@ -59,15 +54,17 @@ AC_PATH_PROGS(AWK, gawk mawk, notfound)
AC_SUBST(AWK)
test "$AWK" = "notfound" && AC_MSG_ERROR(neither gawk nor mawk is found)
dnl ------ Check for sgmls parser --------------------------
AC_PATH_PROGS(NSGMLS, nsgmls onsgmls, notfound)
AC_SUBST(NSGMLS)
test "$NSGMLS" = "notfound" && AC_MSG_ERROR(neither onsgmls nor nsgmls is found)
BUILD_NSGMLS=
AC_SUBST(BUILD_NSGMLS)
dnl ------ Check for sgmlsasp ------------------------------
AC_PATH_PROG(SGMLSASP, sgmlsasp)
AC_ARG_WITH(installed-sgmlsasp,
[ --with-installed-sgmlsasp use installed sgmlsasp],
[ --with-installed-sgmlsasp use installed sgmlsasp],
test -n "$SGMLSASP" || AC_MSG_ERROR(sgmlsasp not found)
BUILD_SGMLSASP=,
SGMLSASP=\${prefix}/bin/sgmlsasp
......@@ -76,13 +73,15 @@ AC_ARG_WITH(installed-sgmlsasp,
AC_SUBST(SGMLSASP)
AC_SUBST(BUILD_SGMLSASP)
dnl ------ Check if we will use installed entity-map -------
AC_ARG_WITH(installed-entity-map,
[ --with-installed-entity-map use installed entity-map],
[ --with-installed-entity-map use installed entity-map],
BUILD_ENTITY_MAP=,
BUILD_ENTITY_MAP=true
)
AC_SUBST(BUILD_ENTITY_MAP)
dnl ------ Check if we will use installed iso-entities -----
AC_ARG_WITH(installed-iso-entities,
[ --with-installed-iso-entities use installed iso-entities],
BUILD_ISO_ENTITIES=,
......@@ -90,6 +89,25 @@ AC_ARG_WITH(installed-iso-entities,
)
AC_SUBST(BUILD_ISO_ENTITIES)
dnl ------ Set dir for auxiliary programs like sgmlpre -----
AC_ARG_WITH(auxbindir,
[ --with-auxbindir=dir dir for internal use programs]
[ (default: EPREFIX/bin)],
auxbindir="$withval",
auxbindir="\${exec_prefix}/bin"
)
AC_SUBST(auxbindir)
dnl ------ Set dir for package datadir --------------------
AC_ARG_WITH(pkgdatadirdir,
[ --with-pkgdatadir=dir dir for package libraries]
[ (default: PREFIX/share/linuxdoc-tools)],
pkgdatadir="$withval",
pkgdatadir="\${prefix}/share/linuxdoc-tools"
)
AC_SUBST(pkgdatadir)
dnl ------ Create list of possible extra subdirs -----------
if test "$BUILD_NSGMLS" = "true"
then
SUB=sp
......@@ -106,7 +124,7 @@ fi
AC_CONFIG_SUBDIRS($SUB)
AC_OUTPUT(Makefile)
AC_OUTPUT([Makefile bin/linuxdoc])
if test "$BUILD_SGMLSASP" = "true"
then
......
#! /bin/sh
if [ -x /usr/bin/gawk ]; then exec /usr/bin/gawk "$@"; fi
if [ -x /usr/bin/mawk ]; then exec /usr/bin/mawk "$@"; fi
echo "Error: None of gawk/mawk available."
echo
exit 1
#! /bin/sh
if [ -x /usr/bin/nsgmls ]; then exec /usr/bin/nsgmls "$@"; fi
if [ -x /usr/bin/onsgmls ]; then exec /usr/bin/onsgmls "$@"; fi
echo "Error: None of nsgmls/onsgmls available."
echo
exit 1
......@@ -48,12 +48,6 @@ build-stamp:
$(MAKE) OPTIMIZE="-g -O2"
# --- Rewrite to use sgmlswhich wrapper
sed -e "s:/usr/bin/o\?nsgmls:/usr/share/linuxdoc-tools/sgmlswhich:" \
-e "s:/usr/bin/[gm]awk:/usr/share/linuxdoc-tools/awkwhich:" \
bin/linuxdoc > linuxdoc.new;
$(build_ldt_copyright)
for i in text latex info; do \
......@@ -92,12 +86,6 @@ install: build
install -m 755 debian/addition/sgml2$$i \
$(DESTDIR)/usr/bin/sgml2$$i; \
done
# ---
install -m 755 debian/addition/sgmlswhich \
$(DESTDIR)/usr/share/linuxdoc-tools/sgmlswhich;
install -m 755 debian/addition/awkwhich \
$(DESTDIR)/usr/share/linuxdoc-tools/awkwhich;
install -m 755 linuxdoc.new $(DESTDIR)/usr/bin/linuxdoc
# ---
cat debian/linuxdoc-tools.info-base doc/guide.info > doc/linuxdoc-sgml.info
dh_installinfo doc/linuxdoc-sgml.info
......
......@@ -38,8 +38,8 @@ PERL=`which perl`
sed < ../bin/linuxdoc.in >$TMPDIR/linuxdoc \
-e 's!\@prefix\@!'${PREFIX}'!' \
-e 's!\@auxbindir\@!'${BINDIR}'!' \
-e 's!\@DATADIR\@!'${TMPDIR}'/linuxdoc-tools!' \
-e 's!\@auxbindir\@!'${AUXBINDIR}'!' \
-e 's!\@pkgdatadir\@!'${TMPDIR}'/linuxdoc-tools!' \
-e 's!\@NSGMLS\@!'${NSGMLS}'!' \
-e 's!\@SGMLSASP\@!'${SGMLSASP}'!' \
-e 's!\@GROFF\@!'${GROFF}'!' \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment