blob: 36b5112bb67b6f61a5eac6194c5f6612298ae253 [file] [log] [blame]
Reid Spencerb195d9d2006-03-23 23:21:29 +00001#!@PERL@
Chris Lattner584073a2006-06-02 18:58:21 +00002##===- tools/llvm-config ---------------------------------------*- perl -*-===##
3#
4# The LLVM Compiler Infrastructure
Reid Spencerf2722ca2006-03-22 15:59:55 +00005#
Chris Lattner234d5292007-12-29 22:59:10 +00006# This file is distributed under the University of Illinois Open Source
7# License. See LICENSE.TXT for details.
Chris Lattner584073a2006-06-02 18:58:21 +00008#
9##===----------------------------------------------------------------------===##
Reid Spencerf2722ca2006-03-22 15:59:55 +000010#
11# Synopsis: Prints out compiler options needed to build against an installed
12# copy of LLVM.
13#
Chris Lattner7f71e212006-04-13 04:21:31 +000014# Syntax: llvm-config OPTIONS... [COMPONENTS...]
Chris Lattner584073a2006-06-02 18:58:21 +000015#
16##===----------------------------------------------------------------------===##
Reid Spencerf2722ca2006-03-22 15:59:55 +000017
Reid Spencerb195d9d2006-03-23 23:21:29 +000018use 5.006;
Reid Spencerf2722ca2006-03-22 15:59:55 +000019use strict;
20use warnings;
21
22#---- begin autoconf values ----
Reid Spencer2d2c2f22006-06-02 18:31:41 +000023my $PACKAGE_NAME = q{@PACKAGE_NAME@};
Reid Spencerf2722ca2006-03-22 15:59:55 +000024my $VERSION = q{@PACKAGE_VERSION@};
25my $PREFIX = q{@LLVM_PREFIX@};
Reid Spencer2d2c2f22006-06-02 18:31:41 +000026my $LLVM_CONFIGTIME = q{@LLVM_CONFIGTIME@};
27my $LLVM_SRC_ROOT = q{@abs_top_srcdir@};
28my $LLVM_OBJ_ROOT = q{@abs_top_builddir@};
29my $LLVM_ON_WIN32 = q{@LLVM_ON_WIN32@};
30my $LLVM_ON_UNIX = q{@LLVM_ON_UNIX@};
31my $LLVMGCCDIR = q{@LLVMGCCDIR@};
32my $LLVMGCC = q{@LLVMGCC@};
33my $LLVMGXX = q{@LLVMGXX@};
34my $LLVMGCC_VERSION = q{@LLVMGCC_VERSION@};
35my $LLVMGCC_MAJVERS = q{@LLVMGCC_MAJVERS@};
36my $ENDIAN = q{@ENDIAN@};
37my $SHLIBEXT = q{@SHLIBEXT@};
38my $EXEEXT = q{@EXEEXT@};
39my $OS = q{@OS@};
Reid Spencerf2722ca2006-03-22 15:59:55 +000040my $ARCH = lc(q{@ARCH@});
Reid Spencer2d2c2f22006-06-02 18:31:41 +000041my $TARGET_TRIPLE = q{@target@};
42my $TARGETS_TO_BUILD = q{@TARGETS_TO_BUILD@};
Reid Spencerb195d9d2006-03-23 23:21:29 +000043my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@};
Reid Spencerf2722ca2006-03-22 15:59:55 +000044my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@};
45#---- end autoconf values ----
46
Jeff Cohen02c91ef2007-03-28 04:45:02 +000047# Must pretend x86_64 architecture is really x86, otherwise the native backend
48# won't get linked in.
49$ARCH = "x86" if $ARCH eq "x86_64";
50
Reid Spencerf2722ca2006-03-22 15:59:55 +000051#---- begin Makefile values ----
David Greenea696d242007-06-28 19:36:08 +000052my $CPPFLAGS = q{@LLVM_CPPFLAGS@};
Reid Spencerf72538e2007-01-06 02:48:03 +000053my $CFLAGS = q{@LLVM_CFLAGS@};
Reid Spencerf2722ca2006-03-22 15:59:55 +000054my $CXXFLAGS = q{@LLVM_CXXFLAGS@};
55my $LDFLAGS = q{@LLVM_LDFLAGS@};
Reid Spencer1bc68642006-07-27 23:00:30 +000056my $SYSTEM_LIBS = q{@LIBS@};
Chris Lattnerabdbae72006-06-02 19:13:29 +000057my $LLVM_BUILDMODE = q{@LLVM_BUILDMODE@};
Reid Spencerf2722ca2006-03-22 15:59:55 +000058#---- end Makefile values ----
59
Chris Lattner16ad6182006-06-02 21:48:10 +000060# Figure out where llvm-config is being run from. Primarily, we care if it has
61# been installed, or is running from the build directory, which changes the
62# locations of some files.
63
Chris Lattnere02b97b2006-06-02 01:23:18 +000064# Convert the current executable name into its directory (e.g. ".").
Chris Lattner16ad6182006-06-02 21:48:10 +000065my ($RUN_DIR) = ($0 =~ /^(.*)\/.*$/);
66
Chris Lattner4a444c72007-10-24 04:35:54 +000067# Find the unix pwd program: we don't want to use the bash builtin, as it does
68# not look through symlinks etc.
69my $PWD = `which pwd`;
70chomp($PWD);
71$PWD = "pwd" if (!-e $PWD);
72
Chris Lattner16ad6182006-06-02 21:48:10 +000073# Turn the directory into an absolute directory on the file system, also pop up
74# from "bin" into the build or prefix dir.
Chris Lattner4a444c72007-10-24 04:35:54 +000075my $ABS_RUN_DIR = `cd $RUN_DIR/..; $PWD`;
Chris Lattner16ad6182006-06-02 21:48:10 +000076chomp($ABS_RUN_DIR);
77
78# Compute the absolute object directory build, e.g. "foo/llvm/Debug".
Chris Lattner3e347f22006-06-06 23:54:15 +000079my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT/$LLVM_BUILDMODE";
Chris Lattner4a444c72007-10-24 04:35:54 +000080$ABS_OBJ_ROOT = `cd $ABS_OBJ_ROOT; $PWD` if (-d $ABS_OBJ_ROOT);
Chris Lattner16ad6182006-06-02 21:48:10 +000081chomp($ABS_OBJ_ROOT);
82
Chris Lattner0cd059e2006-06-02 22:03:50 +000083my $INCLUDEDIR = "$ABS_RUN_DIR/include";
84my $LIBDIR = "$ABS_RUN_DIR/lib";
85my $BINDIR = "$ABS_RUN_DIR/bin";
Chris Lattner16ad6182006-06-02 21:48:10 +000086if ($ABS_RUN_DIR eq $ABS_OBJ_ROOT) {
87 # If we are running out of the build directory, the include dir is in the
88 # srcdir.
89 $INCLUDEDIR = "$LLVM_SRC_ROOT/include";
90} else {
Chris Lattner0cd059e2006-06-02 22:03:50 +000091 # If installed, ignore the prefix the tree was configured with, use the
92 # current prefix.
93 $PREFIX = $ABS_RUN_DIR;
Chris Lattner16ad6182006-06-02 21:48:10 +000094}
Chris Lattnere02b97b2006-06-02 01:23:18 +000095
Reid Spencerf2722ca2006-03-22 15:59:55 +000096sub usage;
97sub fix_library_names (@);
Chris Lattnerd179de52006-06-06 22:38:29 +000098sub fix_library_files (@);
Reid Spencerd8c20a92006-08-03 21:45:35 +000099sub expand_dependencies (@);
Reid Spencerf2722ca2006-03-22 15:59:55 +0000100sub name_map_entries;
101
102# Parse our command-line arguments.
103usage if @ARGV == 0;
104my @components;
105my $has_opt = 0;
106my $want_libs = 0;
107my $want_libnames = 0;
Chris Lattnerd179de52006-06-06 22:38:29 +0000108my $want_libfiles = 0;
Reid Spencerf2722ca2006-03-22 15:59:55 +0000109my $want_components = 0;
110foreach my $arg (@ARGV) {
111 if ($arg =~ /^-/) {
112 if ($arg eq "--version") {
113 $has_opt = 1; print "$VERSION\n";
114 } elsif ($arg eq "--prefix") {
115 $has_opt = 1; print "$PREFIX\n";
116 } elsif ($arg eq "--bindir") {
Chris Lattner16ad6182006-06-02 21:48:10 +0000117 $has_opt = 1; print "$BINDIR\n";
Reid Spencerf2722ca2006-03-22 15:59:55 +0000118 } elsif ($arg eq "--includedir") {
Chris Lattner16ad6182006-06-02 21:48:10 +0000119 $has_opt = 1; print "$INCLUDEDIR\n";
Reid Spencerf2722ca2006-03-22 15:59:55 +0000120 } elsif ($arg eq "--libdir") {
Chris Lattner16ad6182006-06-02 21:48:10 +0000121 $has_opt = 1; print "$LIBDIR\n";
David Greenea696d242007-06-28 19:36:08 +0000122 } elsif ($arg eq "--cppflags") {
Reid Spencer087d90e2007-07-10 07:48:09 +0000123 $has_opt = 1; print "-I$INCLUDEDIR $CPPFLAGS\n";
Reid Spencerf72538e2007-01-06 02:48:03 +0000124 } elsif ($arg eq "--cflags") {
Reid Spencer087d90e2007-07-10 07:48:09 +0000125 $has_opt = 1; print "-I$INCLUDEDIR $CFLAGS\n";
Reid Spencerf2722ca2006-03-22 15:59:55 +0000126 } elsif ($arg eq "--cxxflags") {
Reid Spencer087d90e2007-07-10 07:48:09 +0000127 $has_opt = 1; print "-I$INCLUDEDIR $CXXFLAGS\n";
Reid Spencerf2722ca2006-03-22 15:59:55 +0000128 } elsif ($arg eq "--ldflags") {
Reid Spencer1bc68642006-07-27 23:00:30 +0000129 $has_opt = 1; print "-L$LIBDIR $LDFLAGS $SYSTEM_LIBS\n";
Reid Spencerf2722ca2006-03-22 15:59:55 +0000130 } elsif ($arg eq "--libs") {
131 $has_opt = 1; $want_libs = 1;
132 } elsif ($arg eq "--libnames") {
133 $has_opt = 1; $want_libnames = 1;
Chris Lattnerd179de52006-06-06 22:38:29 +0000134 } elsif ($arg eq "--libfiles") {
135 $has_opt = 1; $want_libfiles = 1;
Reid Spencerf2722ca2006-03-22 15:59:55 +0000136 } elsif ($arg eq "--components") {
137 $has_opt = 1; print join(' ', name_map_entries), "\n";
138 } elsif ($arg eq "--targets-built") {
139 $has_opt = 1; print join(' ', @TARGETS_BUILT), "\n";
Reid Spencer3b87d6a2007-04-22 05:05:36 +0000140 } elsif ($arg eq "--host-target") {
141 $has_opt = 1; print "$TARGET_TRIPLE\n";
Chris Lattner0cd059e2006-06-02 22:03:50 +0000142 } elsif ($arg eq "--build-mode") {
143 $has_opt = 1; print "$LLVM_BUILDMODE\n";
144 } elsif ($arg eq "--obj-root") {
Chris Lattner4a444c72007-10-24 04:35:54 +0000145 $has_opt = 1; print `cd $LLVM_OBJ_ROOT/; $PWD`;
Chris Lattner0cd059e2006-06-02 22:03:50 +0000146 } elsif ($arg eq "--src-root") {
Chris Lattner4a444c72007-10-24 04:35:54 +0000147 $has_opt = 1; print `cd $LLVM_SRC_ROOT/; $PWD`;
Reid Spencerf2722ca2006-03-22 15:59:55 +0000148 } else {
149 usage();
150 }
151 } else {
152 push @components, $arg;
153 }
154}
155
156# If no options were specified, fail.
157usage unless $has_opt;
158
159# If no components were specified, default to 'all'.
160if (@components == 0) {
161 push @components, 'all';
162}
163
Chris Lattner54eae9e2006-09-04 05:35:23 +0000164# Force component names to lower case.
165@components = map lc, @components;
166
Reid Spencerf2722ca2006-03-22 15:59:55 +0000167# Handle any arguments which require building our dependency graph.
Chris Lattnerd179de52006-06-06 22:38:29 +0000168if ($want_libs || $want_libnames || $want_libfiles) {
Reid Spencerd8c20a92006-08-03 21:45:35 +0000169 my @libs = expand_dependencies(@components);
Chris Lattnerd179de52006-06-06 22:38:29 +0000170 print join(' ', fix_library_names(@libs)), "\n" if ($want_libs);
171 print join(' ', @libs), "\n" if ($want_libnames);
172 print join(' ', fix_library_files(@libs)), "\n" if ($want_libfiles);
Reid Spencerf2722ca2006-03-22 15:59:55 +0000173}
174
175exit 0;
176
177#==========================================================================
178# Support Routines
179#==========================================================================
180
181sub usage {
182 print STDERR <<__EOD__;
183Usage: llvm-config <OPTION>... [<COMPONENT>...]
184
185Get various configuration information needed to compile programs which use
186LLVM. Typically called from 'configure' scripts. Examples:
187 llvm-config --cxxflags
188 llvm-config --ldflags
Reid Spencerb195d9d2006-03-23 23:21:29 +0000189 llvm-config --libs engine bcreader scalaropts
Reid Spencerf2722ca2006-03-22 15:59:55 +0000190
191Options:
Reid Spencer087d90e2007-07-10 07:48:09 +0000192 --version Print LLVM version.
193 --prefix Print the installation prefix.
194 --src-root Print the source root LLVM was built from.
195 --obj-root Print the object root used to build LLVM.
196 --bindir Directory containing LLVM executables.
197 --includedir Directory containing LLVM headers.
198 --libdir Directory containing LLVM libraries.
199 --cppflags C preprocessor flags for files that include LLVM headers.
200 --cflags C compiler flags for files that include LLVM headers.
201 --cxxflags C++ compiler flags for files that include LLVM headers.
202 --ldflags Print Linker flags.
203 --libs Libraries needed to link against LLVM components.
204 --libnames Bare library names for in-tree builds.
205 --libfiles Fully qualified library filenames for makefile depends.
206 --components List of all possible components.
207 --targets-built List of all targets currently built.
208 --host-target Target triple used to configure LLVM.
209 --build-mode Print build mode of LLVM tree (e.g. Debug or Release).
Reid Spencerf2722ca2006-03-22 15:59:55 +0000210Typical components:
Reid Spencer087d90e2007-07-10 07:48:09 +0000211 all All LLVM libraries (default).
212 backend Either a native backend or the C backend.
213 engine Either a native JIT or a bytecode interpreter.
Reid Spencerf2722ca2006-03-22 15:59:55 +0000214__EOD__
215 exit(1);
216}
217
218# Use -lfoo instead of libfoo.a whenever possible, and add directories to
219# files which can't be found using -L.
220sub fix_library_names (@) {
221 my @libs = @_;
222 my @result;
223 foreach my $lib (@libs) {
224 # Transform the bare library name appropriately.
225 my ($basename) = ($lib =~ /^lib([^.]*)\.a/);
226 if (defined $basename) {
227 push @result, "-l$basename";
228 } else {
Chris Lattner16ad6182006-06-02 21:48:10 +0000229 push @result, "$LIBDIR/$lib";
Reid Spencerf2722ca2006-03-22 15:59:55 +0000230 }
231 }
232 return @result;
233}
234
Chris Lattnerd179de52006-06-06 22:38:29 +0000235# Turn the list of libraries into a list of files.
236sub fix_library_files(@) {
237 my @libs = @_;
238 my @result;
239 foreach my $lib (@libs) {
240 # Transform the bare library name into a filename.
241 push @result, "$LIBDIR/$lib";
242 }
243 return @result;
244}
Reid Spencerf2722ca2006-03-22 15:59:55 +0000245
246#==========================================================================
247# Library Dependency Analysis
248#==========================================================================
249# Given a few human-readable library names, find all their dependencies
250# and sort them into an order which the linker will like. If we packed
251# our libraries into fewer archives, we could make the linker do much
252# of this work for us.
253#
254# Libraries have two different types of names in this code: Human-friendly
255# "component" names entered on the command-line, and the raw file names
256# we use internally (and ultimately pass to the linker).
257#
258# To understand this code, you'll need a working knowledge of Perl 5,
259# and possibly some quality time with 'man perlref'.
260
261sub load_dependencies;
262sub build_name_map;
Reid Spencerb195d9d2006-03-23 23:21:29 +0000263sub have_native_backend;
264sub find_best_engine;
Reid Spencerf2722ca2006-03-22 15:59:55 +0000265sub expand_names (@);
266sub find_all_required_sets (@);
267sub find_all_required_sets_helper ($$@);
Reid Spencerf2722ca2006-03-22 15:59:55 +0000268
269# Each "set" contains one or more libraries which must be included as a
270# group (due to cyclic dependencies). Sets are represented as a Perl array
271# reference pointing to a list of internal library names.
272my @SETS;
273
274# Various mapping tables.
275my %LIB_TO_SET_MAP; # Maps internal library names to their sets.
276my %SET_DEPS; # Maps sets to a list of libraries they depend on.
277my %NAME_MAP; # Maps human-entered names to internal names.
278
279# Have our dependencies been loaded yet?
280my $DEPENDENCIES_LOADED = 0;
281
282# Given a list of human-friendly component names, translate them into a
283# complete set of linker arguments.
Reid Spencerd8c20a92006-08-03 21:45:35 +0000284sub expand_dependencies (@) {
Reid Spencerf2722ca2006-03-22 15:59:55 +0000285 my @libs = @_;
286 load_dependencies;
287 my @required_sets = find_all_required_sets(expand_names(@libs));
288 my @sorted_sets = topologically_sort_sets(@required_sets);
289
Chris Lattner06e752e2006-06-02 00:56:15 +0000290 # Expand the library sets into libraries.
Reid Spencerf2722ca2006-03-22 15:59:55 +0000291 my @result;
292 foreach my $set (@sorted_sets) { push @result, @{$set}; }
Chris Lattner06e752e2006-06-02 00:56:15 +0000293 return @result;
Reid Spencerf2722ca2006-03-22 15:59:55 +0000294}
295
296# Load in the raw dependency data stored at the end of this file.
297sub load_dependencies {
298 return if $DEPENDENCIES_LOADED;
299 $DEPENDENCIES_LOADED = 1;
300 while (<DATA>) {
301 # Parse our line.
Anton Korobeynikovde9c02b2006-08-04 21:52:23 +0000302 my ($libs, $deps) = /^\s*([^:]+):\s*(.*)\s*$/;
Reid Spencerf2722ca2006-03-22 15:59:55 +0000303 die "Malformed dependency data" unless defined $deps;
304 my @libs = split(' ', $libs);
305 my @deps = split(' ', $deps);
306
307 # Record our dependency data.
308 my $set = \@libs;
309 push @SETS, $set;
310 foreach my $lib (@libs) { $LIB_TO_SET_MAP{$lib} = $set; }
311 $SET_DEPS{$set} = \@deps;
312 }
313 build_name_map;
314}
315
316# Build a map converting human-friendly component names into internal
317# library names.
318sub build_name_map {
319 # Add entries for all the actual libraries.
320 foreach my $set (@SETS) {
321 foreach my $lib (sort @$set) {
322 my $short_name = $lib;
323 $short_name =~ s/^(lib)?LLVM([^.]*)\..*$/$2/;
324 $short_name =~ tr/A-Z/a-z/;
325 $NAME_MAP{$short_name} = [$lib];
326 }
327 }
328
Anton Korobeynikov3c3bc482008-08-17 13:53:59 +0000329 # Add target-specific entries
330 foreach my $target (@TARGETS_BUILT) {
331 # FIXME: Temporary, until we don't switch all targets
332 if (defined $NAME_MAP{$target.'asmprinter'}) {
333 $NAME_MAP{$target} = [$target.'asmprinter', $target.'codegen']
334 }
335 }
336
Reid Spencerf2722ca2006-03-22 15:59:55 +0000337 # Add virtual entries.
Reid Spencerb195d9d2006-03-23 23:21:29 +0000338 $NAME_MAP{'native'} = have_native_backend() ? [$ARCH] : [];
Anton Korobeynikov3c3bc482008-08-17 13:53:59 +0000339 $NAME_MAP{'nativecodegen'} = have_native_backend() ? [$ARCH.'codegen'] : [];
Reid Spencerb195d9d2006-03-23 23:21:29 +0000340 $NAME_MAP{'backend'} = have_native_backend() ? ['native'] : ['cbackend'];
341 $NAME_MAP{'engine'} = find_best_engine;
342 $NAME_MAP{'all'} = [name_map_entries]; # Must be last.
Reid Spencerf2722ca2006-03-22 15:59:55 +0000343}
344
Reid Spencerb195d9d2006-03-23 23:21:29 +0000345# Return true if we have a native backend to use.
346sub have_native_backend {
Reid Spencerf2722ca2006-03-22 15:59:55 +0000347 my %BUILT;
348 foreach my $target (@TARGETS_BUILT) { $BUILT{$target} = 1; }
Reid Spencerb195d9d2006-03-23 23:21:29 +0000349 return defined $NAME_MAP{$ARCH} && defined $BUILT{$ARCH};
350}
351
352# Find a working subclass of ExecutionEngine for this platform.
353sub find_best_engine {
354 if (have_native_backend && $TARGET_HAS_JIT) {
Reid Spencer1c070fc2006-03-24 01:10:39 +0000355 return ['jit', 'native'];
Reid Spencerf2722ca2006-03-22 15:59:55 +0000356 } else {
Reid Spencerb195d9d2006-03-23 23:21:29 +0000357 return ['interpreter'];
Reid Spencerf2722ca2006-03-22 15:59:55 +0000358 }
359}
360
361# Get all the human-friendly component names.
362sub name_map_entries {
363 load_dependencies;
364 return sort keys %NAME_MAP;
365}
366
367# Map human-readable names to internal library names.
368sub expand_names (@) {
369 my @names = @_;
370 my @result;
371 foreach my $name (@names) {
372 if (defined $LIB_TO_SET_MAP{$name}) {
373 # We've hit bottom: An actual library name.
374 push @result, $name;
375 } elsif (defined $NAME_MAP{$name}) {
376 # We've found a short name to expand.
377 push @result, expand_names(@{$NAME_MAP{$name}});
378 } else {
379 print STDERR "llvm-config: unknown component name: $name\n";
380 exit(1);
381 }
382 }
383 return @result;
384}
385
386# Given a list of internal library names, return all sets of libraries which
387# will need to be included by the linker (in no particular order).
388sub find_all_required_sets (@) {
389 my @libs = @_;
390 my %sets_added;
391 my @result;
392 find_all_required_sets_helper(\%sets_added, \@result, @libs);
393 return @result;
394}
395
396# Recursive closures are pretty broken in Perl, so we're going to separate
397# this function from find_all_required_sets and pass in the state we need
398# manually, as references. Yes, this is fairly unpleasant.
399sub find_all_required_sets_helper ($$@) {
400 my ($sets_added, $result, @libs) = @_;
401 foreach my $lib (@libs) {
402 my $set = $LIB_TO_SET_MAP{$lib};
403 next if defined $$sets_added{$set};
404 $$sets_added{$set} = 1;
405 push @$result, $set;
406 find_all_required_sets_helper($sets_added, $result, @{$SET_DEPS{$set}});
407 }
408}
409
410# Print a list of sets, with a label. Used for debugging.
411sub print_sets ($@) {
412 my ($label, @sets) = @_;
413 my @output;
414 foreach my $set (@sets) { push @output, join(',', @$set); }
415 print "$label: ", join(';', @output), "\n";
416}
417
418# Returns true if $lib is a key in $added.
419sub has_lib_been_added ($$) {
420 my ($added, $lib) = @_;
421 return defined $$added{$LIB_TO_SET_MAP{$lib}};
422}
423
424# Returns true if all the dependencies of $set appear in $added.
425sub have_all_deps_been_added ($$) {
426 my ($added, $set) = @_;
427 #print_sets(" Checking", $set);
428 #print_sets(" Wants", $SET_DEPS{$set});
429 foreach my $lib (@{$SET_DEPS{$set}}) {
430 return 0 unless has_lib_been_added($added, $lib);
431 }
432 return 1;
433}
434
435# Given a list of sets, topologically sort them using dependencies.
436sub topologically_sort_sets (@) {
437 my @sets = @_;
438 my %added;
439 my @result;
440 SCAN: while (@sets) { # We'll delete items from @sets as we go.
441 #print_sets("So far", reverse(@result));
442 #print_sets("Remaining", @sets);
443 for (my $i = 0; $i < @sets; ++$i) {
444 my $set = $sets[$i];
445 if (have_all_deps_been_added(\%added, $set)) {
446 push @result, $set;
447 $added{$set} = 1;
448 #print "Removing $i.\n";
449 splice(@sets, $i, 1);
450 next SCAN; # Restart our scan.
451 }
452 }
453 die "Can't find a library with no dependencies";
454 }
455 return reverse(@result);
456}
457
Reid Spencerf2722ca2006-03-22 15:59:55 +0000458# Our library dependency data will be added after the '__END__' token, and will
459# be read through the magic <DATA> filehandle.
460__END__