(dirfd): Elide prototype if dirfd is a macro.
[gnulib.git] / config / config.rpath
blobf5b8921e644c8cc0465aaaeb5dab0b327553858e
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.
5 # Copyright 1996-2002 Free Software Foundation, Inc.
6 # Taken from GNU libtool, 2001
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 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # 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, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program.
28 # The first argument passed to this file is the canonical host specification,
29 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
30 # or
31 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
32 # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
33 # should be set by the caller.
35 # The set of defined variables is at the end of this script.
37 # All known linkers require a `.a' archive for static linking (except M$VC,
38 # which needs '.lib').
39 libext=a
40 shlibext=
42 host="$1"
43 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
44 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
45 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
47 wl=
48 if test "$GCC" = yes; then
49 wl='-Wl,'
50 else
51 case "$host_os" in
52 aix3* | aix4* | aix5*)
53 if test "$host_cpu" = ia64; then
54 wl='-Wl,'
57 hpux9* | hpux10* | hpux11*)
58 wl='-Wl,'
60 irix5* | irix6*)
61 wl='-Wl,'
63 linux*)
64 echo '__INTEL_COMPILER' > conftest.$ac_ext
65 if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
66 then
68 else
69 # Intel icc
70 wl='-Qoption,ld,'
73 osf3* | osf4* | osf5*)
74 wl='-Wl,'
76 solaris*)
77 wl='-Wl,'
79 sunos4*)
80 wl='-Qoption ld '
82 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
83 if test "x$host_vendor" = xsni; then
84 wl='-LD'
85 else
86 wl='-Wl,'
89 esac
92 hardcode_libdir_flag_spec=
93 hardcode_libdir_separator=
94 hardcode_direct=no
95 hardcode_minus_L=no
97 case "$host_os" in
98 cygwin* | mingw* | pw32* )
99 # FIXME: the MSVC++ port hasn't been tested in a loooong time
100 # When not using gcc, we currently assume that we are using
101 # Microsoft Visual C++.
102 if test "$GCC" != yes; then
103 with_gnu_ld=no
106 esac
108 ld_shlibs=yes
109 if test "$with_gnu_ld" = yes; then
110 case "$host_os" in
111 aix3* | aix4* | aix5*)
112 # On AIX, the GNU linker is very broken
113 ld_shlibs=no
115 amigaos*)
116 hardcode_libdir_flag_spec='-L$libdir'
117 hardcode_minus_L=yes
118 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
119 # that the semantics of dynamic libraries on AmigaOS, at least up
120 # to version 4, is to share data among multiple programs linked
121 # with the same dynamic library. Since this doesn't match the
122 # behavior of shared libraries on other platforms, we can use
123 # them.
124 ld_shlibs=no
126 beos*)
127 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
129 else
130 ld_shlibs=no
133 cygwin* | mingw* | pw32*)
134 # hardcode_libdir_flag_spec is actually meaningless, as there is
135 # no search path for DLLs.
136 hardcode_libdir_flag_spec='-L$libdir'
138 solaris* | sysv5*)
139 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
140 ld_shlibs=no
141 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
143 else
144 ld_shlibs=no
147 sunos4*)
148 hardcode_direct=yes
151 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
153 else
154 ld_shlibs=no
157 esac
158 if test "$ld_shlibs" = yes; then
159 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
161 else
162 case "$host_os" in
163 aix3*)
164 # Note: this linker hardcodes the directories in LIBPATH if there
165 # are no directories specified by -L.
166 hardcode_minus_L=yes
167 if test "$GCC" = yes; then
168 # Neither direct hardcoding nor static linking is supported with a
169 # broken collect2.
170 hardcode_direct=unsupported
173 aix4* | aix5*)
174 hardcode_libdir_separator=':'
175 if test "$GCC" = yes; then
176 collect2name=`${CC} -print-prog-name=collect2`
177 if test -f "$collect2name" && \
178 strings "$collect2name" | grep resolve_lib_name >/dev/null
179 then
180 # We have reworked collect2
181 hardcode_direct=yes
182 else
183 # We have old collect2
184 hardcode_direct=unsupported
185 hardcode_minus_L=yes
186 hardcode_libdir_flag_spec='-L$libdir'
187 hardcode_libdir_separator=
189 else
190 hardcode_direct=yes
192 if test "$host_cpu" = ia64; then
193 # On IA64, the linker does run time linking by default, so we don't
194 # have to do anything special.
195 aix_use_runtimelinking=no
196 else
197 # Test if we are trying to use run time linking, or normal AIX style linking.
198 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
199 aix_use_runtimelinking=no
200 for ld_flag in $LDFLAGS; do
201 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
202 aix_use_runtimelinking=yes
203 break
205 done
207 if test "$aix_use_runtimelinking" = yes; then
208 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
209 else
210 if test "$host_cpu" = ia64; then
211 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
212 else
213 hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
217 amigaos*)
218 hardcode_libdir_flag_spec='-L$libdir'
219 hardcode_minus_L=yes
220 # see comment about different semantics on the GNU ld section
221 ld_shlibs=no
223 cygwin* | mingw* | pw32*)
224 # When not using gcc, we currently assume that we are using
225 # Microsoft Visual C++.
226 # hardcode_libdir_flag_spec is actually meaningless, as there is
227 # no search path for DLLs.
228 hardcode_libdir_flag_spec=' '
229 libext=lib
231 darwin* | rhapsody*)
232 hardcode_direct=yes
234 freebsd1*)
235 ld_shlibs=no
237 freebsd2.2*)
238 hardcode_libdir_flag_spec='-R$libdir'
239 hardcode_direct=yes
241 freebsd2*)
242 hardcode_direct=yes
243 hardcode_minus_L=yes
245 freebsd*)
246 hardcode_libdir_flag_spec='-R$libdir'
247 hardcode_direct=yes
249 hpux9* | hpux10* | hpux11*)
250 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
251 hardcode_libdir_separator=:
252 hardcode_direct=yes
253 hardcode_minus_L=yes # Not in the search PATH, but as the default
254 # location of the library.
256 irix5* | irix6*)
257 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
258 hardcode_libdir_separator=:
260 netbsd*)
261 hardcode_libdir_flag_spec='-R$libdir'
262 hardcode_direct=yes
264 newsos6)
265 hardcode_direct=yes
266 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
267 hardcode_libdir_separator=:
269 openbsd*)
270 hardcode_libdir_flag_spec='-R$libdir'
271 hardcode_direct=yes
273 os2*)
274 hardcode_libdir_flag_spec='-L$libdir'
275 hardcode_minus_L=yes
277 osf3*)
278 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
279 hardcode_libdir_separator=:
281 osf4* | osf5*)
282 if test "$GCC" = yes; then
283 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
284 else
285 # Both cc and cxx compiler support -rpath directly
286 hardcode_libdir_flag_spec='-rpath $libdir'
288 hardcode_libdir_separator=:
290 sco3.2v5*)
292 solaris*)
293 hardcode_libdir_flag_spec='-R$libdir'
295 sunos4*)
296 hardcode_libdir_flag_spec='-L$libdir'
297 hardcode_direct=yes
298 hardcode_minus_L=yes
300 sysv4)
301 if test "x$host_vendor" = xsno; then
302 hardcode_direct=yes # is this really true???
303 else
304 hardcode_direct=no # Motorola manual says yes, but my tests say they lie
307 sysv4.3*)
309 sysv5*)
310 hardcode_libdir_flag_spec=
312 uts4*)
313 hardcode_libdir_flag_spec='-L$libdir'
315 dgux*)
316 hardcode_libdir_flag_spec='-L$libdir'
318 sysv4*MP*)
319 if test -d /usr/nec; then
320 ld_shlibs=yes
323 sysv4.2uw2*)
324 hardcode_direct=yes
325 hardcode_minus_L=no
327 sysv5uw7* | unixware7*)
330 ld_shlibs=no
332 esac
335 # Check dynamic linker characteristics
336 libname_spec='lib$name'
337 sys_lib_dlsearch_path_spec="/lib /usr/lib"
338 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
339 case "$host_os" in
340 aix3*)
341 shlibext=so
343 aix4* | aix5*)
344 shlibext=so
346 amigaos*)
347 shlibext=ixlibrary
349 beos*)
350 shlibext=so
352 bsdi4*)
353 shlibext=so
354 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
355 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
357 cygwin* | mingw* | pw32*)
358 case $GCC,$host_os in
359 yes,cygwin*)
360 shlibext=dll.a
362 yes,mingw*)
363 shlibext=dll
364 sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
366 yes,pw32*)
367 shlibext=dll
370 shlibext=dll
372 esac
374 darwin* | rhapsody*)
375 shlibext=dylib
377 freebsd1*)
379 freebsd*)
380 shlibext=so
382 gnu*)
383 shlibext=so
385 hpux9* | hpux10* | hpux11*)
386 shlibext=sl
388 irix5* | irix6*)
389 shlibext=so
390 case "$host_os" in
391 irix5*)
392 libsuff= shlibsuff=
395 case $LD in
396 *-32|*"-32 ") libsuff= shlibsuff= ;;
397 *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
398 *-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
399 *) libsuff= shlibsuff= ;;
400 esac
402 esac
403 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
404 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
406 linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
408 linux-gnu*)
409 shlibext=so
411 netbsd*)
412 shlibext=so
414 newsos6)
415 shlibext=so
417 openbsd*)
418 shlibext=so
420 os2*)
421 libname_spec='$name'
422 shlibext=dll
424 osf3* | osf4* | osf5*)
425 shlibext=so
426 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
427 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
429 sco3.2v5*)
430 shlibext=so
432 solaris*)
433 shlibext=so
435 sunos4*)
436 shlibext=so
438 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
439 shlibext=so
440 case "$host_vendor" in
441 motorola)
442 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
444 esac
446 uts4*)
447 shlibext=so
449 dgux*)
450 shlibext=so
452 sysv4*MP*)
453 if test -d /usr/nec; then
454 shlibext=so
457 esac
459 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
460 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
461 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
462 escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
463 escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
465 sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
467 # How to pass a linker flag through the compiler.
468 wl="$escaped_wl"
470 # Static library suffix (normally "a").
471 libext="$libext"
473 # Shared library suffix (normally "so").
474 shlibext="$shlibext"
476 # Flag to hardcode \$libdir into a binary during linking.
477 # This must work even if \$libdir does not exist.
478 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
480 # Whether we need a single -rpath flag with a separated argument.
481 hardcode_libdir_separator="$hardcode_libdir_separator"
483 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
484 # resulting binary.
485 hardcode_direct="$hardcode_direct"
487 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
488 # resulting binary.
489 hardcode_minus_L="$hardcode_minus_L"
491 # Compile-time system search path for libraries
492 sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
494 # Run-time system search path for libraries
495 sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"