Skip to content

Commit

Permalink
star2html: Use autoconf for tool discovery
Browse files Browse the repository at this point in the history
We can not use a CPAN module in star2html because the program
is used during the build process before starperl has had the
CPAN dependencies sorted out. Instead we use autoconf to search
for the pdftops and pdf2ps commands.
  • Loading branch information
timj committed Oct 2, 2013
1 parent f06b974 commit 73fd7dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions applications/star2html/Makefile.am
Expand Up @@ -26,6 +26,8 @@ l2hdir=$(DESTDIR)$(datadir)/latex2html/bin/

edit=sed \
-e 's,@ENV\@,$(ENV),g' \
-e 's,@PDFTOPS\@,$(PDFTOPS),g' \
-e 's,@PDF2PS\@,$(PDF2PS),g' \
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
-e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
-e 's,@l2hdir\@,$(l2hdir),g'
Expand Down
2 changes: 2 additions & 0 deletions applications/star2html/configure.ac
Expand Up @@ -24,6 +24,8 @@ dnl And requires that Perl is already built, from which we use the
dnl starperl command.
STAR_DECLARE_DEPENDENCIES([configure], [perl])
STAR_CHECK_PROGS([env])
AC_CHECK_PROGS(PDF2PS, 'pdf2ps')
AC_CHECK_PROGS(PDFTOPS, 'pdftops -eps')

dnl List the sun/ssn/... numbers which document this package and
dnl which are present as .tex files in this directory.
Expand Down
14 changes: 9 additions & 5 deletions applications/star2html/star2html.in
Expand Up @@ -257,6 +257,8 @@
# on exit
# 31-AUG-2013 (TIMJ):
# - Convert PDF images to EPS
# 2013-10-02 (TIMJ):
# - Use autoconf to find pdftops
# {enter_further_changes_here}

# Bugs:
Expand All @@ -270,7 +272,6 @@ use Cwd;
use File::Spec;
use Pod::Usage;
use Getopt::Long;
use File::SearchPath qw/ searchpath /;

# Print introductory message.
my $announce = "Star2HTML V@PACKAGE_VERSION@";
Expand Down Expand Up @@ -435,12 +436,15 @@ if ( ( -T $TEXFILE ) && ( -r $TEXFILE ) ) {
{

# First work out which converter to use
my %TOOLS = ( pdftops => '@PDFTOPS@',
pdf2ps => '@PDF2PS@',
);

my @pdftops;
for my $tool (qw/ pdftops pdf2ps /) {
my $path = searchpath( $tool, $ENV{PATH} );
if (defined $path) {
push(@pdftops, $tool);
push(@pdftops, "-eps") if $tool eq 'pdftops';
my $exe = $TOOLS{$tool};
if ($exe) {
push(@pdftops, split(/\s+/,$exe));
last;
}
}
Expand Down

0 comments on commit 73fd7dd

Please sign in to comment.