├── .gitattributes
├── .gitignore
├── .gitmodules
├── .prev-version
├── .x-update-copyright
├── AUTHORS
├── ChangeLog.old
├── HACKING
├── Makefile.am
├── NEWS
├── NO-THANKS
├── PORTING
├── README.md
├── TODO
├── bootstrap
├── bootstrap.conf
├── build-aux
├── .gitignore
├── edit-readme-alpha
├── git-hooks
│ └── commit-msg
├── git-log-fix
├── ltmain.in
├── no-bogus-m4-defines
└── thanks-gen
├── cfg.mk
├── configure.ac
├── doc
├── .gitignore
├── PLATFORMS
├── libtool.texi
└── notes.texi
├── gl
├── build-aux
│ ├── announce-gen.diff
│ └── do-release-commit-and-tag.diff
└── top
│ └── README-release.diff
├── libltdl
├── .gitignore
├── README
├── configure.ac
├── libltdl
│ ├── lt__alloc.h
│ ├── lt__argz_.h
│ ├── lt__dirent.h
│ ├── lt__glibc.h
│ ├── lt__private.h
│ ├── lt__strl.h
│ ├── lt_dlloader.h
│ ├── lt_error.h
│ ├── lt_system.h
│ └── slist.h
├── loaders
│ ├── dld_link.c
│ ├── dlopen.c
│ ├── dyld.c
│ ├── load_add_on.c
│ ├── loadlibrary.c
│ ├── preopen.c
│ └── shl_load.c
├── lt__alloc.c
├── lt__argz.c
├── lt__dirent.c
├── lt__strl.c
├── lt_dlloader.c
├── lt_error.c
├── ltdl.c
├── ltdl.h
├── ltdl.mk
└── slist.c
├── libtoolize.in
├── m4
├── .gitignore
├── autobuild.m4
├── libtool.m4
├── ltargz.m4
├── ltdl.m4
├── ltoptions.m4
├── ltsugar.m4
├── ltversion.in
├── lt~obsolete.m4
└── m4.m4
├── mail
├── LTLIBOBJ
├── amiga
├── c++
├── cygwin32
├── deplibs
├── deplibs.html
├── docs
├── libc_s
├── patches
├── perms
└── rpath
└── tests
├── .gitignore
├── TODO
├── am-subdir.at
├── archive-in-archive.at
├── bindir.at
├── bug_42313.at
├── bug_62343.at
├── bug_71489.at
├── cdemo.at
├── cmdline_wrap.at
├── configure-funcs.at
├── configure-iface.at
├── convenience.at
├── ctor.at
├── cwrapper.at
├── darwin.at
├── demo.at
├── depdemo.at
├── deplib-in-subdir.at
├── deplibs-ident.at
├── deplibs-mingw.at
├── destdir.at
├── dlloader-api.at
├── dumpbin-symbols.at
├── duplicate_conv.at
├── duplicate_deps.at
├── duplicate_members.at
├── early-libtool.at
├── exceptions.at
├── execute-mode.at
├── exeext.at
├── export-def.at
├── export.at
├── f77demo.at
├── fail.at
├── fcdemo.at
├── flags.at
├── help.at
├── indirect_deps.at
├── infer-tag.at
├── inherited_flags.at
├── install.at
├── lalib-syntax.at
├── libtool.at
├── libtoolize.at
├── link-order.at
├── link-order2.at
├── loadlibrary.at
├── localization.at
├── lt_dladvise.at
├── lt_dlexit.at
├── lt_dlopen.at
├── lt_dlopen_a.at
├── lt_dlopenext.at
├── ltdl-api.at
├── ltdl-libdir.at
├── mdemo.at
├── need_lib_prefix.at
├── no-executables.at
├── nocase.at
├── nonrecursive.at
├── old-m4-iface.at
├── pic_flag.at
├── recursive.at
├── resident.at
├── runpath-in-lalib.at
├── search-path.at
├── shlibpath.at
├── slist.at
├── standalone.at
├── static.at
├── stresstest.at
├── subproject.at
├── sysroot.at
├── tagdemo.at
├── template.at
├── testsuite.at
├── versioning.at
└── with-pic.at
/.gitattributes:
--------------------------------------------------------------------------------
1 | ChangeLog merge=merge-changelog
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.aux
2 | *.cp
3 | *.cps
4 | *.dvi
5 | *.exe
6 | *.fn
7 | *.info*
8 | *.ky
9 | *.la
10 | *.lo
11 | *.log
12 | *.o
13 | *.obj
14 | *.orig
15 | *.pdf
16 | *.pg
17 | *.ps
18 | *.rej
19 | *.toc
20 | *.tp
21 | *.vr
22 | *~
23 | +build
24 | +dest
25 | +inst
26 | .#*
27 | .*.prcs_aux
28 | .DS_Store
29 | .deps
30 | .dirstamp
31 | .gdb_history
32 | .gitmodules
33 | .libs
34 | /.pc
35 | /.sc-start*
36 | /.serial
37 | /.version
38 | /COPYING
39 | /ChangeLog
40 | /GNUmakefile
41 | /INSTALL
42 | /README-release
43 | /gnulib-local
44 | /gnulib-tests
45 | /libtoolize
46 | /libtoolize.in
47 | /maint.mk
48 | /patches
49 | /release
50 | Makefile
51 | Makefile.in
52 | README
53 | \#*#
54 | _libs
55 | acinclude.m4
56 | aclocal.m4
57 | atconfig
58 | autom4te.cache
59 | config-h.in
60 | config.*
61 | configure
62 | conftest*
63 | libtool
64 | libtool-*.tar.bz2
65 | libtool-*.tar.gz
66 | libtool-*.tar.lzma
67 | libtool-*.tar.xz
68 | manual.html
69 | patches
70 | stamp-*
71 | testdir*
72 | testsuite
73 | testsuite.dir
74 | testsuite.log
75 | vc-diffs
76 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "gnulib"]
2 | path = gnulib
3 | url = https://git.savannah.gnu.org/git/gnulib
4 | [submodule "bootstrap"]
5 | path = gl-mod/bootstrap
6 | url = https://github.com/gnulib-modules/bootstrap.git
7 |
--------------------------------------------------------------------------------
/.prev-version:
--------------------------------------------------------------------------------
1 | 2.5.3
2 |
--------------------------------------------------------------------------------
/.x-update-copyright:
--------------------------------------------------------------------------------
1 | ChangeLog.old
2 | \.diff$
3 | \.patch$
4 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | * GNU Libtool was conceived, designed and implemented by:
2 |
3 | Gordon Matzigkeit gord@gnu.org
4 |
5 | * GNU Libtool's Dynamic Loader library (libltdl) was conceived,
6 | designed and implemented by:
7 |
8 | Thomas Tanner tanner@ffii.org
9 |
10 | * GNU Libtool and libltdl have previously been maintained, enhanced,
11 | ported and otherwise advanced by:
12 |
13 | Alexandre Oliva oliva@dcc.unicamp.br
14 | Ossama Othman ossama@debian.org
15 | Robert Boehne rboehne@ricardo-us.com
16 | Scott James Remnant scott@netsplit.com
17 | Peter O'Gorman peter@pogma.com
18 | Ralf Wildenhues Ralf.Wildenhues@gmx.de
19 | Gary V. Vaughan gary@vaughan.pe
20 | Bob Friesenhahn bfriesen@simple.dallas.tx.us
21 | Peter Rosin peda@lysator.liu.se
22 | Noah Misch noah@cs.caltech.edu
23 | Charles Wilson libtool@cwilson.fastmail.fm
24 | Brooks Moses bmoses@google.com
25 | Alex Ameen alex.ameen.tx@gmail.com
26 |
27 | * GNU Libtool is currently being cajoled, bullied,
28 | rewritten and otherwise dragged into the future by:
29 |
30 | Ileana Dumitrescu ileanadumitrescu95@gmail.com
31 | --
32 | Copyright (C) 1996, 1998-2019, 2021-2024 Free Software Foundation,
33 | Inc.
34 |
35 | This file is part of GNU Libtool.
36 |
37 | GNU Libtool is free software; you can redistribute it and/or
38 | modify it under the terms of the GNU General Public License as
39 | published by the Free Software Foundation; either version 2 of
40 | the License, or (at your option) any later version.
41 |
42 | GNU Libtool is distributed in the hope that it will be useful,
43 | but WITHOUT ANY WARRANTY; without even the implied warranty of
44 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 | GNU General Public License for more details.
46 |
47 | You should have received a copy of the GNU General Public License
48 | along with GNU Libtool. If not, see .
49 |
--------------------------------------------------------------------------------
/PORTING:
--------------------------------------------------------------------------------
1 | In order to port libtool to a new platform, start by reading the node
2 | 'New ports' in the info document (i.e., the libtool manual).
3 |
4 | If you find that any porting documentation is missing, please
5 | complain! :-) Complaints with patches and improvements to the
6 | documentation, or to libtool itself, are more than welcome. :-) :-)
7 |
--------------------------------------------------------------------------------
/build-aux/.gitignore:
--------------------------------------------------------------------------------
1 | /announce-gen
2 | /ar-lib
3 | /compile
4 | /depcomp
5 | /do-release-commit-and-tag
6 | /gendocs.sh
7 | /git-version-gen
8 | /gnu-web-doc-update
9 | /gnupload
10 | /install-sh
11 | /ltmain.sh
12 | /mdate-sh
13 | /missing
14 | /mkinstalldirs
15 | /test-driver
16 | /texinfo.tex
17 | /useless-if-before-free
18 | /vc-list-files
19 | /gitlog-to-changelog
20 | /update-copyright
21 | /extract-trace
22 | /options-parser
23 | /funclib.sh
24 | /inline-source
25 | /bootstrap.in
26 |
--------------------------------------------------------------------------------
/build-aux/edit-readme-alpha:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # edit-readme-alpha - edit README file for alpha releases
4 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2010
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | # We used to maintain separate (but extremely similar!) README and
24 | # README.alpha files, and had 'make dist' include the right one in a
25 | # distribution based on the contests of '$(VERSION)'.
26 | #
27 | # Now, we have 'make dist' call this script to tweak the first paragraph
28 | # of README in situ, to be more suitable for an alpha quality release.
29 |
30 | EXIT_SUCCESS=0
31 | EXIT_FAILURE=1
32 |
33 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
34 | # is ksh but when the shell is invoked as "sh" and the current value of
35 | # the _XPG environment variable is not equal to 1 (one), the special
36 | # positional parameter $0, within a function call, is the name of the
37 | # function.
38 | progpath=$0
39 |
40 | # The name of this program:
41 | progname=`echo "$progpath" |sed 's|^.*/||'`
42 |
43 |
44 | # func_fatal_error ARG...
45 | # -----------------------
46 | # Echo program name prefixed message to standard error, and exit.
47 | func_fatal_error ()
48 | {
49 | echo "$progname: $*" >&2
50 | exit $EXIT_FAILURE
51 | }
52 |
53 |
54 | for file in "$@"; do
55 | # Assume that read-only README indicates that we are running inside
56 | # the latter part of a 'make distcheck'.
57 | test -w "$file" || {
58 | echo "$progname: not editing non-writeable '$file' (distcheck?)" >&2
59 | continue
60 | }
61 |
62 | # Did we already in-place edited this file?
63 | matched=`sed -n -e '/^This is an alpha testing release/,/a consistent, portable interface\.$/p' $file \
64 | |wc -l |sed 's|^ *||'`
65 | test 3 = "$matched" && {
66 | echo "$progname: $file already edited" >&2
67 | continue
68 | }
69 |
70 | # Make sure the paragraph we are matching has not been edited since
71 | # this script was written.
72 | matched=`sed -n -e '/^\[GNU Libtool\]\[libtool\] is/,/^consistent, portable interface\.$/p' $file \
73 | |wc -l |sed 's|^ *||'`
74 | test 3 = "$matched" \
75 | || func_fatal_error "$file format has changed, please fix '$0'"
76 |
77 | # Don't leave file droppings.
78 | trap 'x=$?; rm $file.T; exit $x' 1 2 13 15
79 |
80 | # Edit the first paragraph to be suitable for an alpha release.
81 | sed '/^\[GNU Libtool\]\[libtool\] is/,/^consistent, portable interface\.$/c\
82 | This is an alpha testing release of [GNU Libtool][libtool], a generic\
83 | library support script. [Libtool][] hides the complexity of using shared\
84 | libraries behind a consistent, portable interface.' $file > $file.T
85 |
86 | # Diagnose redirection failure.
87 | test -f "$file.T" || func_fatal_error "Unable to write $file.T"
88 |
89 | # Overwrite the original file with our edited version.
90 | mv $file.T $file || func_fatal_error "Unable to edit $file"
91 | done
92 |
93 | exit $EXIT_SUCCESS
94 |
--------------------------------------------------------------------------------
/build-aux/git-hooks/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # An example hook script for catching duplicate or malformed Co-authored-by
4 | # or Copyright-paperwork-exempt lines in the commit message.
5 | # Written by Gary V. Vaughan , 2011
6 |
7 | # Copyright (C) 2011-2019, 2021-2024 Free Software Foundation, Inc.
8 | # This is free software; see the source for copying conditions. There is NO
9 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 |
11 | # Libtoolize is free software; you can redistribute it and/or modify
12 | # it under the terms of the GNU General Public License as published by
13 | # the Free Software Foundation; either version 2 of the License, or
14 | # (at your option) any later version.
15 | #
16 | # Libtoolize is distributed in the hope that it will be useful, but
17 | # WITHOUT ANY WARRANTY; without even the implied warranty of
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | # GNU General Public License for more details.
20 | #
21 | # You should have received a copy of the GNU General Public License
22 | # along with this program. If not, see .
23 |
24 |
25 | : ${SED="sed"}
26 | test "${ECHO+set}" = set || ECHO='printf %s\n'
27 |
28 | basename='s|^.*/||'
29 |
30 | nl='
31 | '
32 |
33 | progpath=$0
34 | progname=`$ECHO "$progpath" |$SED -e "$basename"`
35 |
36 | log_file=$1
37 | export log_file
38 |
39 | fn_error ()
40 | {
41 | prefix="$progname: error: "
42 |
43 | save_IFS=$IFS
44 | IFS=$nl
45 | for line in $*; do
46 | IFS=$save_IFS
47 | $ECHO "$prefix$line" 1>&2
48 | prefix="$progname: "
49 | done
50 | IFS=$save_IFS
51 | }
52 |
53 | fn_re_edit ()
54 | {
55 | $ECHO 'Press return to edit. Ctrl-C to abort...' >&2
56 | read v
57 | ${EDITOR-'vi'} "$log_file"
58 | }
59 |
60 | fn_rewrite ()
61 | {
62 | # Output once to stderr
63 | fn_error "$*"
64 |
65 | # And again as a comment in the log_file ready for re-editing
66 | $ECHO "$*" |$SED 's|^|# |'
67 | echo
68 | cat "$log_file"
69 | }
70 |
71 | fn_check_msg ()
72 | {
73 | return_status=0
74 |
75 | CAB_re='^Co-authored-by: '
76 | CPR_re='^Copyright-paperwork-exempt: '
77 |
78 | # Flag duplicated Co-authored-by lines.
79 | dups=`grep "$CAB_re" "$log_file" 2>/dev/null \
80 | |sort |uniq -c |sed -e '/^[ ]*1[ ]/d'`
81 |
82 | test -n "$dups" && {
83 | $ECHO 'Duplicate Co-authored-by lines:
84 | '"$dups"
85 | return_status=1
86 | }
87 |
88 | # Make sure each Co-authored-by line contains a valid email.
89 | email_re='<.*@.*\..*>'
90 |
91 | grep "$CAB_re" "$log_file" 2>/dev/null \
92 | |while read CAB; do
93 | test 0 -eq `expr "$CAB" : ".*$email_re"` && {
94 | echo "Malformed or missing email in '$CAB'"
95 | return_status=1
96 | }
97 | done
98 |
99 | # Flag duplicated Copyright-paperwork-exempt lines.
100 | count=`grep "$CPR_re" "$log_file" 2>/dev/null \
101 | |wc |sed -e 's|^[ ]*||;s|[ ].*$||'`
102 |
103 | test 2 -gt "$count" || {
104 | $ECHO 'More than one Copyright-paperwork-exempt line.'
105 | return_status=1
106 | }
107 |
108 | # Make sure Copyright-paperwork-exempt line is valid.
109 | if grep "$CPR_re[Nn]" "$log_file" >/dev/null 2>&1; then
110 | $ECHO "\
111 | 'Copyright-paperwork-exempt: No' is redundant, please remove."
112 | return_status=1
113 | else
114 | not_yes=`grep "$CPR_re" "$log_file" 2>/dev/null \
115 | |grep -v "${CPR_re}Yes\$"`
116 |
117 | test -n "$not_yes" && {
118 | $ECHO "'Copyright-paperwork-exempt' setting must be 'Yes'."
119 | return_status=1
120 | }
121 | fi
122 |
123 | return $return_status
124 | }
125 |
126 | while :; do
127 | err=`fn_check_msg` && break
128 | fn_rewrite "$err" > "${log_file}T" && mv "${log_file}T" "$log_file"
129 | fn_re_edit
130 | done
131 |
--------------------------------------------------------------------------------
/build-aux/no-bogus-m4-defines:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # no-bogus-m4-defines - detect wrong m4 definitions
4 | # -------------------------------------------------
5 | # Try to catch the case where 'aclocal' pulls installed libtool
6 | # macro file contents from another version of libtool into the
7 | # current package 'aclocal.m4'. Currently used by 'make dist'
8 | # and by ./bootstrap (bootstrap.conf).
9 | #
10 | # Copyright (C) 2015-2019, 2021-2024 Free Software Foundation, Inc.
11 | #
12 | # This file is part of GNU Libtool.
13 | #
14 | # GNU Libtool is free software; you can redistribute it and/or
15 | # modify it under the terms of the GNU General Public License as
16 | # published by the Free Software Foundation; either version 2 of
17 | # the License, or (at your option) any later version.
18 | #
19 | # GNU Libtool is distributed in the hope that it will be useful,
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | # GNU General Public License for more details.
23 | #
24 | # You should have received a copy of the GNU General Public License
25 | # along with GNU Libtool. If not, see .
26 |
27 | # Please report bugs or propose patches to bug-libtool@gnu.org.
28 |
29 | . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh
30 | # source this for "GNU m4" detection methods
31 | . `echo "$0" |${SED-sed} 's|[^/]*$||'`/extract-trace
32 |
33 | $require_gnu_m4
34 |
35 | bogus_macros='LT_INIT AC_PROG_LIBTOOL AM_PROG_LIBTOOL'
36 |
37 | bogus_macros_grep=''
38 | for macro in $bogus_macros; do
39 | func_append bogus_macros_grep "/$macro/p;"
40 | done
41 |
42 | clean_false_alarms="pushdef(\`AC_BEFORE', \`')"
43 |
44 | bogus_macros_check_output=`$ECHO "$clean_false_alarms" \
45 | |$M4 - aclocal.m4 libltdl/aclocal.m4 \
46 | |$SED -n "$bogus_macros_grep"`
47 |
48 | exit_val=0
49 | for macro in $bogus_macros; do
50 | case $bogus_macros_check_output in
51 | *$macro*)
52 | func_error "Bogus $macro macro definition in an aclocal.m4 file"
53 | exit_val=1
54 | ;;
55 | esac
56 | done
57 |
58 | exit $exit_val
59 |
--------------------------------------------------------------------------------
/build-aux/thanks-gen:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -nl
2 | # Use Perl's multi-byte alignment code, via sprintf, while
3 | # performing a rudimentary check for duplicate names and
4 | # removing duplicate name,email pairs.
5 | use Encode;
6 |
7 | BEGIN { my (%elide, %seen, %name) }
8 |
9 | chomp;
10 | my ($name, $email) = split '\0', decode ('UTF-8', $_);
11 |
12 | if ($elide{"!$name"}) {
13 | ; # ignore this author
14 | } elsif (index ($name, '!') == 0) {
15 | $elide{$name}++;
16 | } elsif ($seen{$name}++) {
17 | warn "$0: NO-THANKS: duplicate name: $name\n";
18 | } else {
19 | print encode ('UTF-8', sprintf ('%-36s', $name)), $email;
20 | }
21 |
--------------------------------------------------------------------------------
/doc/.gitignore:
--------------------------------------------------------------------------------
1 | /*.1
2 | /*.html
3 | /fdl.texi
4 | /gendocs_template
5 | /manual
6 | /notes.txt
7 | /version.texi
8 | /gendocs_template_min
9 |
--------------------------------------------------------------------------------
/doc/notes.texi:
--------------------------------------------------------------------------------
1 | @itemize
2 |
3 | @item
4 | You currently need GNU make to build the Libtool package itself.
5 |
6 | @item
7 | On AIX there are two different styles of shared linking, one where symbols
8 | are bound at link-time and one where symbols are bound at runtime only,
9 | similar to ELF@. In case of doubt use @code{LDFLAGS=-Wl,-brtl} for the latter style.
10 |
11 | @item
12 | On AIX, native tools are to be preferred over binutils; especially for C++ code,
13 | if using the AIX Toolbox GCC 4.0 and binutils, configure with
14 | @code{AR=/usr/bin/ar LD=/usr/bin/ld NM='/usr/bin/nm -B'}.
15 |
16 | @item
17 | On AIX, the @command{/bin/sh} is very slow due to its inefficient handling
18 | of here-documents. A modern shell is preferable:
19 | @example
20 | CONFIG_SHELL=/bin/bash; export $CONFIG_SHELL
21 | $CONFIG_SHELL ./configure [...]
22 | @end example
23 |
24 | @item
25 | For C++ code with templates, it may be necessary to specify the way the compiler
26 | will generate the instantiations. For Portland pgCC version5, use
27 | @code{CXX='pgCC --one_instantiation_per_object'} and avoid parallel @command{make}.
28 |
29 | @item
30 | For C++ code, it may be necessary to specify a library if it is a dependency
31 | of a link/compile flag. For example in GNU G++, if you want to use
32 | @code{-fsanitize=address} you need to specify the @code{-lasan} library,
33 | like so: @code{g++ -o libx.la -fsanitize=address -lasan -rpath [...]}.
34 |
35 | @item
36 | On Darwin, for C++ code with templates you need two level shared libraries.
37 | Libtool builds these by default if @env{MACOSX_DEPLOYMENT_TARGET} is set to
38 | 10.3 or later at @command{configure} time. See @url{rdar://problem/4135857}
39 | for more information on this issue.
40 |
41 | @c @item
42 | @c FreeBSD @command{make} does not conform to @sc{posix} in its handling
43 | @c of file modification times, which causes it to loop while building libtool.
44 | @c Consider using a different @command{such} as GNU make instead.
45 |
46 | @item
47 | The default shell on UNICOS 9, a ksh 88e variant, is too buggy to
48 | correctly execute the libtool script. Users are advised to install a
49 | modern shell such as GNU bash.
50 |
51 | @item
52 | Some HP-UX @command{sed} programs are horribly broken, and cannot handle
53 | libtool's requirements, so users may report unusual problems. There
54 | is no workaround except to install a working @command{sed} (such as GNU sed)
55 | on these systems.
56 |
57 | @item
58 | The vendor-distributed NCR MP-RAS @command{cc} programs emits copyright
59 | on standard error that confuse tests on size of @file{conftest.err}. The
60 | workaround is to specify @env{CC} when run configure with
61 | @code{CC='cc -Hnocopyr'}.
62 |
63 | @item
64 | Any earlier DG/UX system with ELF executables, such as R3.10 or
65 | R4.10, is also likely to work, but hasn't been explicitly tested.
66 |
67 | @item
68 | On Reliant Unix libtool has only been tested with the Siemens C-compiler
69 | and an old version of @command{gcc} provided by Marco Walther.
70 |
71 | @item
72 | @file{libtool.m4}, @file{ltdl.m4} and the @file{configure.ac} files are marked
73 | to use autoconf-mode, which is distributed with GNU Emacs 21, Autoconf itself,
74 | and all recent releases of XEmacs.
75 |
76 | @item
77 | When building on some GNU/Linux systems for multilib targets @command{libtool}
78 | sometimes guesses the wrong paths that the linker and dynamic linker search by
79 | default. If this occurs for the dynamic library path, you may use the
80 | @code{LT_SYS_LIBRARY_PATH} environment variable to adjust. Otherwise, at
81 | @command{configure} time you may override libtool's guesses by setting the
82 | @command{autoconf} cache variables @code{lt_cv_sys_lib_search_path_spec} and
83 | @code{lt_cv_sys_lib_dlsearch_path_spec} respectively.
84 |
85 | @end itemize
86 |
--------------------------------------------------------------------------------
/gl/build-aux/announce-gen.diff:
--------------------------------------------------------------------------------
1 | --- gnulib/build-aux/announce-gen 2011-10-19 01:26:27.000000000 +0700
2 | +++ gl/build-aux/announce-gen 2011-10-19 16:54:12.000000000 +0700
3 | @@ -449,7 +449,14 @@
4 |
5 | <\#secure method=pgpmime mode=sign>
6 |
7 | -FIXME: put comments here
8 | +Libtoolers!
9 | +
10 | +The Libtool Team is pleased to announce the release of $package_name $curr_version.
11 | +
12 | +GNU Libtool hides the complexity of using shared libraries behind a
13 | +consistent, portable interface. GNU Libtool ships with GNU libltdl, which
14 | +hides the complexity of loading dynamic runtime libraries (modules)
15 | +behind a consistent, portable interface.
16 |
17 | EOF
18 |
19 | @@ -497,6 +504,11 @@
20 | $release_type eq 'stable'
21 | or print_changelog_deltas ($package_name, $prev_version);
22 |
23 | + print < .prev-version).
17 | -case $(printf "%s\n%s\n" "$prev_ver" "$ver"|sort -V -u|tr '\n' ':') in
18 | - "$prev_ver:$ver:") ;;
19 | - *) die "invalid version: $ver (<= $prev_ver)";;
20 | -esac
21 | +func_lt_ver "$prev_ver" "$ver" \
22 | + || die "invalid version: $ver (<= $prev_ver)"
23 |
24 | case $type in
25 | alpha|beta|stable) ;;
26 |
--------------------------------------------------------------------------------
/gl/top/README-release.diff:
--------------------------------------------------------------------------------
1 | --- gnulib/top/README-release
2 | +++ README-release
3 | @@ -1,5 +1,9 @@
4 | Here are most of the steps we (maintainers) follow when making a release.
5 |
6 | +* If you don't yet have gnu ftp upload rights, read this:
7 | +
8 | + https://www.gnu.org/prep/maintain/html_node/Automated-Upload-Registration.html#Automated-Upload-Registration
9 | +
10 | * Start from a clean, up-to-date git directory on "master":
11 |
12 | make -k maintainer-clean || { ./configure && make maintainer-clean; }
13 | @@ -27,10 +31,25 @@ Here are most of the steps we (maintainers) follow when making a release.
14 |
15 | ./bootstrap && ./configure
16 |
17 | +* Double check that serial number updates in public m4 files weren't
18 | + forgotten since last release (they should be updated in git along with
19 | + commits that require it so that users can work with git snapshots).
20 | +
21 | +* Update the LTDL_VERSION_INFO in libltdl/ltdl.mk for changes since
22 | + the last release.
23 | +
24 | +* Run "./bootstrap && ./configure".
25 | +
26 | * Pre-release testing: ensure that the following commands succeed:
27 |
28 | c=check ve=check-very-expensive; git grep -q "^$ve:\$" && c=$ve
29 | make $c syntax-check distcheck
30 | + make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
31 | + make distcheck DISTCHECK_CONFIGURE_FLAGS=--program-prefix=g
32 | + make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-shared
33 | + make distcheck CXX=g++
34 | +
35 | + If there are any problems, fix them and start again.
36 |
37 | * To (i) set the date, version number, and release TYPE on line 3 of
38 | NEWS, (ii) commit that, and (iii) tag the release, run
39 | @@ -98,4 +115,12 @@
40 |
41 | to update the on-line manual accessible at
42 |
43 | https://www.gnu.org/software/@PACKAGE@/manual/
44 | +
45 | + Ensure that the on-line documentation links to the latest stable release:
46 | +
47 | + https://www.gnu.org/software/@PACKAGE@/
48 | +
49 | + On-line documentation is updated through the CVS repository:
50 | +
51 | + https://savannah.gnu.org/cvs/?group=@PACKAGE@
52 |
--------------------------------------------------------------------------------
/libltdl/.gitignore:
--------------------------------------------------------------------------------
1 | /COPYING.LIB
2 | /Makefile.am
3 | /libltdl/lt__argz.h
4 | /libgnu
5 | /dummy.c
6 | /gnulib.mk
7 |
--------------------------------------------------------------------------------
/libltdl/README:
--------------------------------------------------------------------------------
1 | This is GNU libltdl, a system independent dlopen wrapper for GNU libtool.
2 |
3 | It supports the following dlopen interfaces:
4 | * dlopen (POSIX)
5 | * shl_load (HP-UX)
6 | * LoadLibrary (Win16 and Win32)
7 | * load_add_on (BeOS)
8 | * GNU DLD (emulates dynamic linking for static libraries)
9 | * dyld (darwin/Mac OS X)
10 | * libtool's dlpreopen
11 | --
12 | Copyright (C) 1999, 2003, 2011-2019, 2021-2024 Free Software
13 | Foundation, Inc.
14 | Written by Thomas Tanner, 1999
15 |
16 | This file is part of GNU Libtool.
17 |
18 | Copying and distribution of this file, with or without modification,
19 | are permitted in any medium without royalty provided the copyright
20 | notice and this notice are preserved. This file is offered as-is,
21 | without warranty of any kind.
22 |
--------------------------------------------------------------------------------
/libltdl/configure.ac:
--------------------------------------------------------------------------------
1 | # Process this file with autoconf to create configure. -*- autoconf -*-
2 | #
3 | # Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2024 Free
4 | # Software Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2004
6 | #
7 | # NOTE: The canonical source of this file is maintained with the
8 | # GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 | #
10 | # GNU Libltdl is free software; you can redistribute it and/or
11 | # modify it under the terms of the GNU Lesser General Public
12 | # License as published by the Free Software Foundation; either
13 | # version 2 of the License, or (at your option) any later version.
14 | #
15 | # As a special exception to the GNU Lesser General Public License,
16 | # if you distribute this file as part of a program or library that
17 | # is built using GNU libtool, you may include this file under the
18 | # same distribution terms that you use for the rest of that program.
19 | #
20 | # GNU Libltdl is distributed in the hope that it will be useful,
21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | # GNU Lesser General Public License for more details.
24 | #
25 | # You should have received a copy of the GNU LesserGeneral Public
26 | # License along with GNU Libltdl. If not, see .
27 | ####
28 |
29 | # This configure.ac is not used at all by the libtool bootstrap, but
30 | # is copied to the ltdl subdirectory if you libtoolize --ltdl your own
31 | # project. Adding LT_WITH_LTDL to your project configure.ac will then
32 | # configure this directory if your user doesn't want to use the installed
33 | # libltdl.
34 |
35 | AC_PREREQ(2.59)dnl We use AS_HELP_STRING
36 |
37 |
38 | ## ------------------------ ##
39 | ## Autoconf initialisation. ##
40 | ## ------------------------ ##
41 | AC_INIT([libltdl], [2.4.3a], [bug-libtool@gnu.org])
42 | AC_CONFIG_HEADERS([config.h:config-h.in])
43 | AC_CONFIG_SRCDIR([ltdl.c])
44 | AC_CONFIG_AUX_DIR([../build-aux])
45 | LT_CONFIG_LTDL_DIR([.]) # I am me!
46 |
47 |
48 | ## ------------------------ ##
49 | ## Automake Initialisation. ##
50 | ## ------------------------ ##
51 |
52 | AM_INIT_AUTOMAKE([gnu subdir-objects])
53 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
54 |
55 |
56 | ## ------------------------------- ##
57 | ## Libtool specific configuration. ##
58 | ## ------------------------------- ##
59 | pkgdatadir='$datadir'"/$PACKAGE"
60 |
61 |
62 | ## ----------------------- ##
63 | ## Libtool initialisation. ##
64 | ## ----------------------- ##
65 | LT_INIT([dlopen win32-dll])
66 | _LTDL_SETUP
67 |
68 |
69 | ## -------- ##
70 | ## Outputs. ##
71 | ## -------- ##
72 | AC_CONFIG_FILES([Makefile])
73 | AC_OUTPUT
74 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__alloc.h:
--------------------------------------------------------------------------------
1 | /* lt__alloc.h -- internal memory management interface
2 |
3 | Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation,
4 | Inc.
5 | Written by Gary V. Vaughan, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT__ALLOC_H
30 | #define LT__ALLOC_H 1
31 |
32 | #include "lt_system.h"
33 |
34 | LT_BEGIN_C_DECLS
35 |
36 | #define MALLOC(tp, n) (tp*) lt__malloc((n) * sizeof(tp))
37 | #define REALLOC(tp, mem, n) (tp*) lt__realloc((mem), (n) * sizeof(tp))
38 | #define FREE(mem) LT_STMT_START { \
39 | free (mem); mem = NULL; } LT_STMT_END
40 | #define MEMREASSIGN(p, q) LT_STMT_START { \
41 | if ((p) != (q)) { free (p); (p) = (q); (q) = 0; } \
42 | } LT_STMT_END
43 |
44 | /* If set, this function is called when memory allocation has failed. */
45 | LT_SCOPE void (*lt__alloc_die) (void);
46 |
47 | LT_SCOPE void *lt__malloc (size_t n);
48 | LT_SCOPE void *lt__zalloc (size_t n);
49 | LT_SCOPE void *lt__realloc (void *mem, size_t n);
50 | LT_SCOPE void *lt__memdup (void const *mem, size_t n);
51 |
52 | LT_SCOPE char *lt__strdup (const char *string);
53 |
54 | LT_END_C_DECLS
55 |
56 | #endif /*!defined LT__ALLOC_H*/
57 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__argz_.h:
--------------------------------------------------------------------------------
1 | /* lt__argz.h -- internal argz interface for non-glibc systems
2 |
3 | Copyright (C) 2004, 2007-2008, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Gary V. Vaughan, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT__ARGZ_H
30 | #define LT__ARGZ_H 1
31 |
32 | #include
33 | #define __need_error_t
34 | #include
35 | #include
36 |
37 | #if defined LTDL
38 | # include "lt__glibc.h"
39 | # include "lt_system.h"
40 | #else
41 | # define LT_SCOPE
42 | #endif
43 |
44 | #if defined __cplusplus
45 | extern "C" {
46 | #endif
47 |
48 | LT_SCOPE error_t argz_append (char **pargz, size_t *pargz_len,
49 | const char *buf, size_t buf_len);
50 | LT_SCOPE error_t argz_create_sep(const char *str, int delim,
51 | char **pargz, size_t *pargz_len);
52 | LT_SCOPE error_t argz_insert (char **pargz, size_t *pargz_len,
53 | char *before, const char *entry);
54 | LT_SCOPE char * argz_next (char *argz, size_t argz_len,
55 | const char *entry);
56 | LT_SCOPE void argz_stringify (char *argz, size_t argz_len, int sep);
57 |
58 | #if defined __cplusplus
59 | }
60 | #endif
61 |
62 | #if !defined LTDL
63 | # undef LT_SCOPE
64 | #endif
65 |
66 | #endif /*!defined LT__ARGZ_H*/
67 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__dirent.h:
--------------------------------------------------------------------------------
1 | /* lt__dirent.h -- internal directory entry scanning interface
2 |
3 | Copyright (C) 2001, 2004, 2006, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Bob Friesenhahn, 2001
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT__DIRENT_H
30 | #define LT__DIRENT_H 1
31 |
32 | #if defined LT_CONFIG_H
33 | # include LT_CONFIG_H
34 | #else
35 | # include
36 | #endif
37 |
38 | #include "lt_system.h"
39 |
40 | #ifdef HAVE_DIRENT_H
41 | /* We have a fully operational dirent subsystem. */
42 | # include
43 | # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
44 |
45 | #elif defined __WINDOWS__
46 | /* Use some wrapper code to emulate dirent on windows.. */
47 | # define WINDOWS_DIRENT_EMULATION 1
48 |
49 | # include
50 |
51 | # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
52 | # define dirent lt__dirent
53 | # define DIR lt__DIR
54 | # define opendir lt__opendir
55 | # define readdir lt__readdir
56 | # define closedir lt__closedir
57 |
58 | LT_BEGIN_C_DECLS
59 |
60 | struct dirent
61 | {
62 | char d_name[LT_FILENAME_MAX];
63 | int d_namlen;
64 | };
65 |
66 | typedef struct
67 | {
68 | HANDLE hSearch;
69 | WIN32_FIND_DATA Win32FindData;
70 | BOOL firsttime;
71 | struct dirent file_info;
72 | } DIR;
73 |
74 |
75 | LT_SCOPE DIR * opendir (const char *path);
76 | LT_SCOPE struct dirent *readdir (DIR *entry);
77 | LT_SCOPE void closedir (DIR *entry);
78 |
79 | LT_END_C_DECLS
80 |
81 | #else /* !defined __WINDOWS__*/
82 | ERROR - cannot find dirent
83 | #endif /*!defined __WINDOWS__*/
84 |
85 | #endif /*!defined LT__DIRENT_H*/
86 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__glibc.h:
--------------------------------------------------------------------------------
1 | /* lt__glibc.h -- support for non glibc environments
2 |
3 | Copyright (C) 2004, 2006-2007, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Gary V. Vaughan, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT__GLIBC_H
30 | #define LT__GLIBC_H 1
31 |
32 | #if defined LT_CONFIG_H
33 | # include LT_CONFIG_H
34 | #else
35 | # include
36 | #endif
37 |
38 | #if !defined HAVE_ARGZ_H || !defined HAVE_WORKING_ARGZ
39 | /* Redefine any glibc symbols we reimplement to import the
40 | implementations into our lt__ namespace so we don't ever
41 | clash with the system library if our clients use argz_*
42 | from there in addition to libltdl. */
43 | # undef argz_append
44 | # define argz_append lt__argz_append
45 | # undef argz_create_sep
46 | # define argz_create_sep lt__argz_create_sep
47 | # undef argz_insert
48 | # define argz_insert lt__argz_insert
49 | # undef argz_next
50 | # define argz_next lt__argz_next
51 | # undef argz_stringify
52 | # define argz_stringify lt__argz_stringify
53 |
54 | # include
55 |
56 | #else
57 |
58 | #ifdef __cplusplus
59 | extern "C" {
60 | #endif
61 |
62 | #include
63 |
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 |
68 | #endif /*!defined HAVE_ARGZ_H || !defined HAVE_WORKING_ARGZ*/
69 |
70 | # define slist_concat lt__slist_concat
71 | # define slist_cons lt__slist_cons
72 | # define slist_delete lt__slist_delete
73 | # define slist_remove lt__slist_remove
74 | # define slist_reverse lt__slist_reverse
75 | # define slist_sort lt__slist_sort
76 | # define slist_tail lt__slist_tail
77 | # define slist_nth lt__slist_nth
78 | # define slist_find lt__slist_find
79 | # define slist_length lt__slist_length
80 | # define slist_foreach lt__slist_foreach
81 | # define slist_box lt__slist_box
82 | # define slist_unbox lt__slist_unbox
83 |
84 | #include
85 |
86 | #endif /*!defined LT__GLIBC_H*/
87 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__private.h:
--------------------------------------------------------------------------------
1 | /* lt__private.h -- internal apis for libltdl
2 |
3 | Copyright (C) 2004-2008, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Gary V. Vaughan, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | This library is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT__PRIVATE_H
30 | #define LT__PRIVATE_H 1
31 |
32 | #if defined LT_CONFIG_H
33 | # include LT_CONFIG_H
34 | #else
35 | # include
36 | #endif
37 |
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 |
44 | #if defined HAVE_UNISTD_H
45 | # include
46 | #endif
47 |
48 | /* Import internal interfaces... */
49 | #include "lt__alloc.h"
50 | #include "lt__dirent.h"
51 | #include "lt__strl.h"
52 | #include "lt__glibc.h"
53 |
54 | /* ...and all exported interfaces. */
55 | #include "ltdl.h"
56 |
57 | #if defined WITH_DMALLOC
58 | # include
59 | #endif
60 |
61 | /* DLL building support on win32 hosts; mostly to workaround their
62 | ridiculous implementation of data symbol exporting. */
63 | #ifndef LT_GLOBAL_DATA
64 | # if defined __WINDOWS__ || defined __CYGWIN__
65 | # if defined DLL_EXPORT /* defined by libtool (if required) */
66 | # define LT_GLOBAL_DATA __declspec(dllexport)
67 | # endif
68 | # endif
69 | # ifndef LT_GLOBAL_DATA
70 | # define LT_GLOBAL_DATA /* static linking or !__WINDOWS__ */
71 | # endif
72 | #endif
73 |
74 | #ifndef __attribute__
75 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
76 | # define __attribute__(x)
77 | # endif
78 | #endif
79 |
80 | #ifndef LT__UNUSED
81 | # define LT__UNUSED __attribute__ ((__unused__))
82 | #endif
83 |
84 |
85 | LT_BEGIN_C_DECLS
86 |
87 | #if !defined errno
88 | extern int errno;
89 | #endif
90 |
91 | LT_SCOPE void lt__alloc_die_callback (void);
92 |
93 |
94 | /* For readability: */
95 | #define STRNEQ(s1, s2) (strcmp((s1), (s2)) != 0)
96 | #define STREQ(s1, s2) (strcmp((s1), (s2)) == 0)
97 |
98 |
99 |
100 | /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */
101 |
102 | /* This type is used for the array of interface data sets in each handler. */
103 | typedef struct {
104 | lt_dlinterface_id key;
105 | void * data;
106 | } lt_interface_data;
107 |
108 | struct lt__handle {
109 | lt_dlhandle next;
110 | const lt_dlvtable * vtable; /* dlopening interface */
111 | lt_dlinfo info; /* user visible fields */
112 | int depcount; /* number of dependencies */
113 | lt_dlhandle * deplibs; /* dependencies */
114 | lt_module module; /* system module handle */
115 | void * system; /* system specific data */
116 | lt_interface_data * interface_data; /* per caller associated data */
117 | int flags; /* various boolean stats */
118 | };
119 |
120 | struct lt__advise {
121 | unsigned int try_ext:1; /* try system library extensions. */
122 | unsigned int is_resident:1; /* module can't be unloaded. */
123 | unsigned int is_symglobal:1; /* module symbols can satisfy
124 | subsequently loaded modules. */
125 | unsigned int is_symlocal:1; /* module symbols are only available
126 | locally. */
127 | unsigned int try_preload_only:1;/* only preloaded modules will be tried. */
128 | };
129 |
130 | /* --- ERROR HANDLING --- */
131 |
132 | /* Extract the diagnostic strings from the error table macro in the same
133 | order as the enumerated indices in lt_error.h. */
134 |
135 | #define LT__STRERROR(name) lt__error_string(LT_CONC(LT_ERROR_,name))
136 |
137 | #define LT__GETERROR(lvalue) (lvalue) = lt__get_last_error()
138 | #define LT__SETERRORSTR(errormsg) lt__set_last_error(errormsg)
139 | #define LT__SETERROR(errorcode) LT__SETERRORSTR(LT__STRERROR(errorcode))
140 |
141 | LT_SCOPE const char *lt__error_string (int errorcode);
142 | LT_SCOPE const char *lt__get_last_error (void);
143 | LT_SCOPE const char *lt__set_last_error (const char *errormsg);
144 |
145 | LT_END_C_DECLS
146 |
147 | #endif /*!defined LT__PRIVATE_H*/
148 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__strl.h:
--------------------------------------------------------------------------------
1 | /* lt__strl.h -- size-bounded string copying and concatenation
2 |
3 | Copyright (C) 2004, 2006, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Bob Friesenhahn, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT__STRL_H
30 | #define LT__STRL_H 1
31 |
32 | #if defined LT_CONFIG_H
33 | # include LT_CONFIG_H
34 | #else
35 | # include
36 | #endif
37 |
38 | #include
39 | #include "lt_system.h"
40 |
41 | #if !defined HAVE_STRLCAT
42 | # define strlcat(dst,src,dstsize) lt_strlcat(dst,src,dstsize)
43 | LT_SCOPE size_t lt_strlcat(char *dst, const char *src, const size_t dstsize);
44 | #endif /* !defined HAVE_STRLCAT */
45 |
46 | #if !defined HAVE_STRLCPY
47 | # define strlcpy(dst,src,dstsize) lt_strlcpy(dst,src,dstsize)
48 | LT_SCOPE size_t lt_strlcpy(char *dst, const char *src, const size_t dstsize);
49 | #endif /* !defined HAVE_STRLCPY */
50 |
51 | #endif /*!defined LT__STRL_H*/
52 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt_dlloader.h:
--------------------------------------------------------------------------------
1 | /* lt_dlloader.h -- dynamic library loader interface
2 |
3 | Copyright (C) 2004, 2007-2008, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Gary V. Vaughan, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #if !defined LT_DLLOADER_H
30 | #define LT_DLLOADER_H 1
31 |
32 | #include
33 |
34 | LT_BEGIN_C_DECLS
35 |
36 | typedef void * lt_dlloader;
37 | typedef void * lt_module;
38 | typedef void * lt_user_data;
39 | typedef struct lt__advise * lt_dladvise;
40 |
41 | /* Function pointer types for module loader vtable entries: */
42 | typedef lt_module lt_module_open (lt_user_data data,
43 | const char *filename,
44 | lt_dladvise advise);
45 | typedef int lt_module_close (lt_user_data data,
46 | lt_module module);
47 | typedef void * lt_find_sym (lt_user_data data, lt_module module,
48 | const char *symbolname);
49 | typedef int lt_dlloader_init (lt_user_data data);
50 | typedef int lt_dlloader_exit (lt_user_data data);
51 |
52 | /* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */
53 | typedef enum {
54 | LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND
55 | } lt_dlloader_priority;
56 |
57 | /* This structure defines a module loader, as populated by the get_vtable
58 | entry point of each loader. */
59 | typedef struct {
60 | const char * name;
61 | const char * sym_prefix;
62 | lt_module_open * module_open;
63 | lt_module_close * module_close;
64 | lt_find_sym * find_sym;
65 | lt_dlloader_init * dlloader_init;
66 | lt_dlloader_exit * dlloader_exit;
67 | lt_user_data dlloader_data;
68 | lt_dlloader_priority priority;
69 | } lt_dlvtable;
70 |
71 | LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable);
72 | LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader);
73 |
74 | LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name);
75 | LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name);
76 | LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader);
77 |
78 |
79 | /* Type of a function to get a loader's vtable: */
80 | typedef const lt_dlvtable *lt_get_vtable (lt_user_data data);
81 |
82 | #ifdef LT_DEBUG_LOADERS
83 | LT_SCOPE void lt_dlloader_dump (void);
84 | #endif
85 |
86 | LT_END_C_DECLS
87 |
88 | #endif /*!defined LT_DLLOADER_H*/
89 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt_error.h:
--------------------------------------------------------------------------------
1 | /* lt_error.h -- error propagation interface
2 |
3 | Copyright (C) 1999-2001, 2004, 2007, 2011-2019, 2021-2024 Free
4 | Software Foundation, Inc.
5 | Written by Thomas Tanner, 1999
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | /* Only include this header file once. */
30 | #if !defined LT_ERROR_H
31 | #define LT_ERROR_H 1
32 |
33 | #include
34 |
35 | LT_BEGIN_C_DECLS
36 |
37 | /* Defining error strings alongside their symbolic names in a macro in
38 | this way allows us to expand the macro in different contexts with
39 | confidence that the enumeration of symbolic names will map correctly
40 | onto the table of error strings. \0 is appended to the strings to
41 | explicitly initialize the string terminator. */
42 | #define lt_dlerror_table \
43 | LT_ERROR(UNKNOWN, "unknown error\0") \
44 | LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \
45 | LT_ERROR(INVALID_LOADER, "invalid loader\0") \
46 | LT_ERROR(INIT_LOADER, "loader initialization failed\0") \
47 | LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \
48 | LT_ERROR(FILE_NOT_FOUND, "file not found\0") \
49 | LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \
50 | LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \
51 | LT_ERROR(CANNOT_OPEN, "can't open the module\0") \
52 | LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \
53 | LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \
54 | LT_ERROR(NO_MEMORY, "not enough memory\0") \
55 | LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \
56 | LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \
57 | LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \
58 | LT_ERROR(SHUTDOWN, "library already shutdown\0") \
59 | LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \
60 | LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\
61 | LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\
62 | LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0")
63 |
64 | /* Enumerate the symbolic error names. */
65 | enum {
66 | #define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name),
67 | lt_dlerror_table
68 | #undef LT_ERROR
69 |
70 | LT_ERROR_MAX
71 | };
72 |
73 | /* Should be max of the error string lengths above (plus one for C++) */
74 | #define LT_ERROR_LEN_MAX (41)
75 |
76 | /* These functions are only useful from inside custom module loaders. */
77 | LT_SCOPE int lt_dladderror (const char *diagnostic);
78 | LT_SCOPE int lt_dlseterror (int errorcode);
79 |
80 |
81 | LT_END_C_DECLS
82 |
83 | #endif /*!defined LT_ERROR_H*/
84 |
--------------------------------------------------------------------------------
/libltdl/libltdl/slist.h:
--------------------------------------------------------------------------------
1 | /* slist.h -- generalised singly linked lists
2 |
3 | Copyright (C) 2000, 2004, 2009, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Gary V. Vaughan, 2000
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | /* A generalised list. This is deliberately transparent so that you
30 | can make the NEXT field of all your chained data structures first,
31 | and then cast them to '(SList *)' so that they can be manipulated
32 | by this API.
33 |
34 | Alternatively, you can generate raw SList elements using slist_new(),
35 | and put the element data in the USERDATA field. Either way you
36 | get to manage the memory involved by yourself.
37 | */
38 |
39 | #if !defined SLIST_H
40 | #define SLIST_H 1
41 |
42 | #if defined LTDL
43 | # include
44 | # include
45 | #else
46 | # define LT_SCOPE
47 | #endif
48 |
49 | #include
50 |
51 | #if defined __cplusplus
52 | extern "C" {
53 | #endif
54 |
55 | typedef struct slist {
56 | struct slist *next; /* chain forward pointer*/
57 | const void *userdata; /* for boxed 'SList' item */
58 | } SList;
59 |
60 | typedef void * SListCallback (SList *item, void *userdata);
61 | typedef int SListCompare (const SList *item1, const SList *item2,
62 | void *userdata);
63 |
64 | LT_SCOPE SList *slist_concat (SList *head, SList *tail);
65 | LT_SCOPE SList *slist_cons (SList *item, SList *slist);
66 |
67 | LT_SCOPE SList *slist_delete (SList *slist, void (*delete_fct) (void *item));
68 | LT_SCOPE SList *slist_remove (SList **phead, SListCallback *find,
69 | void *matchdata);
70 | LT_SCOPE SList *slist_reverse (SList *slist);
71 | LT_SCOPE SList *slist_sort (SList *slist, SListCompare *compare,
72 | void *userdata);
73 |
74 | LT_SCOPE SList *slist_tail (SList *slist);
75 | LT_SCOPE SList *slist_nth (SList *slist, size_t n);
76 | LT_SCOPE void * slist_find (SList *slist, SListCallback *find,
77 | void *matchdata);
78 | LT_SCOPE size_t slist_length (SList *slist);
79 |
80 | LT_SCOPE void * slist_foreach (SList *slist, SListCallback *foreach,
81 | void *userdata);
82 |
83 | LT_SCOPE SList *slist_box (const void *userdata);
84 | LT_SCOPE void * slist_unbox (SList *item);
85 |
86 | #if defined __cplusplus
87 | }
88 | #endif
89 |
90 | #if !defined LTDL
91 | # undef LT_SCOPE
92 | #endif
93 |
94 | #endif /*!defined SLIST_H*/
95 |
--------------------------------------------------------------------------------
/libltdl/loaders/dld_link.c:
--------------------------------------------------------------------------------
1 | /* loader-dld_link.c -- dynamic linking with dld
2 |
3 | Copyright (C) 1998-2000, 2004, 2006-2008, 2011-2019, 2021-2024 Free
4 | Software Foundation, Inc.
5 | Written by Thomas Tanner, 1998
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #include "lt__private.h"
30 | #include "lt_dlloader.h"
31 |
32 | /* Use the preprocessor to rename non-static symbols to avoid namespace
33 | collisions when the loader code is statically linked into libltdl.
34 | Use the "_LTX_" prefix so that the symbol addresses can
35 | be fetched from the preloaded symbol list by lt_dlsym(): */
36 | #define get_vtable dld_link_LTX_get_vtable
37 |
38 | LT_BEGIN_C_DECLS
39 | LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data);
40 | LT_END_C_DECLS
41 |
42 |
43 | /* Boilerplate code to set up the vtable for hooking this loader into
44 | libltdl's loader list: */
45 | static int vl_exit (lt_user_data loader_data);
46 | static lt_module vm_open (lt_user_data loader_data, const char *filename,
47 | lt_dladvise advise);
48 | static int vm_close (lt_user_data loader_data, lt_module module);
49 | static void * vm_sym (lt_user_data loader_data, lt_module module,
50 | const char *symbolname);
51 |
52 | static lt_dlvtable *vtable = 0;
53 |
54 | /* Return the vtable for this loader, only the name and sym_prefix
55 | attributes (plus the virtual function implementations, obviously)
56 | change between loaders. */
57 | lt_dlvtable *
58 | get_vtable (lt_user_data loader_data)
59 | {
60 | if (!vtable)
61 | {
62 | vtable = lt__zalloc (sizeof *vtable);
63 | }
64 |
65 | if (vtable && !vtable->name)
66 | {
67 | vtable->name = "lt_dld_link";
68 | vtable->module_open = vm_open;
69 | vtable->module_close = vm_close;
70 | vtable->find_sym = vm_sym;
71 | vtable->dlloader_exit = vl_exit;
72 | vtable->dlloader_data = loader_data;
73 | vtable->priority = LT_DLLOADER_APPEND;
74 | }
75 |
76 | if (vtable && (vtable->dlloader_data != loader_data))
77 | {
78 | LT__SETERROR (INIT_LOADER);
79 | return 0;
80 | }
81 |
82 | return vtable;
83 | }
84 |
85 |
86 |
87 | /* --- IMPLEMENTATION --- */
88 |
89 |
90 | #if defined HAVE_DLD_H
91 | # include
92 | #endif
93 |
94 | /* A function called through the vtable when this loader is no
95 | longer needed by the application. */
96 | static int
97 | vl_exit (lt_user_data loader_data LT__UNUSED)
98 | {
99 | vtable = NULL;
100 | return 0;
101 | }
102 |
103 | /* A function called through the vtable to open a module with this
104 | loader. Returns an opaque representation of the newly opened
105 | module for processing with this loader's other vtable functions. */
106 | static lt_module
107 | vm_open (lt_user_data loader_data LT__UNUSED, const char *filename,
108 | lt_dladvise advise LT__UNUSED)
109 | {
110 | lt_module module = lt__strdup (filename);
111 |
112 | if (module && dld_link (filename) != 0)
113 | {
114 | LT__SETERROR (CANNOT_OPEN);
115 | FREE (module);
116 | }
117 |
118 | return module;
119 | }
120 |
121 | /* A function called through the vtable when a particular module
122 | should be unloaded. */
123 | static int
124 | vm_close (lt_user_data loader_data LT__UNUSED, lt_module module)
125 | {
126 | int errors = 0;
127 |
128 | if (dld_unlink_by_file ((char*)(module), 1) != 0)
129 | {
130 | LT__SETERROR (CANNOT_CLOSE);
131 | ++errors;
132 | }
133 | else
134 | {
135 | FREE (module);
136 | }
137 |
138 | return errors;
139 | }
140 |
141 | /* A function called through the vtable to get the address of
142 | a symbol loaded from a particular module. */
143 | static void *
144 | vm_sym (lt_user_data loader_data LT__UNUSED, lt_module module LT__UNUSED,
145 | const char *name)
146 | {
147 | void *address = dld_get_func (name);
148 |
149 | if (!address)
150 | {
151 | LT__SETERROR (SYMBOL_NOT_FOUND);
152 | }
153 |
154 | return address;
155 | }
156 |
--------------------------------------------------------------------------------
/libltdl/lt__alloc.c:
--------------------------------------------------------------------------------
1 | /* lt__alloc.c -- internal memory management interface
2 |
3 | Copyright (C) 2004, 2006-2007, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Gary V. Vaughan, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #include "lt__private.h"
30 |
31 | #include
32 |
33 | #include "lt__alloc.h"
34 |
35 | static void alloc_die_default (void);
36 |
37 | void (*lt__alloc_die) (void) = alloc_die_default;
38 |
39 | /* Unless overridden, exit on memory failure. */
40 | static void
41 | alloc_die_default (void)
42 | {
43 | fprintf (stderr, "Out of memory.\n");
44 | exit (EXIT_FAILURE);
45 | }
46 |
47 | void *
48 | lt__malloc (size_t n)
49 | {
50 | void *mem;
51 |
52 | if (! (mem = malloc (n)))
53 | (*lt__alloc_die) ();
54 |
55 | return mem;
56 | }
57 |
58 | void *
59 | lt__zalloc (size_t n)
60 | {
61 | void *mem;
62 |
63 | if ((mem = lt__malloc (n)))
64 | memset (mem, 0, n);
65 |
66 | return mem;
67 | }
68 |
69 | void *
70 | lt__realloc (void *mem, size_t n)
71 | {
72 | if (! (mem = realloc (mem, n)))
73 | (*lt__alloc_die) ();
74 |
75 | return mem;
76 | }
77 |
78 | void *
79 | lt__memdup (void const *mem, size_t n)
80 | {
81 | void *newmem;
82 |
83 | if ((newmem = lt__malloc (n)))
84 | return memcpy (newmem, mem, n);
85 |
86 | return 0;
87 | }
88 |
89 | char *
90 | lt__strdup (const char *string)
91 | {
92 | return (char *) lt__memdup (string, strlen (string) +1);
93 | }
94 |
--------------------------------------------------------------------------------
/libltdl/lt__dirent.c:
--------------------------------------------------------------------------------
1 | /* lt__dirent.c -- internal directory entry scanning interface
2 |
3 | Copyright (C) 2001, 2004, 2011-2019, 2021-2024 Free Software
4 | Foundation, Inc.
5 | Written by Bob Friesenhahn, 2001
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #include "lt__private.h"
30 |
31 | #include
32 |
33 | #include "lt__dirent.h"
34 |
35 | #if defined __WINDOWS__
36 |
37 | void
38 | closedir (DIR *entry)
39 | {
40 | assert (entry != (DIR *) NULL);
41 | FindClose (entry->hSearch);
42 | free (entry);
43 | }
44 |
45 |
46 | DIR *
47 | opendir (const char *path)
48 | {
49 | char file_spec[LT_FILENAME_MAX];
50 | DIR *entry;
51 |
52 | assert (path != (char *) 0);
53 | if (lt_strlcpy (file_spec, path, sizeof file_spec) >= sizeof file_spec
54 | || lt_strlcat (file_spec, "\\", sizeof file_spec) >= sizeof file_spec)
55 | return (DIR *) 0;
56 | entry = (DIR *) malloc (sizeof(DIR));
57 | if (entry != (DIR *) 0)
58 | {
59 | entry->firsttime = TRUE;
60 | entry->hSearch = FindFirstFile (file_spec, &entry->Win32FindData);
61 |
62 | if (entry->hSearch == INVALID_HANDLE_VALUE)
63 | {
64 | if (lt_strlcat (file_spec, "\\*.*", sizeof file_spec) < sizeof file_spec)
65 | {
66 | entry->hSearch = FindFirstFile (file_spec, &entry->Win32FindData);
67 | }
68 |
69 | if (entry->hSearch == INVALID_HANDLE_VALUE)
70 | {
71 | entry = (free (entry), (DIR *) 0);
72 | }
73 | }
74 | }
75 |
76 | return entry;
77 | }
78 |
79 |
80 | struct dirent *
81 | readdir (DIR *entry)
82 | {
83 | int status;
84 |
85 | if (entry == (DIR *) 0)
86 | return (struct dirent *) 0;
87 |
88 | if (!entry->firsttime)
89 | {
90 | status = FindNextFile (entry->hSearch, &entry->Win32FindData);
91 | if (status == 0)
92 | return (struct dirent *) 0;
93 | }
94 |
95 | entry->firsttime = FALSE;
96 | if (lt_strlcpy (entry->file_info.d_name, entry->Win32FindData.cFileName,
97 | sizeof entry->file_info.d_name) >= sizeof entry->file_info.d_name)
98 | return (struct dirent *) 0;
99 | entry->file_info.d_namlen = strlen (entry->file_info.d_name);
100 |
101 | return &entry->file_info;
102 | }
103 |
104 | #endif /*defined __WINDOWS__*/
105 |
--------------------------------------------------------------------------------
/libltdl/lt__strl.c:
--------------------------------------------------------------------------------
1 | /* lt__strl.c -- size-bounded string copying and concatenation
2 |
3 | Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation,
4 | Inc.
5 | Written by Bob Friesenhahn, 2004
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #include
30 | #include
31 |
32 | #include "lt__strl.h"
33 |
34 | /*
35 | lt_strlcat appends the NULL-terminated string src to the end of dst.
36 | It will append at most dstsize - strlen(dst) - 1 bytes,
37 | NULL-terminating the result. The total length of the string that
38 | would have been created given sufficient buffer size (may be longer
39 | than dstsize) is returned. This function substitutes for strlcat(),
40 | which is available under NetBSD, FreeBSD and Solaris 9.
41 |
42 | Buffer overflow can be checked as follows:
43 |
44 | if (lt_strlcat(dst, src, dstsize) >= dstsize)
45 | return -1;
46 | */
47 | #if !defined HAVE_STRLCAT
48 | size_t
49 | lt_strlcat(char *dst, const char *src, const size_t dstsize)
50 | {
51 | size_t length;
52 | char *p;
53 | const char *q;
54 |
55 | assert(dst != NULL);
56 | assert(src != (const char *) NULL);
57 | assert(dstsize >= 1);
58 |
59 | length=strlen(dst);
60 |
61 | /*
62 | Copy remaining characters from src while constraining length to
63 | size - 1.
64 | */
65 | for ( p = dst + length, q = src;
66 | (*q != 0) && (length < dstsize - 1);
67 | length++, p++, q++ )
68 | *p = *q;
69 |
70 | dst[length]='\0';
71 |
72 | /*
73 | Add remaining length of src to length.
74 | */
75 | while (*q++)
76 | length++;
77 |
78 | return length;
79 | }
80 | #endif /* !defined HAVE_STRLCAT */
81 |
82 | /*
83 | lt_strlcpy copies up to dstsize - 1 characters from the NULL-terminated
84 | string src to dst, NULL-terminating the result. The total length of
85 | the string that would have been created given sufficient buffer
86 | size (may be longer than dstsize) is returned. This function
87 | substitutes for strlcpy(), which is available under OpenBSD, FreeBSD
88 | and Solaris 9.
89 |
90 | Buffer overflow can be checked as follows:
91 |
92 | if (lt_strlcpy(dst, src, dstsize) >= dstsize)
93 | return -1;
94 | */
95 | #if !defined HAVE_STRLCPY
96 | size_t
97 | lt_strlcpy(char *dst, const char *src, const size_t dstsize)
98 | {
99 | size_t length=0;
100 | char *p;
101 | const char *q;
102 |
103 | assert(dst != NULL);
104 | assert(src != (const char *) NULL);
105 | assert(dstsize >= 1);
106 |
107 | /*
108 | Copy src to dst within bounds of size-1.
109 | */
110 | for ( p=dst, q=src, length=0;
111 | (*q != 0) && (length < dstsize-1);
112 | length++, p++, q++ )
113 | *p = *q;
114 |
115 | dst[length]='\0';
116 |
117 | /*
118 | Add remaining length of src to length.
119 | */
120 | while (*q++)
121 | length++;
122 |
123 | return length;
124 | }
125 | #endif /* !defined HAVE_STRLCPY */
126 |
--------------------------------------------------------------------------------
/libltdl/lt_error.c:
--------------------------------------------------------------------------------
1 | /* lt_error.c -- error propagation interface
2 |
3 | Copyright (C) 1999-2001, 2004-2005, 2007, 2011-2019, 2021-2024 Free
4 | Software Foundation, Inc.
5 | Written by Thomas Tanner, 1999
6 |
7 | NOTE: The canonical source of this file is maintained with the
8 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9 |
10 | GNU Libltdl is free software; you can redistribute it and/or
11 | modify it under the terms of the GNU Lesser General Public
12 | License as published by the Free Software Foundation; either
13 | version 2 of the License, or (at your option) any later version.
14 |
15 | As a special exception to the GNU Lesser General Public License,
16 | if you distribute this file as part of a program or library that
17 | is built using GNU Libtool, you may include this file under the
18 | same distribution terms that you use for the rest of that program.
19 |
20 | GNU Libltdl is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU Lesser General Public License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public
26 | License along with GNU Libltdl. If not, see .
27 | */
28 |
29 | #include "lt__private.h"
30 | #include "lt_error.h"
31 |
32 | static const char *last_error = 0;
33 | static const char error_strings[LT_ERROR_MAX][LT_ERROR_LEN_MAX + 1] =
34 | {
35 | #define LT_ERROR(name, diagnostic) diagnostic,
36 | lt_dlerror_table
37 | #undef LT_ERROR
38 | };
39 |
40 | static const char **user_error_strings = 0;
41 | static int errorcount = LT_ERROR_MAX;
42 |
43 | int
44 | lt_dladderror (const char *diagnostic)
45 | {
46 | int errindex = 0;
47 | int result = -1;
48 | const char **temp = (const char **) 0;
49 |
50 | assert (diagnostic);
51 |
52 | errindex = errorcount - LT_ERROR_MAX;
53 | temp = REALLOC (const char *, user_error_strings, 1 + errindex);
54 | if (temp)
55 | {
56 | user_error_strings = temp;
57 | user_error_strings[errindex] = diagnostic;
58 | result = errorcount++;
59 | }
60 |
61 | return result;
62 | }
63 |
64 | int
65 | lt_dlseterror (int errindex)
66 | {
67 | int errors = 0;
68 |
69 | if (errindex >= errorcount || errindex < 0)
70 | {
71 | /* Ack! Error setting the error message! */
72 | LT__SETERROR (INVALID_ERRORCODE);
73 | ++errors;
74 | }
75 | else if (errindex < LT_ERROR_MAX)
76 | {
77 | /* No error setting the error message! */
78 | LT__SETERRORSTR (error_strings[errindex]);
79 | }
80 | else
81 | {
82 | /* No error setting the error message! */
83 | LT__SETERRORSTR (user_error_strings[errindex - LT_ERROR_MAX]);
84 | }
85 |
86 | return errors;
87 | }
88 |
89 | const char *
90 | lt__error_string (int errorcode)
91 | {
92 | assert (errorcode >= 0);
93 | assert (errorcode < LT_ERROR_MAX);
94 |
95 | return error_strings[errorcode];
96 | }
97 |
98 | const char *
99 | lt__get_last_error (void)
100 | {
101 | return last_error;
102 | }
103 |
104 | const char *
105 | lt__set_last_error (const char *errormsg)
106 | {
107 | return last_error = errormsg;
108 | }
109 |
--------------------------------------------------------------------------------
/m4/.gitignore:
--------------------------------------------------------------------------------
1 | /00gnulib.m4
2 | /gnulib-cache.m4
3 | /gnulib-common.m4
4 | /gnulib-comp.m4
5 | /gnulib-tool.m4
6 | /ltversion.m4
7 | /zzgnulib.m4
8 |
--------------------------------------------------------------------------------
/m4/autobuild.m4:
--------------------------------------------------------------------------------
1 | # autobuild.m4 serial 7
2 | dnl Copyright (C) 2004, 2006-2019, 2021-2024 Free Software Foundation,
3 | dnl Inc.
4 | dnl This file is free software; the Free Software Foundation
5 | dnl gives unlimited permission to copy and/or distribute it,
6 | dnl with or without modifications, as long as this notice is preserved.
7 |
8 | dnl From Simon Josefsson
9 |
10 | # Usage: AB_INIT([MODE]).
11 | AC_DEFUN([AB_INIT],
12 | [
13 | AC_REQUIRE([AC_CANONICAL_BUILD])
14 | AC_REQUIRE([AC_CANONICAL_HOST])
15 |
16 | if test -z "$AB_PACKAGE"; then
17 | AB_PACKAGE=${PACKAGE_NAME:-$PACKAGE}
18 | fi
19 | AC_MSG_NOTICE([autobuild project... $AB_PACKAGE])
20 |
21 | if test -z "$AB_VERSION"; then
22 | AB_VERSION=${PACKAGE_VERSION:-$VERSION}
23 | fi
24 | AC_MSG_NOTICE([autobuild revision... $AB_VERSION])
25 |
26 | hostname=`hostname`
27 | if test "$hostname"; then
28 | AC_MSG_NOTICE([autobuild hostname... $hostname])
29 | fi
30 |
31 | ifelse([$1],[],,[AC_MSG_NOTICE([autobuild mode... $1])])
32 |
33 | date=`TZ=UTC0 date +%Y%m%dT%H%M%SZ`
34 | if test "$?" != 0; then
35 | date=`date`
36 | fi
37 | if test "$date"; then
38 | AC_MSG_NOTICE([autobuild timestamp... $date])
39 | fi
40 | ])
41 |
--------------------------------------------------------------------------------
/m4/ltargz.m4:
--------------------------------------------------------------------------------
1 | # Portability macros for glibc argz. -*- Autoconf -*-
2 | #
3 | # Copyright (C) 2004-2007, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan
6 | #
7 | # This file is free software; the Free Software Foundation gives
8 | # unlimited permission to copy and/or distribute it, with or without
9 | # modifications, as long as this notice is preserved.
10 |
11 | # serial 2 ltargz.m4
12 |
13 | AC_DEFUN([LT_FUNC_ARGZ], [
14 | dnl Required for use of '$SED' in Cygwin configuration.
15 | AC_REQUIRE([AC_PROG_SED])dnl
16 | AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
17 |
18 | AC_CHECK_TYPES([error_t],
19 | [],
20 | [AC_DEFINE([error_t], [int],
21 | [Define to a type to use for 'error_t' if it is not otherwise available.])
22 | AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
23 | does not typedef error_t.])],
24 | [#if defined(HAVE_ARGZ_H)
25 | # include
26 | #endif])
27 |
28 | LT_ARGZ_H=
29 | AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \
30 | argz_next argz_stringify], [], [LT_ARGZ_H=lt__argz.h; AC_LIBOBJ([lt__argz])])
31 |
32 | dnl if have system argz functions, allow forced use of
33 | dnl libltdl-supplied implementation (and default to do so
34 | dnl on "known bad" systems). Could use a runtime check, but
35 | dnl (a) detecting malloc issues is notoriously unreliable
36 | dnl (b) only known system that declares argz functions,
37 | dnl provides them, yet they are broken, is cygwin
38 | dnl releases prior to 16-Mar-2007 (1.5.24 and earlier)
39 | dnl So, it's more straightforward simply to special case
40 | dnl this for known bad systems.
41 | AS_IF([test -z "$LT_ARGZ_H"],
42 | [AC_CACHE_CHECK(
43 | [if argz actually works],
44 | [lt_cv_sys_argz_works],
45 | [[case $host_os in #(
46 | *cygwin*)
47 | lt_cv_sys_argz_works=no
48 | if test no != "$cross_compiling"; then
49 | lt_cv_sys_argz_works="guessing no"
50 | else
51 | lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/'
52 | save_IFS=$IFS
53 | IFS=-.
54 | set x `uname -r | $SED -e "$lt_sed_extract_leading_digits"`
55 | IFS=$save_IFS
56 | lt_os_major=${2-0}
57 | lt_os_minor=${3-0}
58 | lt_os_micro=${4-0}
59 | if test 1 -lt "$lt_os_major" \
60 | || { test 1 -eq "$lt_os_major" \
61 | && { test 5 -lt "$lt_os_minor" \
62 | || { test 5 -eq "$lt_os_minor" \
63 | && test 24 -lt "$lt_os_micro"; }; }; }; then
64 | lt_cv_sys_argz_works=yes
65 | fi
66 | fi
67 | ;; #(
68 | *) lt_cv_sys_argz_works=yes ;;
69 | esac]])
70 | AS_IF([test yes = "$lt_cv_sys_argz_works"],
71 | [AC_DEFINE([HAVE_WORKING_ARGZ], 1,
72 | [This value is set to 1 to indicate that the system argz facility works])],
73 | [LT_ARGZ_H=lt__argz.h
74 | AC_LIBOBJ([lt__argz])])])
75 |
76 | AC_SUBST([LT_ARGZ_H])
77 | ])
78 |
--------------------------------------------------------------------------------
/m4/ltsugar.m4:
--------------------------------------------------------------------------------
1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
2 | #
3 | # Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2004
6 | #
7 | # This file is free software; the Free Software Foundation gives
8 | # unlimited permission to copy and/or distribute it, with or without
9 | # modifications, as long as this notice is preserved.
10 |
11 | # serial 6 ltsugar.m4
12 |
13 | # This is to help aclocal find these macros, as it can't see m4_define.
14 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
15 |
16 |
17 | # lt_join(SEP, ARG1, [ARG2...])
18 | # -----------------------------
19 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
20 | # associated separator.
21 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
22 | # versions in m4sugar had bugs.
23 | m4_define([lt_join],
24 | [m4_if([$#], [1], [],
25 | [$#], [2], [[$2]],
26 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
27 | m4_define([_lt_join],
28 | [m4_if([$#$2], [2], [],
29 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
30 |
31 |
32 | # lt_car(LIST)
33 | # lt_cdr(LIST)
34 | # ------------
35 | # Manipulate m4 lists.
36 | # These macros are necessary as long as will still need to support
37 | # Autoconf-2.59, which quotes differently.
38 | m4_define([lt_car], [[$1]])
39 | m4_define([lt_cdr],
40 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
41 | [$#], 1, [],
42 | [m4_dquote(m4_shift($@))])])
43 | m4_define([lt_unquote], $1)
44 |
45 |
46 | # lt_append(MACRO-NAME, STRING, [SEPARATOR])
47 | # ------------------------------------------
48 | # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
49 | # Note that neither SEPARATOR nor STRING are expanded; they are appended
50 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
51 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different
52 | # than defined and empty).
53 | #
54 | # This macro is needed until we can rely on Autoconf 2.62, since earlier
55 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
56 | m4_define([lt_append],
57 | [m4_define([$1],
58 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
59 |
60 |
61 |
62 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
63 | # ----------------------------------------------------------
64 | # Produce a SEP delimited list of all paired combinations of elements of
65 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
66 | # has the form PREFIXmINFIXSUFFIXn.
67 | # Needed until we can rely on m4_combine added in Autoconf 2.62.
68 | m4_define([lt_combine],
69 | [m4_if(m4_eval([$# > 3]), [1],
70 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
71 | [[m4_foreach([_Lt_prefix], [$2],
72 | [m4_foreach([_Lt_suffix],
73 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
74 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
75 |
76 |
77 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
78 | # -----------------------------------------------------------------------
79 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
80 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
81 | m4_define([lt_if_append_uniq],
82 | [m4_ifdef([$1],
83 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
84 | [lt_append([$1], [$2], [$3])$4],
85 | [$5])],
86 | [lt_append([$1], [$2], [$3])$4])])
87 |
88 |
89 | # lt_dict_add(DICT, KEY, VALUE)
90 | # -----------------------------
91 | m4_define([lt_dict_add],
92 | [m4_define([$1($2)], [$3])])
93 |
94 |
95 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
96 | # --------------------------------------------
97 | m4_define([lt_dict_add_subkey],
98 | [m4_define([$1($2:$3)], [$4])])
99 |
100 |
101 | # lt_dict_fetch(DICT, KEY, [SUBKEY])
102 | # ----------------------------------
103 | m4_define([lt_dict_fetch],
104 | [m4_ifval([$3],
105 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
106 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
107 |
108 |
109 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
110 | # -----------------------------------------------------------------
111 | m4_define([lt_if_dict_fetch],
112 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
113 | [$5],
114 | [$6])])
115 |
116 |
117 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
118 | # --------------------------------------------------------------
119 | m4_define([lt_dict_filter],
120 | [m4_if([$5], [], [],
121 | [lt_join(m4_quote(m4_default([$4], [[, ]])),
122 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
123 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
124 | ])
125 |
--------------------------------------------------------------------------------
/m4/ltversion.in:
--------------------------------------------------------------------------------
1 | # ltversion.m4 -- version numbers -*- Autoconf -*-
2 | #
3 | # Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 | # Written by Scott James Remnant, 2004
6 | #
7 | # This file is free software; the Free Software Foundation gives
8 | # unlimited permission to copy and/or distribute it, with or without
9 | # modifications, as long as this notice is preserved.
10 |
11 | # @configure_input@
12 |
13 | # serial @MACRO_SERIAL@ ltversion.m4
14 | # This file is part of GNU Libtool
15 |
16 | m4_define([LT_PACKAGE_VERSION], [@MACRO_VERSION@])
17 | m4_define([LT_PACKAGE_REVISION], [@MACRO_REVISION@])
18 |
19 | AC_DEFUN([LTVERSION_VERSION],
20 | [macro_version='@MACRO_VERSION@'
21 | macro_revision='@MACRO_REVISION@'
22 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
23 | _LT_DECL(, macro_revision, 0)
24 | ])
25 |
--------------------------------------------------------------------------------
/m4/m4.m4:
--------------------------------------------------------------------------------
1 | # m4.m4 serial 12
2 |
3 | # Copyright (C) 2000, 2006-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 |
6 | # Copying and distribution of this file, with or without modification,
7 | # are permitted in any medium without royalty provided the copyright
8 | # notice and this notice are preserved. This file is offered as-is,
9 | # without warranty of any kind.
10 |
11 | # AC_PROG_GNU_M4
12 | # --------------
13 | # Check for GNU M4, at least 1.4.6 (all earlier versions had bugs in
14 | # trace support and regexp support):
15 | # http://lists.gnu.org/archive/html/bug-gnu-utils/2006-11/msg00096.html
16 | # http://lists.gnu.org/archive/html/bug-autoconf/2009-07/msg00023.html
17 | # Also, check whether --error-output (through 1.4.x) or --debugfile (2.0)
18 | # is supported, and AC_SUBST M4_DEBUGFILE accordingly.
19 | # Also avoid versions of m4 that trigger strstr bugs.
20 | AC_DEFUN([AC_PROG_GNU_M4],
21 | [AC_ARG_VAR([M4], [Location of GNU M4 1.4.6 or later. Defaults to the first
22 | program of 'm4', 'gm4', or 'gnum4' on PATH that meets Autoconf needs.])
23 | AC_CACHE_CHECK([for GNU M4 that supports accurate traces], [ac_cv_path_M4],
24 | [rm -f conftest.m4f
25 | ac_had_posixly_correct=${POSIXLY_CORRECT:+yes}
26 | AS_UNSET([POSIXLY_CORRECT])
27 | AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4],
28 | [dnl Creative quoting here to avoid raw dnl and ifdef in configure.
29 | # Root out GNU M4 1.4.5, as well as non-GNU m4 that ignore -t, -F.
30 | # Root out GNU M4 1.4.15 with buggy false negative replacement strstr.
31 | # Root out Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 with buggy
32 | # false positive strstr.
33 | ac_snippet=change'quote(<,>)in''dir(,mac,bug)'
34 | ac_snippet=${ac_snippet}pat'subst(a,\(b\)\|\(a\),\1)d'nl
35 | ac_snippet=$ac_snippet${as_nl}if'else(in''dex(..wi.d.,.d.),-1,bug)'
36 | ac_snippet=$ac_snippet${as_nl}if'else(in''dex(dnl
37 | ;:11-:12-:12-:12-:12-:12-:12-:12-:12.:12.:12.:12.:12.:12.:12.:12.:12-,dnl
38 | :12-:12-:12-:12-:12-:12-:12-:12-),-1,,strstr-bug2)'
39 | test -z "`$ac_path_M4 -F conftest.m4f &1`" \
40 | && test -z "`AS_ECHO([$ac_snippet]) | $ac_path_M4 --trace=mac 2>&1`" \
41 | && test -f conftest.m4f \
42 | && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:
43 | rm -f conftest.m4f],
44 | [AC_MSG_ERROR([no acceptable m4 could be found in \$PATH.
45 | GNU M4 1.4.6 or later is required; 1.4.16 or newer is recommended.
46 | GNU M4 1.4.15 uses a buggy replacement strstr on some systems.
47 | Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 have another strstr bug.])])])
48 | M4=$ac_cv_path_M4
49 | AC_CACHE_CHECK([whether $ac_cv_path_M4 accepts --gnu],
50 | [ac_cv_prog_gnu_m4_gnu],
51 | [case `$M4 --help < /dev/null 2>&1` in
52 | *--gnu*) ac_cv_prog_gnu_m4_gnu=yes ;;
53 | *) ac_cv_prog_gnu_m4_gnu=no ;;
54 | esac])
55 | if test yes = "$ac_cv_prog_gnu_m4_gnu"; then
56 | M4_GNU=--gnu
57 | else
58 | M4_GNU=
59 | fi
60 | AC_SUBST([M4_GNU])
61 | if test yes = "$ac_had_posixly_correct"; then
62 | POSIXLY_CORRECT=:
63 | if test no = $ac_cv_prog_gnu_m4_gnu; then
64 | AC_MSG_WARN([the version of M4 that was found does not support -g])
65 | AC_MSG_WARN([using it with POSIXLY_CORRECT set may cause problems])
66 | fi
67 | fi
68 | AC_CACHE_CHECK([how m4 supports trace files], [ac_cv_prog_gnu_m4_debugfile],
69 | [case `$M4 --help < /dev/null 2>&1` in
70 | *debugfile*) ac_cv_prog_gnu_m4_debugfile=--debugfile ;;
71 | *) ac_cv_prog_gnu_m4_debugfile=--error-output ;;
72 | esac])
73 | AC_SUBST([M4_DEBUGFILE], [$ac_cv_prog_gnu_m4_debugfile])
74 | ])
75 |
76 | # Compatibility for bootstrapping with Autoconf 2.61.
77 | dnl FIXME - replace this with AC_PREREQ([2.62]) after the release.
78 | # AC_PATH_PROGS_FEATURE_CHECK was added the same time the slightly broken,
79 | # undocumented _AC_PATH_PROG_FEATURE_CHECK was deleted.
80 | m4_ifndef([AC_PATH_PROGS_FEATURE_CHECK],
81 | [m4_define([AC_PATH_PROGS_FEATURE_CHECK],
82 | [_AC_PATH_PROG_FEATURE_CHECK([$1], [$2], [$3], [$5])
83 | ])])
84 |
--------------------------------------------------------------------------------
/mail/docs:
--------------------------------------------------------------------------------
1 | From nobody Wed Oct 14 17:14:44 1998
2 | X-From-Line: rms@santafe.edu Mon Jun 01 19:52:46 1998
3 | Return-Path:
4 | Delivered-To: gord@trick.profitpress.com
5 | Received: (qmail 15232 invoked from network); 1 Jun 1998 19:52:45 -0000
6 | Received: from unknown (HELO bambam.m-tech.ab.ca) (127.0.0.1)
7 | by 127.0.0.1 with SMTP; 1 Jun 1998 19:52:45 -0000
8 | Received: from sfi.santafe.edu (gateway [10.0.0.1]) by bambam.m-tech.ab.ca (8.8.5/8.6.9) with SMTP id MAA32739 for ; Mon, 1 Jun 1998 12:09:11 -0600
9 | Received: from wijiji.santafe.edu by sfi.santafe.edu (4.1/SMI-4.1)
10 | id AA03877; Mon, 1 Jun 98 11:55:41 MDT
11 | Received: by wijiji.santafe.edu (SMI-8.6/SMI-SVR4)
12 | id LAA04106; Mon, 1 Jun 1998 11:55:40 -0600
13 | Date: Mon, 1 Jun 1998 11:55:40 -0600
14 | Message-Id: <199806011755.LAA04106@wijiji.santafe.edu>
15 | From: Richard Stallman
16 | To: gord@m-tech.ab.ca
17 | In-Reply-To: <86hg27twsh.fsf@trick.profitpress.com> (message from Gordon
18 | Matzigkeit on 30 May 1998 12:53:50 -0600)
19 | Subject: Re: libtool manual comments
20 | Reply-To: rms@gnu.org
21 | References: <199805240500.XAA01237@wijiji.santafe.edu> <86hg27twsh.fsf@trick.profitpress.com>
22 | Xref: trick.profitpress.com mail.libtool:1476
23 | Lines: 23
24 | X-Gnus-Article-Number: 1 Mon Nov 2 17:18:09 1998
25 |
26 | Regarless, it needs to have a light touch on the option
27 | namespace, since it forwards any unrecognized options to the
28 | underlying compiler. This is so that people can pass arbitrary flags
29 | that libtool doesn't know about.
30 |
31 | Sorry, I don't follow the logic.
32 |
33 | Long-named options are the GNU standard, so every a GNU program should
34 | provide a long-named version of every option name.
35 |
36 | If you think there is some practical reason why libtool should not support
37 | long-named versions of its own options, would you please spell it out?
38 | I don't see why it would cause any problem.
39 |
40 | RMS> In section 5.3.1 there is a table of environment variable names,
41 | RMS> that should be @table @code. Section 12.4 has one too.
42 |
43 | Actually, these are not tables, they are lists of `@defvar' blocks.
44 | What would you recommend in this situation?
45 |
46 | I'd recommend @table @code. We don't use @defvar for environment
47 | variables.
48 |
49 |
--------------------------------------------------------------------------------
/mail/patches:
--------------------------------------------------------------------------------
1 | Date: Thu, 29 Jul 1999 14:56:40 +0200 (CEST)
2 | From: Peter Breitenlohner
3 | Reply-To: Peter Breitenlohner
4 | To: bug-libtool@gnu.org
5 | Subject: a suggestion for libtool (1.3.2)
6 | Message-ID:
7 | MIME-Version: 1.0
8 | Content-Type: MULTIPART/MIXED; BOUNDARY="1803957763-1087116776-933253000=:8802"
9 | Resent-Message-ID: <"2rP1j3.0.z77.p-4et"@mescaline.gnu.org>
10 | Resent-From: bug-libtool@gnu.org
11 | X-Mailing-List: archive/latest/952
12 | X-Loop: bug-libtool@gnu.org
13 | Precedence: list
14 | Resent-Sender: bug-libtool-request@gnu.org
15 | Resent-Bcc:
16 | X-UIDL: e9e213a8e1d8afc0286b4a4305ab5a36
17 | Status: RO
18 | X-Status: A
19 | Content-Length: 4085
20 | Lines: 83
21 |
22 | This message is in MIME format. The first part should be readable text,
23 | while the remaining parts are likely unreadable without MIME-aware tools.
24 | Send mail to mime@docserver.cac.washington.edu for more info.
25 |
26 | --1803957763-1087116776-933253000=:8802
27 | Content-Type: TEXT/PLAIN; charset=US-ASCII
28 |
29 | With our setup I found it necessary to apply the following patch to ltmain.sh
30 | (1.3.2) although it should, of course, be applied to ltmain.in instead.
31 |
32 | Let me explain the functionality of this modification and its necessity
33 | arising from our situation.
34 |
35 | 1.
36 | Gcc (or rather the ld invoked by gcc) searches for libraries in more
37 | directories than those specified with "-L" or the standard ones /lib,
38 | /usr/lib, and /usr/local/lib. Most notably there is /usr//lib or
39 | /usr/local//lib, depending on where gcc was installed.
40 |
41 | According to the general libtool philosophy, when
42 | gcc foo.o bar.o -ltest -o foo
43 | succeeds in locating libtest.so (or libtest.a) in /usr//lib, then
44 | libtool --mode=link gcc bar.lo -ltest -rpath -o bar.la
45 | should equally succeed in locating /usr//lib/libtest.so.
46 |
47 | Note that with different incarnations of gcc for different s one
48 | certainly wouldn't want to add "-L/usr//lib" to the command line.
49 | The proposed modification uses "gcc -print-file-name=libtest.so" to locate
50 | the dependency libraries.
51 |
52 | 2.
53 | My actual situation is as follows:
54 | We have a lot of users on our Linux systems (neither RedHat, nor SuSe, nor
55 | Debian, nor ...) and some groups `absolutely need libc5' whereas others
56 | `absolutely need glibc'. In order to allow for coexistence of libc (5.4.38
57 | or so) and glibc (first 2.0.6, now 2.1.1) for quite some time as well as for a
58 | really smooth transition, gcc behaves as either "gcc -b i486-pc-linux-gnulibc1"
59 | or "gcc -b i486-pc-linux-gnu", depending on the value of an environment
60 | variable. Actually /usr/bin/gcc is a symbolic link to a small shell script
61 | that invokes either /usr/i486-pc-linux-gnulibc1/bin/gcc or
62 | /usr/i486-pc-linux-gnu/bin/gcc and similarly for the binutils;
63 | consequently, there are libc5 and glibc vesions of shared libraries, e.g.
64 | /usr/i486-pc-linux-gnulibc1/lib/libncurses.so and
65 | /usr/i486-pc-linux-gnu/lib/libncurses.so etc.
66 |
67 | All that worked really nice, until I recently tried to compile
68 | w3c-libwww-5.2.8 that uses libtool. First I had to replace their libtool-1.2e
69 | (which couldn't resolve shared library dependencies at all) by version 1.3.2
70 | in order to locate libdl.so etc. (in /lib), but still had problems to locate
71 | libz.so (in /usr//lib) until I manufactured the patch.
72 |
73 | regards
74 | Peter Breitenlohner
75 |
76 |
77 | --1803957763-1087116776-933253000=:8802
78 | Content-Type: TEXT/PLAIN; charset=US-ASCII; name="libtool-1.3.2-diff"
79 | Content-Transfer-Encoding: BASE64
80 | Content-ID:
81 | Content-Description:
82 |
83 | diff -ur libtool-1.3.2.orig/ltmain.sh libtool-1.3.2/ltmain.sh
84 | --- libtool-1.3.2.orig/ltmain.sh Wed May 26 02:31:24 1999
85 | +++ libtool-1.3.2/ltmain.sh Tue Jul 27 09:43:49 1999
86 | @@ -1902,7 +1902,15 @@
87 | # If $name is empty we are operating on a -L argument.
88 | if test "$name" != "" ; then
89 | libname=`eval \\$echo \"$libname_spec\"`
90 | - for i in $lib_search_path; do
91 | + # First try to locate the library through gcc
92 | + gcc_path=
93 | + if test "$CC" = "gcc" ; then
94 | + eval library_names=\"$library_names_spec\"
95 | + set dummy $library_names
96 | + eval potlib="\$$#"
97 | + gcc_path="`gcc -print-file-name=$potlib | sed 's%/*'$potlib'$%%'`"
98 | + fi
99 | + for i in $gcc_path $lib_search_path; do
100 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
101 | for potent_lib in $potential_libs; do
102 | # Follow soft links.
103 |
104 | --1803957763-1087116776-933253000=:8802--
105 |
--------------------------------------------------------------------------------
/tests/.gitignore:
--------------------------------------------------------------------------------
1 | /defs
2 | /defs.in
3 | /package.m4
4 | /*.trs
5 |
--------------------------------------------------------------------------------
/tests/TODO:
--------------------------------------------------------------------------------
1 | Please write the following testcases and submit to libtool-patches@gnu.org:
2 |
3 | - ensure each libtool library 'originator' is tried.
4 | - check that passing NULL as the 'originator' correctly loads all
5 | preloaded modules originating from "self" (program itself).
6 | - test whether a preloaded library will open without the matching
7 | .la file.
8 |
--------------------------------------------------------------------------------
/tests/am-subdir.at:
--------------------------------------------------------------------------------
1 | # am-subdir.at -- libtool subdir-objects support -*- Autotest -*-
2 |
3 | # Copyright (C) 2004, 2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2004
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 |
24 | AT_BANNER([Libtool subdir-objects support.])
25 |
26 |
27 | ## ----------- ##
28 | ## C Language. ##
29 | ## ----------- ##
30 |
31 | AT_SETUP([C subdir-objects])
32 |
33 | AT_DATA([[configure.ac]],
34 | [[AC_INIT([subdir-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
35 | AM_INIT_AUTOMAKE
36 | LT_INIT([win32-dll])
37 | AC_PROG_CC
38 | AM_PROG_CC_C_O
39 | AC_CONFIG_FILES([Makefile])
40 | AC_OUTPUT
41 | ]])
42 |
43 | AT_DATA([[Makefile.am]],
44 | [[ACLOCAL_AMFLAGS = -I m4
45 | AUTOMAKE_OPTIONS = subdir-objects foreign 1.6
46 | AM_CPPFLAGS = -I$(top_srcdir)/../..
47 |
48 | lib_LTLIBRARIES = subdir/libsub.la
49 | subdir_libsub_la_SOURCES= subdir/sub.c
50 |
51 | bin_PROGRAMS = subdir/subdemo
52 | subdir_subdemo_SOURCES = subdir/main.c
53 | subdir_subdemo_LDADD = subdir/libsub.la
54 | ]])
55 |
56 | test -d subdir || { rm -f subdir && mkdir subdir; }
57 |
58 | AT_DATA([[subdir/main.c]],
59 | [[#include
60 |
61 | extern void sub (void);
62 |
63 | int main (void)
64 | {
65 | printf ("Welcome to GNU Libtool subdir-objects test!\n");
66 | sub();
67 | return 0;
68 | }
69 | ]])
70 |
71 | AT_DATA([[subdir/sub.c]],
72 | [[#include
73 | void sub (void) { printf ("** This is libsub **\n"); }
74 | ]])
75 |
76 | LT_AT_BOOTSTRAP([--copy], [-I m4], [ignore], [--add-missing])
77 |
78 | LT_AT_EXEC_CHECK([subdir/subdemo], 0, stdout)
79 | AT_CHECK([$GREP 'Welcome to GNU Libtool subdir-objects test' stdout],
80 | [], [ignore])
81 | AT_CHECK([$GREP 'This is libsub' stdout],
82 | [], [ignore])
83 |
84 | AT_CLEANUP
85 |
86 |
87 | ## ------------- ##
88 | ## C++ Language. ##
89 | ## ------------- ##
90 |
91 | AT_SETUP([C++ subdir-objects])
92 | LT_AT_TAG([CXX])
93 |
94 | AT_DATA([[configure.ac]],
95 | [[AC_INIT([subdir-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
96 | AM_INIT_AUTOMAKE
97 | AC_PROG_CC
98 | AM_PROG_CC_C_O
99 | AC_PROG_CXX
100 | AC_PROG_CXXCPP
101 |
102 | AC_LANG([C++])
103 | LT_INIT([win32-dll])
104 |
105 | AC_CONFIG_FILES([Makefile])
106 | AC_OUTPUT
107 | ]])
108 |
109 | AT_DATA([[Makefile.am]],
110 | [[ACLOCAL_AMFLAGS = -I m4
111 | AUTOMAKE_OPTIONS = subdir-objects foreign 1.6
112 | AM_CPPFLAGS = -I$(top_srcdir)/../..
113 |
114 | lib_LTLIBRARIES = subdir/libsub.la
115 | subdir_libsub_la_SOURCES= subdir/sub.cxx subdir/sub.hxx
116 |
117 | bin_PROGRAMS = subdir/subdemo
118 | subdir_subdemo_SOURCES = subdir/main.cxx
119 | subdir_subdemo_LDADD = subdir/libsub.la
120 | ]])
121 |
122 | test -d subdir || { rm -f subdir && mkdir subdir; }
123 |
124 | AT_DATA([[subdir/sub.hxx]],
125 | [[class libsub { public: int sub (void); };
126 | ]])
127 |
128 | AT_DATA([[subdir/main.cxx]],
129 | [[#include "sub.hxx"
130 |
131 | int main (void)
132 | {
133 | libsub SUB;
134 | return SUB.sub() != 27;
135 | }
136 | ]])
137 |
138 | AT_DATA([[subdir/sub.cxx]],
139 | [[#include "sub.hxx"
140 |
141 | int libsub::sub (void) { return 27; }
142 | ]])
143 |
144 | LT_AT_BOOTSTRAP([--copy], [-I m4], [ignore], [--add-missing])
145 |
146 | LT_AT_EXEC_CHECK([subdir/subdemo], 0)
147 |
148 | AT_CLEANUP
149 |
--------------------------------------------------------------------------------
/tests/archive-in-archive.at:
--------------------------------------------------------------------------------
1 | # dmacks.at -- test for dmacks bug -*- Autotest -*-
2 | #
3 | # Copyright (C) 2007-2008, 2010-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Peter O'Gorman, 2007
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 |
24 | AT_SETUP([static library contains static library])
25 | AT_KEYWORDS([libtool])
26 |
27 | # This test passes with MS lib.
28 | AT_XFAIL_IF([case $AR in ar-lib\ * | *[[/\\]]ar-lib\ *) false;; *) :;; esac])
29 |
30 | AT_DATA([foo.c],
31 | [
32 | int foo() { return 1;}
33 | ])
34 |
35 | AT_DATA([bar.c],
36 | [
37 | int bar() { return 1;}
38 | ])
39 |
40 | thisdir=`cd . && pwd`
41 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo.lo foo.c
42 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
43 | $LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \
44 | -o libfoo.la foo.lo -version-info 1:0:0 -rpath $thisdir
45 | $LIBTOOL --mode=install cp libfoo.la $thisdir
46 | eval `$EGREP '^(old_library)=' < libfoo.la`
47 | libfoo=$old_library
48 | AT_CHECK([$LIBTOOL --mode=link --tag=CC --tag=disable-shared $CC $CFLAGS $LDFLAGS \
49 | -o libbar.la bar.lo $libfoo -version-info 1:0:0 -rpath $thisdir],
50 | [], [ignore], [ignore])
51 | AT_CHECK([$LIBTOOL --mode=install cp libbar.la $thisdir], [], [ignore], [ignore])
52 | eval `$EGREP '^(old_library)=' < libbar.la`
53 | libbar=$old_library
54 | AT_CHECK([$AR -t $libbar | $GREP $libfoo],[1],[ignore],[ignore])
55 | AT_CHECK([$AR -t $libbar | $GREP foo.$OBJEXT],[],[ignore],[ignore])
56 | AT_CHECK([$AR -t $libbar | $GREP bar.$OBJEXT],[],[ignore],[ignore])
57 | AT_CLEANUP
58 |
--------------------------------------------------------------------------------
/tests/bug_42313.at:
--------------------------------------------------------------------------------
1 | # bug_42313.at -- bug 42313 -*- Autotest -*-
2 |
3 | # Copyright (C) 2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_BANNER([Testing bug 42313:])
22 |
23 | AT_SETUP([verify no autoscan AC_PROG_RANLIB warning])
24 |
25 | AT_DATA([configure.ac],
26 | [[
27 | AC_PREREQ([2.69])
28 | AC_INIT([testcase], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
29 | LT_INIT
30 | AC_CONFIG_MACRO_DIR([m4])
31 | AC_OUTPUT
32 | ]])
33 |
34 | LT_AT_LIBTOOLIZE([--install])
35 | AT_CHECK([$AUTORECONF --install], [0], [stdout], [stderr])
36 | AT_CHECK([autoscan || exit 77], [0], [stdout], [stderr])
37 | AT_CHECK([$GREP -- 'AC_PROG_RANLIB' stderr], [1], [ignore])
38 |
39 | AT_CLEANUP
40 |
41 | AT_SETUP([check AC_PROG_RANLIB declaration has warning])
42 |
43 | AT_DATA([configure.ac],
44 | [[
45 | AC_PREREQ([2.69])
46 | AC_INIT([testcase], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
47 | LT_INIT
48 | AC_CONFIG_MACRO_DIR([m4])
49 | AC_PROG_CPP
50 | AC_PROG_CXX
51 | AC_PROG_INSTALL
52 | AC_PROG_MAKE_SET
53 | AC_PROG_RANLIB
54 | AC_OUTPUT
55 | ]])
56 |
57 | LT_AT_LIBTOOLIZE([--install])
58 | AT_CHECK([$AUTORECONF --install], [0], [stdout], [stderr])
59 | AT_CHECK([$GREP -- 'obsolete' stdout], [0], [ignore])
60 |
61 | AT_CLEANUP
62 |
--------------------------------------------------------------------------------
/tests/bug_62343.at:
--------------------------------------------------------------------------------
1 | # bug_62343.at -- bug 62343 -*- Autotest -*-
2 |
3 | # Copyright (C) 2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_BANNER([Testing bug 62343:])
22 |
23 | AT_SETUP([Use -no-canonical-prefixes flag])
24 |
25 | AT_CHECK([$LIBTOOL --config | $EGREP '^build_libtool_libs=no' && (exit 77)], 1)
26 |
27 | AT_DATA([x.cpp],
28 | [[
29 | #include
30 |
31 | int main() {
32 | std::cout << "Hello, World!" << std::endl;
33 | return 0;
34 | }
35 | ]])
36 |
37 | # The -no-canonical-prefixes flag sometimes fails at the compiler level
38 | # depending on how the environment is set up, or which other flags have to be passed.
39 | # So first try to compile without libtool first to test if the current environment
40 | # supports the -no-canonical-prefixes flag. If it doesn't, skip the test.
41 |
42 | $CXX -no-canonical-prefixes -c x.cpp
43 |
44 | result=$?
45 |
46 | if test 0 -ne "$result"; then
47 | AT_SKIP_IF([:])
48 | fi
49 |
50 | AT_CHECK([$LIBTOOL --mode=compile --tag=CXX $CXX -no-canonical-prefixes -c x.cpp], [0], [stdout], [stderr])
51 |
52 | AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore])
53 |
54 | host_flags=:
55 | case $host_os in
56 | cygwin* | mingw* | windows*)
57 | host_flags=-no-undefined
58 | ;;
59 | *)
60 | ;;
61 | esac
62 |
63 | AT_CHECK([$LIBTOOL --mode=link --tag=CXX $CXX -no-canonical-prefixes $host_flags -o libx.la -rpath /usr/lib64/ x.lo], [0], [stdout], [stderr])
64 |
65 | AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore])
66 |
67 | AT_CLEANUP
68 |
--------------------------------------------------------------------------------
/tests/cdemo.at:
--------------------------------------------------------------------------------
1 | # cdemo.at -- Using Automake to build a program and library -*- Autotest -*-
2 | #
3 | # Copyright (C) 2003-2004, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2003
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 |
24 | AT_BANNER([Convenience libraries.])
25 |
26 |
27 | # _LT_SETUP
28 | # ---------
29 | m4_define([_LT_SETUP],
30 | [AT_DATA([configure.ac],
31 | [[AC_INIT([cdemo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
32 | AC_CONFIG_AUX_DIR([build-aux])
33 | AC_CONFIG_MACRO_DIRS([m4])
34 | AM_INIT_AUTOMAKE
35 | AC_PROG_CC
36 | LT_INIT
37 | AC_SUBST([LIBTOOL_DEPS])
38 | LT_LIB_M
39 | AC_CONFIG_FILES([Makefile])
40 | AC_CONFIG_HEADERS([config.h:config.in.h])
41 | AC_OUTPUT
42 | ]])
43 |
44 | AT_DATA([Makefile.am],
45 | [[AUTOMAKE_OPTIONS = no-dependencies foreign
46 | ACLOCAL_AMFLAGS = -I m4
47 |
48 | noinst_LTLIBRARIES = libfoo.la
49 | libfoo_la_SOURCES = foo.c
50 | libfoo_la_LIBADD = $(LIBM)
51 | libfoo_la_LDFLAGS = -no-undefined
52 | noinst_HEADERS = foo.h
53 |
54 | bin_PROGRAMS = cdemo
55 | cdemo_SOURCES = main.c
56 | cdemo_LDADD = libfoo.la
57 |
58 | libtool: $(LIBTOOL_DEPS)
59 | $(SHELL) ./config.status --recheck
60 | ]])
61 |
62 | AT_DATA([foo.h],
63 | [[#ifndef FOO_H
64 | #define FOO_H 1
65 |
66 | /* Silly constants that the functions return. */
67 | #define HELLO_RET 0xe110
68 | #define FOO_RET 0xf00
69 |
70 | extern int foo();
71 |
72 | extern int hello();
73 |
74 | #endif
75 | ]])
76 |
77 | AT_DATA([foo.c],
78 | [[#include
79 | #include
80 | #include
81 |
82 | #include "foo.h"
83 |
84 | int foo() {
85 | printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
86 | return FOO_RET;
87 | }
88 |
89 | int hello() {
90 | printf ("** This is libfoo **\n");
91 | return HELLO_RET;
92 | }
93 | ]])
94 |
95 | AT_DATA([main.c],
96 | [[#include
97 | #include
98 | #include "foo.h"
99 |
100 | int main ()
101 | {
102 | int value;
103 |
104 | printf ("Welcome to GNU libtool cdemo!\n");
105 |
106 | value = hello();
107 | printf ("hello returned: %i\n", value);
108 | if (value == HELLO_RET)
109 | printf("hello is ok!\n");
110 |
111 | if (foo () == FOO_RET)
112 | printf("foo is ok!\n");
113 |
114 | return 0;
115 | }
116 | ]])
117 |
118 | LT_AT_HOST_DATA([expout],
119 | [[Welcome to GNU libtool cdemo!
120 | ** This is libfoo **
121 | hello returned: 57616
122 | hello is ok!
123 | cos (0.0) = 1
124 | foo is ok!
125 | ]])
126 | ]) # _LT_SETUP
127 |
128 |
129 | ## ------------- ##
130 | ## Cdemo static. ##
131 | ## ------------- ##
132 |
133 | AT_SETUP([build and link against a static library])
134 |
135 | _LT_SETUP
136 |
137 | LT_AT_CHECK_CONFIG([--disable-shared],
138 | [^build_old_libs=yes], [^build_libtool_libs=no])
139 | LT_AT_CHECK_EXECUTE([], [./cdemo])
140 |
141 | AT_CLEANUP
142 |
143 |
144 | ## ------------- ##
145 | ## Cdemo shared. ##
146 | ## ------------- ##
147 |
148 | AT_SETUP([build and link against a dynamic library])
149 |
150 | _LT_SETUP
151 |
152 | LT_AT_CHECK_CONFIG([--disable-static],
153 | [^build_old_libs=no], [^build_libtool_libs=yes])
154 | LT_AT_CHECK_EXECUTE([], [./cdemo])
155 |
156 | AT_CLEANUP
157 |
158 |
159 | ## ----------- ##
160 | ## Cdemo conf. ##
161 | ## ----------- ##
162 |
163 | AT_SETUP([build both static and dynamic])
164 |
165 | _LT_SETUP
166 |
167 | LT_AT_CHECK_CONFIG([],
168 | [^build_old_libs=yes], [^build_libtool_libs=yes])
169 | LT_AT_CHECK_EXECUTE([], [./cdemo])
170 |
171 | AT_CLEANUP
172 |
173 |
174 | ## ------------ ##
175 | ## Cdemo undef. ##
176 | ## ------------ ##
177 |
178 | AT_SETUP([allow_undefined_flag])
179 |
180 | _LT_SETUP
181 |
182 | LT_AT_CHECK_CONFIG([--disable-static])
183 |
184 | AT_CHECK([$EGREP "^allow_undefined_flag=.\{0,1}unsupported.\{0,1}$" libtool && (exit 77)],
185 | 1, [ignore])
186 |
187 | $SED 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool
188 |
189 | LT_AT_CHECK_EXECUTE([], [./cdemo])
190 |
191 | AT_CLEANUP
192 |
--------------------------------------------------------------------------------
/tests/cmdline_wrap.at:
--------------------------------------------------------------------------------
1 | # cmdline_wrap.at -- run tests with low max_cmd_len -*- Autotest -*-
2 |
3 | # Copyright (C) 2007, 2009, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2007
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | # Make sure libtool works when it needs to wrap command lines.
24 | # We simulate this by setting max_cmd_len very low.
25 |
26 | AT_SETUP([Run tests with low max_cmd_len])
27 | AT_KEYWORDS([recursive expensive])
28 | dnl If we already have failures, then reruns will fail too!
29 | fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do test -f "$f" && echo "$f"; done`
30 | echo "DEBUG: fail_list='$fail_list'"
31 | AT_CHECK([test -z "$fail_list" || (exit 77)])
32 | m4_ifdef([AT_CAPTURE_FILE],
33 | [AT_CAPTURE_FILE([testsuite.log])])
34 |
35 | $SED 's|max_cmd_len=.*|max_cmd_len="24"|' < $LIBTOOL > libtool
36 | chmod +x libtool
37 | LIBTOOL=`pwd`/libtool
38 | export LIBTOOL
39 | # run the suite in a subdirectory, otherwise the two suites will compete
40 | # for the output file 'testsuite.log'.
41 | mkdir tests
42 | cd tests
43 | INNER_TESTSUITEFLAGS="$INNER_TESTSUITEFLAGS abs_top_srcdir=$abs_top_srcdir \
44 | abs_builddir=$abs_builddir"
45 | AT_CHECK([$CONFIG_SHELL $abs_srcdir/testsuite -k libtool$INNER_TESTSUITEFLAGS],
46 | [], [ignore], [ignore])
47 |
48 | AT_CLEANUP
49 |
--------------------------------------------------------------------------------
/tests/configure-funcs.at:
--------------------------------------------------------------------------------
1 | # configure-functions.at -- shared shell functions. -*- Autotest -*-
2 | #
3 | # Copyright (C) 2015-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_BANNER([Functions shared with configure and libtool.])
22 |
23 | m4_define([_AT_FUNC_SETUP], [dnl
24 | AT_SETUP([$1 works])dnl
25 | _lt_bin=$abs_top_builddir/libtool
26 | re_begincf='^# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE'
27 | re_endcf='^# ### END FUNCTIONS SHARED WITH CONFIGURE'
28 |
29 | $ECHO '#!/bin/sh' > "$1"
30 | $ECHO '#: ${SED=sed}' >> "$1"
31 | $ECHO '#: ${ECHO=echo}' >> "$1"
32 |
33 | sed "1,/$re_begincf/d;/$re_endcf/,\$d" < "$_lt_bin" >> "$1"
34 | ])
35 |
36 | _AT_FUNC_SETUP([func_munge_path_list])
37 |
38 | cat <<\EOF >> func_munge_path_list
39 | for orig in "/usr/lib" " /lib /usr/lib "; do
40 | $ECHO "'$orig':"
41 | for path in "/p1:" "/p3:/p2:" ":/a1" ":/a2:/a3" "/p4::/a4" "/p6:/p5::/a5:/a6"; do
42 | old=$orig
43 | func_munge_path_list orig "$path" || exit 1
44 | $ECHO "munge ($path) = $orig"
45 | done
46 | done
47 | EOF
48 | chmod +x func_munge_path_list
49 |
50 | AT_CHECK([ECHO="$ECHO" SED="$SED" ./func_munge_path_list], [0],
51 | ['/usr/lib':
52 | munge (/p1:) = /p1 /usr/lib
53 | munge (/p3:/p2:) = /p3 /p2 /p1 /usr/lib
54 | munge (:/a1) = /p3 /p2 /p1 /usr/lib /a1
55 | munge (:/a2:/a3) = /p3 /p2 /p1 /usr/lib /a1 /a2 /a3
56 | munge (/p4::/a4) = /p4 /p3 /p2 /p1 /usr/lib /a1 /a2 /a3 /a4
57 | munge (/p6:/p5::/a5:/a6) = /p6 /p5 /p4 /p3 /p2 /p1 /usr/lib /a1 /a2 /a3 /a4 /a5 /a6
58 | ' /lib /usr/lib ':
59 | munge (/p1:) = /p1 /lib /usr/lib @&t@
60 | munge (/p3:/p2:) = /p3 /p2 /p1 /lib /usr/lib @&t@
61 | munge (:/a1) = /p3 /p2 /p1 /lib /usr/lib /a1
62 | munge (:/a2:/a3) = /p3 /p2 /p1 /lib /usr/lib /a1 /a2 /a3
63 | munge (/p4::/a4) = /p4 /p3 /p2 /p1 /lib /usr/lib /a1 /a2 /a3 /a4
64 | munge (/p6:/p5::/a5:/a6) = /p6 /p5 /p4 /p3 /p2 /p1 /lib /usr/lib /a1 /a2 /a3 /a4 /a5 /a6
65 | ], [])
66 |
67 | AT_CLEANUP
68 |
--------------------------------------------------------------------------------
/tests/ctor.at:
--------------------------------------------------------------------------------
1 | # ctor.at -- Test constructors via C++ -*- Autotest -*-
2 | #
3 | # Copyright (C) 2007-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Noah Misch, 2007
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_BANNER([Constructors.])
24 |
25 | AT_SETUP([C++ static constructors])
26 | LT_AT_TAG([CXX])
27 | AT_KEYWORDS([libtool])
28 |
29 | AT_DATA(class.h,
30 | [[#define magic 0xaabbccdd
31 | class Foo {
32 | public:
33 | Foo() { bar = magic; }
34 | unsigned bar;
35 | };
36 |
37 | extern Foo instance;
38 | ]])
39 |
40 | AT_DATA(libctor.cpp,
41 | [[#include "class.h"
42 | Foo instance;
43 | ]])
44 |
45 | AT_DATA(main.cpp,
46 | [[#include "class.h"
47 |
48 | int main(void)
49 | {
50 | return instance.bar != magic;
51 | }
52 | ]])
53 |
54 | AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
55 | -c libctor.cpp -o libctor.lo], [0], [ignore], [ignore])
56 | AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
57 | -c main.cpp -o main.lo], [0], [ignore], [ignore])
58 | AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
59 | libctor.lo -o libctor.la -rpath /none], [0], [ignore], [ignore])
60 | AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
61 | main.lo libctor.la -o main$EXEEXT], [0], [ignore], [ignore])
62 |
63 | LT_AT_EXEC_CHECK([./main], [0])
64 |
65 | AT_CLEANUP
66 |
--------------------------------------------------------------------------------
/tests/deplibs-ident.at:
--------------------------------------------------------------------------------
1 | # deplibs-ident.at -- detecting identical deplibs -*- Autotest -*-
2 |
3 | # Copyright (C) 2005, 2007-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_BANNER([Detecting identical deplibs.])
24 |
25 |
26 | ## ----------------------------------------------- ##
27 | ## Different relative paths within the build tree. ##
28 | ## ----------------------------------------------- ##
29 |
30 | AT_SETUP([build tree relpaths])
31 | AT_KEYWORDS([libtool])
32 |
33 | mkdir a a/b c
34 | echo 'int c() { return 0; }' > c/libcee.c
35 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c c/libcee.c -o c/libcee.lo],
36 | [0],[ignore],[ignore])
37 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o c/libcee.la c/libcee.lo -rpath /nowhere],
38 | [0],[ignore],[ignore])
39 |
40 | depl_1=../c/libcee.la
41 | depl_2=`pwd`/c/libcee.la
42 | depl_3="-L../c -lcee"
43 |
44 | (
45 | cd a
46 | for i in 1 2 3; do
47 | eval depend_on_c=\"\$depl_$i\"
48 | echo "extern int c(void); int a$i() { return c(); }" > liba$i.c
49 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c liba$i.c],
50 | [0],[ignore],[ignore])
51 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la liba$i.lo $depend_on_c -rpath /nowhere],
52 | [0],[ignore],[ignore])
53 | done
54 | )
55 |
56 | AT_DATA([a/b/b.c],
57 | [[extern int a1(void), a2(void), a3(void), c(void);
58 | int main() { return a1() + a2() + a3() + c(); }
59 | ]])
60 |
61 | (
62 | cd a/b
63 | AT_CHECK([$CC $CFLAGS -c b.c],[0],[ignore],[ignore])
64 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o b$EXEEXT b.$OBJEXT ../liba1.la ../liba2.la ../liba3.la ../../c/libcee.la -rpath /nowhere],
65 | [0],[stdout],[ignore])
66 | AT_CHECK([$EGREP 'cee.*cee' stdout], 1, [ignore], [ignore])
67 | AT_XFAIL_IF([dnl
68 | eval `$LIBTOOL --config | $EGREP '^hardcode_(direct|direct_absolute|action)='`
69 | case $hardcode_action,$hardcode_direct,$hardcode_direct_absolute in
70 | relink,yes,no) :;;
71 | *,no,*) :;;
72 | *) false;;
73 | esac])
74 | dnl This is currently broken in libtool
75 | )
76 |
77 | AT_CLEANUP
78 |
--------------------------------------------------------------------------------
/tests/deplibs-mingw.at:
--------------------------------------------------------------------------------
1 | # deplibs-mingw.at -- -*- Autotest -*-
2 |
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | # Check that deplibs are detected correctly even if there is no 'file'
22 | # command installed.
23 |
24 | AT_SETUP([deplibs without file command])
25 | AT_KEYWORDS([libtool])
26 |
27 | cwd=`pwd`
28 | instdir=$cwd/inst
29 | libdir=$instdir/lib
30 | bindir=$instdir/bin
31 | save_LDFLAGS=$LDFLAGS
32 | LDFLAGS="$LDFLAGS -no-undefined"
33 |
34 | mkdir inst inst/bin inst/lib
35 |
36 | AT_DATA([a.c],
37 | [[int a () { return 0; }
38 | ]])
39 | AT_DATA([b.c],
40 | [[extern int a ();
41 | int b () { return a (); }
42 | ]])
43 |
44 | for file in a.c b.c; do
45 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
46 | done
47 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir],
48 | [], [ignore], [ignore])
49 | AT_CHECK([library_names= && . ./liba.la && if test -z "$library_names"; then exit 77; fi ],
50 | [], [ignore], [ignore])
51 | AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir], [], [ignore], [ignore])
52 | AT_CHECK([$LIBTOOL --mode=clean rm -f liba.la], [], [ignore], [ignore])
53 | rm -f $libdir/liba.la
54 |
55 | # check once with 'file' (if present) and once without, if on MinGW.
56 | for try in with-file without-file; do
57 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir ]dnl
58 | [-L$libdir -la],
59 | [], [ignore], [ignore])
60 | AT_CHECK([library_names= && . ./libb.la && if test -z "$library_names"; then exit 99; fi ],
61 | [], [ignore], [ignore])
62 |
63 | case $host_os in
64 | mingw* | windows*)
65 | if file /; then
66 | mkdir bin new-libtool
67 |
68 | cat >bin/file <<\EOF
69 | #! /bin/sh
70 | exit 1
71 | EOF
72 | chmod +x bin/file
73 | PATH=`pwd`/bin${PATH_SEPARATOR-:}$PATH
74 | cd new-libtool
75 | # configure might fail due to in-tree build of toplevel, or
76 | # missing configure flags and other reasons.
77 | LDFLAGS=$save_LDFLAGS
78 | LT_AT_CONFIGURE([|| exit 77], ["$abs_top_srcdir"/configure])
79 | LDFLAGS="$LDFLAGS -no-undefined"
80 | cd ..
81 | LIBTOOL=new-libtool/libtool
82 | export LIBTOOL
83 | # Check whether the generated script is usable; otherwise, skip.
84 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libunrelated.la a.lo -rpath $libdir] dnl
85 | [|| exit 77], [], [ignore], [ignore])
86 | else
87 | break;
88 | fi;;
89 | *)
90 | break;;
91 | esac
92 | done
93 |
94 | AT_CLEANUP
95 |
--------------------------------------------------------------------------------
/tests/dumpbin-symbols.at:
--------------------------------------------------------------------------------
1 | # dumpbin-symbols.at -- libtool "dumpbin -symbols" support -*- Autotest -*-
2 |
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_BANNER([Windows tests.])
22 | AT_SETUP([dumpbin -symbols section hiding])
23 |
24 | # I don't know of a stable way to create a pair of objects that
25 | # exhibits the potential problem, so this test fakes it by
26 | # testing with output from a case that do have the potential
27 | # problem.
28 |
29 | # First check if the global_symbol_pipe can handle the below
30 | # test case at all, and skip if $NM is not MS dumpbin.
31 |
32 | AT_DATA([variable.c],
33 | [[
34 | int some_variable = 0;
35 | ]])
36 |
37 | AT_CHECK([$CC $CPPFLAGS $CFLAGS -c variable.c], [], [ignore], [ignore])
38 | AT_CHECK([$NM variable.$OBJEXT], [], [stdout], [ignore])
39 | AT_CHECK([$GREP 'External.*some_variable' stdout || exit 77], [], [ignore])
40 |
41 | eval `$LIBTOOL --config | $EGREP '^(global_symbol_pipe)='`
42 |
43 | AT_DATA([dumpbin-output],
44 | [[
45 | Dump of file foo.obj
46 |
47 | File Type: COFF OBJECT
48 |
49 | COFF SYMBOL TABLE
50 | 000 00AB766F ABS notype Static | @comp.id
51 | 001 00000001 ABS notype Static | @feat.00
52 | 002 00000000 SECT1 notype Static | .drectve
53 | Section length 8F, #relocs 0, #linenums 0, checksum 0
54 | 004 00000000 SECT2 notype Static | .debug$S
55 | Section length 44B4, #relocs 1C, #linenums 0, checksum 0
56 | 006 00000000 SECT3 notype Static | .rdata
57 | Section length 1, #relocs 0, #linenums 0, checksum 0, selection 2 (pick any)
58 | 008 00000000 SECT3 notype External | ?value@?$integral_constant@_N$0A@@tr1@std@@2_NB (public: static bool const std::tr1::integral_constant::value)
59 | 009 00000000 SECT4 notype Static | .rdata
60 | Section length 1, #relocs 0, #linenums 0, checksum 77073096, selection 2 (pick any)
61 | *snip lots of uninteresting crap*
62 | 12A 00000000 SECT5B notype Static | .text
63 | Section length 4B, #relocs 2, #linenums 0, checksum 22AE8362, selection 2 (pick any)
64 | 12C 00000000 SECT5C notype Static | .debug$S
65 | Section length 150, #relocs B, #linenums 0, checksum 0, selection 5 (pick associative Section 0x5B)
66 | 12F 00000000 SECT5D notype Static | .debug$T
67 | Section length 5C, #relocs 0, #linenums 0, checksum 0
68 |
69 | String Table Size = 0x15EF bytes
70 |
71 |
72 | Dump of file conv.lib
73 |
74 | File Type: LIBRARY
75 |
76 | COFF SYMBOL TABLE
77 | 000 00AB766F ABS notype Static | @comp.id
78 | 001 00000001 ABS notype Static | @feat.00
79 | 002 00000000 SECT1 notype Static | .drectve
80 | Section length 2F, #relocs 0, #linenums 0, checksum 0
81 | 004 00000000 SECT2 notype Static | .debug$S
82 | Section length 70C, #relocs 5, #linenums 0, checksum 0
83 | 006 00000000 SECT3 notype Static | .text
84 | Section length A, #relocs 0, #linenums 0, checksum BAFC81C1
85 | 008 00000000 SECT3 notype () External | _convenience
86 | 009 00000000 SECT4 notype Static | .debug$T
87 | Section length 5C, #relocs 0, #linenums 0, checksum 0
88 |
89 | String Table Size = 0x11 bytes
90 |
91 | Summary
92 |
93 | 5B3C .debug$S
94 | B8 .debug$T
95 | BE .drectve
96 | 129 .rdata
97 | C .sxdata
98 | 613 .text
99 | 6C .text$x
100 | B8 .xdata$x
101 | ]])
102 |
103 | # Check if the _convenience symbol from section SECT3 in conv.lib is
104 | # present even if section SECT3 in foo.obj is hidden.
105 | AT_CHECK([< dumpbin-output eval "$global_symbol_pipe"], [], [stdout])
106 | AT_CHECK([$GREP convenience stdout], [], [ignore])
107 |
108 | AT_CLEANUP
109 |
--------------------------------------------------------------------------------
/tests/duplicate_conv.at:
--------------------------------------------------------------------------------
1 | # duplicate_conv.at -- duplicate convenience archive names -*- Autotest -*-
2 |
3 | # Copyright (C) 2006, 2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2006
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([duplicate convenience archive names])
24 | AT_KEYWORDS([libtool])
25 |
26 | eval `$LIBTOOL --config | $SED -n '/^reload_cmds=/,/^$/p'`
27 |
28 | # We create two convenience archives with the same name, and _also_
29 | # containing an object with the same name. This is necessary to detect
30 | # the failure with both 1.5.22 and HEAD, since the latter does not (did
31 | # not?) remove the temporary output directory, thus masking the failure
32 | # when all objects have distinct names.
33 |
34 | mkdir a b c
35 |
36 | echo 'int a () { return 0; }' > a/a.c
37 | echo 'int a2() { return 0; }' > b/a.c
38 | echo 'int b () { return 0; }' > b/b.c
39 | echo 'extern int a(), a2(), b(); int c() { return a() + a2() + b(); }' > c.c
40 | echo 'extern int c(); int main() { return c(); }' > main.c
41 |
42 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a/a.c -o a/a.lo
43 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b/a.c -o b/a.lo
44 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b/b.c -o b/b.lo
45 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c c.c
46 | $CC $CPPFLAGS $CFLAGS -c main.c
47 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o a/liba.la a/a.lo
48 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o b/liba.la b/a.lo b/b.lo
49 |
50 | # Fold into convenience archive.
51 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -o libcee.la c.lo a/liba.la b/liba.la],
52 | [0], [ignore], [ignore])
53 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la],
54 | [0], [ignore], [ignore])
55 | LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
56 | $LIBTOOL --mode=clean rm -f libcee.la
57 |
58 |
59 | # FIXME: For this test, we may want to zero out whole_archive_flag_spec;
60 | # OTOH, we'd like to test the other situation, too.
61 |
62 | # Fold into static library.
63 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -rpath /foo -static -o libcee.la c.lo a/liba.la b/liba.la],
64 | [0], [ignore], [ignore])
65 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la],
66 | [0], [ignore], [ignore])
67 | LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
68 | $LIBTOOL --mode=clean rm -f libcee.la
69 |
70 | # Fold into library.
71 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -no-undefined -rpath /foo -o libcee.la c.lo a/liba.la b/liba.la],
72 | [0], [ignore], [ignore])
73 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la],
74 | [0], [ignore], [ignore])
75 | LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
76 | $LIBTOOL --mode=clean rm -f libcee.la
77 |
78 | AT_CHECK([test false = "$reload_cmds" && exit 77], [1])
79 |
80 | # Test whether this works with reloadable objects as well.
81 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o cee.$OBJEXT c.lo a/liba.la b/liba.la],
82 | [0], [ignore], [ignore])
83 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT cee.$OBJEXT],
84 | [0], [ignore], [ignore])
85 | LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
86 |
87 | # TODO: test dlpreloading of duplicates (when it is implemented)
88 |
89 | AT_CLEANUP
90 |
--------------------------------------------------------------------------------
/tests/duplicate_deps.at:
--------------------------------------------------------------------------------
1 | # duplicate_deps.at -- preserve duplicate convenience deps -*- Autotest -*-
2 |
3 | # Copyright (C) 2006-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2006
6 | $
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([preserve duplicate convenience deps])
24 | AT_KEYWORDS([libtool])
25 |
26 | # --preserve-dup-deps should work for convenience archives.
27 |
28 | # Create a circular dependency of liba and libb:
29 | # a1 pulls in b1, that pulls in a2.
30 | cat >a1.c <<\EOF
31 | extern int b1 ();
32 | int a1 () { return b1 (); }
33 | EOF
34 | cat >a2.c <<\EOF
35 | int a2 () { return 0; }
36 | EOF
37 | cat >b1.c <<\EOF
38 | extern int a2 ();
39 | int b1 () { return a2 (); }
40 | EOF
41 | cat >main.c <<\EOF
42 | extern int a1 ();
43 | int main () { return a1 (); }
44 | EOF
45 |
46 | for file in a1.c a2.c b1.c; do
47 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
48 | done
49 | $CC $CPPFLAGS $CFLAGS -c main.c
50 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o liba.la a1.lo a2.lo
51 |
52 | # This could be worked around by adding liba.la to libb.la
53 | # (in that case all objects from liba would be merged into
54 | # libb.a as well, possibly renamed.)
55 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b1.lo liba.la
56 | AT_CHECK([$LIBTOOL --mode=link --tag=CC \
57 | $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la],
58 | [0], [ignore], [ignore])
59 | LT_AT_EXEC_CHECK([./main])
60 |
61 | # Forgo the workaround and create a true circular dependency.
62 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b1.lo
63 | # Some systems find all symbols anyway; skip this test on such systems.
64 | AT_CHECK([$LIBTOOL --mode=link --tag=CC \
65 | $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la liba.la \
66 | && exit 77],
67 | [1], [ignore], [ignore])
68 | # Other systems need special treatment, so preserve-dup-deps flag is used.
69 | AT_CHECK([$LIBTOOL --mode=link --preserve-dup-deps --tag=CC \
70 | $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la libb.la liba.la],
71 | [0], [ignore], [ignore])
72 |
73 | AT_CLEANUP
74 |
--------------------------------------------------------------------------------
/tests/duplicate_members.at:
--------------------------------------------------------------------------------
1 | # duplicate_members.at -- duplicate members in archive tests -*- Autotest -*-
2 |
3 | # Copyright (C) 2005, 2007-2009, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Alexandre Oliva & Peter O'Gorman, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([duplicate members in archive tests])
24 | AT_KEYWORDS([libtool])
25 |
26 | # we don't want to use whole_archive_flag_spec, even if available
27 | $SED -e 's|^whole_archive_flag_spec=.*|whole_archive_flag_spec=|g' < $LIBTOOL > libtool
28 |
29 | chmod +x ./libtool
30 | LIBTOOL=./libtool
31 |
32 | AT_DATA(bar.c,
33 | [[extern int foo1 (), foo2 (), foo3 (), foo4 (), foo5 (), foo6 ();
34 | int bar() {
35 | int result = foo1 () + foo2 () + foo3 () + foo4 () + foo5 () + foo6 ();
36 | return result;
37 | }
38 | ]])
39 |
40 | AT_DATA(main.c,
41 | [[int bar();
42 | int main()
43 | {
44 | if (bar() == 21) return 0;
45 | return 1;
46 | }
47 | ]])
48 |
49 |
50 | for a in 1 2 3 4 5 6
51 | do
52 | mkdir $a
53 | echo "int foo$a() {return $a;}" > $a/a.c
54 | done
55 |
56 |
57 | for a in 1 2 3 4 5 6
58 | do
59 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o $a/a.lo $a/a.c
60 | done
61 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libc0.la 6/a.lo
62 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la ]dnl
63 | [1/a.lo 2/a.lo 3/a.lo 4/a.lo 5/a.lo libc0.la], [], [ignore], [ignore])
64 |
65 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
66 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la ]dnl
67 | [ bar.lo libconv.la -rpath /notexist], [], [ignore], [ignore])
68 |
69 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
70 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT ]dnl
71 | [main.lo ./libbar.la], [], [ignore], [ignore])
72 |
73 | LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
74 |
75 | AT_CLEANUP
76 |
--------------------------------------------------------------------------------
/tests/exeext.at:
--------------------------------------------------------------------------------
1 | # exeext.at -- ensure that exeext handling works -*- Autotest -*-
2 | #
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | # Written by Peter Rosin
5 | #
6 | # This file is part of GNU Libtool.
7 | #
8 | # GNU Libtool is free software; you can redistribute it and/or
9 | # modify it under the terms of the GNU General Public License as
10 | # published by the Free Software Foundation; either version 2 of
11 | # the License, or (at your option) any later version.
12 | #
13 | # GNU Libtool is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with GNU Libtool. If not, see .
20 | ####
21 |
22 |
23 | AT_SETUP([both of -o prog and -o prog$EXEEXT work])
24 | AT_KEYWORDS([libtool])
25 |
26 | AT_CHECK([test -n "$EXEEXT" || exit 77])
27 |
28 | bin=`pwd`/bin
29 | binext=`pwd`/binext
30 | mkdir src $bin srcext $binext
31 |
32 | AT_DATA(src/prog.c,
33 | [[
34 | int main(void) { return 0; }
35 | ]])
36 |
37 | $CC $CPPFLAGS $CFLAGS -c src/prog.c -o src/prog.$OBJEXT
38 |
39 | AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/prog src/prog.$OBJEXT,
40 | [0], [ignore], [ignore])
41 | AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o srcext/prog$EXEEXT src/prog.$OBJEXT,
42 | [0], [ignore], [ignore])
43 |
44 | $LIBTOOL --mode=install cp src/prog $bin/prog
45 | $LIBTOOL --mode=install cp srcext/prog$EXEEXT $binext/prog$EXEEXT
46 |
47 | LT_AT_EXEC_CHECK([$bin/prog])
48 | LT_AT_EXEC_CHECK([$binext/prog$EXEEXT])
49 |
50 | AT_CLEANUP
51 |
--------------------------------------------------------------------------------
/tests/export-def.at:
--------------------------------------------------------------------------------
1 | # export-def.at -- test module-definition files -*- Autotest -*-
2 |
3 | # Copyright (C) 2013-2019, 2021-2024 Free Software Foundation, Inc.
4 | # Written by Peter Rosin, 2013
5 | #
6 | # This file is part of GNU Libtool.
7 | #
8 | # GNU Libtool is free software; you can redistribute it and/or
9 | # modify it under the terms of the GNU General Public License as
10 | # published by the Free Software Foundation; either version 2 of
11 | # the License, or (at your option) any later version.
12 | #
13 | # GNU Libtool is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with GNU Libtool. If not, see .
20 | ####
21 |
22 | AT_SETUP([export from a DLL with a .def file])
23 | AT_KEYWORDS([libtool])
24 |
25 | AT_CHECK([$LIBTOOL --features | $GREP 'disable shared libraries' && (exit 77)],
26 | [1], [ignore])
27 | eval `$LIBTOOL --config | $EGREP '^(shrext_cmds|libname_spec|soname_spec)='`
28 |
29 | eval shared_ext=\"$shrext_cmds\"
30 |
31 | # skip if not building a .dll
32 | AT_CHECK([test .dll = "$shared_ext" || (exit 77)])
33 |
34 | LDFLAGS="$LDFLAGS -no-undefined"
35 | libdir=`pwd`/inst/lib
36 | mkdir inst inst/lib
37 |
38 | AT_DATA([a.c],
39 | [[/* a */
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | int v1 = -1;
45 | int v2 (void) { return -2; }
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 | ]])
51 |
52 | AT_DATA([syms],
53 | [[v1
54 | v2
55 | ]])
56 |
57 | AT_DATA([def1],
58 | [[EXPORTS
59 | v1 DATA
60 | v2
61 | ]])
62 |
63 | AT_DATA([def2],
64 | [[; Def file
65 | ; with some very important comments
66 | EXPORTS
67 | v1 DATA
68 | v2
69 | ]])
70 |
71 | AT_DATA([def3],
72 | [[
73 | EXPORTS v1 DATA
74 | v2
75 | ]])
76 |
77 | AT_DATA([def4],
78 | [[ LIBRARY %soname%
79 | EXPORTS
80 | v1 DATA
81 | v2
82 | ]])
83 |
84 | AT_DATA([main.c],
85 | [[
86 | /* w32 fun. With GCC, you can have auto-import, which will work for
87 | * functions and non-const variables. With MSVC, you have to explicitly
88 | * import all variables.
89 | *
90 | * For users, it's best to realize that they should not provide any
91 | * non-function API at all.
92 | */
93 | #if defined LIBA_DLL_IMPORT
94 | # if defined _WIN32 && defined _MSC_VER
95 | # define LIBA_SCOPE_VAR extern __declspec(dllimport)
96 | # endif
97 | #endif
98 | #if !defined LIBA_SCOPE_VAR
99 | # define LIBA_SCOPE_VAR extern
100 | #endif
101 | #ifdef __cplusplus
102 | extern "C" {
103 | #endif
104 | LIBA_SCOPE_VAR int v1;
105 | extern int v2(void);
106 | #ifdef __cplusplus
107 | }
108 | #endif
109 |
110 | int main (void)
111 | {
112 | return v1 + v2() + 3;
113 | }
114 | ]])
115 |
116 | name=a
117 | eval libname=\"$libname_spec\"
118 | major=0
119 | versuffix=-$major
120 | eval soname=\"$soname_spec\"
121 |
122 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],[0],[ignore],[ignore])
123 | AT_CHECK([$CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c],[0],[ignore],[ignore])
124 |
125 | for exportsyms in syms def1 def2 def3 def4
126 | do
127 | $SED "s/%soname%/$soname/" -i $exportsyms
128 |
129 | LT_AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \
130 | -rpath $libdir' -export-symbols $exportsyms], [], [ignore], [ignore])
131 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la],
132 | [], [ignore], [ignore])
133 | LT_AT_EXEC_CHECK([./main])
134 | done
135 |
136 | AT_CLEANUP
137 |
--------------------------------------------------------------------------------
/tests/fail.at:
--------------------------------------------------------------------------------
1 | # fail.at -- test that libtool really fail when it should -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005, 2008-2009, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | # TODO: many possible failure cases missing. (But how to simulate a full disk?)
24 |
25 | AT_SETUP([Failure tests])
26 | AT_KEYWORDS([libtool])
27 | eval `$LIBTOOL --config | $EGREP '^(pic_mode|pic_flag|build_old_libs|build_libtool_libs)='`
28 | LDFLAGS="$LDFLAGS -no-undefined"
29 |
30 | m4_pushdef([FAIL_CHECK],
31 | [AT_CHECK([if $1; then (exit 1); else :; fi], [0], [ignore], [ignore])
32 | ])
33 |
34 | AT_DATA([script],
35 | [[#! /bin/sh
36 | exit 0
37 | ]])
38 | chmod +x script
39 | if test -x script >/dev/null 2>&1; then
40 | test_x="test -x"
41 | else
42 | test_x=:
43 | fi
44 |
45 | # compile failure
46 | echo 'choke me' > a.c
47 | FAIL_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c])
48 | AT_CHECK([test -f a.lo], [1])
49 |
50 | # non-PIC compile failure
51 | case $pic_mode in default | no)
52 | case " $CFLAGS " in
53 | *\ -prefer-pic\ *) ;;
54 | *)
55 | case $build_old_libs,$pic_flag in yes,*-DPIC*)
56 | AT_DATA([a.c], [[
57 | #ifndef PIC
58 | choke me
59 | #endif
60 | ]])
61 | FAIL_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -no-suppress -c a.c])
62 | AT_CHECK([test -f a.lo], [1])
63 | ;;
64 | esac
65 | ;;
66 | esac
67 | ;;
68 | esac
69 |
70 | # program creation failure.
71 | # We can't rely on 'main' not being present: the QNX linker
72 | # won't error out in that case, although the resulting binary won't work.
73 | # So we provoke a link failure due to an unresolved symbol, and require
74 | # libtool to fail only if the link without libtool would have failed, too.
75 | cat > a.c <<'EOF'
76 | extern int nonexistent_function (void);
77 | int main (void)
78 | {
79 | return nonexistent_function ();
80 | }
81 | EOF
82 | $CC $CPPFLAGS $CFLAGS -c a.c
83 | if $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT; then :; else
84 | rm -f a a$EXEEXT
85 | FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT])
86 | AT_CHECK([{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x a$EXEEXT; }], [1])
87 | FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a$EXEEXT a.$OBJEXT -static])
88 | AT_CHECK([{ test -f a && $test_x a; } || { test -f a$EXEEXT && $test_x a$EXEEXT; }], [1])
89 | fi
90 |
91 | # shared library creation failure
92 | case $build_libtool_libs in yes)
93 | echo 'int duplicate_name(void) { return 0; }' > a.c
94 | echo 'double duplicate_name(double x) { return 2.*x; }' > b.c
95 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
96 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
97 | # Unfortunately, this may actually succeed on AIX and IRIX :(
98 | # So, also add a bogus object file to provoke more failure.
99 | echo 'int whatever(void) { return 0;}' > c.c
100 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c c.c
101 | (
102 | . ./c.lo
103 | test none = "$pic_object" || echo choke me >"$pic_object"
104 | test none = "$non_pic_object" || echo choke me >"$non_pic_object"
105 | )
106 | FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo b.lo c.lo -rpath /foo])
107 | AT_CHECK([test -f liba.la], [1])
108 | ;;
109 | esac
110 |
111 | # Ensure we diagnose '-L path'.
112 | echo 'int main () { return 0; }' > d.c
113 | echo 'int foo () { return 0; }' > space-after-L.c
114 | $CC $CPPFLAGS $CFLAGS -c d.c
115 | $CC $CPPFLAGS $CFLAGS -c space-after-L.c
116 | FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -L space-after-L.$OBJEXT -o d$EXEEXT d.$OBJEXT])
117 | FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o d$EXEEXT d.$OBJEXT -L])
118 |
119 | m4_popdef([FAIL_CHECK])
120 | AT_CLEANUP
121 |
--------------------------------------------------------------------------------
/tests/flags.at:
--------------------------------------------------------------------------------
1 | # flags.at -- libtool passing of flags -*- Autotest -*-
2 | #
3 | # Copyright (C) 2009-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | m4_foreach([lt_tag], [CC, CXX, F77, FC, GCJ],
22 | [AT_SETUP([passing lt_tag flags through libtool])
23 | AT_KEYWORDS([libtool])
24 | LT_AT_TAG(m4_defn([lt_tag]))
25 |
26 | case $host_os in
27 | # FIXME: Locate shared version of gcc library for NetBSD.
28 | netbsd*)
29 | if test "CXX" = "lt_tag"; then
30 | AT_SKIP_IF([:])
31 | fi
32 | ;;
33 | *)
34 | LDFLAGS="$LDFLAGS -no-undefined"
35 | ;;
36 | esac
37 | eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`"
38 |
39 | m4_case(lt_tag,
40 | [CC], [AT_DATA([a.c],
41 | [[int main () { return 0; }
42 | ]])
43 | compile="$CC $CPPFLAGS $CFLAGS" link="$CC $CFLAGS $LDFLAGS" source=a.c
44 | ],
45 | [CXX], [AT_DATA([a.cpp],
46 | [[int main () { return 0; }
47 | ]])
48 | compile="$CXX $CPPFLAGS $CXXFLAGS" link="$CXX $CXXFLAGS $LDFLAGS" source=a.cpp
49 | ],
50 | [F77], [AT_DATA([a.f],
51 | [[ program main
52 | end
53 | ]])
54 | compile="$F77 $FFLAGS" link="$F77 $FFLAGS $LDFLAGS" source=a.f
55 | ],
56 | [FC], [AT_DATA([a.f90],
57 | [[ program main
58 | end
59 | ]])
60 | compile="$FC $FCFLAGS" link="$FC $FCFLAGS $LDFLAGS" source=a.f90
61 | ],
62 | [GCJ], [AT_DATA([a.java],
63 | [[class a {}
64 | ]])
65 | compile="$GCJ $GCJFLAGS" link="$GCJ $GCJFLAGS $LDFLAGS" source=a.java
66 | ])
67 |
68 | # Linker flags are not passed to the archiver, so don't test static libraries.
69 | if $LIBTOOL --features | $GREP 'enable shared libraries'; then
70 | library_and_module='library.la "module.la -module -avoid-version"'
71 | else
72 | library_and_module=
73 | fi
74 |
75 | eval "`$LIBTOOL --tag=lt_tag --config | $EGREP '^(wl|archive_cmds)='`"
76 |
77 | AT_CHECK([$LIBTOOL --tag=lt_tag --mode=compile $compile -c $source],
78 | [], [ignore], [ignore])
79 |
80 | # Linker flags are prefixed with $wl iff they are passed to the
81 | # compiler driver, instead of directly to the linker.
82 | case $archive_cmds in
83 | *\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
84 | *) maybe_wl=$wl compiler_flags_in_liblink=: ;;
85 | esac
86 |
87 | for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
88 | case $flag in
89 | -Wc, | -Xcompiler\ )
90 | AT_CHECK([$LIBTOOL -n --tag=lt_tag --mode=compile $compile ]dnl
91 | [$flag-foo -c $source], [], [stdout], [ignore])
92 | AT_CHECK([$FGREP " -foo" stdout], [], [ignore])
93 | flag_prefix_prog=
94 | flag_prefix_lib=
95 | flags_in_liblink=$compiler_flags_in_liblink
96 | ;;
97 | -Wl, | -Xlinker\ )
98 | flag_prefix_prog=$wl
99 | flag_prefix_lib=$maybe_wl
100 | flags_in_liblink=:
101 | ;;
102 | esac
103 |
104 | AT_CHECK([$LIBTOOL -n --tag=lt_tag --mode=link $link ]dnl
105 | [-o program$EXEEXT a.lo $flag-foo], [], [stdout], [ignore])
106 | AT_CHECK([$FGREP " $flag_prefix_prog-foo" stdout], [], [ignore])
107 |
108 | eval set x "$library_and_module"
109 | for output
110 | do
111 | test x = "$output" && continue
112 | AT_CHECK([$LIBTOOL -n --tag=lt_tag --mode=link $link ]dnl
113 | [-o $output a.lo -rpath /nowhere $flag-foo], [], [stdout], [ignore])
114 | if $flags_in_liblink; then
115 | AT_CHECK([$FGREP " $flag_prefix_lib-foo" stdout], [], [ignore])
116 | else
117 | AT_CHECK([$FGREP " $flag_prefix_lib-foo" stdout], [1])
118 | fi
119 | done
120 | done
121 |
122 | AT_CLEANUP
123 | ])dnl m4_foreach(tag)
124 |
--------------------------------------------------------------------------------
/tests/indirect_deps.at:
--------------------------------------------------------------------------------
1 | # indirect_deps.at -- support for link_all_deplibs=no -*- Autotest -*-
2 |
3 | # Copyright (C) 2007-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2007.
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([indirect convenience])
24 | AT_KEYWORDS([libtool])
25 |
26 | AT_DATA([a.c], [[
27 | #include
28 | int a () { return 0; }
29 | double ad (double x) { return sin (x); }
30 | ]])
31 | AT_DATA([b.c], [[
32 | extern int a ();
33 | extern double ad (double);
34 | int b () { return a () + (int) ad (0.0); }
35 | ]])
36 | AT_DATA([c.c], [[
37 | extern int b ();
38 | int c () { return b (); }
39 | ]])
40 | AT_DATA([m.c], [[
41 | extern int c ();
42 | int main () { return c (); }
43 | ]])
44 |
45 | LDFLAGS="$LDFLAGS -no-undefined"
46 | for file in a.c b.c c.c; do
47 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c $file
48 | done
49 | $CC $CPPFLAGS $CFLAGS -c m.c
50 |
51 | # liba is an indirect dependency of libd and of libconv.
52 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath /nowhere -lm
53 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b.lo liba.la -rpath /nowhere
54 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la c.lo libb.la
55 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libd.la libconv.la -rpath /nowhere
56 |
57 | for st in '' -static; do
58 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m.$OBJEXT libd.la],
59 | [], [ignore], [ignore])
60 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m.$OBJEXT libconv.la],
61 | [], [ignore], [ignore])
62 | LT_AT_EXEC_CHECK([./m1])
63 | LT_AT_EXEC_CHECK([./m2])
64 | done
65 |
66 | AT_CLEANUP
67 |
68 |
69 | AT_SETUP([indirect uninstalled])
70 | AT_KEYWORDS([libtool])
71 |
72 | AT_DATA([a.c], [[
73 | int a () { return 0; }
74 | ]])
75 | AT_DATA([b.c], [[
76 | extern int a ();
77 | int b () { return a (); }
78 | ]])
79 | AT_DATA([c.c], [[
80 | extern int b ();
81 | int c () { return b (); }
82 | ]])
83 |
84 | AT_DATA([m1.c], [[
85 | extern int b ();
86 | int main () { return b (); }
87 | ]])
88 | AT_DATA([m2.c], [[
89 | extern int c ();
90 | int main () { return c (); }
91 | ]])
92 |
93 | mkdir a b c
94 | LDFLAGS="$LDFLAGS -no-undefined"
95 | for file in a.c b.c c.c; do
96 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c $file
97 | done
98 | for file in m1.c m2.c; do
99 | $CC $CPPFLAGS $CFLAGS -c $file
100 | done
101 |
102 | for st in '' -static; do
103 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o a/liba.la a.lo -rpath /nowherea
104 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o b/libb.la b.lo a/liba.la -rpath /nowhereb
105 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o c/libcee.la c.lo b/libb.la -rpath /nowherec
106 |
107 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m1.$OBJEXT b/libb.la],
108 | [], [ignore], [ignore])
109 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m2.$OBJEXT c/libcee.la],
110 | [], [ignore], [ignore])
111 | LT_AT_EXEC_CHECK([./m1])
112 | LT_AT_EXEC_CHECK([./m2])
113 | done
114 |
115 | AT_CLEANUP
116 |
--------------------------------------------------------------------------------
/tests/infer-tag.at:
--------------------------------------------------------------------------------
1 | # infer-tag.at -- libtool without --tag -*- Autotest -*-
2 | #
3 | # Copyright (C) 2008, 2010-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 | #
6 | # This file is part of GNU Libtool.
7 | #
8 | # GNU Libtool is free software; you can redistribute it and/or
9 | # modify it under the terms of the GNU General Public License as
10 | # published by the Free Software Foundation; either version 2 of
11 | # the License, or (at your option) any later version.
12 | #
13 | # GNU Libtool is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with GNU Libtool. If not, see .
20 | ####
21 |
22 | # Check that func_infer_tag works.
23 |
24 | # We add one test per tag, so that only those tests are skipped
25 | # for which the tags are disabled (otherwise we only ever test
26 | # on systems where all tags are enabled).
27 |
28 | AT_SETUP([inferred tag])
29 | AT_KEYWORDS([libtool])
30 |
31 | AT_DATA([a.c],
32 | [[int a (void) { return 0; }
33 | ]])
34 |
35 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],
36 | [], [ignore], [ignore])
37 |
38 | AT_CLEANUP
39 |
40 | AT_SETUP([CXX inferred tag])
41 | LT_AT_TAG([CXX])
42 | AT_KEYWORDS([libtool])
43 |
44 | AT_DATA([a.cpp],
45 | [[int a (void) { return 0; }
46 | ]])
47 |
48 | AT_CHECK([$LIBTOOL --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c a.cpp],
49 | [], [ignore], [ignore])
50 |
51 | AT_CLEANUP
52 |
53 | AT_SETUP([F77 inferred tag])
54 | LT_AT_TAG([F77])
55 | AT_KEYWORDS([libtool])
56 |
57 | AT_DATA([a.f],
58 | [[ program main
59 | end
60 | ]])
61 |
62 | AT_CHECK([$LIBTOOL --mode=compile $F77 $FFLAGS -c a.f],
63 | [], [ignore], [ignore])
64 |
65 | AT_CLEANUP
66 |
67 | AT_SETUP([FC inferred tag])
68 | LT_AT_TAG([FC])
69 | AT_KEYWORDS([libtool])
70 |
71 | AT_DATA([a.f],
72 | [[ program main
73 | end
74 | ]])
75 |
76 | AT_CHECK([$LIBTOOL --mode=compile $FC $FCFLAGS -c a.f],
77 | [], [ignore], [ignore])
78 |
79 | AT_CLEANUP
80 |
81 | AT_SETUP([GCJ inferred tag])
82 | LT_AT_TAG([GCJ])
83 | AT_KEYWORDS([libtool])
84 |
85 | AT_DATA([A.java],
86 | [[public class A {
87 | private int a;
88 | public A () { a = 0; }
89 | };
90 | ]])
91 |
92 | AT_CHECK([$LIBTOOL --mode=compile $GCJ $GCJCFLAGS -c A.java],
93 | [], [ignore], [ignore])
94 |
95 | AT_CLEANUP
96 |
--------------------------------------------------------------------------------
/tests/inherited_flags.at:
--------------------------------------------------------------------------------
1 | # inherited_flags.at -- test inherited_linker_flags -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Peter O'Garman, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 |
24 | AT_SETUP([inherited_linker_flags])
25 | AT_KEYWORDS([libtool])
26 |
27 | AT_DATA([foo.c],
28 | [
29 | int foo() { return 1;}
30 | ])
31 |
32 | AT_DATA([bar.c],
33 | [
34 | int bar() { return 1;}
35 | ])
36 |
37 | AT_DATA([baz.c],
38 | [
39 | int baz() { return 1;}
40 | ])
41 |
42 | AT_DATA([both.c],
43 | [
44 | int both() { return 1;}
45 | ])
46 |
47 | AT_DATA([main.c],
48 | [
49 | int main() { return 0;}
50 | ])
51 |
52 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo.lo foo.c
53 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar.lo bar.c
54 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o baz.lo baz.c
55 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o both.lo both.c
56 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.lo main.c
57 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo -rpath /nonexistent -no-undefined
58 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la bar.lo -rpath /nonexistent -no-undefined
59 | $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libboth.la both.lo -rpath /nonexistent -no-undefined
60 |
61 |
62 | mv libfoo.la libfoo.la.bak
63 | $SED -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_inlikely_existing_lib/g' < libfoo.la.bak > libfoo.la
64 | rm libfoo.la.bak
65 |
66 | mv libbar.la libbar.la.bak
67 | $SED -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g' < libbar.la.bak > libbar.la
68 | rm libbar.la.bak
69 |
70 | mv libboth.la libboth.la.bak
71 | $SED -e "s/^inherited_linker_flags.*/inherited_linker_flags='-llt_inlikely_existing_lib -llt_unlikely_existing_lib'/g" < libboth.la.bak > libboth.la
72 | rm libboth.la.bak
73 |
74 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la],
75 | [ignore],[stdout],[ignore])
76 | # We used to grep for
77 | # 'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'
78 | # here. This fails on win32/MSVC because the generated command lines have a
79 | # different syntax. So drop the first 'l'.
80 | AT_CHECK([$LIBTOOL --features | $GREP 'disable shared libraries' && (exit 77)], [1], [ignore])
81 | AT_CHECK([$GREP 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' stdout],
82 | [0],[ignore],[ignore])
83 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la],
84 | [ignore],[stdout],[ignore])
85 | AT_CHECK([$GREP 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' stdout],
86 | [0],[ignore],[ignore])
87 |
88 | # now check for duplicates
89 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la],
90 | [ignore],[stdout],[ignore])
91 | AT_CHECK([$GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout],
92 | [1],[ignore],[ignore])
93 | AT_CHECK([$GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout],
94 | [1],[ignore],[ignore])
95 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la ./libboth.la],
96 | [ignore],[stdout],[ignore])
97 | AT_CHECK([$GREP 'lt_inlikely_existing_lib.*lt_inlikely_existing_lib' stdout],
98 | [1],[ignore],[ignore])
99 | AT_CHECK([$GREP 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout],
100 | [1],[ignore],[ignore])
101 |
102 | mv libboth.la libboth.la.bak
103 | $SED "s/^inherited_linker_flags.*/inherited_linker_flags='-framework Cocoa -framework ApplicationServices'/" < libboth.la.bak > libboth.la
104 | rm libboth.la.bak
105 |
106 | AT_CHECK([$LIBTOOL -n --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -framework Cocoa -framework ApplicationServices -o libbaz.la baz.lo libboth.la -no-undefined -rpath /nonexistent],
107 | [], [stdout], [ignore])
108 | AT_CHECK([$GREP Cocoa.ltframework stdout], [1], [], [])
109 | AT_CHECK([$GREP ' -framework Cocoa' stdout], [0], [ignore], [])
110 |
111 | AT_CLEANUP
112 |
--------------------------------------------------------------------------------
/tests/install.at:
--------------------------------------------------------------------------------
1 | # install.at -- install mode tests -*- Autotest -*-
2 | #
3 | # Copyright (C) 2008-2009, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2008
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([Install tests])
24 | AT_KEYWORDS([libtool])
25 |
26 | # Ensure that install_override_mode overrides the mode of the shared
27 | # library (and only the shared library).
28 |
29 | AT_CHECK([$LIBTOOL --features | $GREP 'enable shared libraries' || exit 77],
30 | [], [ignore])
31 | $SED 's|^\(install_override_mode\)=.*|\1=755|' < $LIBTOOL > ./libtool
32 | LIBTOOL=./libtool
33 | chmod a+rx $LIBTOOL
34 |
35 | inst=`pwd`/inst
36 | mkdir inst
37 |
38 | echo 'int a () { return 0; }' > a.c
39 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
40 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo ]dnl
41 | [-rpath $inst -no-undefined], [], [ignore], [ignore])
42 | AT_CHECK([$LIBTOOL --mode=install $lt_INSTALL liba.la $inst],
43 | [], [stdout], [ignore])
44 | AT_CHECK([$GREP ' -m 755' stdout], [], [ignore])
45 | AT_CHECK([$LIBTOOL --mode=install $lt_INSTALL -m 644 liba.la $inst],
46 | [], [stdout], [ignore])
47 | AT_CHECK([$GREP ' -m 755' stdout], [], [ignore])
48 | AT_CHECK([$GREP ' -m 644.*liba.la' stdout], [], [ignore])
49 |
50 | AT_CLEANUP
51 |
--------------------------------------------------------------------------------
/tests/lalib-syntax.at:
--------------------------------------------------------------------------------
1 | # lalib-syntax.at -- parsing .la files robustly -*- Autotest -*-
2 | #
3 | # Copyright (C) 2009-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_SETUP([syntax of .la files])
22 | AT_KEYWORDS([libtool])
23 | AT_KEYWORDS([libltdl])
24 |
25 | AT_XFAIL_IF([:]) dnl libltdl does not consistently return non-NULL lt_dlerror
26 |
27 | AT_DATA([main.c],
28 | [[#include
29 | #include
30 | #include
31 |
32 | int
33 | main (int argc, char* argv[])
34 | {
35 | int err = 0;
36 | lt_dlhandle plugin_handle;
37 |
38 | if (argc < 2)
39 | {
40 | fprintf (stderr, "usage: %s plugin\n", argv[0]);
41 | return 1;
42 | }
43 |
44 | lt_dlinit ();
45 | plugin_handle = lt_dlopenext (argv[1]);
46 | if (NULL != plugin_handle)
47 | {
48 | printf ("plugin opened successfully!\n");
49 | lt_dlclose (plugin_handle);
50 | }
51 | else
52 | {
53 | const char *error = lt_dlerror ();
54 | assert (error != NULL);
55 | printf ("plugin failed to open: %s\n", error);
56 | err = 1;
57 | }
58 | lt_dlexit ();
59 | return err;
60 | }
61 | ]])
62 |
63 | AT_DATA([module.c],
64 | [[int foo (void) { return 0; }
65 | ]])
66 |
67 | : ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
68 | : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
69 |
70 | # Skip this test when called from:
71 | # make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
72 | AT_CHECK([case $LIBLTDL in #(
73 | */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
74 | esac], [], [ignore])
75 |
76 | CPPFLAGS="$CPPFLAGS $LTDLINCL"
77 |
78 | AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c], [], [ignore], [ignore])
79 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c module.c],
80 | [], [ignore], [ignore])
81 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o module.la module.lo ]dnl
82 | [-module -avoid-version -rpath /somewhere], [], [ignore], [ignore])
83 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT $LIBLTDL],
84 | [], [ignore], [ignore])
85 |
86 |
87 | # Several bogus test cases.
88 |
89 | AT_DATA([missing-closing-quote.la],
90 | [[# missing-closing-quote.la - a libtool library file
91 | # Generated by libtool
92 | dlname='module.so
93 | library_names='module.so module.so module.so'
94 | old_library='module.a'
95 | installed=no
96 | shouldnotlink=yes
97 | libdir='/somewhere'
98 | ]])
99 |
100 | AT_DATA([wrong-quotes.la],
101 | [[# wrong-quotes.la - a libtool library file
102 | # Generated by libtool
103 | dlname=module.so
104 | library_names='module.so module.so module.so'
105 | old_library='module.a'
106 | installed=no
107 | shouldnotlink=yes
108 | libdir='/somewhere'
109 | ]])
110 |
111 | AT_DATA([no-dlname.la],
112 | [[# no-dlname.la - a libtool library file
113 | # Generated by libtool
114 | installed=no
115 | shouldnotlink=yes
116 | libdir='/somewhere'
117 | ]])
118 |
119 | AT_DATA([nonexistent-dlname.la],
120 | [[# nonexistent-dlname.la - a libtool library file
121 | # Generated by libtool
122 | dlname='does-not-exist.so'
123 | installed=no
124 | shouldnotlink=yes
125 | libdir='/somewhere'
126 | ]])
127 |
128 | for file in ./missing-closing-quote.la ./wrong-quotes.la \
129 | ./no-dlname.la ./nonexistent-dlname.la; do
130 | LT_AT_EXEC_CHECK([./main], [1], [stdout], [ignore], [$file])
131 | AT_CHECK([$GREP 'plugin failed to open' stdout], [], [ignore])
132 | done
133 |
134 | AT_CLEANUP
135 |
--------------------------------------------------------------------------------
/tests/link-order.at:
--------------------------------------------------------------------------------
1 | # link-order.at -- ensure that library linking order matches -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005, 2007-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Alexandre Oliva & Ralf Wildenhues, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 |
24 | AT_SETUP([Link order test])
25 | AT_KEYWORDS([libtool])
26 | eval `$LIBTOOL --config | $EGREP '^(hardcode_direct|hardcode_direct_absolute|shrext_cmds)='`
27 | LDFLAGS="$LDFLAGS -no-undefined"
28 |
29 | module=no
30 | eval shared_ext=\"$shrext_cmds\"
31 |
32 | prefix_old=`pwd`/old
33 | prefix_new=`pwd`/new
34 | mkdir src $prefix_old $prefix_new $prefix_old/lib $prefix_new/lib
35 |
36 | AT_DATA(src/c.c,
37 | [[int c = 1;
38 | ]])
39 |
40 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c src/c.c -o src/c.lo
41 | $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/libcee.la src/c.lo -rpath $prefix_old/lib
42 | $LIBTOOL --mode=install cp src/libcee.la $prefix_old/lib/libcee.la
43 |
44 | for i in old new; do
45 | rm -rf src
46 | mkdir src
47 |
48 | cat >src/a_$i.c <src/b_$i.c <src/main_$i.c <.
19 | ####
20 |
21 | AT_SETUP([localized compiler messages])
22 | AT_KEYWORDS([libtool])
23 |
24 | # Let's try German locale. :-)
25 | m4_pushdef([lt_localize],
26 | [LANG=de_DE LANGUAGE=de_DE LC_ALL=de_DE])
27 |
28 | AT_DATA([a.c],
29 | [[int x[-1];
30 | ]])
31 | AT_DATA([b.c],
32 | [[int y;
33 | ]])
34 |
35 | # First see if setting a locale is accepted at all.
36 | AT_CHECK([(lt_localize $CC $CPPFLAGS $CFLAGS -c b.c) || exit 77],
37 | [], [stdout], [stderr])
38 |
39 | # Find out about expected output.
40 | AT_CHECK([(lt_localize $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1],
41 | [1], [stdout], [stderr])
42 | LT_AT_NORMALIZE_COMPILER_OUTPUT([stdout], [expected-stdout])
43 | LT_AT_NORMALIZE_COMPILER_OUTPUT([stderr], [expected-stderr])
44 | AT_CHECK([(lt_localize $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c) || exit 1],
45 | [1], [stdout], [stderr])
46 | LT_AT_NORMALIZE_COMPILER_OUTPUT([stdout], [libtool-stdout])
47 | LT_AT_NORMALIZE_COMPILER_OUTPUT([stderr], [libtool-stderr])
48 | # Avoid these errors:
49 | # GNU/Linux:
50 | # /bin/sh: warning: setlocale: LC_ALL: cannot change locale (de_DE)
51 | # HP-UX:
52 | # Warning! One or more of your selected locales are not available.
53 | # Please invoke the commands "locale" and "locale -a" to verify your
54 | # selections and the available locales.
55 | #
56 | # Continuing processing using the "C" locale.
57 | AT_CHECK([$GREP locale stdout stderr && exit 77], [1])
58 | AT_CHECK([diff expected-stderr libtool-stderr])
59 | AT_CHECK([diff expected-stdout libtool-stdout])
60 |
61 | # check that we get our quoting right.
62 | m4_define([lt_localize],
63 | [[LANGUAGE='a; nosuchprogram " '\'' & $x /#+*(){}|,:`\ !%']])
64 | AT_CHECK([(lt_localize $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b.c)],
65 | [0], [stdout], [stderr])
66 | AT_CHECK([$GREP nosuchprogram stdout stderr], [1])
67 |
68 | m4_popdef([lt_localize])
69 |
70 | AT_CLEANUP
71 |
--------------------------------------------------------------------------------
/tests/lt_dlopen.at:
--------------------------------------------------------------------------------
1 | # lt_dlopen.at -- test libltdl functionality -*- Autotest -*-
2 | #
3 | # Copyright (C) 2009, 2011-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_SETUP([lt_dlopen error messages])
22 | AT_KEYWORDS([libltdl])
23 |
24 | # The bug is not fixed:
25 | AT_XFAIL_IF([:])
26 |
27 | # This test only works if the system allows undefined symbols.
28 | eval `$LIBTOOL --config | $GREP '^allow_undefined_flag='`
29 | AT_CHECK([test unsupported != "$allow_undefined_flag" || exit 77])
30 |
31 | AT_DATA([main.c],
32 | [[#include
33 | #include
34 |
35 | int
36 | main (int argc, char* argv[])
37 | {
38 | int err = 0;
39 | lt_dlhandle plugin_handle;
40 |
41 | if (argc < 2)
42 | {
43 | fprintf (stderr, "usage: %s plugin\n", argv[0]);
44 | return 1;
45 | }
46 |
47 | lt_dlinit ();
48 | plugin_handle = lt_dlopenext (argv[1]);
49 | if (NULL != plugin_handle)
50 | {
51 | printf ("plugin opened successfully!\n");
52 | lt_dlclose (plugin_handle);
53 | }
54 | else
55 | {
56 | printf ("plugin failed to open: %s\n", lt_dlerror());
57 | err = 1;
58 | }
59 | lt_dlexit ();
60 | return err;
61 | }
62 | ]])
63 |
64 | AT_DATA([good-plugin.c],
65 | [[int foo;
66 | int *i = &foo;
67 | ]])
68 |
69 | AT_DATA([missing-symbol-plugin.c],
70 | [[/* On systems that allow undefined symbols, this will compile,
71 | but the symbol "foo" won't be found at runtime */
72 | extern int foo;
73 | int *i = &foo;
74 | ]])
75 |
76 | : ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
77 | : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
78 |
79 | CPPFLAGS="$LTDLINCL $CPPFLAGS"
80 | inst=`pwd`/inst
81 | libdir=$inst/lib
82 |
83 | AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c], [], [ignore], [ignore])
84 | for file in good-plugin.c missing-symbol-plugin.c; do
85 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file],
86 | [], [ignore], [ignore])
87 | done
88 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o good-plugin.la -rpath $libdir ]dnl
89 | [-module -avoid-version good-plugin.lo], [], [ignore], [ignore])
90 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o missing-symbol-plugin.la -rpath $libdir]dnl
91 | [-module -avoid-version missing-symbol-plugin.lo], [], [ignore], [ignore])
92 |
93 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ]dnl
94 | [-dlopen good-plugin.la -dlopen missing-symbol-plugin.la $LIBLTDL],
95 | [], [ignore], [ignore])
96 |
97 | LT_AT_EXEC_CHECK([./main], [], [ignore], [ignore], [./good-plugin.la])
98 | LT_AT_EXEC_CHECK([./main], [1], [ignore], [stderr], [./missing-symbol-plugin.la])
99 | AT_CHECK([$GREP 'missing symbol' stderr], [], [ignore])
100 |
101 | AT_CLEANUP
102 |
--------------------------------------------------------------------------------
/tests/lt_dlopen_a.at:
--------------------------------------------------------------------------------
1 | # lt_dlopen_a.at -- test libltdl functionality -*- Autotest -*-
2 | #
3 | # Copyright (C) 2009, 2011-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_SETUP([lt_dlopen archive])
22 | AT_KEYWORDS([libltdl lt_dlopen_a])
23 |
24 | AT_DATA([main.c],
25 | [[#include
26 | #include
27 | #include
28 |
29 | /* This dlopen() in the main executable should override any dlopen()s in
30 | shared libraries etc.
31 |
32 | If that is not the case (or the platform does not use dlopen()) then this
33 | test should exit 77, causing the test to SKIP.
34 | */
35 | static int retcde = 77;
36 |
37 | void * dlopen(const char *path, int mode) {
38 | if (!(strcmp(path,"plugin.a") && strcmp(path,"plugin.lib")))
39 | {
40 | fprintf(stderr,"Tried to open archive %s\n",path);
41 | retcde = 1;
42 | }
43 | else
44 | {
45 | fprintf(stderr,"Opening ... %s\n", path);
46 | if (retcde == 77) retcde = 0;
47 | }
48 | return NULL;
49 | }
50 |
51 | int
52 | main (int argc, char* argv[])
53 | {
54 | int err = 0;
55 | lt_dlhandle plugin_handle;
56 |
57 | lt_dlinit ();
58 | plugin_handle = lt_dlopenext (argv[1]);
59 | lt_dlexit ();
60 | return retcde;
61 | }
62 | ]])
63 |
64 | AT_DATA([plugin.c],
65 | [[
66 | int i = 1;
67 | ]])
68 |
69 | : ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
70 | : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
71 |
72 | CPPFLAGS="$LTDLINCL $CPPFLAGS"
73 | inst=`pwd`/inst
74 | libdir=$inst/lib
75 | bindir=$inst/bin
76 |
77 | AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c || exit 77],[],[ignore],[ignore])
78 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c plugin.c || exit 77],
79 | [], [ignore], [ignore])
80 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o plugin.la -rpath ]dnl
81 | [$libdir -module -no-undefined -avoid-version plugin.lo || exit 77],
82 | [], [ignore], [ignore])
83 |
84 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT ]dnl
85 | [main.$OBJEXT -dlopen plugin.la $LIBLTDL || exit 77],
86 | [], [ignore], [ignore])
87 |
88 | mkdir -p $libdir
89 | mkdir -p $bindir
90 |
91 | AT_CHECK([$LIBTOOL --mode=install cp plugin.la $libdir],[], [ignore], [ignore])
92 | AT_CHECK([$LIBTOOL --mode=install cp main$EXEEXT $bindir],[], [ignore], [ignore])
93 | AT_CHECK([test -f "$libdir/plugin.a" || exit 77])
94 | LT_AT_EXEC_CHECK([$bindir/main], [], [ignore], [ignore],[$libdir/plugin.la])
95 |
96 | AT_CLEANUP
97 |
--------------------------------------------------------------------------------
/tests/ltdl-api.at:
--------------------------------------------------------------------------------
1 | # ltdl-api.at -- test libltdl API -*- Autotest -*-
2 | #
3 | # Copyright (C) 2008, 2011-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 | # Written by Ralf Wildenhues, 2008.
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([ltdl API])
24 | AT_KEYWORDS([libltdl])
25 |
26 | # Ensure that no symbols from argz are unrenamed.
27 | eval `$LIBTOOL --config | $EGREP '^(NM|global_symbol_pipe|objext)='`
28 | lt__argz_o=$abs_top_builddir/libltdl/lt__argz.$objext
29 | AT_CHECK([test -f "$lt__argz_o" || exit 77])
30 | AT_CHECK([eval "$NM \"\$lt__argz_o\" | $global_symbol_pipe"],
31 | [], [stdout], [ignore])
32 | # Check for global symbols beginning with "argz_"
33 | AT_CHECK([$GREP "^T argz_" stdout], [1])
34 | # and also for the _ prefixed version "_argz_"
35 | AT_CHECK([$GREP "^T _argz_" stdout], [1])
36 |
37 | AT_CLEANUP
38 |
--------------------------------------------------------------------------------
/tests/ltdl-libdir.at:
--------------------------------------------------------------------------------
1 | # ltdl-libdir.at -- test libltdl functionality -*- Autotest -*-
2 | #
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | # This file is part of GNU Libtool.
5 | #
6 | # GNU Libtool is free software; you can redistribute it and/or
7 | # modify it under the terms of the GNU General Public License as
8 | # published by the Free Software Foundation; either version 2 of
9 | # the License, or (at your option) any later version.
10 | #
11 | # GNU Libtool is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with GNU Libtool. If not, see .
18 | ####
19 |
20 | AT_SETUP([libdir of installed modules])
21 | AT_KEYWORDS([libltdl])
22 |
23 | # This test requires shared library support.
24 | AT_CHECK([$LIBTOOL --features | $GREP 'enable shared libraries' || exit 77],
25 | [], [ignore])
26 |
27 | # With MinGW, try Windows-style paths only.
28 | if pwd -W >/dev/null 2>&1; then
29 | prefix=`pwd -W`/inst
30 | else
31 | prefix=`pwd`/inst
32 | fi
33 | libdir=$prefix/lib
34 | bindir=$prefix/bin
35 | mkdir $prefix $libdir $bindir
36 |
37 | AT_DATA([a.c],
38 | [[#ifdef __cplusplus
39 | extern "C"
40 | #endif
41 | int f (void)
42 | {
43 | return 42;
44 | }
45 | ]])
46 |
47 | AT_DATA([m.c],
48 | [[
49 | #include
50 | #include
51 |
52 | typedef int func_f(void);
53 |
54 | int
55 | main (int argc, const char *argv[])
56 | {
57 | lt_dlhandle module = NULL;
58 | func_f *f = NULL;
59 |
60 | if (lt_dlinit()) {
61 | fprintf(stderr, "lt_dlinit failed '%s'\n", lt_dlerror());
62 | return 1;
63 | }
64 |
65 | module = lt_dlopen("./a.la");
66 |
67 | if (!module) {
68 | fprintf(stderr, "lt_dlopen failed '%s'\n", lt_dlerror());
69 | return 1;
70 | }
71 |
72 | f = (func_f *)lt_dlsym(module, "f");
73 |
74 | if (!f) {
75 | fprintf(stderr, "lt_dlsym failed '%s'\n", lt_dlerror());
76 | return 1;
77 | }
78 |
79 | if (f() != 42) {
80 | fprintf(stderr, "f did not return 42\n");
81 | return 1;
82 | }
83 |
84 | lt_dlclose(module);
85 | lt_dlexit();
86 | return 0;
87 | }
88 | ]])
89 |
90 | : ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
91 | : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
92 |
93 | # Skip installcheck if --disable-ltdl-install was used.
94 | AT_CHECK([test -f "$LIBLTDL" || exit 77])
95 |
96 | CPPFLAGS="$LTDLINCL $CPPFLAGS"
97 | LDFLAGS="$LDFLAGS -no-undefined"
98 |
99 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],
100 | [], [ignore], [ignore])
101 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a.la ]dnl
102 | [a.lo -rpath $libdir -module -shared -avoid-version],
103 | [], [ignore], [ignore])
104 | AT_CHECK([$CC $CPPFLAGS $CFLAGS -c m.c],
105 | [], [ignore], [ignore])
106 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT ]dnl
107 | [m.$OBJEXT $LIBLTDL],
108 | [], [ignore], [ignore])
109 | AT_CHECK([$LIBTOOL --mode=install cp a.la $libdir/a.la],
110 | [], [ignore], [ignore])
111 | AT_CHECK([$LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT],
112 | [], [ignore], [ignore])
113 |
114 | # Try finding the module via the libdir entry in a misplaced .la file.
115 |
116 | mv $libdir/a.la $bindir/a.la
117 | cd $bindir
118 | LT_AT_EXEC_CHECK([./m],
119 | [], [ignore], [ignore])
120 |
121 | AT_CLEANUP
122 |
--------------------------------------------------------------------------------
/tests/no-executables.at:
--------------------------------------------------------------------------------
1 | # no-executables.at -- Libtool usage in GCC -*- Autotest -*-
2 |
3 | # Copyright (C) 2008, 2010-2019, 2021-2024 Free Software Foundation,
4 | # Inc.
5 | #
6 | # This file is part of GNU Libtool.
7 | #
8 | # GNU Libtool is free software; you can redistribute it and/or
9 | # modify it under the terms of the GNU General Public License as
10 | # published by the Free Software Foundation; either version 2 of
11 | # the License, or (at your option) any later version.
12 | #
13 | # GNU Libtool is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with GNU Libtool. If not, see .
20 | ####
21 |
22 | AT_BANNER([Libtool usage in GCC])
23 | AT_SETUP([AC_NO_EXECUTABLES])
24 |
25 | mkdir m4
26 |
27 | AT_DATA([configure.ac],
28 | [[AC_INIT([no-exec], [1])
29 | AC_CONFIG_MACRO_DIRS([m4])
30 |
31 | # We punt a bit here, to get the results of AC_PROG_CC
32 | # (and allow it to do link tests) but still error out on
33 | # link tests within Libtool macros.
34 | LDFLAGS=-lnosuchlibrary
35 | AC_NO_EXECUTABLES
36 | AC_PROG_CC
37 | AC_PROG_CXX
38 | AC_PROG_F77
39 | AC_PROG_FC
40 | AM_PROG_GCJ
41 |
42 | # Consequently, we have to set cache variables for each link
43 | # test we may need. For the purposes of this test, it shouldn't
44 | # matter much whether these values are actually wrong, the point
45 | # is that the linker should never be invoked.
46 |
47 | lt_cv_shlibpath_overrides_runpath=no
48 | lt_cv_archive_cmds_need_lc=no
49 | lt_cv_cc_needs_belf=no
50 | lt_cv_support_no_fixup_chains=no
51 | lt_cv_ld_exported_symbols_list=no
52 | lt_cv_prog_compiler_static_works=no
53 | lt_cv_aix_libpath=/usr/lib:/lib
54 | lt_cv_irix_exported_symbol=yes
55 |
56 | # Deal with AC_LIBTOOL_DLOPEN in one of two possible ways:
57 | # - do not execute it at all in the ac_no_link case
58 | # - preset the individual Autoconf test variables
59 |
60 | if ${test_ac_libtool_dlopen-false}; then
61 | ac_cv_func_shl_load=no
62 | ac_cv_lib_dld_shl_load=no
63 | ac_cv_func_dlopen=no
64 | ac_cv_lib_dl_dlopen=no
65 | ac_cv_lib_svld_dlopen=no
66 | ac_cv_lib_dld_dld_link=no
67 | AC_LIBTOOL_DLOPEN
68 | fi
69 | AC_PROG_LIBTOOL
70 |
71 | AC_OUTPUT
72 | ]])
73 |
74 | LT_AT_BOOTSTRAP([--install], [-I m4], [ignore], [ignore], [], [ignore], [ignore])
75 | LT_AT_CONFIGURE([])
76 | LT_AT_CONFIGURE([test_ac_libtool_dlopen=:])
77 |
78 | AT_CLEANUP
79 |
--------------------------------------------------------------------------------
/tests/nocase.at:
--------------------------------------------------------------------------------
1 | # nocase.at -- test for nocase lib search -*- Autotest -*-
2 | #
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | # Written by Peter Rosin, 2007
5 | #
6 | # This file is part of GNU Libtool.
7 | #
8 | # GNU Libtool is free software; you can redistribute it and/or
9 | # modify it under the terms of the GNU General Public License as
10 | # published by the Free Software Foundation; either version 2 of
11 | # the License, or (at your option) any later version.
12 | #
13 | # GNU Libtool is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with GNU Libtool. If not, see .
20 | ####
21 |
22 |
23 | AT_SETUP([nocase library search])
24 | AT_KEYWORDS([libtool])
25 |
26 | eval `$LIBTOOL --config | $EGREP '^(want_nocaseglob|file_magic_glob)='`
27 |
28 | AT_CHECK([test yes != "$want_nocaseglob" && ]dnl
29 | [test -z "$file_magic_glob" && exit 77],
30 | [1], [ignore], [ignore])
31 |
32 | mkdir foo
33 | AT_DATA([foo/Foo.c],
34 | [
35 | int Foo (void) { return 1; }
36 | ])
37 |
38 | mkdir bar
39 | AT_DATA([bar/bar.c],
40 | [
41 | extern int Foo (void);
42 | int bar (void) { return Foo (); }
43 | ])
44 |
45 | AT_DATA([main.c],
46 | [
47 | extern int bar (void);
48 | int main (void) { return bar (); }
49 | ])
50 |
51 | libdir=`pwd`/inst/lib
52 | mkdir inst inst/bin inst/lib
53 |
54 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo/Foo.lo foo/Foo.c
55 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o foo/libFoo.la foo/Foo.lo ]dnl
56 | [-no-undefined -version-info 1:0:0 -rpath $libdir],
57 | [], [ignore], [ignore])
58 | AT_CHECK([$LIBTOOL --mode=install cp foo/libFoo.la $libdir],
59 | [], [ignore], [ignore])
60 | AT_CHECK([$LIBTOOL --mode=clean rm -f foo/libFoo.la],
61 | [], [ignore], [ignore])
62 |
63 | rm -f $libdir/libFoo.la
64 |
65 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar/bar.lo bar/bar.c
66 | AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o bar/libbar.la bar/bar.lo ]dnl
67 | [-L$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath $libdir],
68 | [], [ignore], [ignore])
69 | AT_CHECK([$LIBTOOL --mode=install cp bar/libbar.la $libdir],
70 | [], [ignore], [ignore])
71 |
72 | str=`$EGREP '^(old_library)=' < $libdir/libbar.la`
73 | eval "$str"
74 | libbar=$old_library
75 | rm -f $libdir/$libbar
76 |
77 | $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.$OBJEXT main.c
78 |
79 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$libdir -lbar],
80 | [], [ignore], [ignore])
81 |
82 | AT_CLEANUP
83 |
--------------------------------------------------------------------------------
/tests/nonrecursive.at:
--------------------------------------------------------------------------------
1 | # nonrecursive.at -- test nonrecursive Automake Libltdl -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005, 2008-2009, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 |
24 | AT_BANNER([Nonrecursive Automake Libltdl.])
25 |
26 | # _LT_AT_LTDL_SETUP
27 | # -----------------
28 | m4_pushdef([_LT_AT_LTDL_SETUP],
29 | [AT_DATA([configure.ac],
30 | [[AC_INIT([subdirectory-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
31 | LT_CONFIG_LTDL_DIR([ltdl])
32 | AC_CONFIG_AUX_DIR([ltdl/config])
33 | AC_CONFIG_MACRO_DIRS([ltdl/m4])
34 | AC_CONFIG_LIBOBJ_DIR([ltdl])
35 | AC_CONFIG_HEADERS([config.h:config.hin])
36 | AM_INIT_AUTOMAKE([foreign subdir-objects])
37 | AC_PROG_CC
38 | AM_PROG_CC_C_O
39 | LT_INIT
40 | LTDL_INIT([nonrecursive])
41 | AC_CONFIG_FILES([Makefile])
42 | AC_OUTPUT
43 | ]])
44 |
45 | AT_DATA([Makefile.am],
46 | [[ACLOCAL_AMFLAGS = -I ltdl/m4
47 | AUTOMAKE_OPTIONS = 1.9.6
48 | BUILT_SOURCES =
49 |
50 | AM_CPPFLAGS =
51 | AM_LDFLAGS =
52 |
53 | include_HEADERS =
54 | noinst_LTLIBRARIES =
55 | lib_LTLIBRARIES = foo.la
56 | EXTRA_LTLIBRARIES =
57 |
58 | EXTRA_DIST =
59 |
60 | CLEANFILES =
61 | MOSTLYCLEANFILES =
62 |
63 | include ltdl/ltdl.mk
64 |
65 | foo_la_LDFLAGS = -module -avoid-version -no-undefined
66 | foo_la_SOURCES = foo.c
67 | ]])
68 |
69 | echo 'int dummy = 0;' > foo.c
70 | ])# _LT_AT_LTDL_SETUP
71 |
72 | ## ------------------------ ##
73 | ## Softlinked libltdl tree. ##
74 | ## ------------------------ ##
75 |
76 | AT_SETUP([compiling softlinked libltdl])
77 |
78 | _LT_AT_LTDL_SETUP
79 |
80 | LT_AT_LIBTOOLIZE([--ltdl])
81 | AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
82 |
83 | # Support vanilla autoconf-2.59 & automake-1.9.6
84 | for file in lt__argz.c lt__dirent.c lt__strl.c; do
85 | cp ltdl/$file $file
86 | done
87 |
88 | LT_AT_BOOTSTRAP([ignore], [-I ltdl/m4], [], [--add-missing --copy],
89 | [], [], [all $tst_dist])
90 |
91 | AT_CHECK([test -f ltdl/libltdlc.la])
92 |
93 | AT_CLEANUP
94 |
95 |
96 | ## -------------------- ##
97 | ## Copied libltdl tree. ##
98 | ## -------------------- ##
99 |
100 | AT_SETUP([compiling copied libltdl])
101 |
102 | _LT_AT_LTDL_SETUP
103 |
104 | LT_AT_LIBTOOLIZE([--copy --ltdl])
105 | AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
106 |
107 | # Support vanilla autoconf-2.59 & automake-1.9.6
108 | for file in lt__argz.c lt__dirent.c lt__strl.c; do
109 | cp ltdl/$file $file
110 | done
111 |
112 | LT_AT_BOOTSTRAP([ignore], [-I ltdl/m4], [], [--add-missing --copy],
113 | [], [], [all $tst_dist])
114 |
115 | AT_CHECK([test -f ltdl/libltdlc.la])
116 |
117 | AT_CLEANUP
118 |
119 |
120 | ## ------------------------- ##
121 | ## Installable libltdl tree. ##
122 | ## ------------------------- ##
123 |
124 | AT_SETUP([installable libltdl])
125 |
126 | _LT_AT_LTDL_SETUP
127 |
128 | prefix=`pwd`/_inst
129 |
130 | LT_AT_LIBTOOLIZE([--copy --ltdl])
131 | AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
132 |
133 | # Support vanilla autoconf-2.59 & automake-1.9.6
134 | for file in lt__argz.c lt__dirent.c lt__strl.c; do
135 | cp ltdl/$file $file
136 | done
137 |
138 | LT_AT_BOOTSTRAP([ignore], [-I ltdl/m4], [], [--add-missing --copy],
139 | [], [--enable-ltdl-install --prefix=$prefix], [all install $tst_dist])
140 |
141 | AT_CHECK([test -f "$prefix/lib/libltdl.la"])
142 | AT_CHECK([test -f "$prefix/include/ltdl.h"])
143 |
144 | AT_CLEANUP
145 |
146 | dnl Be careful not to let the definition leak into other tests
147 | m4_popdef([_LT_AT_LTDL_SETUP])
148 |
--------------------------------------------------------------------------------
/tests/pic_flag.at:
--------------------------------------------------------------------------------
1 | # pic_flag.at -- override the pic_flag at configure time -*- Autotest -*-
2 |
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_SETUP([override pic_flag at configure time])
22 |
23 | # Just try to configure the Libtool package with -fpic if we can compile
24 | # with it, for C and C++.
25 |
26 | AT_DATA([foo.c],
27 | [[int data = 42;
28 | int func(void) { return data; }
29 | ]])
30 |
31 | cp foo.c foo.cpp
32 | C_pic_flag='-fpic -DPIC'
33 | AT_CHECK([$CC $CPPFLAGS $CFLAGS $C_pic_flag -c foo.c || exit 77],
34 | [], [stdout], [stderr])
35 | # The configure test for the PIC flag also checks for warnings.
36 | AT_CHECK([$GREP fpic stdout stderr && exit 77], [1])
37 | AT_CHECK([[$GREP '[uU]nknown.*option' stdout stderr && exit 77]], [1])
38 |
39 | CXX_pic_flag='-fpic -DPIC'
40 | if $CXX $CPPFLAGS $CXXFLAGS $CXX_pic_flag -c foo.cpp; then :; else
41 | CXX_pic_flag=
42 | fi
43 |
44 | # Set up a tests/demo.at style project.
45 | _LT_DEMO_SETUP
46 |
47 | # Bootstrap, and configure it so that we can extract libtool --config
48 | # settings.
49 | LT_AT_BOOTSTRAP([], [-I m4], [], [--add-missing], [],
50 | [ignore], [ignore])
51 |
52 | LT_AT_CONFIGURE([lt_cv_prog_compiler_pic="$C_pic_flag" ]dnl
53 | [lt_cv_prog_compiler_pic_CXX="$CXX_pic_flag"],
54 | [./configure])
55 | : ${MAKE=make}
56 | AT_CHECK([$MAKE], [], [stdout], [ignore])
57 | AT_CHECK([if ./libtool --features | $GREP 'enable shared libraries'; then ]dnl
58 | [ $GREP ' -fpic' stdout; else exit 77; fi], [], [ignore], [ignore])
59 |
60 | AT_CLEANUP
61 |
--------------------------------------------------------------------------------
/tests/recursive.at:
--------------------------------------------------------------------------------
1 | # recursive.at -- test recursive Automake libltdl build -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005, 2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_BANNER([Recursive Automake Libltdl.])
24 |
25 | # _LT_AT_LTDL_SETUP
26 | # -----------------
27 | m4_pushdef([_LT_AT_LTDL_SETUP],
28 | [AT_DATA([configure.ac],
29 | [[AC_INIT([subdirectory-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
30 | LT_CONFIG_LTDL_DIR([ltdl])
31 | AC_CONFIG_AUX_DIR([ltdl/config])
32 | AC_CONFIG_MACRO_DIRS([ltdl/m4])
33 | AC_CONFIG_LIBOBJ_DIR([ltdl])
34 | AC_CONFIG_HEADERS([config.h:config.hin])
35 | AM_INIT_AUTOMAKE([foreign])
36 | LT_INIT
37 | LTDL_INIT([recursive])
38 | AC_CONFIG_FILES([Makefile ltdl/Makefile])
39 | AC_OUTPUT
40 | ]])
41 |
42 | AT_DATA([Makefile.am],
43 | [[ACLOCAL_AMFLAGS = -I ltdl/m4
44 | AUTOMAKE_OPTIONS = 1.7
45 | SUBDIRS = ltdl
46 | lib_LTLIBRARIES = foo.la
47 | foo_la_LDFLAGS = -module -avoid-version -no-undefined
48 | foo_la_SOURCES = foo.c
49 | ]])
50 |
51 | echo 'int dummy = 0;' > foo.c
52 | ])# _LT_AT_LTDL_SETUP
53 |
54 | ## ------------------------ ##
55 | ## Softlinked libltdl tree. ##
56 | ## ------------------------ ##
57 |
58 | AT_SETUP([compiling softlinked libltdl])
59 |
60 | _LT_AT_LTDL_SETUP
61 |
62 | LT_AT_LIBTOOLIZE([--ltdl])
63 | AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
64 |
65 | LT_AT_AUTORECONF([--force --verbose --install])
66 | LT_AT_CONFIGURE
67 | LT_AT_MAKE([all $tst_dist])
68 |
69 | AT_CHECK([test -f ltdl/libltdlc.la])
70 |
71 | AT_CLEANUP
72 |
73 |
74 | ## -------------------- ##
75 | ## Copied libltdl tree. ##
76 | ## -------------------- ##
77 |
78 | AT_SETUP([compiling copied libltdl])
79 |
80 | _LT_AT_LTDL_SETUP
81 |
82 | LT_AT_LIBTOOLIZE([--copy --ltdl])
83 | AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
84 |
85 | LT_AT_AUTORECONF([--force --verbose --install])
86 | LT_AT_CONFIGURE
87 | LT_AT_MAKE([all $tst_dist])
88 |
89 | AT_CHECK([test -f ltdl/libltdlc.la])
90 |
91 | AT_CLEANUP
92 |
93 |
94 | ## ------------------------- ##
95 | ## Installable libltdl tree. ##
96 | ## ------------------------- ##
97 |
98 | AT_SETUP([installable libltdl])
99 |
100 | _LT_AT_LTDL_SETUP
101 |
102 | prefix=`pwd`/_inst
103 |
104 | LT_AT_LIBTOOLIZE([--copy --ltdl])
105 | AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
106 |
107 | LT_AT_AUTORECONF([--force --verbose --install])
108 | LT_AT_CONFIGURE([--enable-ltdl-install --prefix=$prefix])
109 | LT_AT_MAKE([all install $tst_dist])
110 |
111 | AT_CHECK([test -f "$prefix/lib/libltdl.la"])
112 | AT_CHECK([test -f "$prefix/include/ltdl.h"])
113 |
114 | AT_CLEANUP
115 |
116 | dnl Be careful not to let the definition leak into other tests
117 | m4_popdef([_LT_AT_LTDL_SETUP])
118 |
--------------------------------------------------------------------------------
/tests/resident.at:
--------------------------------------------------------------------------------
1 | # resident.at -- test resident modules -*- Autotest -*-
2 |
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | # Ensure resident modules are not unloaded at program exit:
22 | # they need to be able to invoke atexit handlers.
23 |
24 | AT_SETUP([resident modules])
25 | AT_KEYWORDS([libltdl])
26 |
27 | AT_DATA([main.c],
28 | [[#include
29 | #include
30 |
31 | int
32 | main (int argc, char* argv[])
33 | {
34 | int err = 0;
35 | lt_dlhandle plugin_handle;
36 | lt_dladvise advise;
37 |
38 | LTDL_SET_PRELOADED_SYMBOLS();
39 |
40 | if (argc < 2)
41 | {
42 | fprintf (stderr, "usage: %s plugin\n", argv[0]);
43 | return 1;
44 | }
45 |
46 | lt_dlinit ();
47 | if (lt_dladvise_init (&advise) != 0
48 | || lt_dladvise_ext (&advise) != 0
49 | || lt_dladvise_resident (&advise) != 0)
50 | {
51 | printf ("advise failure: %s\n", lt_dlerror ());
52 | err = 1;
53 | }
54 | else
55 | {
56 | plugin_handle = lt_dlopenadvise (argv[1], advise);
57 | if (NULL != plugin_handle)
58 | {
59 | int (*pf) (void);
60 | printf ("plugin opened successfully!\n");
61 | pf = (int (*) (void)) lt_dlsym (plugin_handle, "setup_plugin");
62 | if (pf)
63 | pf ();
64 | else
65 | {
66 | printf ("dlsym failure: %s\n", lt_dlerror ());
67 | err = 1;
68 | }
69 | if (!lt_dlisresident (plugin_handle))
70 | {
71 | printf ("module wrongly not marked resident\n");
72 | err = 1;
73 | }
74 | if (lt_dlclose (plugin_handle) != 0)
75 | {
76 | printf ("close failure (expected): %s\n", lt_dlerror ());
77 | }
78 | else
79 | {
80 | printf ("wrongly closed resident module\n");
81 | err = 1;
82 | }
83 | }
84 | else
85 | {
86 | printf ("plugin failed to open: %s\n", lt_dlerror ());
87 | err = 1;
88 | }
89 | if (lt_dladvise_destroy (&advise) != 0)
90 | {
91 | printf ("advise destroy failure: %s\n", lt_dlerror ());
92 | err = 1;
93 | }
94 | }
95 | lt_dlexit ();
96 | return err;
97 | }
98 | ]])
99 |
100 | AT_DATA([plugin.c],
101 | [[#include
102 | #include
103 |
104 | void
105 | bye (void)
106 | {
107 | puts ("called from atexit handler");
108 | }
109 |
110 | #ifdef __cplusplus
111 | extern "C"
112 | #endif
113 | int
114 | setup_plugin (void)
115 | {
116 | return atexit (bye);
117 | }
118 | ]])
119 |
120 | : ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
121 | : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
122 |
123 | # Skip this test when called from:
124 | # make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
125 | AT_CHECK([case $LIBLTDL in #(
126 | */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
127 | esac], [], [ignore])
128 |
129 | CPPFLAGS="$LTDLINCL $CPPFLAGS"
130 | LDFLAGS="$LDFLAGS -no-undefined"
131 | inst=`pwd`/inst
132 | libdir=$inst/lib
133 |
134 | AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c], [], [ignore], [ignore])
135 | AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c plugin.c],
136 | [], [ignore], [ignore])
137 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o plugin.la -rpath $libdir ]dnl
138 | [-module -avoid-version plugin.lo], [], [ignore], [ignore])
139 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ]dnl
140 | [-dlopen plugin.la $LIBLTDL],
141 | [], [ignore], [ignore])
142 | LT_AT_EXEC_CHECK([./main], [], [stdout], [ignore], [./plugin.la])
143 | AT_CHECK([$GREP 'called from atexit handler' stdout], [], [ignore])
144 |
145 | AT_CLEANUP
146 |
--------------------------------------------------------------------------------
/tests/runpath-in-lalib.at:
--------------------------------------------------------------------------------
1 | # runpath-in-lalib.at -- -*- Autotest -*-
2 |
3 | # Copyright (C) 2007-2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2007
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([Runpath in libtool library files])
24 | AT_KEYWORDS([libtool])
25 |
26 | AT_DATA([a.c],
27 | [[int a () { return 0; }
28 | ]])
29 | AT_DATA([b.c],
30 | [[extern int a ();
31 | int b () { return a (); }
32 | ]])
33 | AT_DATA([m.c],
34 | [[extern int b ();
35 | int main () { return b (); }
36 | ]])
37 |
38 | instdir=`pwd`/inst
39 | libdir=$instdir/lib
40 | bindir=$instdir/bin
41 | addrunpath=`pwd`/foobar
42 |
43 | mkdir $instdir $libdir $bindir
44 |
45 | for file in a.c b.c; do
46 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
47 | done
48 | $CC $CPPFLAGS $CFLAGS -c m.c
49 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir -R$addrunpath],
50 | [], [ignore], [ignore])
51 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir liba.la],
52 | [], [ignore], [ignore])
53 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT libb.la],
54 | [], [ignore], [ignore])
55 | AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir/liba.la], [], [ignore], [ignore])
56 | AT_CHECK([$LIBTOOL --mode=install cp libb.la $libdir/libb.la], [], [ignore], [ignore])
57 | AT_CHECK([$LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT], [], [ignore], [ignore])
58 |
59 | AT_CHECK([$GREP /foobar $libdir/liba.la], [], [ignore])
60 | AT_CHECK([$GREP /foobar $libdir/libb.la], [], [ignore])
61 |
62 | # TODO: check that m gets -R, too.
63 |
64 | AT_CLEANUP
65 |
--------------------------------------------------------------------------------
/tests/search-path.at:
--------------------------------------------------------------------------------
1 | # search-path.at -- test sys_lib_search_path_spec -*- Autotest -*-
2 | #
3 | # Copyright (C) 2006, 2008, 2010-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | #
6 | # This file is part of GNU Libtool.
7 | #
8 | # GNU Libtool is free software; you can redistribute it and/or
9 | # modify it under the terms of the GNU General Public License as
10 | # published by the Free Software Foundation; either version 2 of
11 | # the License, or (at your option) any later version.
12 | #
13 | # GNU Libtool is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with GNU Libtool. If not, see .
20 | ####
21 |
22 | AT_SETUP([sys_lib_search_path])
23 | AT_KEYWORDS([libtool])
24 | LDFLAGS="$LDFLAGS -no-undefined"
25 |
26 | AT_DATA([main.c],
27 | [[extern
28 | #ifdef __cplusplus
29 | "C"
30 | #endif
31 | int inflate ();
32 | int main()
33 | {
34 | return inflate ();
35 | }
36 | ]])
37 |
38 | $CC $CPPFLAGS $CFLAGS -c main.c
39 | eval `$LIBTOOL --config | $EGREP '^(sys_lib_search_path_spec)='`
40 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
41 | no_libz=:
42 | for path in $sys_lib_search_path; do
43 | if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$path -lz
44 | then
45 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -lz],
46 | [], [ignore], [ignore])
47 | no_libz=false
48 | break
49 | fi
50 | done
51 |
52 | # If -lz doesn't exist (hello, cross compiler!), we need a dummy test.
53 | if $no_libz; then
54 | AT_CHECK([exit 77])
55 | fi
56 |
57 | AT_CLEANUP
58 |
59 |
60 | AT_SETUP([sys_lib_search_path on w32])
61 | AT_KEYWORDS([libtool])
62 |
63 | # Check if libtool knows the path to system libraries. Using
64 | # a w32 system library since the test is designed to check if
65 | # the libtool handling of the sys_lib_search_path variable is
66 | # correct for MSVC.
67 |
68 | LDFLAGS="$LDFLAGS -no-undefined"
69 |
70 | AT_DATA([gc.c],
71 | [[#include
72 | HCURSOR get_cursor (void)
73 | {
74 | return GetCursor ();
75 | }
76 | ]])
77 |
78 | eval "`$LIBTOOL --config | $GREP '^build_libtool_libs='`"
79 | AT_CHECK([test yes = "$build_libtool_libs" || exit 77])
80 |
81 | AT_CHECK([$LIBTOOL --mode=compile --tag=CC \
82 | $CC $CPPFLAGS $CFLAGS -o gc.lo -c gc.c || exit 77],
83 | [], [ignore], [ignore])
84 |
85 | # Ok, compile was fine, then it should be possible to link too.
86 |
87 | AT_CHECK([$LIBTOOL --mode=link --tag=CC --tag=disable-static \
88 | $CC $CFLAGS $LDFLAGS -o libgc.la gc.lo -rpath /nowhere -luser32],
89 | [], [ignore], [ignore])
90 |
91 | # If -luser32 was found, then libtool will build a shared library,
92 | # otherwise libtool will fall back to creating a static library.
93 | AT_CHECK([$GREP old_library=\'\' libgc.la], [], [ignore])
94 |
95 | AT_CLEANUP
96 |
--------------------------------------------------------------------------------
/tests/shlibpath.at:
--------------------------------------------------------------------------------
1 | # shlibpath.at -- Test shlibpath settings -*- Autotest -*-
2 | #
3 | # Copyright (C) 2006, 2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Ralf Wildenhues, 2006
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_SETUP([shlibpath_overrides_runpath])
24 | AT_KEYWORDS([libtool])
25 |
26 | mkdir sub sub/lib sub/bin
27 | echo 'int a () { return 0; }' > a.c
28 | echo 'extern int a (); int main () { return a(); }' > m.c
29 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
30 | $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath `pwd`/sub/lib
31 | $LIBTOOL --mode=install cp liba.la `pwd`/sub/lib/liba.la
32 | $LIBTOOL --mode=clean rm -f liba.la
33 | rm -f sub/lib/liba.la
34 |
35 | $CC $CPPFLAGS $CFLAGS -c m.c
36 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT m.$OBJEXT -Lsub/lib -la -R`pwd`/sub/lib],
37 | [], [ignore], [ignore])
38 | AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m2$EXEEXT m.$OBJEXT -Lsub/lib -la],
39 | [], [ignore], [ignore])
40 |
41 | LT_AT_MVDIR([sub], [moved])
42 | mkdir sub sub/lib sub/bin
43 | echo 'int wrong_lib () { return 0; }' > a.c
44 | $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
45 | $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath `pwd`/sub/lib
46 | $LIBTOOL --mode=install cp liba.la `pwd`/sub/lib/liba.la
47 | $LIBTOOL --mode=clean rm -f liba.la
48 |
49 | eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|shlibpath_overrides_runpath)='`
50 |
51 | # No point checking a system with static libraries:
52 | LT_AT_EXEC_CHECK([./m], [1], [ignore], [ignore], [|| exit 1 && exit 77])
53 |
54 | if test PATH = "$shlibpath_var"; then
55 | addpath=`pwd`/moved/bin
56 | else
57 | addpath=`pwd`/moved/lib
58 | fi
59 | sep=
60 | eval test -n \"\$$shlibpath_var\" && sep=:
61 | eval $shlibpath_var='$addpath$sep$'$shlibpath_var
62 | export $shlibpath_var
63 | if test no != "$shlibpath_overrides_runpath"; then
64 | LT_AT_EXEC_CHECK([./m], [0], [ignore], [ignore])
65 | else
66 | LT_AT_EXEC_CHECK([./m], [1], [ignore], [ignore], [|| exit 1])
67 | fi
68 | # Test that shlibpath_var is effective in adding paths at all:
69 | LT_AT_EXEC_CHECK([./m2], [0], [ignore], [ignore])
70 |
71 | AT_CLEANUP
72 |
--------------------------------------------------------------------------------
/tests/standalone.at:
--------------------------------------------------------------------------------
1 | # standalone.at -- test standalone libltdl builds -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005, 2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2006
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_BANNER([Standalone Libltdl.])
24 |
25 | ## ------------------------ ##
26 | ## Softlinked libltdl tree. ##
27 | ## ------------------------ ##
28 |
29 | AT_SETUP([compiling softlinked libltdl])
30 |
31 | LT_AT_CHECK_LIBTOOLIZE([--ltdl=.], [], [ignore])
32 | LT_AT_CONFIGURE
33 | AT_XFAIL_IF([test no = "$ACLOCAL"])
34 | LT_AT_MAKE([all $tst_dist])
35 |
36 | AT_CHECK([test -f libltdlc.la])
37 |
38 | AT_CLEANUP
39 |
40 |
41 | ## -------------------- ##
42 | ## Copied libltdl tree. ##
43 | ## -------------------- ##
44 |
45 | AT_SETUP([compiling copied libltdl])
46 |
47 | LT_AT_CHECK_LIBTOOLIZE([--copy --ltdl=.], [], [ignore])
48 | LT_AT_CONFIGURE
49 | AT_XFAIL_IF([test no = "$ACLOCAL"])
50 | LT_AT_MAKE([all $tst_dist])
51 |
52 | AT_CHECK([test -f libltdlc.la])
53 |
54 | AT_CLEANUP
55 |
56 |
57 | ## ------------------------- ##
58 | ## Installable libltdl tree. ##
59 | ## ------------------------- ##
60 |
61 | AT_SETUP([installable libltdl])
62 |
63 | prefix=`pwd`/_inst
64 |
65 | LT_AT_CHECK_LIBTOOLIZE([--copy --ltdl=.], [], [ignore])
66 | LT_AT_CONFIGURE([--enable-ltdl-install --prefix=$prefix])
67 | AT_XFAIL_IF([test no = "$ACLOCAL"])
68 | LT_AT_MAKE([all install $tst_dist])
69 |
70 | AT_CHECK([test -f "$prefix/lib/libltdl.la"])
71 | AT_CHECK([test -f "$prefix/include/ltdl.h"])
72 |
73 | AT_CLEANUP
74 |
75 |
76 | ## ----------------------------------------------- ##
77 | ## libltdl is usable without Autoconf or Automake. ##
78 | ## ----------------------------------------------- ##
79 |
80 | AT_SETUP([linking libltdl without autotools])
81 |
82 | _LTDL_PROJECT_FILES([libltdl])
83 | LT_AT_CHECK_LIBTOOLIZE([--copy --ltdl], [], [ignore])
84 | AT_XFAIL_IF([test no = "$ACLOCAL"])
85 | LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" ]dnl
86 | [CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ]dnl
87 | [CONFIGURE_OPTIONS="$configure_options"])
88 |
89 | LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
90 |
91 | AT_CLEANUP
92 |
--------------------------------------------------------------------------------
/tests/subproject.at:
--------------------------------------------------------------------------------
1 | # subproject.at -- test subproject Libltdl builds -*- Autotest -*-
2 | #
3 | # Copyright (C) 2005, 2008, 2011-2019, 2021-2024 Free Software
4 | # Foundation, Inc.
5 | # Written by Gary V. Vaughan, 2005
6 | #
7 | # This file is part of GNU Libtool.
8 | #
9 | # GNU Libtool is free software; you can redistribute it and/or
10 | # modify it under the terms of the GNU General Public License as
11 | # published by the Free Software Foundation; either version 2 of
12 | # the License, or (at your option) any later version.
13 | #
14 | # GNU Libtool is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with GNU Libtool. If not, see .
21 | ####
22 |
23 | AT_BANNER([Subproject Libltdl.])
24 |
25 | # _LT_AT_LTDL_SETUP
26 | # -----------------
27 | m4_pushdef([_LT_AT_LTDL_SETUP],
28 | [AT_DATA([configure.ac],
29 | [[AC_INIT([subproject-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
30 | LT_CONFIG_LTDL_DIR([sub/ltdl])
31 | AC_CONFIG_AUX_DIR([sub/ltdl/config])
32 | AC_CONFIG_MACRO_DIRS([sub/ltdl/m4])
33 | AM_INIT_AUTOMAKE([foreign])
34 | LT_INIT
35 | LT_WITH_LTDL
36 | AC_CONFIG_FILES([Makefile])
37 | AC_OUTPUT
38 | ]])
39 |
40 | AT_DATA([Makefile.am],
41 | [[ACLOCAL_AMFLAGS = -I sub/ltdl/m4
42 | AUTOMAKE_OPTIONS = 1.9
43 | SUBDIRS = sub/ltdl
44 | lib_LTLIBRARIES = foo.la
45 | foo_la_LDFLAGS = -module -avoid-version -no-undefined
46 | ]])
47 |
48 | echo 'int dummy = 0;' > foo.c
49 | ])# _LT_AT_LTDL_SETUP
50 |
51 | ## ------------------------ ##
52 | ## Softlinked libltdl tree. ##
53 | ## ------------------------ ##
54 |
55 | AT_SETUP([compiling softlinked libltdl])
56 |
57 | _LT_AT_LTDL_SETUP
58 |
59 | LT_AT_BOOTSTRAP([--ltdl], [-I sub/ltdl/m4], [ignore], [--add-missing --copy],
60 | [], [], [all $tst_dist])
61 |
62 | AT_CHECK([test -f sub/ltdl/libltdlc.la])
63 |
64 | AT_CLEANUP
65 |
66 |
67 | ## -------------------- ##
68 | ## Copied libltdl tree. ##
69 | ## -------------------- ##
70 |
71 | AT_SETUP([compiling copied libltdl])
72 |
73 | _LT_AT_LTDL_SETUP
74 |
75 | LT_AT_BOOTSTRAP([--copy --ltdl], [-I sub/ltdl/m4], [ignore],
76 | [--add-missing --copy], [], [], [all $tst_dist])
77 |
78 | AT_CHECK([test -f sub/ltdl/libltdlc.la])
79 |
80 | AT_CLEANUP
81 |
82 |
83 | ## ------------------------- ##
84 | ## Installable libltdl tree. ##
85 | ## ------------------------- ##
86 |
87 | AT_SETUP([installable libltdl])
88 |
89 | prefix=`pwd`/_inst
90 |
91 | _LT_AT_LTDL_SETUP
92 |
93 | LT_AT_BOOTSTRAP([--copy --ltdl], [-I sub/ltdl/m4], [ignore],
94 | [--add-missing --copy], [], [--enable-ltdl-install --prefix=$prefix],
95 | [all install $tst_dist])
96 |
97 | AT_CHECK([test -f "$prefix/lib/libltdl.la"])
98 | AT_CHECK([test -f "$prefix/include/ltdl.h"])
99 |
100 | AT_CLEANUP
101 |
102 |
103 | ## ----------------------------------------------- ##
104 | ## libltdl is usable without Autoconf or Automake. ##
105 | ## ----------------------------------------------- ##
106 |
107 | AT_SETUP([linking libltdl without autotools])
108 |
109 | _LTDL_PROJECT_FILES([sub/ltdl])
110 | LT_AT_LIBTOOLIZE([--copy --ltdl=sub/ltdl])
111 | AT_XFAIL_IF([test no = "$ACLOCAL"])
112 | LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" ]dnl
113 | [CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" MAKE="${MAKE-make}" ]dnl
114 | [CONFIGURE_OPTIONS="$configure_options"])
115 |
116 | LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
117 |
118 | AT_CLEANUP
119 |
120 | dnl Be careful not to let the definition leak into other tests
121 | m4_popdef([_LT_AT_LTDL_SETUP])
122 |
--------------------------------------------------------------------------------
/tests/with-pic.at:
--------------------------------------------------------------------------------
1 | # with-pic.at -- test the --enable-pic flag -*- Autotest -*-
2 |
3 | # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
4 | #
5 | # This file is part of GNU Libtool.
6 | #
7 | # GNU Libtool is free software; you can redistribute it and/or
8 | # modify it under the terms of the GNU General Public License as
9 | # published by the Free Software Foundation; either version 2 of
10 | # the License, or (at your option) any later version.
11 | #
12 | # GNU Libtool is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with GNU Libtool. If not, see .
19 | ####
20 |
21 | AT_SETUP([test --enable-pic])
22 |
23 | # Set up a tests/demo.at style project.
24 | _LT_DEMO_SETUP
25 |
26 | # Bootstrap, and configure it so that we can extract libtool --config
27 | # settings.
28 | LT_AT_BOOTSTRAP([], [-I m4], [], [--add-missing], [],
29 | [], [ignore])
30 | eval `$LIBTOOL --config | $EGREP '^(pic_flag|FGREP)='`
31 |
32 | no_dlls=:
33 | case " $pic_flag " in
34 | *" -DDLL_EXPORT "*) no_dlls=false ;;
35 | esac
36 | AT_CHECK([$no_dlls || exit 77])
37 | AT_CHECK([test . != "$at_srcdir" || exit 77])
38 |
39 | : ${MAKE=make}
40 |
41 | LT_AT_CONFIGURE([--disable-shared --enable-pic=no])
42 | AT_CHECK([$MAKE], [], [stdout], [ignore])
43 | AT_CHECK([$FGREP -v "$pic_flag" stdout], [], [ignore], [ignore])
44 | $MAKE clean
45 |
46 | LT_AT_CONFIGURE([--disable-shared --enable-pic=yes])
47 | AT_CHECK([$MAKE], [], [stdout], [ignore])
48 | AT_CHECK([$FGREP "$pic_flag" stdout], [], [ignore], [ignore])
49 | $MAKE clean
50 |
51 | LT_AT_CONFIGURE([--disable-shared --enable-pic="demo,foo,bar"])
52 | AT_CHECK([$MAKE], [], [stdout], [ignore])
53 | AT_CHECK([$FGREP "$pic_flag" stdout], [], [ignore], [ignore])
54 | $MAKE clean
55 |
56 | LT_AT_CONFIGURE([--disable-shared --enable-pic="foo,bar"])
57 | AT_CHECK([$MAKE], [], [stdout], [ignore])
58 | AT_CHECK([$FGREP -v "$pic_flag" stdout], [], [ignore], [ignore])
59 | $MAKE clean
60 |
61 | AT_CLEANUP
62 |
--------------------------------------------------------------------------------