#!@PERL@ # # Program: llvm-config # # Synopsis: Prints out compiler options needed to build against an installed # copy of LLVM. # # Syntax: lllvm-config OPTIONS... [COMPONENTS...] # # This file was written by Eric Kidd, and is placed into the public domain. # use 5.006; use strict; use warnings; #---- begin autoconf values ---- my $VERSION = q{@PACKAGE_VERSION@}; my $PREFIX = q{@LLVM_PREFIX@}; my $BINDIR = q{@LLVM_BINDIR@}; my $INCLUDEDIR = q{@LLVM_INCLUDEDIR@}; my $LIBDIR = q{@LLVM_LIBDIR@}; my $ARCH = lc(q{@ARCH@}); my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@}; my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@}; #---- end autoconf values ---- #---- begin Makefile values ---- my $CXXFLAGS = q{@LLVM_CXXFLAGS@}; my $LDFLAGS = q{@LLVM_LDFLAGS@}; my $CORE_IS_ARCHIVE = q{@CORE_IS_ARCHIVE@}; #---- end Makefile values ---- sub usage; sub fix_library_names (@); sub expand_dependecies (@); sub name_map_entries; # Parse our command-line arguments. usage if @ARGV == 0; my @components; my $has_opt = 0; my $want_libs = 0; my $want_libnames = 0; my $want_components = 0; foreach my $arg (@ARGV) { if ($arg =~ /^-/) { if ($arg eq "--version") { $has_opt = 1; print "$VERSION\n"; } elsif ($arg eq "--prefix") { $has_opt = 1; print "$PREFIX\n"; } elsif ($arg eq "--bindir") { $has_opt = 1; print "$BINDIR\n"; } elsif ($arg eq "--includedir") { $has_opt = 1; print "$INCLUDEDIR\n"; } elsif ($arg eq "--libdir") { $has_opt = 1; print "$LIBDIR\n"; } elsif ($arg eq "--cxxflags") { $has_opt = 1; print "-I$INCLUDEDIR $CXXFLAGS\n"; } elsif ($arg eq "--ldflags") { $has_opt = 1; print "-L$LIBDIR $LDFLAGS\n"; } elsif ($arg eq "--libs") { $has_opt = 1; $want_libs = 1; } elsif ($arg eq "--libnames") { $has_opt = 1; $want_libnames = 1; } elsif ($arg eq "--components") { $has_opt = 1; print join(' ', name_map_entries), "\n"; } elsif ($arg eq "--targets-built") { $has_opt = 1; print join(' ', @TARGETS_BUILT), "\n"; } else { usage(); } } else { push @components, $arg; } } # If no options were specified, fail. usage unless $has_opt; # If no components were specified, default to 'all'. if (@components == 0) { push @components, 'all'; } # Handle any arguments which require building our dependency graph. if ($want_libs || $want_libnames) { my @libs = expand_dependecies(@components); if ($want_libs) { print join(' ', fix_library_names(@libs)), "\n"; } if ($want_libnames) { print join(' ', @libs), "\n"; } } exit 0; #========================================================================== # Support Routines #========================================================================== sub usage { print STDERR <<__EOD__; Usage: llvm-config