]>
Commit | Line | Data |
---|---|---|
82805b60 TS |
1 | # The AC_MULTILIB macro was extracted and modified from |
2 | # gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file | |
3 | # so that the correct paths can be used for 64-bit libraries. | |
4 | # | |
5 | dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. | |
6 | dnl This file is free software; the Free Software Foundation | |
7 | dnl gives unlimited permission to copy and/or distribute it, | |
8 | dnl with or without modifications, as long as this notice is preserved. | |
9 | dnl From Bruno Haible. | |
10 | ||
11 | dnl AC_MULTILIB creates a variable libdirsuffix, containing | |
12 | dnl the suffix of the libdir, either "" or "64". | |
13 | dnl Only do this if the given enable parameter is "yes". | |
14 | AC_DEFUN([AC_MULTILIB], | |
15 | [ | |
16 | dnl There is no formal standard regarding lib and lib64. The current | |
17 | dnl practice is that on a system supporting 32-bit and 64-bit instruction | |
18 | dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit | |
19 | dnl libraries go under $prefix/lib. We determine the compiler's default | |
20 | dnl mode by looking at the compiler's library search path. If at least | |
21 | dnl of its elements ends in /lib64 or points to a directory whose absolute | |
22 | dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the | |
23 | dnl default, namely "lib". | |
24 | enable_lib64="$1" | |
25 | libdirsuffix="" | |
26 | searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` | |
27 | if test "$enable_lib64" = "yes" -a -n "$searchpath"; then | |
28 | save_IFS="${IFS= }"; IFS=":" | |
29 | for searchdir in $searchpath; do | |
30 | if test -d "$searchdir"; then | |
31 | case "$searchdir" in | |
32 | */lib64/ | */lib64 ) libdirsuffix=64 ;; | |
33 | *) searchdir=`cd "$searchdir" && pwd` | |
34 | case "$searchdir" in | |
35 | */lib64 ) libdirsuffix=64 ;; | |
36 | esac ;; | |
37 | esac | |
38 | fi | |
39 | done | |
40 | IFS="$save_IFS" | |
41 | fi | |
42 | AC_SUBST(libdirsuffix) | |
43 | ]) |