|
| 1 | +## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- |
| 2 | +## Copyright (C) 1996-1999,2000 Free Software Foundation, Inc. |
| 3 | +## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 4 | +## |
| 5 | +## This program is free software; you can redistribute it and/or modify |
| 6 | +## it under the terms of the GNU General Public License as published by |
| 7 | +## the Free Software Foundation; either version 2 of the License, or |
| 8 | +## (at your option) any later version. |
| 9 | +## |
| 10 | +## This program is distributed in the hope that it will be useful, but |
| 11 | +## WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | +## General Public License for more details. |
| 14 | +## |
| 15 | +## You should have received a copy of the GNU General Public License |
| 16 | +## along with this program; if not, write to the Free Software |
| 17 | +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | +## |
| 19 | +## As a special exception to the GNU General Public License, if you |
| 20 | +## distribute this file as part of a program that contains a |
| 21 | +## configuration script generated by Autoconf, you may include it under |
| 22 | +## the same distribution terms that you use for the rest of that program. |
| 23 | + |
| 24 | +# No, PostgreSQL doesn't use libtool (yet), we just borrow stuff from it. |
| 25 | +# This file was taken on 2000-10-20 from the multi-language branch (since |
| 26 | +# that is the branch that PostgreSQL would most likely adopt anyway). |
| 27 | +# --petere |
| 28 | + |
| 29 | +# ... bunch of stuff removed here ... |
| 30 | + |
| 31 | +# AC_PROG_LD - find the path to the GNU or non-GNU linker |
| 32 | +AC_DEFUN(AC_PROG_LD, |
| 33 | +[AC_ARG_WITH(gnu-ld, |
| 34 | +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], |
| 35 | +test"$withval"= no|| with_gnu_ld=yes, with_gnu_ld=no) |
| 36 | +AC_REQUIRE([AC_PROG_CC])dnl |
| 37 | +AC_REQUIRE([AC_CANONICAL_HOST])dnl |
| 38 | +dnl###not for PostgreSQL### AC_REQUIRE([AC_CANONICAL_BUILD])dnl |
| 39 | +ac_prog=ld |
| 40 | +iftest"$ac_cv_prog_gcc" = yes;then |
| 41 | +# Check if gcc -print-prog-name=ld gives a path. |
| 42 | + AC_MSG_CHECKING([for ld used by GCC]) |
| 43 | +case$hostin |
| 44 | +*-*-mingw*) |
| 45 | +# gcc leaves a trailing carriage return which upsets mingw |
| 46 | + ac_prog=`($CC -print-prog-name=ld)2>&5| tr -d'\015'` ;; |
| 47 | +*) |
| 48 | + ac_prog=`($CC -print-prog-name=ld)2>&5` ;; |
| 49 | +esac |
| 50 | +case"$ac_prog"in |
| 51 | +# Accept absolute paths. |
| 52 | +changequote(,)dnl |
| 53 | + [\\/]* | [A-Za-z]:[\\/]*) |
| 54 | + re_direlt='/[^/][^/]*/\.\./' |
| 55 | +changequote([,])dnl |
| 56 | +# Canonicalize the path of ld |
| 57 | + ac_prog=`echo$ac_prog| sed's%\\\\%/%g'` |
| 58 | +whileecho$ac_prog| grep"$re_direlt"> /dev/null2>&1;do |
| 59 | +ac_prog=`echo$ac_prog| sed"s%$re_direlt%/%"` |
| 60 | +done |
| 61 | +test -z"$LD"&& LD="$ac_prog" |
| 62 | + ;; |
| 63 | +"") |
| 64 | +# If it fails, then pretend we aren't using GCC. |
| 65 | + ac_prog=ld |
| 66 | + ;; |
| 67 | +*) |
| 68 | +# If it is relative, then search for the first ld in PATH. |
| 69 | + with_gnu_ld=unknown |
| 70 | + ;; |
| 71 | +esac |
| 72 | +eliftest"$with_gnu_ld" = yes;then |
| 73 | + AC_MSG_CHECKING([for GNU ld]) |
| 74 | +else |
| 75 | + AC_MSG_CHECKING([for non-GNU ld]) |
| 76 | +fi |
| 77 | +AC_CACHE_VAL(ac_cv_path_LD, |
| 78 | +[iftest-z"$LD";then |
| 79 | + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" |
| 80 | +forac_dirin$PATH;do |
| 81 | +test -z"$ac_dir"&& ac_dir=. |
| 82 | +iftest -f"$ac_dir/$ac_prog"||test -f"$ac_dir/$ac_prog$ac_exeext";then |
| 83 | + ac_cv_path_LD="$ac_dir/$ac_prog" |
| 84 | +# Check to see if the program is GNU ld. I'd rather use --version, |
| 85 | +# but apparently some GNU ld's only accept -v. |
| 86 | +# Break only if it was the GNU/non-GNU ld that we prefer. |
| 87 | +if"$ac_cv_path_LD" -v2>&1< /dev/null| egrep'(GNU|with BFD)'> /dev/null;then |
| 88 | +test"$with_gnu_ld"!= no&&break |
| 89 | +else |
| 90 | +test"$with_gnu_ld"!= yes&&break |
| 91 | +fi |
| 92 | +fi |
| 93 | +done |
| 94 | + IFS="$ac_save_ifs" |
| 95 | +else |
| 96 | + ac_cv_path_LD="$LD"# Let the user override the test with a path. |
| 97 | +fi]) |
| 98 | +LD="$ac_cv_path_LD" |
| 99 | +iftest -n"$LD";then |
| 100 | + AC_MSG_RESULT($LD) |
| 101 | +else |
| 102 | + AC_MSG_RESULT(no) |
| 103 | +fi |
| 104 | +test-z"$LD"&& AC_MSG_ERROR([no acceptable ld foundin\$PATH]) |
| 105 | +AC_PROG_LD_GNU |
| 106 | +]) |
| 107 | + |
| 108 | +AC_DEFUN(AC_PROG_LD_GNU, |
| 109 | +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, |
| 110 | +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. |
| 111 | +if$LD -v2>&1</dev/null| egrep'(GNU|with BFD)'1>&5;then |
| 112 | + ac_cv_prog_gnu_ld=yes |
| 113 | +else |
| 114 | + ac_cv_prog_gnu_ld=no |
| 115 | +fi]) |
| 116 | +with_gnu_ld=$ac_cv_prog_gnu_ld |
| 117 | +]) |
| 118 | + |
| 119 | +# ... more stuff removed ... |
| 120 | + |
| 121 | +# ... added: |
| 122 | +AC_SUBST(LD) |
| 123 | +AC_SUBST(with_gnu_ld) |