Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 1 | #!@PERL@ |
Chris Lattner | 584073a | 2006-06-02 18:58:21 +0000 | [diff] [blame] | 2 | ##===- tools/llvm-config ---------------------------------------*- perl -*-===## |
| 3 | # |
| 4 | # The LLVM Compiler Infrastructure |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 5 | # |
Chris Lattner | 584073a | 2006-06-02 18:58:21 +0000 | [diff] [blame] | 6 | # This file was developed by Eric Kidd and is distributed under |
| 7 | # the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 8 | # |
| 9 | ##===----------------------------------------------------------------------===## |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 10 | # |
| 11 | # Synopsis: Prints out compiler options needed to build against an installed |
| 12 | # copy of LLVM. |
| 13 | # |
Chris Lattner | 7f71e21 | 2006-04-13 04:21:31 +0000 | [diff] [blame] | 14 | # Syntax: llvm-config OPTIONS... [COMPONENTS...] |
Chris Lattner | 584073a | 2006-06-02 18:58:21 +0000 | [diff] [blame] | 15 | # |
| 16 | ##===----------------------------------------------------------------------===## |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 17 | |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 18 | use 5.006; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 19 | use strict; |
| 20 | use warnings; |
| 21 | |
| 22 | #---- begin autoconf values ---- |
Reid Spencer | 2d2c2f2 | 2006-06-02 18:31:41 +0000 | [diff] [blame] | 23 | my $PACKAGE_NAME = q{@PACKAGE_NAME@}; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 24 | my $VERSION = q{@PACKAGE_VERSION@}; |
| 25 | my $PREFIX = q{@LLVM_PREFIX@}; |
Reid Spencer | 2d2c2f2 | 2006-06-02 18:31:41 +0000 | [diff] [blame] | 26 | my $LLVM_CONFIGTIME = q{@LLVM_CONFIGTIME@}; |
| 27 | my $LLVM_SRC_ROOT = q{@abs_top_srcdir@}; |
| 28 | my $LLVM_OBJ_ROOT = q{@abs_top_builddir@}; |
| 29 | my $LLVM_ON_WIN32 = q{@LLVM_ON_WIN32@}; |
| 30 | my $LLVM_ON_UNIX = q{@LLVM_ON_UNIX@}; |
| 31 | my $LLVMGCCDIR = q{@LLVMGCCDIR@}; |
| 32 | my $LLVMGCC = q{@LLVMGCC@}; |
| 33 | my $LLVMGXX = q{@LLVMGXX@}; |
| 34 | my $LLVMGCC_VERSION = q{@LLVMGCC_VERSION@}; |
| 35 | my $LLVMGCC_MAJVERS = q{@LLVMGCC_MAJVERS@}; |
| 36 | my $ENDIAN = q{@ENDIAN@}; |
| 37 | my $SHLIBEXT = q{@SHLIBEXT@}; |
| 38 | my $EXEEXT = q{@EXEEXT@}; |
| 39 | my $OS = q{@OS@}; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 40 | my $ARCH = lc(q{@ARCH@}); |
Reid Spencer | 2d2c2f2 | 2006-06-02 18:31:41 +0000 | [diff] [blame] | 41 | my $TARGET_TRIPLE = q{@target@}; |
| 42 | my $TARGETS_TO_BUILD = q{@TARGETS_TO_BUILD@}; |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 43 | my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@}; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 44 | my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@}; |
| 45 | #---- end autoconf values ---- |
| 46 | |
| 47 | #---- begin Makefile values ---- |
| 48 | my $CXXFLAGS = q{@LLVM_CXXFLAGS@}; |
| 49 | my $LDFLAGS = q{@LLVM_LDFLAGS@}; |
Chris Lattner | abdbae7 | 2006-06-02 19:13:29 +0000 | [diff] [blame] | 50 | my $LLVM_BUILDMODE = q{@LLVM_BUILDMODE@}; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 51 | #---- end Makefile values ---- |
| 52 | |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 53 | # Figure out where llvm-config is being run from. Primarily, we care if it has |
| 54 | # been installed, or is running from the build directory, which changes the |
| 55 | # locations of some files. |
| 56 | |
Chris Lattner | e02b97b | 2006-06-02 01:23:18 +0000 | [diff] [blame] | 57 | # Convert the current executable name into its directory (e.g. "."). |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 58 | my ($RUN_DIR) = ($0 =~ /^(.*)\/.*$/); |
| 59 | |
| 60 | # Turn the directory into an absolute directory on the file system, also pop up |
| 61 | # from "bin" into the build or prefix dir. |
| 62 | my $ABS_RUN_DIR = `cd $RUN_DIR/..; pwd`; |
| 63 | chomp($ABS_RUN_DIR); |
| 64 | |
| 65 | # Compute the absolute object directory build, e.g. "foo/llvm/Debug". |
| 66 | my $ABS_OBJ_ROOT = `cd $LLVM_OBJ_ROOT/$LLVM_BUILDMODE; pwd`; |
| 67 | chomp($ABS_OBJ_ROOT); |
| 68 | |
| 69 | my $INCLUDEDIR = "$PREFIX/include"; |
| 70 | my $LIBDIR = "$PREFIX/lib"; |
| 71 | my $BINDIR = "$PREFIX/bin"; |
| 72 | $LIBDIR = "$ABS_RUN_DIR/lib"; |
| 73 | $BINDIR = "$ABS_RUN_DIR/bin"; |
| 74 | if ($ABS_RUN_DIR eq $ABS_OBJ_ROOT) { |
| 75 | # If we are running out of the build directory, the include dir is in the |
| 76 | # srcdir. |
| 77 | $INCLUDEDIR = "$LLVM_SRC_ROOT/include"; |
| 78 | } else { |
| 79 | $INCLUDEDIR = "$ABS_RUN_DIR/include"; |
| 80 | } |
Chris Lattner | e02b97b | 2006-06-02 01:23:18 +0000 | [diff] [blame] | 81 | |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 82 | sub usage; |
| 83 | sub fix_library_names (@); |
| 84 | sub expand_dependecies (@); |
| 85 | sub name_map_entries; |
| 86 | |
| 87 | # Parse our command-line arguments. |
| 88 | usage if @ARGV == 0; |
| 89 | my @components; |
| 90 | my $has_opt = 0; |
| 91 | my $want_libs = 0; |
| 92 | my $want_libnames = 0; |
| 93 | my $want_components = 0; |
| 94 | foreach my $arg (@ARGV) { |
| 95 | if ($arg =~ /^-/) { |
| 96 | if ($arg eq "--version") { |
| 97 | $has_opt = 1; print "$VERSION\n"; |
| 98 | } elsif ($arg eq "--prefix") { |
| 99 | $has_opt = 1; print "$PREFIX\n"; |
| 100 | } elsif ($arg eq "--bindir") { |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 101 | $has_opt = 1; print "$BINDIR\n"; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 102 | } elsif ($arg eq "--includedir") { |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 103 | $has_opt = 1; print "$INCLUDEDIR\n"; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 104 | } elsif ($arg eq "--libdir") { |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 105 | $has_opt = 1; print "$LIBDIR\n"; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 106 | } elsif ($arg eq "--cxxflags") { |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 107 | $has_opt = 1; print "-I$INCLUDEDIR $CXXFLAGS\n"; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 108 | } elsif ($arg eq "--ldflags") { |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 109 | $has_opt = 1; print "-L$LIBDIR $LDFLAGS\n"; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 110 | } elsif ($arg eq "--libs") { |
| 111 | $has_opt = 1; $want_libs = 1; |
| 112 | } elsif ($arg eq "--libnames") { |
| 113 | $has_opt = 1; $want_libnames = 1; |
| 114 | } elsif ($arg eq "--components") { |
| 115 | $has_opt = 1; print join(' ', name_map_entries), "\n"; |
| 116 | } elsif ($arg eq "--targets-built") { |
| 117 | $has_opt = 1; print join(' ', @TARGETS_BUILT), "\n"; |
| 118 | } else { |
| 119 | usage(); |
| 120 | } |
| 121 | } else { |
| 122 | push @components, $arg; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | # If no options were specified, fail. |
| 127 | usage unless $has_opt; |
| 128 | |
| 129 | # If no components were specified, default to 'all'. |
| 130 | if (@components == 0) { |
| 131 | push @components, 'all'; |
| 132 | } |
| 133 | |
| 134 | # Handle any arguments which require building our dependency graph. |
| 135 | if ($want_libs || $want_libnames) { |
| 136 | my @libs = expand_dependecies(@components); |
| 137 | if ($want_libs) { |
| 138 | print join(' ', fix_library_names(@libs)), "\n"; |
| 139 | } |
| 140 | if ($want_libnames) { |
| 141 | print join(' ', @libs), "\n"; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | exit 0; |
| 146 | |
| 147 | #========================================================================== |
| 148 | # Support Routines |
| 149 | #========================================================================== |
| 150 | |
| 151 | sub usage { |
| 152 | print STDERR <<__EOD__; |
| 153 | Usage: llvm-config <OPTION>... [<COMPONENT>...] |
| 154 | |
| 155 | Get various configuration information needed to compile programs which use |
| 156 | LLVM. Typically called from 'configure' scripts. Examples: |
| 157 | llvm-config --cxxflags |
| 158 | llvm-config --ldflags |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 159 | llvm-config --libs engine bcreader scalaropts |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 160 | |
| 161 | Options: |
| 162 | --version LLVM version. |
| 163 | --prefix Installation prefix. |
| 164 | --bindir Directory containing LLVM executables. |
| 165 | --includedir Directory containing LLVM headers. |
| 166 | --libdir Directory containing LLVM libraries. |
| 167 | --cxxflags C++ compiler flags for files that include LLVM headers. |
| 168 | --ldflags Linker flags. |
| 169 | --libs Libraries needed to link against LLVM components. |
| 170 | --libnames Bare library names for in-tree builds. |
| 171 | --components List of all possible components. |
| 172 | --targets-built List of all targets currently built. |
| 173 | Typical components: |
| 174 | all All LLVM libraries (default). |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 175 | backend Either a native backend or the C backend. |
| 176 | engine Either a native JIT or a bytecode interpreter. |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 177 | __EOD__ |
| 178 | exit(1); |
| 179 | } |
| 180 | |
| 181 | # Use -lfoo instead of libfoo.a whenever possible, and add directories to |
| 182 | # files which can't be found using -L. |
| 183 | sub fix_library_names (@) { |
| 184 | my @libs = @_; |
| 185 | my @result; |
| 186 | foreach my $lib (@libs) { |
| 187 | # Transform the bare library name appropriately. |
| 188 | my ($basename) = ($lib =~ /^lib([^.]*)\.a/); |
| 189 | if (defined $basename) { |
| 190 | push @result, "-l$basename"; |
| 191 | } else { |
Chris Lattner | 16ad618 | 2006-06-02 21:48:10 +0000 | [diff] [blame^] | 192 | push @result, "$LIBDIR/$lib"; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | return @result; |
| 196 | } |
| 197 | |
| 198 | |
| 199 | #========================================================================== |
| 200 | # Library Dependency Analysis |
| 201 | #========================================================================== |
| 202 | # Given a few human-readable library names, find all their dependencies |
| 203 | # and sort them into an order which the linker will like. If we packed |
| 204 | # our libraries into fewer archives, we could make the linker do much |
| 205 | # of this work for us. |
| 206 | # |
| 207 | # Libraries have two different types of names in this code: Human-friendly |
| 208 | # "component" names entered on the command-line, and the raw file names |
| 209 | # we use internally (and ultimately pass to the linker). |
| 210 | # |
| 211 | # To understand this code, you'll need a working knowledge of Perl 5, |
| 212 | # and possibly some quality time with 'man perlref'. |
| 213 | |
| 214 | sub load_dependencies; |
| 215 | sub build_name_map; |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 216 | sub have_native_backend; |
| 217 | sub find_best_engine; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 218 | sub expand_names (@); |
| 219 | sub find_all_required_sets (@); |
| 220 | sub find_all_required_sets_helper ($$@); |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 221 | |
| 222 | # Each "set" contains one or more libraries which must be included as a |
| 223 | # group (due to cyclic dependencies). Sets are represented as a Perl array |
| 224 | # reference pointing to a list of internal library names. |
| 225 | my @SETS; |
| 226 | |
| 227 | # Various mapping tables. |
| 228 | my %LIB_TO_SET_MAP; # Maps internal library names to their sets. |
| 229 | my %SET_DEPS; # Maps sets to a list of libraries they depend on. |
| 230 | my %NAME_MAP; # Maps human-entered names to internal names. |
| 231 | |
| 232 | # Have our dependencies been loaded yet? |
| 233 | my $DEPENDENCIES_LOADED = 0; |
| 234 | |
| 235 | # Given a list of human-friendly component names, translate them into a |
| 236 | # complete set of linker arguments. |
| 237 | sub expand_dependecies (@) { |
| 238 | my @libs = @_; |
| 239 | load_dependencies; |
| 240 | my @required_sets = find_all_required_sets(expand_names(@libs)); |
| 241 | my @sorted_sets = topologically_sort_sets(@required_sets); |
| 242 | |
Chris Lattner | 06e752e | 2006-06-02 00:56:15 +0000 | [diff] [blame] | 243 | # Expand the library sets into libraries. |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 244 | my @result; |
| 245 | foreach my $set (@sorted_sets) { push @result, @{$set}; } |
Chris Lattner | 06e752e | 2006-06-02 00:56:15 +0000 | [diff] [blame] | 246 | return @result; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | # Load in the raw dependency data stored at the end of this file. |
| 250 | sub load_dependencies { |
| 251 | return if $DEPENDENCIES_LOADED; |
| 252 | $DEPENDENCIES_LOADED = 1; |
| 253 | while (<DATA>) { |
| 254 | # Parse our line. |
| 255 | my ($libs, $deps) = /^(^[^:]+): ?(.*)$/; |
| 256 | die "Malformed dependency data" unless defined $deps; |
| 257 | my @libs = split(' ', $libs); |
| 258 | my @deps = split(' ', $deps); |
| 259 | |
| 260 | # Record our dependency data. |
| 261 | my $set = \@libs; |
| 262 | push @SETS, $set; |
| 263 | foreach my $lib (@libs) { $LIB_TO_SET_MAP{$lib} = $set; } |
| 264 | $SET_DEPS{$set} = \@deps; |
| 265 | } |
| 266 | build_name_map; |
| 267 | } |
| 268 | |
| 269 | # Build a map converting human-friendly component names into internal |
| 270 | # library names. |
| 271 | sub build_name_map { |
| 272 | # Add entries for all the actual libraries. |
| 273 | foreach my $set (@SETS) { |
| 274 | foreach my $lib (sort @$set) { |
| 275 | my $short_name = $lib; |
| 276 | $short_name =~ s/^(lib)?LLVM([^.]*)\..*$/$2/; |
| 277 | $short_name =~ tr/A-Z/a-z/; |
| 278 | $NAME_MAP{$short_name} = [$lib]; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | # Add virtual entries. |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 283 | $NAME_MAP{'native'} = have_native_backend() ? [$ARCH] : []; |
| 284 | $NAME_MAP{'backend'} = have_native_backend() ? ['native'] : ['cbackend']; |
| 285 | $NAME_MAP{'engine'} = find_best_engine; |
| 286 | $NAME_MAP{'all'} = [name_map_entries]; # Must be last. |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 287 | } |
| 288 | |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 289 | # Return true if we have a native backend to use. |
| 290 | sub have_native_backend { |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 291 | my %BUILT; |
| 292 | foreach my $target (@TARGETS_BUILT) { $BUILT{$target} = 1; } |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 293 | return defined $NAME_MAP{$ARCH} && defined $BUILT{$ARCH}; |
| 294 | } |
| 295 | |
| 296 | # Find a working subclass of ExecutionEngine for this platform. |
| 297 | sub find_best_engine { |
| 298 | if (have_native_backend && $TARGET_HAS_JIT) { |
Reid Spencer | 1c070fc | 2006-03-24 01:10:39 +0000 | [diff] [blame] | 299 | return ['jit', 'native']; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 300 | } else { |
Reid Spencer | b195d9d | 2006-03-23 23:21:29 +0000 | [diff] [blame] | 301 | return ['interpreter']; |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 302 | } |
| 303 | } |
| 304 | |
| 305 | # Get all the human-friendly component names. |
| 306 | sub name_map_entries { |
| 307 | load_dependencies; |
| 308 | return sort keys %NAME_MAP; |
| 309 | } |
| 310 | |
| 311 | # Map human-readable names to internal library names. |
| 312 | sub expand_names (@) { |
| 313 | my @names = @_; |
| 314 | my @result; |
| 315 | foreach my $name (@names) { |
| 316 | if (defined $LIB_TO_SET_MAP{$name}) { |
| 317 | # We've hit bottom: An actual library name. |
| 318 | push @result, $name; |
| 319 | } elsif (defined $NAME_MAP{$name}) { |
| 320 | # We've found a short name to expand. |
| 321 | push @result, expand_names(@{$NAME_MAP{$name}}); |
| 322 | } else { |
| 323 | print STDERR "llvm-config: unknown component name: $name\n"; |
| 324 | exit(1); |
| 325 | } |
| 326 | } |
| 327 | return @result; |
| 328 | } |
| 329 | |
| 330 | # Given a list of internal library names, return all sets of libraries which |
| 331 | # will need to be included by the linker (in no particular order). |
| 332 | sub find_all_required_sets (@) { |
| 333 | my @libs = @_; |
| 334 | my %sets_added; |
| 335 | my @result; |
| 336 | find_all_required_sets_helper(\%sets_added, \@result, @libs); |
| 337 | return @result; |
| 338 | } |
| 339 | |
| 340 | # Recursive closures are pretty broken in Perl, so we're going to separate |
| 341 | # this function from find_all_required_sets and pass in the state we need |
| 342 | # manually, as references. Yes, this is fairly unpleasant. |
| 343 | sub find_all_required_sets_helper ($$@) { |
| 344 | my ($sets_added, $result, @libs) = @_; |
| 345 | foreach my $lib (@libs) { |
| 346 | my $set = $LIB_TO_SET_MAP{$lib}; |
| 347 | next if defined $$sets_added{$set}; |
| 348 | $$sets_added{$set} = 1; |
| 349 | push @$result, $set; |
| 350 | find_all_required_sets_helper($sets_added, $result, @{$SET_DEPS{$set}}); |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | # Print a list of sets, with a label. Used for debugging. |
| 355 | sub print_sets ($@) { |
| 356 | my ($label, @sets) = @_; |
| 357 | my @output; |
| 358 | foreach my $set (@sets) { push @output, join(',', @$set); } |
| 359 | print "$label: ", join(';', @output), "\n"; |
| 360 | } |
| 361 | |
| 362 | # Returns true if $lib is a key in $added. |
| 363 | sub has_lib_been_added ($$) { |
| 364 | my ($added, $lib) = @_; |
| 365 | return defined $$added{$LIB_TO_SET_MAP{$lib}}; |
| 366 | } |
| 367 | |
| 368 | # Returns true if all the dependencies of $set appear in $added. |
| 369 | sub have_all_deps_been_added ($$) { |
| 370 | my ($added, $set) = @_; |
| 371 | #print_sets(" Checking", $set); |
| 372 | #print_sets(" Wants", $SET_DEPS{$set}); |
| 373 | foreach my $lib (@{$SET_DEPS{$set}}) { |
| 374 | return 0 unless has_lib_been_added($added, $lib); |
| 375 | } |
| 376 | return 1; |
| 377 | } |
| 378 | |
| 379 | # Given a list of sets, topologically sort them using dependencies. |
| 380 | sub topologically_sort_sets (@) { |
| 381 | my @sets = @_; |
| 382 | my %added; |
| 383 | my @result; |
| 384 | SCAN: while (@sets) { # We'll delete items from @sets as we go. |
| 385 | #print_sets("So far", reverse(@result)); |
| 386 | #print_sets("Remaining", @sets); |
| 387 | for (my $i = 0; $i < @sets; ++$i) { |
| 388 | my $set = $sets[$i]; |
| 389 | if (have_all_deps_been_added(\%added, $set)) { |
| 390 | push @result, $set; |
| 391 | $added{$set} = 1; |
| 392 | #print "Removing $i.\n"; |
| 393 | splice(@sets, $i, 1); |
| 394 | next SCAN; # Restart our scan. |
| 395 | } |
| 396 | } |
| 397 | die "Can't find a library with no dependencies"; |
| 398 | } |
| 399 | return reverse(@result); |
| 400 | } |
| 401 | |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 402 | # Our library dependency data will be added after the '__END__' token, and will |
| 403 | # be read through the magic <DATA> filehandle. |
| 404 | __END__ |