* parse-packet.c (dump_sig_subpkt, parse_signature), build-packet.c
[gnupg.git] / scripts / config.rpath
blob3f1bef34a0f0d57a0561e71fc215e64905d9950c
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-2005 Free Software Foundation, Inc.
6 # Taken from GNU libtool, 2001
7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # This file is free software; the Free Software Foundation gives
10 # unlimited permission to copy and/or distribute it, with or without
11 # modifications, as long as this notice is preserved.
13 # The first argument passed to this file is the canonical host specification,
14 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
15 # or
16 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
17 # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
18 # should be set by the caller.
20 # The set of defined variables is at the end of this script.
22 # Known limitations:
23 # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
24 # than 256 bytes, otherwise the compiler driver will dump core. The only
25 # known workaround is to choose shorter directory names for the build
26 # directory and/or the installation directory.
28 # All known linkers require a `.a' archive for static linking (except M$VC,
29 # which needs '.lib').
30 libext=a
31 shrext=.so
33 host="$1"
34 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
35 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
36 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
38 cc_basename=`echo "$CC" | sed -e 's%^.*/%%'`
40 # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
42 wl=
43 if test "$GCC" = yes; then
44 wl='-Wl,'
45 else
46 case "$host_os" in
47 aix*)
48 wl='-Wl,'
50 darwin*)
51 case "$cc_basename" in
52 xlc*)
53 wl='-Wl,'
55 esac
57 mingw* | pw32* | os2*)
59 hpux9* | hpux10* | hpux11*)
60 wl='-Wl,'
62 irix5* | irix6* | nonstopux*)
63 wl='-Wl,'
65 newsos6)
67 linux*)
68 case $cc_basename in
69 icc* | ecc*)
70 wl='-Wl,'
72 pgcc | pgf77 | pgf90)
73 wl='-Wl,'
75 ccc*)
76 wl='-Wl,'
78 como)
79 wl='-lopt='
81 esac
83 osf3* | osf4* | osf5*)
84 wl='-Wl,'
86 sco3.2v5*)
88 solaris*)
89 wl='-Wl,'
91 sunos4*)
92 wl='-Qoption ld '
94 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
95 wl='-Wl,'
97 sysv4*MP*)
99 unicos*)
100 wl='-Wl,'
102 uts4*)
104 esac
107 # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
109 hardcode_libdir_flag_spec=
110 hardcode_libdir_separator=
111 hardcode_direct=no
112 hardcode_minus_L=no
114 case "$host_os" in
115 cygwin* | mingw* | pw32*)
116 # FIXME: the MSVC++ port hasn't been tested in a loooong time
117 # When not using gcc, we currently assume that we are using
118 # Microsoft Visual C++.
119 if test "$GCC" != yes; then
120 with_gnu_ld=no
123 openbsd*)
124 with_gnu_ld=no
126 esac
128 ld_shlibs=yes
129 if test "$with_gnu_ld" = yes; then
130 case "$host_os" in
131 aix3* | aix4* | aix5*)
132 # On AIX/PPC, the GNU linker is very broken
133 if test "$host_cpu" != ia64; then
134 ld_shlibs=no
137 amigaos*)
138 hardcode_libdir_flag_spec='-L$libdir'
139 hardcode_minus_L=yes
140 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
141 # that the semantics of dynamic libraries on AmigaOS, at least up
142 # to version 4, is to share data among multiple programs linked
143 # with the same dynamic library. Since this doesn't match the
144 # behavior of shared libraries on other platforms, we cannot use
145 # them.
146 ld_shlibs=no
148 beos*)
149 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
151 else
152 ld_shlibs=no
155 cygwin* | mingw* | pw32*)
156 # hardcode_libdir_flag_spec is actually meaningless, as there is
157 # no search path for DLLs.
158 hardcode_libdir_flag_spec='-L$libdir'
159 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
161 else
162 ld_shlibs=no
165 netbsd*)
167 solaris* | sysv5*)
168 if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
169 ld_shlibs=no
170 elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
172 else
173 ld_shlibs=no
176 sunos4*)
177 hardcode_direct=yes
179 linux*)
180 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
182 else
183 ld_shlibs=no
187 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
189 else
190 ld_shlibs=no
193 esac
194 if test "$ld_shlibs" = yes; then
195 # Unlike libtool, we use -rpath here, not --rpath, since the documented
196 # option of GNU ld is called -rpath, not --rpath.
197 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
199 else
200 case "$host_os" in
201 aix3*)
202 # Note: this linker hardcodes the directories in LIBPATH if there
203 # are no directories specified by -L.
204 hardcode_minus_L=yes
205 if test "$GCC" = yes; then
206 # Neither direct hardcoding nor static linking is supported with a
207 # broken collect2.
208 hardcode_direct=unsupported
211 aix4* | aix5*)
212 if test "$host_cpu" = ia64; then
213 # On IA64, the linker does run time linking by default, so we don't
214 # have to do anything special.
215 aix_use_runtimelinking=no
216 else
217 aix_use_runtimelinking=no
218 # Test if we are trying to use run time linking or normal
219 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
220 # need to do runtime linking.
221 case $host_os in aix4.[23]|aix4.[23].*|aix5*)
222 for ld_flag in $LDFLAGS; do
223 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
224 aix_use_runtimelinking=yes
225 break
227 done
228 esac
230 hardcode_direct=yes
231 hardcode_libdir_separator=':'
232 if test "$GCC" = yes; then
233 case $host_os in aix4.[012]|aix4.[012].*)
234 collect2name=`${CC} -print-prog-name=collect2`
235 if test -f "$collect2name" && \
236 strings "$collect2name" | grep resolve_lib_name >/dev/null
237 then
238 # We have reworked collect2
239 hardcode_direct=yes
240 else
241 # We have old collect2
242 hardcode_direct=unsupported
243 hardcode_minus_L=yes
244 hardcode_libdir_flag_spec='-L$libdir'
245 hardcode_libdir_separator=
247 esac
249 # Begin _LT_AC_SYS_LIBPATH_AIX.
250 echo 'int main () { return 0; }' > conftest.c
251 ${CC} ${LDFLAGS} conftest.c -o conftest
252 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
254 if test -z "$aix_libpath"; then
255 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
258 if test -z "$aix_libpath"; then
259 aix_libpath="/usr/lib:/lib"
261 rm -f conftest.c conftest
262 # End _LT_AC_SYS_LIBPATH_AIX.
263 if test "$aix_use_runtimelinking" = yes; then
264 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
265 else
266 if test "$host_cpu" = ia64; then
267 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
268 else
269 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
273 amigaos*)
274 hardcode_libdir_flag_spec='-L$libdir'
275 hardcode_minus_L=yes
276 # see comment about different semantics on the GNU ld section
277 ld_shlibs=no
279 bsdi[45]*)
281 cygwin* | mingw* | pw32*)
282 # When not using gcc, we currently assume that we are using
283 # Microsoft Visual C++.
284 # hardcode_libdir_flag_spec is actually meaningless, as there is
285 # no search path for DLLs.
286 hardcode_libdir_flag_spec=' '
287 libext=lib
289 darwin* | rhapsody*)
290 hardcode_direct=no
291 if test "$GCC" = yes ; then
293 else
294 case "$cc_basename" in
295 xlc*)
298 ld_shlibs=no
300 esac
303 dgux*)
304 hardcode_libdir_flag_spec='-L$libdir'
306 freebsd1*)
307 ld_shlibs=no
309 freebsd2.2*)
310 hardcode_libdir_flag_spec='-R$libdir'
311 hardcode_direct=yes
313 freebsd2*)
314 hardcode_direct=yes
315 hardcode_minus_L=yes
317 freebsd* | kfreebsd*-gnu | dragonfly*)
318 hardcode_libdir_flag_spec='-R$libdir'
319 hardcode_direct=yes
321 hpux9*)
322 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
323 hardcode_libdir_separator=:
324 hardcode_direct=yes
325 # hardcode_minus_L: Not really in the search PATH,
326 # but as the default location of the library.
327 hardcode_minus_L=yes
329 hpux10* | hpux11*)
330 if test "$with_gnu_ld" = no; then
331 case "$host_cpu" in
332 hppa*64*)
333 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
334 hardcode_libdir_separator=:
335 hardcode_direct=no
337 ia64*)
338 hardcode_libdir_flag_spec='-L$libdir'
339 hardcode_direct=no
340 # hardcode_minus_L: Not really in the search PATH,
341 # but as the default location of the library.
342 hardcode_minus_L=yes
345 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
346 hardcode_libdir_separator=:
347 hardcode_direct=yes
348 # hardcode_minus_L: Not really in the search PATH,
349 # but as the default location of the library.
350 hardcode_minus_L=yes
352 esac
355 irix5* | irix6* | nonstopux*)
356 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
357 hardcode_libdir_separator=:
359 netbsd*)
360 hardcode_libdir_flag_spec='-R$libdir'
361 hardcode_direct=yes
363 newsos6)
364 hardcode_direct=yes
365 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
366 hardcode_libdir_separator=:
368 openbsd*)
369 hardcode_direct=yes
370 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
371 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
372 else
373 case "$host_os" in
374 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
375 hardcode_libdir_flag_spec='-R$libdir'
378 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
380 esac
383 os2*)
384 hardcode_libdir_flag_spec='-L$libdir'
385 hardcode_minus_L=yes
387 osf3*)
388 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
389 hardcode_libdir_separator=:
391 osf4* | osf5*)
392 if test "$GCC" = yes; then
393 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
394 else
395 # Both cc and cxx compiler support -rpath directly
396 hardcode_libdir_flag_spec='-rpath $libdir'
398 hardcode_libdir_separator=:
400 sco3.2v5*)
402 solaris*)
403 hardcode_libdir_flag_spec='-R$libdir'
405 sunos4*)
406 hardcode_libdir_flag_spec='-L$libdir'
407 hardcode_direct=yes
408 hardcode_minus_L=yes
410 sysv4)
411 case $host_vendor in
412 sni)
413 hardcode_direct=yes # is this really true???
415 siemens)
416 hardcode_direct=no
418 motorola)
419 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
421 esac
423 sysv4.3*)
425 sysv4*MP*)
426 if test -d /usr/nec; then
427 ld_shlibs=yes
430 sysv4.2uw2*)
431 hardcode_direct=yes
432 hardcode_minus_L=no
434 sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
436 sysv5*)
437 hardcode_libdir_flag_spec=
439 uts4*)
440 hardcode_libdir_flag_spec='-L$libdir'
443 ld_shlibs=no
445 esac
448 # Check dynamic linker characteristics
449 # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
450 libname_spec='lib$name'
451 case "$host_os" in
452 aix3*)
454 aix4* | aix5*)
456 amigaos*)
458 beos*)
460 bsdi[45]*)
462 cygwin* | mingw* | pw32*)
463 shrext=.dll
465 darwin* | rhapsody*)
466 shrext=.dylib
468 dgux*)
470 freebsd1*)
472 kfreebsd*-gnu)
474 freebsd*)
476 gnu*)
478 hpux9* | hpux10* | hpux11*)
479 case "$host_cpu" in
480 ia64*)
481 shrext=.so
483 hppa*64*)
484 shrext=.sl
487 shrext=.sl
489 esac
491 irix5* | irix6* | nonstopux*)
492 case "$host_os" in
493 irix5* | nonstopux*)
494 libsuff= shlibsuff=
497 case $LD in
498 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
499 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
500 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
501 *) libsuff= shlibsuff= ;;
502 esac
504 esac
506 linux*oldld* | linux*aout* | linux*coff*)
508 linux*)
510 knetbsd*-gnu)
512 netbsd*)
514 newsos6)
516 nto-qnx*)
518 openbsd*)
520 os2*)
521 libname_spec='$name'
522 shrext=.dll
524 osf3* | osf4* | osf5*)
526 sco3.2v5*)
528 solaris*)
530 sunos4*)
532 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
534 sysv4*MP*)
536 uts4*)
538 esac
540 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
541 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
542 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
543 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
545 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
547 # How to pass a linker flag through the compiler.
548 wl="$escaped_wl"
550 # Static library suffix (normally "a").
551 libext="$libext"
553 # Shared library suffix (normally "so").
554 shlibext="$shlibext"
556 # Flag to hardcode \$libdir into a binary during linking.
557 # This must work even if \$libdir does not exist.
558 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
560 # Whether we need a single -rpath flag with a separated argument.
561 hardcode_libdir_separator="$hardcode_libdir_separator"
563 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
564 # resulting binary.
565 hardcode_direct="$hardcode_direct"
567 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
568 # resulting binary.
569 hardcode_minus_L="$hardcode_minus_L"