From 04709aa2e6bc1aa68e3a68c07ec0002dfeb57a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Fri, 10 Jun 2011 21:31:20 +0800 Subject: [PATCH] ensure that ldconfig is in PATH on linux *and* luajit is enabled. --- util/configure | 24 +++++++++++++++++++++++- util/get-tarball | 3 ++- util/mirror-tarballs | 3 ++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/util/configure b/util/configure index 27f0099..f2d292c 100755 --- a/util/configure +++ b/util/configure @@ -5,6 +5,7 @@ use strict; use warnings; use File::Spec; +use ExtUtils::MakeMaker (); sub shell ($@); sub env ($$); @@ -258,7 +259,7 @@ sub build_resty_opts { } if ($opts->{no_http_ssl} && $opts->{http_ssl}) { - die "--with-http_ssl_module conflicts with --without-http_ssl_module\n"; + die "--with-http_ssl_module conflicts with --without-http_ssl_module.\n"; } if (! $opts->{no_http_ssl} && ! $opts->{http_ssl}) { @@ -266,6 +267,10 @@ sub build_resty_opts { push @ngx_opts, '--with-http_ssl_module'; } + if ($platform eq 'linux' && $opts->{luajit} && ! can_run("ldconfig")) { + die "you need to have ldconfig in your PATH env when enabling luajit.\n"; + } + my $opts_line = ''; if ($opts->{debug}) { @@ -628,3 +633,20 @@ sub gen_makefile { close $out; } +# check if we can run some command +sub can_run { + my ($cmd) = @_; + + #warn "can run: @_\n"; + my $_cmd = $cmd; + return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); + + for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { + next if $dir eq ''; + my $abs = File::Spec->catfile($dir, $_[0]); + return $abs if (-x $abs or $abs = MM->maybe_command($abs)); + } + + return; +} + diff --git a/util/get-tarball b/util/get-tarball index 1598a82..6464863 100755 --- a/util/get-tarball +++ b/util/get-tarball @@ -1,6 +1,7 @@ #!/bin/bash -root=$(readlink -f -- "$(dirname -- "$0")/..") +#root=$(readlink -f -- "$(dirname -- "$0")/..") +root=`perl -MCwd -e'print Cwd::abs_path(shift)' $(dirname -- "$0")/..` work=$root/work if [ ! -d $work ]; then diff --git a/util/mirror-tarballs b/util/mirror-tarballs index bdceb84..de5204c 100755 --- a/util/mirror-tarballs +++ b/util/mirror-tarballs @@ -1,6 +1,7 @@ #!/bin/bash -root=$(readlink -f -- "$(dirname -- "$0")/..") +#root=$(readlink -f -- "$(dirname -- "$0")/..") +root=`perl -MCwd -e'print Cwd::abs_path(shift)' $(dirname -- "$0")/..` . util/ver