time: Fix test failure on FreeBSD.
[gnulib.git] / build-aux / config.libpath
blob173cd0d90ba78b054df631b1ba8d0bc187a7637d
1 #! /bin/sh
2 # Output a system dependent set of variables, describing how to set the
3 # run time search path of shared libraries in an executable at run time.
5 # Copyright 1996-2024 Free Software Foundation, Inc.
6 # Taken from GNU libtool, 2003
7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program 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.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # func_usage
28 # outputs to stdout the --help usage message.
29 func_usage ()
31 echo "\
32 Usage: config.libpath [OPTION] HOST
34 Prints shell variable assignments that describe how to set the
35 run time search path of shared libraries in an executable at run time.
37 The first argument passed to this file is the canonical host specification,
38 CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
40 CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
42 The environment variable LD should be set by the caller.
44 The set of defined variables is at the end of this script.
46 Options:
47 --help print this help and exit
48 --version print version information and exit
50 Send patches and bug reports to <bug-gnulib@gnu.org>."
53 # func_version
54 # outputs to stdout the --version message.
55 func_version ()
57 echo "config.libpath (GNU gnulib, module relocatable-prog)"
58 echo "Copyright (C) 2024 Free Software Foundation, Inc.
59 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
60 This is free software: you are free to change and redistribute it.
61 There is NO WARRANTY, to the extent permitted by law."
62 echo
63 printf 'Written by %s.\n' "Bruno Haible"
66 # func_fatal_error message
67 # outputs to stderr a fatal error message, and terminates the program.
68 func_fatal_error ()
70 echo "config.libpath: *** $1" 1>&2
71 echo "config.libpath: *** Stop." 1>&2
72 exit 1
75 # Command-line option processing.
76 while test $# -gt 0; do
77 case "$1" in
78 --help | --hel | --he | --h )
79 func_usage
80 exit 0 ;;
81 --version | --versio | --versi | --vers | --ver | --ve | --v )
82 func_version
83 exit 0 ;;
84 -- ) # Stop option processing
85 shift; break ;;
86 -* )
87 func_fatal_error "unrecognized option: $1"
89 * )
90 break ;;
91 esac
92 done
94 if test $# -gt 1; then
95 func_fatal_error "too many arguments"
97 if test $# -lt 1; then
98 func_fatal_error "too few arguments"
101 host="$1"
102 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
103 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
104 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
106 shlibpath_var=
107 case $host_os in
108 aix3*)
109 shlibpath_var=LIBPATH
111 aix[4-9]*)
112 if test "$host_cpu" = ia64; then
113 # AIX 5 supports IA64
114 shlibpath_var=LD_LIBRARY_PATH
115 else
116 shlibpath_var=LIBPATH
119 beos*)
120 shlibpath_var=LIBRARY_PATH
122 bsdi[45]*)
123 shlibpath_var=LD_LIBRARY_PATH
125 cygwin* | mingw* | pw32* | cegcc*)
126 # FIXME: first we should search . and the directory the executable is in
127 shlibpath_var=PATH
129 darwin* | rhapsody*)
130 shlibpath_var=DYLD_LIBRARY_PATH
132 dgux*)
133 shlibpath_var=LD_LIBRARY_PATH
135 freebsd* | dragonfly* | midnightbsd*)
136 shlibpath_var=LD_LIBRARY_PATH
138 gnu*)
139 shlibpath_var=LD_LIBRARY_PATH
141 hpux9* | hpux10* | hpux11*)
142 case "$host_cpu" in
143 ia64* | hppa*64*) shlibpath_var=LD_LIBRARY_PATH ;;
144 *) shlibpath_var=SHLIB_PATH ;;
145 esac
147 interix[3-9]*)
148 shlibpath_var=LD_LIBRARY_PATH
150 irix5* | irix6* | nonstopux*)
151 case $host_os in
152 irix5* | nonstopux*)
153 shlibsuff=
156 case $LD in # libtool.m4 will add one of these switches to LD
157 *-32|*"-32 ") shlibsuff= ;;
158 *-n32|*"-n32 ") shlibsuff=N32 ;;
159 *-64|*"-64 ") shlibsuff=64 ;;
160 *) shlibsuff= ;;
161 esac
163 esac
164 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
166 linux*oldld* | linux*aout* | linux*coff*)
168 linux* | k*bsd*-gnu)
169 shlibpath_var=LD_LIBRARY_PATH
171 netbsd*)
172 shlibpath_var=LD_LIBRARY_PATH
174 newsos6)
175 shlibpath_var=LD_LIBRARY_PATH
177 nto-qnx*)
178 shlibpath_var=LD_LIBRARY_PATH
180 openbsd*)
181 shlibpath_var=LD_LIBRARY_PATH
183 os2*)
184 shlibpath_var=LIBPATH
186 osf3* | osf4* | osf5*)
187 shlibpath_var=LD_LIBRARY_PATH
189 rdos*)
191 solaris*)
192 shlibpath_var=LD_LIBRARY_PATH
194 sunos4*)
195 shlibpath_var=LD_LIBRARY_PATH
197 sysv4 | sysv4.3*)
198 shlibpath_var=LD_LIBRARY_PATH
200 sysv4*MP*)
201 if test -d /usr/nec ;then
202 shlibpath_var=LD_LIBRARY_PATH
205 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
206 shlibpath_var=LD_LIBRARY_PATH
208 uts4*)
209 shlibpath_var=LD_LIBRARY_PATH
211 esac
213 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
215 # This is the shared library path variable.
216 shlibpath_var=$shlibpath_var