📄 automake.in
字号:
if ($xname ne '' && ! &variable_defined ($xname . '_DEPENDENCIES', $cond)) { &define_pretty_variable ($xname . '_DEPENDENCIES', $cond, @dep_list); } return $seen_libobjs;}# Canonicalize a name, and check to make sure the non-canonical name# is never used. Returns canonical name. Arguments are name and a# list of suffixes to check for.sub check_canonical_spelling{ local ($name, @suffixes) = @_; local ($xname, $xt); ($xname = $name) =~ tr/A-Za-z0-9_/_/c; if ($xname ne $name) { local ($xt); foreach $xt (@suffixes) { &am_line_error ($name . $xt, "invalid variable \`" . $name . $xt . "'; should be \`" . $xname . $xt . "'") if &variable_defined ($name . $xt); } } return $xname;}# Handle C programs.sub handle_programs{ local (@proglist) = &am_install_var ('-clean', 'progs', 'PROGRAMS', 'bin', 'sbin', 'libexec', 'pkglib', 'noinst', 'check'); return if ! @proglist; # If a program is installed, this is required. We only want this # error to appear once. &am_conf_error ("AC_ARG_PROGRAM must be used in \`$configure_ac'") unless $seen_arg_prog; $seen_arg_prog = 1; local ($one_file, $xname, $munge); local ($seen_libobjs) = 0; foreach $one_file (@proglist) { local ($obj) = &get_object_extension ($one_file); # Canonicalize names and check for misspellings. $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', '_SOURCES', '_OBJECTS', '_DEPENDENCIES'); # FIXME: Using a trick to figure out if any lex sources appear # in our program; should use some cleaner method. local ($lex_num) = scalar (keys %lex_sources); local ($linker) = &handle_source_transform ($xname, $one_file, $obj); local ($lex_file_seen) = (scalar (keys %lex_sources) > $lex_num); local ($xt) = ''; if (&variable_defined ($xname . "_LDADD")) { if (&handle_lib_objects ($xname, $xname . '_LDADD', $lex_file_seen)) { $seen_libobjs = 1; } $lex_file_seen = 0; $xt = '_LDADD'; } else { # User didn't define prog_LDADD override. So do it. &define_variable ($xname . '_LDADD', '$(LDADD)'); # This does a bit too much work. But we need it to # generate _DEPENDENCIES when appropriate. if (&variable_defined ('LDADD')) { if (&handle_lib_objects ($xname, 'LDADD', $lex_file_seen)) { $seen_libobjs = 1; } $lex_file_seen = 0; } elsif (! &variable_defined ($xname . '_DEPENDENCIES')) { &define_variable ($xname . '_DEPENDENCIES', ''); } $xt = '_SOURCES' } if (&variable_defined ($xname . '_LIBADD')) { &am_line_error ($xname . '_LIBADD', "use \`" . $xname . "_LDADD', not \`" . $xname . "_LIBADD'"); } if (! &variable_defined ($xname . '_LDFLAGS')) { # Define the prog_LDFLAGS variable. &define_variable ($xname . '_LDFLAGS', ''); } # Determine program to use for link. local ($xlink); if (&variable_defined ($xname . '_LINK')) { $xlink = $xname . '_LINK'; } else { $xlink = $linker ? $linker : 'LINK'; } local ($xexe); if ($seen_exeext && $one_file !~ /\./) { $xexe = 's/\@EXEEXT\@/\$(EXEEXT)/g;'; } else { $xexe = 's/\@EXEEXT\@//g;'; } $output_rules .= &file_contents_with_transform ('s/\@PROGRAM\@/' . $one_file . '/go;' . 's/\@XPROGRAM\@/' . $xname . '/go;' . 's/\@XLINK\@/' . $xlink . '/go;' . $xexe, 'program'); } if (&variable_defined ('LDADD') && &handle_lib_objects ('', 'LDADD', 0)) { $seen_libobjs = 1; } if ($seen_libobjs) { foreach $one_file (@proglist) { # Canonicalize names. ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c; if (&variable_defined ($xname . '_LDADD')) { &check_libobjs_sources ($xname, $xname . '_LDADD'); } elsif (&variable_defined ('LDADD')) { &check_libobjs_sources ($xname, 'LDADD'); } } }}# Handle libraries.sub handle_libraries{ local (@liblist) = &am_install_var ('-clean', 'libs', 'LIBRARIES', 'lib', 'pkglib', 'noinst', 'check'); return if ! @liblist; local (%valid) = &am_primary_prefixes ('LIBRARIES', 'lib', 'pkglib', 'noinst', 'check'); if (! defined $configure_vars{'RANLIB'}) { local ($key); foreach $key (keys %valid) { if (&variable_defined ($key . '_LIBRARIES')) { &am_line_error ($key . '_LIBRARIES', "library used but \`RANLIB' not defined in \`$configure_ac'"); # Only get this error once. If this is ever printed, # we have a bug. $configure_vars{'RANLIB'} = 'BUG'; last; } } } local ($onelib); local ($munge); local ($xlib); local ($seen_libobjs) = 0; foreach $onelib (@liblist) { # Check that the library fits the standard naming convention. if ($onelib !~ /^lib.*\.a$/) { # FIXME should put line number here. That means mapping # from library name back to variable name. &am_error ("\`$onelib' is not a standard library name"); } local ($obj) = &get_object_extension ($onelib); # Canonicalize names and check for misspellings. $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES'); if (&variable_defined ($xlib . '_LIBADD')) { if (&handle_lib_objects ($xlib, $xlib . '_LIBADD', 0)) { $seen_libobjs = 1; } } else { # Generate support for conditional object inclusion in # libraries. &define_variable ($xlib . "_LIBADD", ''); } if (&variable_defined ($xlib . '_LDADD')) { &am_line_error ($xlib . '_LDADD', "use \`" . $xlib . "_LIBADD', not \`" . $xlib . "_LDADD'"); } # Make sure we at look at this. &examine_variable ($xlib . '_DEPENDENCIES'); &handle_source_transform ($xlib, $onelib, $obj); $output_rules .= &file_contents_with_transform ('s/\@LIBRARY\@/' . $onelib . '/go;' . 's/\@XLIBRARY\@/' . $xlib . '/go;', 'library'); } if ($seen_libobjs) { foreach $onelib (@liblist) { # Canonicalize names. ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; if (&variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); } } } &define_variable ('AR', 'ar'); &define_configure_variable ('RANLIB');}# Handle shared libraries.sub handle_ltlibraries{ local (@liblist) = &am_install_var ('-clean', 'ltlib', 'LTLIBRARIES', 'noinst', 'lib', 'pkglib'); return if ! @liblist; local (%instdirs); local (%valid) = &am_primary_prefixes ('LTLIBRARIES', 'lib', 'pkglib', 'noinst'); local ($key); foreach $key (keys %valid) { if (&variable_defined ($key . '_LTLIBRARIES')) { if (!$seen_libtool) { &am_line_error ($key . '_LTLIBRARIES', "library used but \`LIBTOOL' not defined in \`$configure_ac'"); # Only get this error once. If this is ever printed, # we have a bug. $configure_vars{'LIBTOOL'} = 'BUG'; $seen_libtool = 1; } # Get the installation directory of each library. for (&variable_value_as_list ($key . '_LTLIBRARIES', 'all')) { if ($instdirs{$_}) { &am_error ("\`$_' is already going to be installed in \`$instdirs{$_}'"); } else { $instdirs{$_} = $key; } } } } local ($onelib); local ($munge); local ($xlib); local ($seen_libobjs) = 0; foreach $onelib (@liblist) { local ($obj) = &get_object_extension ($onelib); # Canonicalize names and check for misspellings. $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', '_SOURCES', '_OBJECTS', '_DEPENDENCIES'); if (! &variable_defined ($xlib . '_LDFLAGS')) { # Define the lib_LDFLAGS variable. &define_variable ($xlib . '_LDFLAGS', ''); } # Check that the library fits the standard naming convention. $libname_rx = "^lib.*\.la"; if (&variable_value ($xlib . '_LDFLAGS') =~ /-module/) { # Relax name checking for libtool modules. $libname_rx = "\.la"; } if ($onelib !~ /$libname_rx$/) { # FIXME this should only be a warning for foreign packages # FIXME should put line number here. That means mapping # from library name back to variable name. &am_error ("\`$onelib' is not a standard libtool library name"); } if (&variable_defined ($xlib . '_LIBADD')) { if (&handle_lib_objects ($xlib, $xlib . '_LIBADD', 0)) { $seen_libobjs = 1; } } else { # Generate support for conditional object inclusion in # libraries. &define_variable ($xlib . "_LIBADD", ''); } if (&variable_defined ($xlib . '_LDADD')) { &am_line_error ($xlib . '_LDADD', "use \`" . $xlib . "_LIBADD', not \`" . $xlib . "_LDADD'"); } # Make sure we at look at this. &examine_variable ($xlib . '_DEPENDENCIES'); local ($linker) = &handle_source_transform ($xlib, $onelib, $obj); # Determine program to use for link. local ($xlink); if (&variable_defined ($xlib . '_LINK')) { $xlink = $xlib . '_LINK'; } else { $xlink = $linker ? $linker : 'LINK'; } local ($rpath); if ($instdirs{$onelib} eq 'EXTRA' || $instdirs{$onelib} eq 'noinst') { # It's an EXTRA_ library, so we can't specify -rpath, # because we don't know where the library will end up. # The user probably knows, but generally speaking automake # doesn't -- and in fact configure could decide # dynamically between two different locations. $rpath = 's/\@RPATH\@//go;'; } else { $rpath = ('s/\@RPATH\@/-rpath \$(' . $instdirs{$onelib} . 'dir)/go;'); } $output_rules .= &file_contents_with_transform ('s/\@LTLIBRARY\@/' . $onelib . '/go;' . 's/\@XLTLIBRARY\@/' . $xlib . '/go;' . $rpath . 's/\@XLINK\@/' . $xlink . '/go;', 'ltlibrary'); } if ($seen_libobjs) { foreach $onelib (@liblist) { # Canonicalize names. ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; if (&variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); } } }}# See if any _SOURCES variable were misspelled. Also, make sure that# EXTRA_ variables don't contain configure substitutions.sub check_typos{ local ($varname, $primary); foreach $varname (keys %contents) { foreach $primary ('_SOURCES', '_LIBADD', '_LDADD', '_LDFLAGS', '_DEPENDENCIES') { if ($varname =~ /$primary$/ && ! $content_seen{$varname}) { &am_line_error ($varname, "invalid unused variable name: \`$varname'"); } } }}# Handle scripts.sub handle_scripts{ # NOTE we no longer automatically clean SCRIPTS, because it is # useful to sometimes distribute scripts verbatim. This happens # eg in Automake itself. &am_install_var ('scripts', 'SCRIPTS', 'bin', 'sbin', 'libexec', 'pkgdata', 'noinst', 'check'); local ($scripts_installed) = 0; # Set $scripts_installed if appropriate. Make sure we only find # scripts which are actually installed -- this is why we can't # simply use the return value of am_install_var. local (%valid) = &am_primary_prefixes ('SCRIPTS', 'bin', 'sbin', 'libexec', 'pkgdata', 'noinst', 'check'); local ($key); foreach $key (keys %valid) { if ($key ne 'noinst' && $key ne 'check' && &variable_defined ($key . '_SCRIPTS')) { $scripts_installed = 1; # push (@check_tests, 'check-' . $key . 'SCRIPTS'); } } if ($scripts_installed) { # If a program is installed, this is required. We only want this # error to appear once. &am_conf_error ("AC_ARG_PROGRAM must be used in \`$configure_ac'") unless $seen_arg_prog; $seen_arg_prog = 1; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -