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
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.
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.
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.
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.
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).
29
# ... bunch of stuff removed here ...
31
# PGAC_PROG_LD - find the path to the GNU or non-GNU linker
32
AC_DEFUN([PGAC_PROG_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
40
if test "$GCC" = yes; then
41
# Check if gcc -print-prog-name=ld gives a path.
42
AC_MSG_CHECKING([for ld used by GCC])
45
# gcc leaves a trailing carriage return which upsets mingw
46
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
48
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
51
# Accept absolute paths.
53
[\\/]* | [A-Za-z]:[\\/]*)
54
re_direlt='/[^/][^/]*/\.\./'
56
# Canonicalize the path of ld
57
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
58
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
59
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
61
test -z "$LD" && LD="$ac_prog"
64
# If it fails, then pretend we aren't using GCC.
68
# If it is relative, then search for the first ld in PATH.
72
elif test "$with_gnu_ld" = yes; then
73
AC_MSG_CHECKING([for GNU ld])
75
AC_MSG_CHECKING([for non-GNU ld])
77
AC_CACHE_VAL(ac_cv_path_LD,
78
[if test -z "$LD"; then
79
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
80
for ac_dir in $PATH; do
81
test -z "$ac_dir" && ac_dir=.
82
if test -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" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
88
test "$with_gnu_ld" != no && break
90
test "$with_gnu_ld" != yes && break
96
ac_cv_path_LD="$LD" # Let the user override the test with a path.
99
if test -n "$LD"; then
104
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
108
AC_DEFUN([PGAC_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 -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
112
ac_cv_prog_gnu_ld=yes
116
with_gnu_ld=$ac_cv_prog_gnu_ld
119
# ... more stuff removed ...