git-update-mirror: Remove a useless sed(1) call
[monitoring-plugins.git] / config.rpath
blobe082db6bb57ae4628bab90a6fdfa65f510aa4ebe
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-2006 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 MSVC,
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 # Code taken from libtool.m4's _LT_CC_BASENAME.
40 for cc_temp in $CC""; do
41 case $cc_temp in
42 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
43 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
44 \-*) ;;
45 *) break;;
46 esac
47 done
48 cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
50 # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
52 wl=
53 if test "$GCC" = yes; then
54 wl='-Wl,'
55 else
56 case "$host_os" in
57 aix*)
58 wl='-Wl,'
60 darwin*)
61 case $cc_basename in
62 xlc*)
63 wl='-Wl,'
65 esac
67 mingw* | pw32* | os2*)
69 hpux9* | hpux10* | hpux11*)
70 wl='-Wl,'
72 irix5* | irix6* | nonstopux*)
73 wl='-Wl,'
75 newsos6)
77 linux*)
78 case $cc_basename in
79 icc* | ecc*)
80 wl='-Wl,'
82 pgcc | pgf77 | pgf90)
83 wl='-Wl,'
85 ccc*)
86 wl='-Wl,'
88 como)
89 wl='-lopt='
92 case `$CC -V 2>&1 | sed 5q` in
93 *Sun\ C*)
94 wl='-Wl,'
96 esac
98 esac
100 osf3* | osf4* | osf5*)
101 wl='-Wl,'
103 sco3.2v5*)
105 solaris*)
106 wl='-Wl,'
108 sunos4*)
109 wl='-Qoption ld '
111 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
112 wl='-Wl,'
114 sysv4*MP*)
116 unicos*)
117 wl='-Wl,'
119 uts4*)
121 esac
124 # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
126 hardcode_libdir_flag_spec=
127 hardcode_libdir_separator=
128 hardcode_direct=no
129 hardcode_minus_L=no
131 case "$host_os" in
132 cygwin* | mingw* | pw32*)
133 # FIXME: the MSVC++ port hasn't been tested in a loooong time
134 # When not using gcc, we currently assume that we are using
135 # Microsoft Visual C++.
136 if test "$GCC" != yes; then
137 with_gnu_ld=no
140 interix*)
141 # we just hope/assume this is gcc and not c89 (= MSVC++)
142 with_gnu_ld=yes
144 openbsd*)
145 with_gnu_ld=no
147 esac
149 ld_shlibs=yes
150 if test "$with_gnu_ld" = yes; then
151 # Set some defaults for GNU ld with shared library support. These
152 # are reset later if shared libraries are not supported. Putting them
153 # here allows them to be overridden if necessary.
154 # Unlike libtool, we use -rpath here, not --rpath, since the documented
155 # option of GNU ld is called -rpath, not --rpath.
156 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
157 case "$host_os" in
158 aix3* | aix4* | aix5*)
159 # On AIX/PPC, the GNU linker is very broken
160 if test "$host_cpu" != ia64; then
161 ld_shlibs=no
164 amigaos*)
165 hardcode_libdir_flag_spec='-L$libdir'
166 hardcode_minus_L=yes
167 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
168 # that the semantics of dynamic libraries on AmigaOS, at least up
169 # to version 4, is to share data among multiple programs linked
170 # with the same dynamic library. Since this doesn't match the
171 # behavior of shared libraries on other platforms, we cannot use
172 # them.
173 ld_shlibs=no
175 beos*)
176 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
178 else
179 ld_shlibs=no
182 cygwin* | mingw* | pw32*)
183 # hardcode_libdir_flag_spec is actually meaningless, as there is
184 # no search path for DLLs.
185 hardcode_libdir_flag_spec='-L$libdir'
186 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
188 else
189 ld_shlibs=no
192 interix3*)
193 hardcode_direct=no
194 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
196 linux*)
197 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
199 else
200 ld_shlibs=no
203 netbsd*)
205 solaris*)
206 if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
207 ld_shlibs=no
208 elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
210 else
211 ld_shlibs=no
214 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
215 case `$LD -v 2>&1` in
216 *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
217 ld_shlibs=no
220 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
221 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
222 else
223 ld_shlibs=no
226 esac
228 sunos4*)
229 hardcode_direct=yes
232 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
234 else
235 ld_shlibs=no
238 esac
239 if test "$ld_shlibs" = no; then
240 hardcode_libdir_flag_spec=
242 else
243 case "$host_os" in
244 aix3*)
245 # Note: this linker hardcodes the directories in LIBPATH if there
246 # are no directories specified by -L.
247 hardcode_minus_L=yes
248 if test "$GCC" = yes; then
249 # Neither direct hardcoding nor static linking is supported with a
250 # broken collect2.
251 hardcode_direct=unsupported
254 aix4* | aix5*)
255 if test "$host_cpu" = ia64; then
256 # On IA64, the linker does run time linking by default, so we don't
257 # have to do anything special.
258 aix_use_runtimelinking=no
259 else
260 aix_use_runtimelinking=no
261 # Test if we are trying to use run time linking or normal
262 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
263 # need to do runtime linking.
264 case $host_os in aix4.[23]|aix4.[23].*|aix5*)
265 for ld_flag in $LDFLAGS; do
266 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
267 aix_use_runtimelinking=yes
268 break
270 done
272 esac
274 hardcode_direct=yes
275 hardcode_libdir_separator=':'
276 if test "$GCC" = yes; then
277 case $host_os in aix4.[012]|aix4.[012].*)
278 collect2name=`${CC} -print-prog-name=collect2`
279 if test -f "$collect2name" && \
280 strings "$collect2name" | grep resolve_lib_name >/dev/null
281 then
282 # We have reworked collect2
283 hardcode_direct=yes
284 else
285 # We have old collect2
286 hardcode_direct=unsupported
287 hardcode_minus_L=yes
288 hardcode_libdir_flag_spec='-L$libdir'
289 hardcode_libdir_separator=
292 esac
294 # Begin _LT_AC_SYS_LIBPATH_AIX.
295 echo 'int main () { return 0; }' > conftest.c
296 ${CC} ${LDFLAGS} conftest.c -o conftest
297 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
299 if test -z "$aix_libpath"; then
300 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
303 if test -z "$aix_libpath"; then
304 aix_libpath="/usr/lib:/lib"
306 rm -f conftest.c conftest
307 # End _LT_AC_SYS_LIBPATH_AIX.
308 if test "$aix_use_runtimelinking" = yes; then
309 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
310 else
311 if test "$host_cpu" = ia64; then
312 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
313 else
314 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
318 amigaos*)
319 hardcode_libdir_flag_spec='-L$libdir'
320 hardcode_minus_L=yes
321 # see comment about different semantics on the GNU ld section
322 ld_shlibs=no
324 bsdi[45]*)
326 cygwin* | mingw* | pw32*)
327 # When not using gcc, we currently assume that we are using
328 # Microsoft Visual C++.
329 # hardcode_libdir_flag_spec is actually meaningless, as there is
330 # no search path for DLLs.
331 hardcode_libdir_flag_spec=' '
332 libext=lib
334 darwin* | rhapsody*)
335 hardcode_direct=no
336 if test "$GCC" = yes ; then
338 else
339 case $cc_basename in
340 xlc*)
343 ld_shlibs=no
345 esac
348 dgux*)
349 hardcode_libdir_flag_spec='-L$libdir'
351 freebsd1*)
352 ld_shlibs=no
354 freebsd2.2*)
355 hardcode_libdir_flag_spec='-R$libdir'
356 hardcode_direct=yes
358 freebsd2*)
359 hardcode_direct=yes
360 hardcode_minus_L=yes
362 freebsd* | kfreebsd*-gnu | dragonfly*)
363 hardcode_libdir_flag_spec='-R$libdir'
364 hardcode_direct=yes
366 hpux9*)
367 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
368 hardcode_libdir_separator=:
369 hardcode_direct=yes
370 # hardcode_minus_L: Not really in the search PATH,
371 # but as the default location of the library.
372 hardcode_minus_L=yes
374 hpux10*)
375 if test "$with_gnu_ld" = no; then
376 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
377 hardcode_libdir_separator=:
378 hardcode_direct=yes
379 # hardcode_minus_L: Not really in the search PATH,
380 # but as the default location of the library.
381 hardcode_minus_L=yes
384 hpux11*)
385 if test "$with_gnu_ld" = no; then
386 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
387 hardcode_libdir_separator=:
388 case $host_cpu in
389 hppa*64*|ia64*)
390 hardcode_direct=no
393 hardcode_direct=yes
394 # hardcode_minus_L: Not really in the search PATH,
395 # but as the default location of the library.
396 hardcode_minus_L=yes
398 esac
401 irix5* | irix6* | nonstopux*)
402 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
403 hardcode_libdir_separator=:
405 netbsd*)
406 hardcode_libdir_flag_spec='-R$libdir'
407 hardcode_direct=yes
409 newsos6)
410 hardcode_direct=yes
411 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
412 hardcode_libdir_separator=:
414 openbsd*)
415 hardcode_direct=yes
416 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
417 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
418 else
419 case "$host_os" in
420 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
421 hardcode_libdir_flag_spec='-R$libdir'
424 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
426 esac
429 os2*)
430 hardcode_libdir_flag_spec='-L$libdir'
431 hardcode_minus_L=yes
433 osf3*)
434 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
435 hardcode_libdir_separator=:
437 osf4* | osf5*)
438 if test "$GCC" = yes; then
439 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
440 else
441 # Both cc and cxx compiler support -rpath directly
442 hardcode_libdir_flag_spec='-rpath $libdir'
444 hardcode_libdir_separator=:
446 solaris*)
447 hardcode_libdir_flag_spec='-R$libdir'
449 sunos4*)
450 hardcode_libdir_flag_spec='-L$libdir'
451 hardcode_direct=yes
452 hardcode_minus_L=yes
454 sysv4)
455 case $host_vendor in
456 sni)
457 hardcode_direct=yes # is this really true???
459 siemens)
460 hardcode_direct=no
462 motorola)
463 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
465 esac
467 sysv4.3*)
469 sysv4*MP*)
470 if test -d /usr/nec; then
471 ld_shlibs=yes
474 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
476 sysv5* | sco3.2v5* | sco5v6*)
477 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
478 hardcode_libdir_separator=':'
480 uts4*)
481 hardcode_libdir_flag_spec='-L$libdir'
484 ld_shlibs=no
486 esac
489 # Check dynamic linker characteristics
490 # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
491 # Unlike libtool.m4, here we don't care about _all_ names of the library, but
492 # only about the one the linker finds when passed -lNAME. This is the last
493 # element of library_names_spec in libtool.m4, or possibly two of them if the
494 # linker has special search rules.
495 library_names_spec= # the last element of library_names_spec in libtool.m4
496 libname_spec='lib$name'
497 case "$host_os" in
498 aix3*)
499 library_names_spec='$libname.a'
501 aix4* | aix5*)
502 library_names_spec='$libname$shrext'
504 amigaos*)
505 library_names_spec='$libname.a'
507 beos*)
508 library_names_spec='$libname$shrext'
510 bsdi[45]*)
511 library_names_spec='$libname$shrext'
513 cygwin* | mingw* | pw32*)
514 shrext=.dll
515 library_names_spec='$libname.dll.a $libname.lib'
517 darwin* | rhapsody*)
518 shrext=.dylib
519 library_names_spec='$libname$shrext'
521 dgux*)
522 library_names_spec='$libname$shrext'
524 freebsd1*)
526 kfreebsd*-gnu)
527 library_names_spec='$libname$shrext'
529 freebsd* | dragonfly*)
530 case "$host_os" in
531 freebsd[123]*)
532 library_names_spec='$libname$shrext$versuffix' ;;
534 library_names_spec='$libname$shrext' ;;
535 esac
537 gnu*)
538 library_names_spec='$libname$shrext'
540 hpux9* | hpux10* | hpux11*)
541 case $host_cpu in
542 ia64*)
543 shrext=.so
545 hppa*64*)
546 shrext=.sl
549 shrext=.sl
551 esac
552 library_names_spec='$libname$shrext'
554 interix3*)
555 library_names_spec='$libname$shrext'
557 irix5* | irix6* | nonstopux*)
558 library_names_spec='$libname$shrext'
559 case "$host_os" in
560 irix5* | nonstopux*)
561 libsuff= shlibsuff=
564 case $LD in
565 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
566 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
567 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
568 *) libsuff= shlibsuff= ;;
569 esac
571 esac
573 linux*oldld* | linux*aout* | linux*coff*)
575 linux*)
576 library_names_spec='$libname$shrext'
578 knetbsd*-gnu)
579 library_names_spec='$libname$shrext'
581 netbsd*)
582 library_names_spec='$libname$shrext'
584 newsos6)
585 library_names_spec='$libname$shrext'
587 nto-qnx*)
588 library_names_spec='$libname$shrext'
590 openbsd*)
591 library_names_spec='$libname$shrext$versuffix'
593 os2*)
594 libname_spec='$name'
595 shrext=.dll
596 library_names_spec='$libname.a'
598 osf3* | osf4* | osf5*)
599 library_names_spec='$libname$shrext'
601 solaris*)
602 library_names_spec='$libname$shrext'
604 sunos4*)
605 library_names_spec='$libname$shrext$versuffix'
607 sysv4 | sysv4.3*)
608 library_names_spec='$libname$shrext'
610 sysv4*MP*)
611 library_names_spec='$libname$shrext'
613 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
614 library_names_spec='$libname$shrext'
616 uts4*)
617 library_names_spec='$libname$shrext'
619 esac
621 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
622 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
623 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
624 escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
625 escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
626 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
628 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
630 # How to pass a linker flag through the compiler.
631 wl="$escaped_wl"
633 # Static library suffix (normally "a").
634 libext="$libext"
636 # Shared library suffix (normally "so").
637 shlibext="$shlibext"
639 # Format of library name prefix.
640 libname_spec="$escaped_libname_spec"
642 # Library names that the linker finds when passed -lNAME.
643 library_names_spec="$escaped_library_names_spec"
645 # Flag to hardcode \$libdir into a binary during linking.
646 # This must work even if \$libdir does not exist.
647 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
649 # Whether we need a single -rpath flag with a separated argument.
650 hardcode_libdir_separator="$hardcode_libdir_separator"
652 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
653 # resulting binary.
654 hardcode_direct="$hardcode_direct"
656 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
657 # resulting binary.
658 hardcode_minus_L="$hardcode_minus_L"