"Fossies" - the Fresh Open Source Software Archive

Member "tcsh-6.22.03/aclocal.m4" (18 Nov 2020, 79713 Bytes) of package /linux/misc/tcsh-6.22.03.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "aclocal.m4": 6.22.02_vs_6.22.03.

    1 # generated automatically by aclocal 1.16.1 -*- Autoconf -*-
    2 
    3 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
    4 
    5 # This file is free software; the Free Software Foundation
    6 # gives unlimited permission to copy and/or distribute it,
    7 # with or without modifications, as long as this notice is preserved.
    8 
    9 # This program is distributed in the hope that it will be useful,
   10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
   11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   12 # PARTICULAR PURPOSE.
   13 
   14 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
   15 # host-cpu-c-abi.m4 serial 11
   16 dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
   17 dnl This file is free software; the Free Software Foundation
   18 dnl gives unlimited permission to copy and/or distribute it,
   19 dnl with or without modifications, as long as this notice is preserved.
   20 
   21 dnl From Bruno Haible and Sam Steingold.
   22 
   23 dnl Sets the HOST_CPU variable to the canonical name of the CPU.
   24 dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
   25 dnl C language ABI (application binary interface).
   26 dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
   27 dnl config.h.
   28 dnl
   29 dnl This canonical name can be used to select a particular assembly language
   30 dnl source file that will interoperate with C code on the given host.
   31 dnl
   32 dnl For example:
   33 dnl * 'i386' and 'sparc' are different canonical names, because code for i386
   34 dnl   will not run on SPARC CPUs and vice versa. They have different
   35 dnl   instruction sets.
   36 dnl * 'sparc' and 'sparc64' are different canonical names, because code for
   37 dnl   'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
   38 dnl   contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
   39 dnl   instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
   40 dnl   mode, but not both.
   41 dnl * 'mips' and 'mipsn32' are different canonical names, because they use
   42 dnl   different argument passing and return conventions for C functions, and
   43 dnl   although the instruction set of 'mips' is a large subset of the
   44 dnl   instruction set of 'mipsn32'.
   45 dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
   46 dnl   different sizes for the C types like 'int' and 'void *', and although
   47 dnl   the instruction sets of 'mipsn32' and 'mips64' are the same.
   48 dnl * The same canonical name is used for different endiannesses. You can
   49 dnl   determine the endianness through preprocessor symbols:
   50 dnl   - 'arm': test __ARMEL__.
   51 dnl   - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
   52 dnl   - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN.
   53 dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
   54 dnl   (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
   55 dnl   - Instructions that do not exist on all of these CPUs (cmpxchg,
   56 dnl     MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
   57 dnl     assembly language source files use such instructions, you will
   58 dnl     need to make the distinction.
   59 dnl   - Speed of execution of the common instruction set is reasonable across
   60 dnl     the entire family of CPUs. If you have assembly language source files
   61 dnl     that are optimized for particular CPU types (like GNU gmp has), you
   62 dnl     will need to make the distinction.
   63 dnl   See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
   64 AC_DEFUN([gl_HOST_CPU_C_ABI],
   65 [
   66   AC_REQUIRE([AC_CANONICAL_HOST])
   67   AC_REQUIRE([gl_C_ASM])
   68   AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
   69     [case "$host_cpu" in
   70 
   71 changequote(,)dnl
   72        i[4567]86 )
   73 changequote([,])dnl
   74          gl_cv_host_cpu_c_abi=i386
   75          ;;
   76 
   77        x86_64 )
   78          # On x86_64 systems, the C compiler may be generating code in one of
   79          # these ABIs:
   80          # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
   81          # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
   82          #   with native Windows (mingw, MSVC).
   83          # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
   84          # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
   85          AC_COMPILE_IFELSE(
   86            [AC_LANG_SOURCE(
   87               [[#if (defined __x86_64__ || defined __amd64__ \
   88                      || defined _M_X64 || defined _M_AMD64)
   89                  int ok;
   90                 #else
   91                  error fail
   92                 #endif
   93               ]])],
   94            [AC_COMPILE_IFELSE(
   95               [AC_LANG_SOURCE(
   96                  [[#if defined __ILP32__ || defined _ILP32
   97                     int ok;
   98                    #else
   99                     error fail
  100                    #endif
  101                  ]])],
  102               [gl_cv_host_cpu_c_abi=x86_64-x32],
  103               [gl_cv_host_cpu_c_abi=x86_64])],
  104            [gl_cv_host_cpu_c_abi=i386])
  105          ;;
  106 
  107 changequote(,)dnl
  108        alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
  109 changequote([,])dnl
  110          gl_cv_host_cpu_c_abi=alpha
  111          ;;
  112 
  113        arm* | aarch64 )
  114          # Assume arm with EABI.
  115          # On arm64 systems, the C compiler may be generating code in one of
  116          # these ABIs:
  117          # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
  118          # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
  119          # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
  120          AC_COMPILE_IFELSE(
  121            [AC_LANG_SOURCE(
  122               [[#ifdef __aarch64__
  123                  int ok;
  124                 #else
  125                  error fail
  126                 #endif
  127               ]])],
  128            [AC_COMPILE_IFELSE(
  129               [AC_LANG_SOURCE(
  130                 [[#if defined __ILP32__ || defined _ILP32
  131                    int ok;
  132                   #else
  133                    error fail
  134                   #endif
  135                 ]])],
  136               [gl_cv_host_cpu_c_abi=arm64-ilp32],
  137               [gl_cv_host_cpu_c_abi=arm64])],
  138            [# Don't distinguish little-endian and big-endian arm, since they
  139             # don't require different machine code for simple operations and
  140             # since the user can distinguish them through the preprocessor
  141             # defines __ARMEL__ vs. __ARMEB__.
  142             # But distinguish arm which passes floating-point arguments and
  143             # return values in integer registers (r0, r1, ...) - this is
  144             # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
  145             # passes them in float registers (s0, s1, ...) and double registers
  146             # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
  147             # sets the preprocessor defines __ARM_PCS (for the first case) and
  148             # __ARM_PCS_VFP (for the second case), but older GCC does not.
  149             echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
  150             # Look for a reference to the register d0 in the .s file.
  151             AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
  152             if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
  153               gl_cv_host_cpu_c_abi=armhf
  154             else
  155               gl_cv_host_cpu_c_abi=arm
  156             fi
  157             rm -f conftest*
  158            ])
  159          ;;
  160 
  161        hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
  162          # On hppa, the C compiler may be generating 32-bit code or 64-bit
  163          # code. In the latter case, it defines _LP64 and __LP64__.
  164          AC_COMPILE_IFELSE(
  165            [AC_LANG_SOURCE(
  166               [[#ifdef __LP64__
  167                  int ok;
  168                 #else
  169                  error fail
  170                 #endif
  171               ]])],
  172            [gl_cv_host_cpu_c_abi=hppa64],
  173            [gl_cv_host_cpu_c_abi=hppa])
  174          ;;
  175 
  176        ia64* )
  177          # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
  178          # 32-bit code. In the latter case, it defines _ILP32.
  179          AC_COMPILE_IFELSE(
  180            [AC_LANG_SOURCE(
  181               [[#ifdef _ILP32
  182                  int ok;
  183                 #else
  184                  error fail
  185                 #endif
  186               ]])],
  187            [gl_cv_host_cpu_c_abi=ia64-ilp32],
  188            [gl_cv_host_cpu_c_abi=ia64])
  189          ;;
  190 
  191        mips* )
  192          # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
  193          # at 32.
  194          AC_COMPILE_IFELSE(
  195            [AC_LANG_SOURCE(
  196               [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
  197                  int ok;
  198                 #else
  199                  error fail
  200                 #endif
  201               ]])],
  202            [gl_cv_host_cpu_c_abi=mips64],
  203            [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
  204             # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
  205             # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
  206             # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
  207             AC_COMPILE_IFELSE(
  208               [AC_LANG_SOURCE(
  209                  [[#if (_MIPS_SIM == _ABIN32)
  210                     int ok;
  211                    #else
  212                     error fail
  213                    #endif
  214                  ]])],
  215               [gl_cv_host_cpu_c_abi=mipsn32],
  216               [gl_cv_host_cpu_c_abi=mips])])
  217          ;;
  218 
  219        powerpc* )
  220          # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
  221          # No need to distinguish them here; the caller may distinguish
  222          # them based on the OS.
  223          # On powerpc64 systems, the C compiler may still be generating
  224          # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
  225          # be generating 64-bit code.
  226          AC_COMPILE_IFELSE(
  227            [AC_LANG_SOURCE(
  228               [[#if defined __powerpc64__ || defined _ARCH_PPC64
  229                  int ok;
  230                 #else
  231                  error fail
  232                 #endif
  233               ]])],
  234            [# On powerpc64, there are two ABIs on Linux: The AIX compatible
  235             # one and the ELFv2 one. The latter defines _CALL_ELF=2.
  236             AC_COMPILE_IFELSE(
  237               [AC_LANG_SOURCE(
  238                  [[#if defined _CALL_ELF && _CALL_ELF == 2
  239                     int ok;
  240                    #else
  241                     error fail
  242                    #endif
  243                  ]])],
  244               [gl_cv_host_cpu_c_abi=powerpc64-elfv2],
  245               [gl_cv_host_cpu_c_abi=powerpc64])
  246            ],
  247            [gl_cv_host_cpu_c_abi=powerpc])
  248          ;;
  249 
  250        rs6000 )
  251          gl_cv_host_cpu_c_abi=powerpc
  252          ;;
  253 
  254        riscv32 | riscv64 )
  255          # There are 2 architectures (with variants): rv32* and rv64*.
  256          AC_COMPILE_IFELSE(
  257            [AC_LANG_SOURCE(
  258               [[#if __riscv_xlen == 64
  259                   int ok;
  260                 #else
  261                   error fail
  262                 #endif
  263               ]])],
  264            [cpu=riscv64],
  265            [cpu=riscv32])
  266          # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
  267          # Size of 'long' and 'void *':
  268          AC_COMPILE_IFELSE(
  269            [AC_LANG_SOURCE(
  270               [[#if defined __LP64__
  271                   int ok;
  272                 #else
  273                   error fail
  274                 #endif
  275               ]])],
  276            [main_abi=lp64],
  277            [main_abi=ilp32])
  278          # Float ABIs:
  279          # __riscv_float_abi_double:
  280          #   'float' and 'double' are passed in floating-point registers.
  281          # __riscv_float_abi_single:
  282          #   'float' are passed in floating-point registers.
  283          # __riscv_float_abi_soft:
  284          #   No values are passed in floating-point registers.
  285          AC_COMPILE_IFELSE(
  286            [AC_LANG_SOURCE(
  287               [[#if defined __riscv_float_abi_double
  288                   int ok;
  289                 #else
  290                   error fail
  291                 #endif
  292               ]])],
  293            [float_abi=d],
  294            [AC_COMPILE_IFELSE(
  295               [AC_LANG_SOURCE(
  296                  [[#if defined __riscv_float_abi_single
  297                      int ok;
  298                    #else
  299                      error fail
  300                    #endif
  301                  ]])],
  302               [float_abi=f],
  303               [float_abi=''])
  304            ])
  305          gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
  306          ;;
  307 
  308        s390* )
  309          # On s390x, the C compiler may be generating 64-bit (= s390x) code
  310          # or 31-bit (= s390) code.
  311          AC_COMPILE_IFELSE(
  312            [AC_LANG_SOURCE(
  313               [[#if defined __LP64__ || defined __s390x__
  314                   int ok;
  315                 #else
  316                   error fail
  317                 #endif
  318               ]])],
  319            [gl_cv_host_cpu_c_abi=s390x],
  320            [gl_cv_host_cpu_c_abi=s390])
  321          ;;
  322 
  323        sparc | sparc64 )
  324          # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
  325          # C compiler still generates 32-bit code.
  326          AC_COMPILE_IFELSE(
  327            [AC_LANG_SOURCE(
  328               [[#if defined __sparcv9 || defined __arch64__
  329                  int ok;
  330                 #else
  331                  error fail
  332                 #endif
  333               ]])],
  334            [gl_cv_host_cpu_c_abi=sparc64],
  335            [gl_cv_host_cpu_c_abi=sparc])
  336          ;;
  337 
  338        *)
  339          gl_cv_host_cpu_c_abi="$host_cpu"
  340          ;;
  341      esac
  342     ])
  343 
  344   dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
  345   HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
  346   HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
  347   AC_SUBST([HOST_CPU])
  348   AC_SUBST([HOST_CPU_C_ABI])
  349 
  350   # This was
  351   #   AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
  352   #   AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
  353   # earlier, but KAI C++ 3.2d doesn't like this.
  354   sed -e 's/-/_/g' >> confdefs.h <<EOF
  355 #ifndef __${HOST_CPU}__
  356 #define __${HOST_CPU}__ 1
  357 #endif
  358 #ifndef __${HOST_CPU_C_ABI}__
  359 #define __${HOST_CPU_C_ABI}__ 1
  360 #endif
  361 EOF
  362   AH_TOP([/* CPU and C ABI indicator */
  363 #ifndef __i386__
  364 #undef __i386__
  365 #endif
  366 #ifndef __x86_64_x32__
  367 #undef __x86_64_x32__
  368 #endif
  369 #ifndef __x86_64__
  370 #undef __x86_64__
  371 #endif
  372 #ifndef __alpha__
  373 #undef __alpha__
  374 #endif
  375 #ifndef __arm__
  376 #undef __arm__
  377 #endif
  378 #ifndef __armhf__
  379 #undef __armhf__
  380 #endif
  381 #ifndef __arm64_ilp32__
  382 #undef __arm64_ilp32__
  383 #endif
  384 #ifndef __arm64__
  385 #undef __arm64__
  386 #endif
  387 #ifndef __hppa__
  388 #undef __hppa__
  389 #endif
  390 #ifndef __hppa64__
  391 #undef __hppa64__
  392 #endif
  393 #ifndef __ia64_ilp32__
  394 #undef __ia64_ilp32__
  395 #endif
  396 #ifndef __ia64__
  397 #undef __ia64__
  398 #endif
  399 #ifndef __m68k__
  400 #undef __m68k__
  401 #endif
  402 #ifndef __mips__
  403 #undef __mips__
  404 #endif
  405 #ifndef __mipsn32__
  406 #undef __mipsn32__
  407 #endif
  408 #ifndef __mips64__
  409 #undef __mips64__
  410 #endif
  411 #ifndef __powerpc__
  412 #undef __powerpc__
  413 #endif
  414 #ifndef __powerpc64__
  415 #undef __powerpc64__
  416 #endif
  417 #ifndef __powerpc64_elfv2__
  418 #undef __powerpc64_elfv2__
  419 #endif
  420 #ifndef __riscv32__
  421 #undef __riscv32__
  422 #endif
  423 #ifndef __riscv64__
  424 #undef __riscv64__
  425 #endif
  426 #ifndef __riscv32_ilp32__
  427 #undef __riscv32_ilp32__
  428 #endif
  429 #ifndef __riscv32_ilp32f__
  430 #undef __riscv32_ilp32f__
  431 #endif
  432 #ifndef __riscv32_ilp32d__
  433 #undef __riscv32_ilp32d__
  434 #endif
  435 #ifndef __riscv64_ilp32__
  436 #undef __riscv64_ilp32__
  437 #endif
  438 #ifndef __riscv64_ilp32f__
  439 #undef __riscv64_ilp32f__
  440 #endif
  441 #ifndef __riscv64_ilp32d__
  442 #undef __riscv64_ilp32d__
  443 #endif
  444 #ifndef __riscv64_lp64__
  445 #undef __riscv64_lp64__
  446 #endif
  447 #ifndef __riscv64_lp64f__
  448 #undef __riscv64_lp64f__
  449 #endif
  450 #ifndef __riscv64_lp64d__
  451 #undef __riscv64_lp64d__
  452 #endif
  453 #ifndef __s390__
  454 #undef __s390__
  455 #endif
  456 #ifndef __s390x__
  457 #undef __s390x__
  458 #endif
  459 #ifndef __sh__
  460 #undef __sh__
  461 #endif
  462 #ifndef __sparc__
  463 #undef __sparc__
  464 #endif
  465 #ifndef __sparc64__
  466 #undef __sparc64__
  467 #endif
  468 ])
  469 
  470 ])
  471 
  472 
  473 dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
  474 dnl (application binary interface) is a 32-bit one, or to 'no' otherwise.
  475 dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
  476 AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
  477 [
  478   AC_REQUIRE([AC_CANONICAL_HOST])
  479   AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
  480     [if test -n "$gl_cv_host_cpu_c_abi"; then
  481        case "$gl_cv_host_cpu_c_abi" in
  482          i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
  483            gl_cv_host_cpu_c_abi_32bit=yes ;;
  484          *)
  485            gl_cv_host_cpu_c_abi_32bit=no ;;
  486        esac
  487      else
  488        case "$host_cpu" in
  489 
  490 changequote(,)dnl
  491          i[4567]86 )
  492 changequote([,])dnl
  493            gl_cv_host_cpu_c_abi_32bit=yes
  494            ;;
  495 
  496          x86_64 )
  497            # On x86_64 systems, the C compiler may be generating code in one of
  498            # these ABIs:
  499            # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
  500            # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
  501            #   with native Windows (mingw, MSVC).
  502            # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
  503            # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
  504            AC_COMPILE_IFELSE(
  505              [AC_LANG_SOURCE(
  506                 [[#if (defined __x86_64__ || defined __amd64__ \
  507                        || defined _M_X64 || defined _M_AMD64) \
  508                       && !(defined __ILP32__ || defined _ILP32)
  509                    int ok;
  510                   #else
  511                    error fail
  512                   #endif
  513                 ]])],
  514              [gl_cv_host_cpu_c_abi_32bit=no],
  515              [gl_cv_host_cpu_c_abi_32bit=yes])
  516            ;;
  517 
  518          arm* | aarch64 )
  519            # Assume arm with EABI.
  520            # On arm64 systems, the C compiler may be generating code in one of
  521            # these ABIs:
  522            # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
  523            # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
  524            # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
  525            AC_COMPILE_IFELSE(
  526              [AC_LANG_SOURCE(
  527                 [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32)
  528                    int ok;
  529                   #else
  530                    error fail
  531                   #endif
  532                 ]])],
  533              [gl_cv_host_cpu_c_abi_32bit=no],
  534              [gl_cv_host_cpu_c_abi_32bit=yes])
  535            ;;
  536 
  537          hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
  538            # On hppa, the C compiler may be generating 32-bit code or 64-bit
  539            # code. In the latter case, it defines _LP64 and __LP64__.
  540            AC_COMPILE_IFELSE(
  541              [AC_LANG_SOURCE(
  542                 [[#ifdef __LP64__
  543                    int ok;
  544                   #else
  545                    error fail
  546                   #endif
  547                 ]])],
  548              [gl_cv_host_cpu_c_abi_32bit=no],
  549              [gl_cv_host_cpu_c_abi_32bit=yes])
  550            ;;
  551 
  552          ia64* )
  553            # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
  554            # 32-bit code. In the latter case, it defines _ILP32.
  555            AC_COMPILE_IFELSE(
  556              [AC_LANG_SOURCE(
  557                 [[#ifdef _ILP32
  558                    int ok;
  559                   #else
  560                    error fail
  561                   #endif
  562                 ]])],
  563              [gl_cv_host_cpu_c_abi_32bit=yes],
  564              [gl_cv_host_cpu_c_abi_32bit=no])
  565            ;;
  566 
  567          mips* )
  568            # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
  569            # at 32.
  570            AC_COMPILE_IFELSE(
  571              [AC_LANG_SOURCE(
  572                 [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
  573                    int ok;
  574                   #else
  575                    error fail
  576                   #endif
  577                 ]])],
  578              [gl_cv_host_cpu_c_abi_32bit=no],
  579              [gl_cv_host_cpu_c_abi_32bit=yes])
  580            ;;
  581 
  582          powerpc* )
  583            # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
  584            # No need to distinguish them here; the caller may distinguish
  585            # them based on the OS.
  586            # On powerpc64 systems, the C compiler may still be generating
  587            # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
  588            # be generating 64-bit code.
  589            AC_COMPILE_IFELSE(
  590              [AC_LANG_SOURCE(
  591                 [[#if defined __powerpc64__ || defined _ARCH_PPC64
  592                    int ok;
  593                   #else
  594                    error fail
  595                   #endif
  596                 ]])],
  597              [gl_cv_host_cpu_c_abi_32bit=no],
  598              [gl_cv_host_cpu_c_abi_32bit=yes])
  599            ;;
  600 
  601          rs6000 )
  602            gl_cv_host_cpu_c_abi_32bit=yes
  603            ;;
  604 
  605          riscv32 | riscv64 )
  606            # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
  607            # Size of 'long' and 'void *':
  608            AC_COMPILE_IFELSE(
  609              [AC_LANG_SOURCE(
  610                 [[#if defined __LP64__
  611                     int ok;
  612                   #else
  613                     error fail
  614                   #endif
  615                 ]])],
  616              [gl_cv_host_cpu_c_abi_32bit=no],
  617              [gl_cv_host_cpu_c_abi_32bit=yes])
  618            ;;
  619 
  620          s390* )
  621            # On s390x, the C compiler may be generating 64-bit (= s390x) code
  622            # or 31-bit (= s390) code.
  623            AC_COMPILE_IFELSE(
  624              [AC_LANG_SOURCE(
  625                 [[#if defined __LP64__ || defined __s390x__
  626                     int ok;
  627                   #else
  628                     error fail
  629                   #endif
  630                 ]])],
  631              [gl_cv_host_cpu_c_abi_32bit=no],
  632              [gl_cv_host_cpu_c_abi_32bit=yes])
  633            ;;
  634 
  635          sparc | sparc64 )
  636            # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
  637            # C compiler still generates 32-bit code.
  638            AC_COMPILE_IFELSE(
  639              [AC_LANG_SOURCE(
  640                 [[#if defined __sparcv9 || defined __arch64__
  641                    int ok;
  642                   #else
  643                    error fail
  644                   #endif
  645                 ]])],
  646              [gl_cv_host_cpu_c_abi_32bit=no],
  647              [gl_cv_host_cpu_c_abi_32bit=yes])
  648            ;;
  649 
  650          *)
  651            gl_cv_host_cpu_c_abi_32bit=no
  652            ;;
  653        esac
  654      fi
  655     ])
  656 
  657   HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
  658 ])
  659 
  660 # iconv.m4 serial 21
  661 dnl Copyright (C) 2000-2002, 2007-2014, 2016-2019 Free Software Foundation,
  662 dnl Inc.
  663 dnl This file is free software; the Free Software Foundation
  664 dnl gives unlimited permission to copy and/or distribute it,
  665 dnl with or without modifications, as long as this notice is preserved.
  666 
  667 dnl From Bruno Haible.
  668 
  669 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
  670 [
  671   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
  672   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  673   AC_REQUIRE([AC_LIB_RPATH])
  674 
  675   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
  676   dnl accordingly.
  677   AC_LIB_LINKFLAGS_BODY([iconv])
  678 ])
  679 
  680 AC_DEFUN([AM_ICONV_LINK],
  681 [
  682   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  683   dnl those with the standalone portable GNU libiconv installed).
  684   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
  685 
  686   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
  687   dnl accordingly.
  688   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
  689 
  690   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
  691   dnl because if the user has installed libiconv and not disabled its use
  692   dnl via --without-libiconv-prefix, he wants to use it. The first
  693   dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
  694   am_save_CPPFLAGS="$CPPFLAGS"
  695   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
  696 
  697   AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
  698     am_cv_func_iconv="no, consider installing GNU libiconv"
  699     am_cv_lib_iconv=no
  700     AC_LINK_IFELSE(
  701       [AC_LANG_PROGRAM(
  702          [[
  703 #include <stdlib.h>
  704 #include <iconv.h>
  705          ]],
  706          [[iconv_t cd = iconv_open("","");
  707            iconv(cd,NULL,NULL,NULL,NULL);
  708            iconv_close(cd);]])],
  709       [am_cv_func_iconv=yes])
  710     if test "$am_cv_func_iconv" != yes; then
  711       am_save_LIBS="$LIBS"
  712       LIBS="$LIBS $LIBICONV"
  713       AC_LINK_IFELSE(
  714         [AC_LANG_PROGRAM(
  715            [[
  716 #include <stdlib.h>
  717 #include <iconv.h>
  718            ]],
  719            [[iconv_t cd = iconv_open("","");
  720              iconv(cd,NULL,NULL,NULL,NULL);
  721              iconv_close(cd);]])],
  722         [am_cv_lib_iconv=yes]
  723         [am_cv_func_iconv=yes])
  724       LIBS="$am_save_LIBS"
  725     fi
  726   ])
  727   if test "$am_cv_func_iconv" = yes; then
  728     AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
  729       dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
  730       dnl Solaris 10.
  731       am_save_LIBS="$LIBS"
  732       if test $am_cv_lib_iconv = yes; then
  733         LIBS="$LIBS $LIBICONV"
  734       fi
  735       am_cv_func_iconv_works=no
  736       for ac_iconv_const in '' 'const'; do
  737         AC_RUN_IFELSE(
  738           [AC_LANG_PROGRAM(
  739              [[
  740 #include <iconv.h>
  741 #include <string.h>
  742 
  743 #ifndef ICONV_CONST
  744 # define ICONV_CONST $ac_iconv_const
  745 #endif
  746              ]],
  747              [[int result = 0;
  748   /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
  749      returns.  */
  750   {
  751     iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
  752     if (cd_utf8_to_88591 != (iconv_t)(-1))
  753       {
  754         static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
  755         char buf[10];
  756         ICONV_CONST char *inptr = input;
  757         size_t inbytesleft = strlen (input);
  758         char *outptr = buf;
  759         size_t outbytesleft = sizeof (buf);
  760         size_t res = iconv (cd_utf8_to_88591,
  761                             &inptr, &inbytesleft,
  762                             &outptr, &outbytesleft);
  763         if (res == 0)
  764           result |= 1;
  765         iconv_close (cd_utf8_to_88591);
  766       }
  767   }
  768   /* Test against Solaris 10 bug: Failures are not distinguishable from
  769      successful returns.  */
  770   {
  771     iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
  772     if (cd_ascii_to_88591 != (iconv_t)(-1))
  773       {
  774         static ICONV_CONST char input[] = "\263";
  775         char buf[10];
  776         ICONV_CONST char *inptr = input;
  777         size_t inbytesleft = strlen (input);
  778         char *outptr = buf;
  779         size_t outbytesleft = sizeof (buf);
  780         size_t res = iconv (cd_ascii_to_88591,
  781                             &inptr, &inbytesleft,
  782                             &outptr, &outbytesleft);
  783         if (res == 0)
  784           result |= 2;
  785         iconv_close (cd_ascii_to_88591);
  786       }
  787   }
  788   /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
  789   {
  790     iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
  791     if (cd_88591_to_utf8 != (iconv_t)(-1))
  792       {
  793         static ICONV_CONST char input[] = "\304";
  794         static char buf[2] = { (char)0xDE, (char)0xAD };
  795         ICONV_CONST char *inptr = input;
  796         size_t inbytesleft = 1;
  797         char *outptr = buf;
  798         size_t outbytesleft = 1;
  799         size_t res = iconv (cd_88591_to_utf8,
  800                             &inptr, &inbytesleft,
  801                             &outptr, &outbytesleft);
  802         if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
  803           result |= 4;
  804         iconv_close (cd_88591_to_utf8);
  805       }
  806   }
  807 #if 0 /* This bug could be worked around by the caller.  */
  808   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
  809   {
  810     iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
  811     if (cd_88591_to_utf8 != (iconv_t)(-1))
  812       {
  813         static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
  814         char buf[50];
  815         ICONV_CONST char *inptr = input;
  816         size_t inbytesleft = strlen (input);
  817         char *outptr = buf;
  818         size_t outbytesleft = sizeof (buf);
  819         size_t res = iconv (cd_88591_to_utf8,
  820                             &inptr, &inbytesleft,
  821                             &outptr, &outbytesleft);
  822         if ((int)res > 0)
  823           result |= 8;
  824         iconv_close (cd_88591_to_utf8);
  825       }
  826   }
  827 #endif
  828   /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
  829      provided.  */
  830   {
  831     /* Try standardized names.  */
  832     iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
  833     /* Try IRIX, OSF/1 names.  */
  834     iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
  835     /* Try AIX names.  */
  836     iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
  837     /* Try HP-UX names.  */
  838     iconv_t cd4 = iconv_open ("utf8", "eucJP");
  839     if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
  840         && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
  841       result |= 16;
  842     if (cd1 != (iconv_t)(-1))
  843       iconv_close (cd1);
  844     if (cd2 != (iconv_t)(-1))
  845       iconv_close (cd2);
  846     if (cd3 != (iconv_t)(-1))
  847       iconv_close (cd3);
  848     if (cd4 != (iconv_t)(-1))
  849       iconv_close (cd4);
  850   }
  851   return result;
  852 ]])],
  853           [am_cv_func_iconv_works=yes], ,
  854           [case "$host_os" in
  855              aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
  856              *)            am_cv_func_iconv_works="guessing yes" ;;
  857            esac])
  858         test "$am_cv_func_iconv_works" = no || break
  859       done
  860       LIBS="$am_save_LIBS"
  861     ])
  862     case "$am_cv_func_iconv_works" in
  863       *no) am_func_iconv=no am_cv_lib_iconv=no ;;
  864       *)   am_func_iconv=yes ;;
  865     esac
  866   else
  867     am_func_iconv=no am_cv_lib_iconv=no
  868   fi
  869   if test "$am_func_iconv" = yes; then
  870     AC_DEFINE([HAVE_ICONV], [1],
  871       [Define if you have the iconv() function and it works.])
  872   fi
  873   if test "$am_cv_lib_iconv" = yes; then
  874     AC_MSG_CHECKING([how to link with libiconv])
  875     AC_MSG_RESULT([$LIBICONV])
  876   else
  877     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
  878     dnl either.
  879     CPPFLAGS="$am_save_CPPFLAGS"
  880     LIBICONV=
  881     LTLIBICONV=
  882   fi
  883   AC_SUBST([LIBICONV])
  884   AC_SUBST([LTLIBICONV])
  885 ])
  886 
  887 dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
  888 dnl avoid warnings like
  889 dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
  890 dnl This is tricky because of the way 'aclocal' is implemented:
  891 dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
  892 dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
  893 dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
  894 dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
  895 dnl   warnings.
  896 m4_define([gl_iconv_AC_DEFUN],
  897   m4_version_prereq([2.64],
  898     [[AC_DEFUN_ONCE(
  899         [$1], [$2])]],
  900     [m4_ifdef([gl_00GNULIB],
  901        [[AC_DEFUN_ONCE(
  902            [$1], [$2])]],
  903        [[AC_DEFUN(
  904            [$1], [$2])]])]))
  905 gl_iconv_AC_DEFUN([AM_ICONV],
  906 [
  907   AM_ICONV_LINK
  908   if test "$am_cv_func_iconv" = yes; then
  909     AC_MSG_CHECKING([for iconv declaration])
  910     AC_CACHE_VAL([am_cv_proto_iconv], [
  911       AC_COMPILE_IFELSE(
  912         [AC_LANG_PROGRAM(
  913            [[
  914 #include <stdlib.h>
  915 #include <iconv.h>
  916 extern
  917 #ifdef __cplusplus
  918 "C"
  919 #endif
  920 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
  921 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  922 #else
  923 size_t iconv();
  924 #endif
  925            ]],
  926            [[]])],
  927         [am_cv_proto_iconv_arg1=""],
  928         [am_cv_proto_iconv_arg1="const"])
  929       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
  930     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
  931     AC_MSG_RESULT([
  932          $am_cv_proto_iconv])
  933   else
  934     dnl When compiling GNU libiconv on a system that does not have iconv yet,
  935     dnl pick the POSIX compliant declaration without 'const'.
  936     am_cv_proto_iconv_arg1=""
  937   fi
  938   AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
  939     [Define as const if the declaration of iconv() needs const.])
  940   dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
  941   m4_ifdef([gl_ICONV_H_DEFAULTS],
  942     [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
  943      if test -n "$am_cv_proto_iconv_arg1"; then
  944        ICONV_CONST="const"
  945      fi
  946     ])
  947 ])
  948 
  949 # lib-ld.m4 serial 9
  950 dnl Copyright (C) 1996-2003, 2009-2019 Free Software Foundation, Inc.
  951 dnl This file is free software; the Free Software Foundation
  952 dnl gives unlimited permission to copy and/or distribute it,
  953 dnl with or without modifications, as long as this notice is preserved.
  954 
  955 dnl Subroutines of libtool.m4,
  956 dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
  957 dnl collision with libtool.m4.
  958 
  959 dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
  960 AC_DEFUN([AC_LIB_PROG_LD_GNU],
  961 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
  962 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
  963 case `$LD -v 2>&1 </dev/null` in
  964 *GNU* | *'with BFD'*)
  965   acl_cv_prog_gnu_ld=yes
  966   ;;
  967 *)
  968   acl_cv_prog_gnu_ld=no
  969   ;;
  970 esac])
  971 with_gnu_ld=$acl_cv_prog_gnu_ld
  972 ])
  973 
  974 dnl From libtool-2.4. Sets the variable LD.
  975 AC_DEFUN([AC_LIB_PROG_LD],
  976 [AC_REQUIRE([AC_PROG_CC])dnl
  977 AC_REQUIRE([AC_CANONICAL_HOST])dnl
  978 
  979 AC_ARG_WITH([gnu-ld],
  980     [AS_HELP_STRING([--with-gnu-ld],
  981         [assume the C compiler uses GNU ld [default=no]])],
  982     [test "$withval" = no || with_gnu_ld=yes],
  983     [with_gnu_ld=no])dnl
  984 
  985 # Prepare PATH_SEPARATOR.
  986 # The user is always right.
  987 if test "${PATH_SEPARATOR+set}" != set; then
  988   # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
  989   # contains only /bin. Note that ksh looks also at the FPATH variable,
  990   # so we have to set that as well for the test.
  991   PATH_SEPARATOR=:
  992   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
  993     && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
  994            || PATH_SEPARATOR=';'
  995        }
  996 fi
  997 
  998 if test -n "$LD"; then
  999   AC_MSG_CHECKING([for ld])
 1000 elif test "$GCC" = yes; then
 1001   AC_MSG_CHECKING([for ld used by $CC])
 1002 elif test "$with_gnu_ld" = yes; then
 1003   AC_MSG_CHECKING([for GNU ld])
 1004 else
 1005   AC_MSG_CHECKING([for non-GNU ld])
 1006 fi
 1007 if test -n "$LD"; then
 1008   # Let the user override the test with a path.
 1009   :
 1010 else
 1011   AC_CACHE_VAL([acl_cv_path_LD],
 1012   [
 1013     acl_cv_path_LD= # Final result of this test
 1014     ac_prog=ld # Program to search in $PATH
 1015     if test "$GCC" = yes; then
 1016       # Check if gcc -print-prog-name=ld gives a path.
 1017       case $host in
 1018         *-*-mingw*)
 1019           # gcc leaves a trailing carriage return which upsets mingw
 1020           acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
 1021         *)
 1022           acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
 1023       esac
 1024       case $acl_output in
 1025         # Accept absolute paths.
 1026         [[\\/]]* | ?:[[\\/]]*)
 1027           re_direlt='/[[^/]][[^/]]*/\.\./'
 1028           # Canonicalize the pathname of ld
 1029           acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'`
 1030           while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do
 1031             acl_output=`echo $acl_output | sed "s%$re_direlt%/%"`
 1032           done
 1033           # Got the pathname. No search in PATH is needed.
 1034           acl_cv_path_LD="$acl_output"
 1035           ac_prog=
 1036           ;;
 1037         "")
 1038           # If it fails, then pretend we aren't using GCC.
 1039           ;;
 1040         *)
 1041           # If it is relative, then search for the first ld in PATH.
 1042           with_gnu_ld=unknown
 1043           ;;
 1044       esac
 1045     fi
 1046     if test -n "$ac_prog"; then
 1047       # Search for $ac_prog in $PATH.
 1048       acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
 1049       for ac_dir in $PATH; do
 1050         IFS="$acl_save_ifs"
 1051         test -z "$ac_dir" && ac_dir=.
 1052         if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
 1053           acl_cv_path_LD="$ac_dir/$ac_prog"
 1054           # Check to see if the program is GNU ld.  I'd rather use --version,
 1055           # but apparently some variants of GNU ld only accept -v.
 1056           # Break only if it was the GNU/non-GNU ld that we prefer.
 1057           case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
 1058             *GNU* | *'with BFD'*)
 1059               test "$with_gnu_ld" != no && break
 1060               ;;
 1061             *)
 1062               test "$with_gnu_ld" != yes && break
 1063               ;;
 1064           esac
 1065         fi
 1066       done
 1067       IFS="$acl_save_ifs"
 1068     fi
 1069     case $host in
 1070       *-*-aix*)
 1071         AC_COMPILE_IFELSE(
 1072           [AC_LANG_SOURCE(
 1073              [[#if defined __powerpc64__ || defined _ARCH_PPC64
 1074                 int ok;
 1075                #else
 1076                 error fail
 1077                #endif
 1078              ]])],
 1079           [# The compiler produces 64-bit code. Add option '-b64' so that the
 1080            # linker groks 64-bit object files.
 1081            case "$acl_cv_path_LD " in
 1082              *" -b64 "*) ;;
 1083              *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
 1084            esac
 1085           ], [])
 1086         ;;
 1087       sparc64-*-netbsd*)
 1088         AC_COMPILE_IFELSE(
 1089           [AC_LANG_SOURCE(
 1090              [[#if defined __sparcv9 || defined __arch64__
 1091                 int ok;
 1092                #else
 1093                 error fail
 1094                #endif
 1095              ]])],
 1096           [],
 1097           [# The compiler produces 32-bit code. Add option '-m elf32_sparc'
 1098            # so that the linker groks 32-bit object files.
 1099            case "$acl_cv_path_LD " in
 1100              *" -m elf32_sparc "*) ;;
 1101              *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;;
 1102            esac
 1103           ])
 1104         ;;
 1105     esac
 1106   ])
 1107   LD="$acl_cv_path_LD"
 1108 fi
 1109 if test -n "$LD"; then
 1110   AC_MSG_RESULT([$LD])
 1111 else
 1112   AC_MSG_RESULT([no])
 1113   AC_MSG_ERROR([no acceptable ld found in \$PATH])
 1114 fi
 1115 AC_LIB_PROG_LD_GNU
 1116 ])
 1117 
 1118 # lib-link.m4 serial 28
 1119 dnl Copyright (C) 2001-2019 Free Software Foundation, Inc.
 1120 dnl This file is free software; the Free Software Foundation
 1121 dnl gives unlimited permission to copy and/or distribute it,
 1122 dnl with or without modifications, as long as this notice is preserved.
 1123 
 1124 dnl From Bruno Haible.
 1125 
 1126 AC_PREREQ([2.61])
 1127 
 1128 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
 1129 dnl the libraries corresponding to explicit and implicit dependencies.
 1130 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
 1131 dnl augments the CPPFLAGS variable.
 1132 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
 1133 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 1134 AC_DEFUN([AC_LIB_LINKFLAGS],
 1135 [
 1136   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 1137   AC_REQUIRE([AC_LIB_RPATH])
 1138   pushdef([Name],[m4_translit([$1],[./+-], [____])])
 1139   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 1140                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 1141   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
 1142     AC_LIB_LINKFLAGS_BODY([$1], [$2])
 1143     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
 1144     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
 1145     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
 1146     ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
 1147   ])
 1148   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
 1149   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
 1150   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
 1151   LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
 1152   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 1153   AC_SUBST([LIB]NAME)
 1154   AC_SUBST([LTLIB]NAME)
 1155   AC_SUBST([LIB]NAME[_PREFIX])
 1156   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
 1157   dnl results of this search when this library appears as a dependency.
 1158   HAVE_LIB[]NAME=yes
 1159   popdef([NAME])
 1160   popdef([Name])
 1161 ])
 1162 
 1163 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
 1164 dnl searches for libname and the libraries corresponding to explicit and
 1165 dnl implicit dependencies, together with the specified include files and
 1166 dnl the ability to compile and link the specified testcode. The missing-message
 1167 dnl defaults to 'no' and may contain additional hints for the user.
 1168 dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
 1169 dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
 1170 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
 1171 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
 1172 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
 1173 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 1174 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
 1175 [
 1176   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 1177   AC_REQUIRE([AC_LIB_RPATH])
 1178   pushdef([Name],[m4_translit([$1],[./+-], [____])])
 1179   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 1180                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 1181 
 1182   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
 1183   dnl accordingly.
 1184   AC_LIB_LINKFLAGS_BODY([$1], [$2])
 1185 
 1186   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
 1187   dnl because if the user has installed lib[]Name and not disabled its use
 1188   dnl via --without-lib[]Name-prefix, he wants to use it.
 1189   ac_save_CPPFLAGS="$CPPFLAGS"
 1190   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 1191 
 1192   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
 1193     ac_save_LIBS="$LIBS"
 1194     dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
 1195     dnl because these -l options might require -L options that are present in
 1196     dnl LIBS. -l options benefit only from the -L options listed before it.
 1197     dnl Otherwise, add it to the front of LIBS, because it may be a static
 1198     dnl library that depends on another static library that is present in LIBS.
 1199     dnl Static libraries benefit only from the static libraries listed after
 1200     dnl it.
 1201     case " $LIB[]NAME" in
 1202       *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
 1203       *)       LIBS="$LIB[]NAME $LIBS" ;;
 1204     esac
 1205     AC_LINK_IFELSE(
 1206       [AC_LANG_PROGRAM([[$3]], [[$4]])],
 1207       [ac_cv_lib[]Name=yes],
 1208       [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
 1209     LIBS="$ac_save_LIBS"
 1210   ])
 1211   if test "$ac_cv_lib[]Name" = yes; then
 1212     HAVE_LIB[]NAME=yes
 1213     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
 1214     AC_MSG_CHECKING([how to link with lib[]$1])
 1215     AC_MSG_RESULT([$LIB[]NAME])
 1216   else
 1217     HAVE_LIB[]NAME=no
 1218     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
 1219     dnl $INC[]NAME either.
 1220     CPPFLAGS="$ac_save_CPPFLAGS"
 1221     LIB[]NAME=
 1222     LTLIB[]NAME=
 1223     LIB[]NAME[]_PREFIX=
 1224   fi
 1225   AC_SUBST([HAVE_LIB]NAME)
 1226   AC_SUBST([LIB]NAME)
 1227   AC_SUBST([LTLIB]NAME)
 1228   AC_SUBST([LIB]NAME[_PREFIX])
 1229   popdef([NAME])
 1230   popdef([Name])
 1231 ])
 1232 
 1233 dnl Determine the platform dependent parameters needed to use rpath:
 1234 dnl   acl_libext,
 1235 dnl   acl_shlibext,
 1236 dnl   acl_libname_spec,
 1237 dnl   acl_library_names_spec,
 1238 dnl   acl_hardcode_libdir_flag_spec,
 1239 dnl   acl_hardcode_libdir_separator,
 1240 dnl   acl_hardcode_direct,
 1241 dnl   acl_hardcode_minus_L.
 1242 AC_DEFUN([AC_LIB_RPATH],
 1243 [
 1244   dnl Complain if config.rpath is missing.
 1245   AC_REQUIRE_AUX_FILE([config.rpath])
 1246   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
 1247   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
 1248   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
 1249   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
 1250   AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
 1251     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
 1252     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
 1253     . ./conftest.sh
 1254     rm -f ./conftest.sh
 1255     acl_cv_rpath=done
 1256   ])
 1257   wl="$acl_cv_wl"
 1258   acl_libext="$acl_cv_libext"
 1259   acl_shlibext="$acl_cv_shlibext"
 1260   acl_libname_spec="$acl_cv_libname_spec"
 1261   acl_library_names_spec="$acl_cv_library_names_spec"
 1262   acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
 1263   acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
 1264   acl_hardcode_direct="$acl_cv_hardcode_direct"
 1265   acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
 1266   dnl Determine whether the user wants rpath handling at all.
 1267   AC_ARG_ENABLE([rpath],
 1268     [  --disable-rpath         do not hardcode runtime library paths],
 1269     :, enable_rpath=yes)
 1270 ])
 1271 
 1272 dnl AC_LIB_FROMPACKAGE(name, package)
 1273 dnl declares that libname comes from the given package. The configure file
 1274 dnl will then not have a --with-libname-prefix option but a
 1275 dnl --with-package-prefix option. Several libraries can come from the same
 1276 dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
 1277 dnl macro call that searches for libname.
 1278 AC_DEFUN([AC_LIB_FROMPACKAGE],
 1279 [
 1280   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 1281                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 1282   define([acl_frompackage_]NAME, [$2])
 1283   popdef([NAME])
 1284   pushdef([PACK],[$2])
 1285   pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
 1286                                      [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 1287   define([acl_libsinpackage_]PACKUP,
 1288     m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
 1289   popdef([PACKUP])
 1290   popdef([PACK])
 1291 ])
 1292 
 1293 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
 1294 dnl the libraries corresponding to explicit and implicit dependencies.
 1295 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
 1296 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
 1297 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 1298 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 1299 [
 1300   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 1301   pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 1302                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 1303   pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
 1304   pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
 1305                                      [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 1306   pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
 1307   dnl By default, look in $includedir and $libdir.
 1308   use_additional=yes
 1309   AC_LIB_WITH_FINAL_PREFIX([
 1310     eval additional_includedir=\"$includedir\"
 1311     eval additional_libdir=\"$libdir\"
 1312   ])
 1313   AC_ARG_WITH(PACK[-prefix],
 1314 [[  --with-]]PACK[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
 1315   --without-]]PACK[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
 1316 [
 1317     if test "X$withval" = "Xno"; then
 1318       use_additional=no
 1319     else
 1320       if test "X$withval" = "X"; then
 1321         AC_LIB_WITH_FINAL_PREFIX([
 1322           eval additional_includedir=\"$includedir\"
 1323           eval additional_libdir=\"$libdir\"
 1324         ])
 1325       else
 1326         additional_includedir="$withval/include"
 1327         additional_libdir="$withval/$acl_libdirstem"
 1328         if test "$acl_libdirstem2" != "$acl_libdirstem" \
 1329            && test ! -d "$withval/$acl_libdirstem"; then
 1330           additional_libdir="$withval/$acl_libdirstem2"
 1331         fi
 1332       fi
 1333     fi
 1334 ])
 1335   dnl Search the library and its dependencies in $additional_libdir and
 1336   dnl $LDFLAGS. Using breadth-first-seach.
 1337   LIB[]NAME=
 1338   LTLIB[]NAME=
 1339   INC[]NAME=
 1340   LIB[]NAME[]_PREFIX=
 1341   dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
 1342   dnl computed. So it has to be reset here.
 1343   HAVE_LIB[]NAME=
 1344   rpathdirs=
 1345   ltrpathdirs=
 1346   names_already_handled=
 1347   names_next_round='$1 $2'
 1348   while test -n "$names_next_round"; do
 1349     names_this_round="$names_next_round"
 1350     names_next_round=
 1351     for name in $names_this_round; do
 1352       already_handled=
 1353       for n in $names_already_handled; do
 1354         if test "$n" = "$name"; then
 1355           already_handled=yes
 1356           break
 1357         fi
 1358       done
 1359       if test -z "$already_handled"; then
 1360         names_already_handled="$names_already_handled $name"
 1361         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
 1362         dnl or AC_LIB_HAVE_LINKFLAGS call.
 1363         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
 1364         eval value=\"\$HAVE_LIB$uppername\"
 1365         if test -n "$value"; then
 1366           if test "$value" = yes; then
 1367             eval value=\"\$LIB$uppername\"
 1368             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
 1369             eval value=\"\$LTLIB$uppername\"
 1370             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
 1371           else
 1372             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
 1373             dnl that this library doesn't exist. So just drop it.
 1374             :
 1375           fi
 1376         else
 1377           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
 1378           dnl and the already constructed $LIBNAME/$LTLIBNAME.
 1379           found_dir=
 1380           found_la=
 1381           found_so=
 1382           found_a=
 1383           eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
 1384           if test -n "$acl_shlibext"; then
 1385             shrext=".$acl_shlibext"             # typically: shrext=.so
 1386           else
 1387             shrext=
 1388           fi
 1389           if test $use_additional = yes; then
 1390             dir="$additional_libdir"
 1391             dnl The same code as in the loop below:
 1392             dnl First look for a shared library.
 1393             if test -n "$acl_shlibext"; then
 1394               if test -f "$dir/$libname$shrext"; then
 1395                 found_dir="$dir"
 1396                 found_so="$dir/$libname$shrext"
 1397               else
 1398                 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
 1399                   ver=`(cd "$dir" && \
 1400                         for f in "$libname$shrext".*; do echo "$f"; done \
 1401                         | sed -e "s,^$libname$shrext\\\\.,," \
 1402                         | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
 1403                         | sed 1q ) 2>/dev/null`
 1404                   if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
 1405                     found_dir="$dir"
 1406                     found_so="$dir/$libname$shrext.$ver"
 1407                   fi
 1408                 else
 1409                   eval library_names=\"$acl_library_names_spec\"
 1410                   for f in $library_names; do
 1411                     if test -f "$dir/$f"; then
 1412                       found_dir="$dir"
 1413                       found_so="$dir/$f"
 1414                       break
 1415                     fi
 1416                   done
 1417                 fi
 1418               fi
 1419             fi
 1420             dnl Then look for a static library.
 1421             if test "X$found_dir" = "X"; then
 1422               if test -f "$dir/$libname.$acl_libext"; then
 1423                 found_dir="$dir"
 1424                 found_a="$dir/$libname.$acl_libext"
 1425               fi
 1426             fi
 1427             if test "X$found_dir" != "X"; then
 1428               if test -f "$dir/$libname.la"; then
 1429                 found_la="$dir/$libname.la"
 1430               fi
 1431             fi
 1432           fi
 1433           if test "X$found_dir" = "X"; then
 1434             for x in $LDFLAGS $LTLIB[]NAME; do
 1435               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1436               case "$x" in
 1437                 -L*)
 1438                   dir=`echo "X$x" | sed -e 's/^X-L//'`
 1439                   dnl First look for a shared library.
 1440                   if test -n "$acl_shlibext"; then
 1441                     if test -f "$dir/$libname$shrext"; then
 1442                       found_dir="$dir"
 1443                       found_so="$dir/$libname$shrext"
 1444                     else
 1445                       if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
 1446                         ver=`(cd "$dir" && \
 1447                               for f in "$libname$shrext".*; do echo "$f"; done \
 1448                               | sed -e "s,^$libname$shrext\\\\.,," \
 1449                               | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
 1450                               | sed 1q ) 2>/dev/null`
 1451                         if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
 1452                           found_dir="$dir"
 1453                           found_so="$dir/$libname$shrext.$ver"
 1454                         fi
 1455                       else
 1456                         eval library_names=\"$acl_library_names_spec\"
 1457                         for f in $library_names; do
 1458                           if test -f "$dir/$f"; then
 1459                             found_dir="$dir"
 1460                             found_so="$dir/$f"
 1461                             break
 1462                           fi
 1463                         done
 1464                       fi
 1465                     fi
 1466                   fi
 1467                   dnl Then look for a static library.
 1468                   if test "X$found_dir" = "X"; then
 1469                     if test -f "$dir/$libname.$acl_libext"; then
 1470                       found_dir="$dir"
 1471                       found_a="$dir/$libname.$acl_libext"
 1472                     fi
 1473                   fi
 1474                   if test "X$found_dir" != "X"; then
 1475                     if test -f "$dir/$libname.la"; then
 1476                       found_la="$dir/$libname.la"
 1477                     fi
 1478                   fi
 1479                   ;;
 1480               esac
 1481               if test "X$found_dir" != "X"; then
 1482                 break
 1483               fi
 1484             done
 1485           fi
 1486           if test "X$found_dir" != "X"; then
 1487             dnl Found the library.
 1488             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
 1489             if test "X$found_so" != "X"; then
 1490               dnl Linking with a shared library. We attempt to hardcode its
 1491               dnl directory into the executable's runpath, unless it's the
 1492               dnl standard /usr/lib.
 1493               if test "$enable_rpath" = no \
 1494                  || test "X$found_dir" = "X/usr/$acl_libdirstem" \
 1495                  || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
 1496                 dnl No hardcoding is needed.
 1497                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 1498               else
 1499                 dnl Use an explicit option to hardcode DIR into the resulting
 1500                 dnl binary.
 1501                 dnl Potentially add DIR to ltrpathdirs.
 1502                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
 1503                 haveit=
 1504                 for x in $ltrpathdirs; do
 1505                   if test "X$x" = "X$found_dir"; then
 1506                     haveit=yes
 1507                     break
 1508                   fi
 1509                 done
 1510                 if test -z "$haveit"; then
 1511                   ltrpathdirs="$ltrpathdirs $found_dir"
 1512                 fi
 1513                 dnl The hardcoding into $LIBNAME is system dependent.
 1514                 if test "$acl_hardcode_direct" = yes; then
 1515                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
 1516                   dnl resulting binary.
 1517                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 1518                 else
 1519                   if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
 1520                     dnl Use an explicit option to hardcode DIR into the resulting
 1521                     dnl binary.
 1522                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 1523                     dnl Potentially add DIR to rpathdirs.
 1524                     dnl The rpathdirs will be appended to $LIBNAME at the end.
 1525                     haveit=
 1526                     for x in $rpathdirs; do
 1527                       if test "X$x" = "X$found_dir"; then
 1528                         haveit=yes
 1529                         break
 1530                       fi
 1531                     done
 1532                     if test -z "$haveit"; then
 1533                       rpathdirs="$rpathdirs $found_dir"
 1534                     fi
 1535                   else
 1536                     dnl Rely on "-L$found_dir".
 1537                     dnl But don't add it if it's already contained in the LDFLAGS
 1538                     dnl or the already constructed $LIBNAME
 1539                     haveit=
 1540                     for x in $LDFLAGS $LIB[]NAME; do
 1541                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1542                       if test "X$x" = "X-L$found_dir"; then
 1543                         haveit=yes
 1544                         break
 1545                       fi
 1546                     done
 1547                     if test -z "$haveit"; then
 1548                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
 1549                     fi
 1550                     if test "$acl_hardcode_minus_L" != no; then
 1551                       dnl FIXME: Not sure whether we should use
 1552                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
 1553                       dnl here.
 1554                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 1555                     else
 1556                       dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
 1557                       dnl here, because this doesn't fit in flags passed to the
 1558                       dnl compiler. So give up. No hardcoding. This affects only
 1559                       dnl very old systems.
 1560                       dnl FIXME: Not sure whether we should use
 1561                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
 1562                       dnl here.
 1563                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
 1564                     fi
 1565                   fi
 1566                 fi
 1567               fi
 1568             else
 1569               if test "X$found_a" != "X"; then
 1570                 dnl Linking with a static library.
 1571                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
 1572               else
 1573                 dnl We shouldn't come here, but anyway it's good to have a
 1574                 dnl fallback.
 1575                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
 1576               fi
 1577             fi
 1578             dnl Assume the include files are nearby.
 1579             additional_includedir=
 1580             case "$found_dir" in
 1581               */$acl_libdirstem | */$acl_libdirstem/)
 1582                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
 1583                 if test "$name" = '$1'; then
 1584                   LIB[]NAME[]_PREFIX="$basedir"
 1585                 fi
 1586                 additional_includedir="$basedir/include"
 1587                 ;;
 1588               */$acl_libdirstem2 | */$acl_libdirstem2/)
 1589                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
 1590                 if test "$name" = '$1'; then
 1591                   LIB[]NAME[]_PREFIX="$basedir"
 1592                 fi
 1593                 additional_includedir="$basedir/include"
 1594                 ;;
 1595             esac
 1596             if test "X$additional_includedir" != "X"; then
 1597               dnl Potentially add $additional_includedir to $INCNAME.
 1598               dnl But don't add it
 1599               dnl   1. if it's the standard /usr/include,
 1600               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
 1601               dnl   3. if it's already present in $CPPFLAGS or the already
 1602               dnl      constructed $INCNAME,
 1603               dnl   4. if it doesn't exist as a directory.
 1604               if test "X$additional_includedir" != "X/usr/include"; then
 1605                 haveit=
 1606                 if test "X$additional_includedir" = "X/usr/local/include"; then
 1607                   if test -n "$GCC"; then
 1608                     case $host_os in
 1609                       linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 1610                     esac
 1611                   fi
 1612                 fi
 1613                 if test -z "$haveit"; then
 1614                   for x in $CPPFLAGS $INC[]NAME; do
 1615                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1616                     if test "X$x" = "X-I$additional_includedir"; then
 1617                       haveit=yes
 1618                       break
 1619                     fi
 1620                   done
 1621                   if test -z "$haveit"; then
 1622                     if test -d "$additional_includedir"; then
 1623                       dnl Really add $additional_includedir to $INCNAME.
 1624                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
 1625                     fi
 1626                   fi
 1627                 fi
 1628               fi
 1629             fi
 1630             dnl Look for dependencies.
 1631             if test -n "$found_la"; then
 1632               dnl Read the .la file. It defines the variables
 1633               dnl dlname, library_names, old_library, dependency_libs, current,
 1634               dnl age, revision, installed, dlopen, dlpreopen, libdir.
 1635               save_libdir="$libdir"
 1636               case "$found_la" in
 1637                 */* | *\\*) . "$found_la" ;;
 1638                 *) . "./$found_la" ;;
 1639               esac
 1640               libdir="$save_libdir"
 1641               dnl We use only dependency_libs.
 1642               for dep in $dependency_libs; do
 1643                 case "$dep" in
 1644                   -L*)
 1645                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
 1646                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
 1647                     dnl But don't add it
 1648                     dnl   1. if it's the standard /usr/lib,
 1649                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
 1650                     dnl   3. if it's already present in $LDFLAGS or the already
 1651                     dnl      constructed $LIBNAME,
 1652                     dnl   4. if it doesn't exist as a directory.
 1653                     if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
 1654                        && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
 1655                       haveit=
 1656                       if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
 1657                          || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
 1658                         if test -n "$GCC"; then
 1659                           case $host_os in
 1660                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 1661                           esac
 1662                         fi
 1663                       fi
 1664                       if test -z "$haveit"; then
 1665                         haveit=
 1666                         for x in $LDFLAGS $LIB[]NAME; do
 1667                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1668                           if test "X$x" = "X-L$additional_libdir"; then
 1669                             haveit=yes
 1670                             break
 1671                           fi
 1672                         done
 1673                         if test -z "$haveit"; then
 1674                           if test -d "$additional_libdir"; then
 1675                             dnl Really add $additional_libdir to $LIBNAME.
 1676                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
 1677                           fi
 1678                         fi
 1679                         haveit=
 1680                         for x in $LDFLAGS $LTLIB[]NAME; do
 1681                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1682                           if test "X$x" = "X-L$additional_libdir"; then
 1683                             haveit=yes
 1684                             break
 1685                           fi
 1686                         done
 1687                         if test -z "$haveit"; then
 1688                           if test -d "$additional_libdir"; then
 1689                             dnl Really add $additional_libdir to $LTLIBNAME.
 1690                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
 1691                           fi
 1692                         fi
 1693                       fi
 1694                     fi
 1695                     ;;
 1696                   -R*)
 1697                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
 1698                     if test "$enable_rpath" != no; then
 1699                       dnl Potentially add DIR to rpathdirs.
 1700                       dnl The rpathdirs will be appended to $LIBNAME at the end.
 1701                       haveit=
 1702                       for x in $rpathdirs; do
 1703                         if test "X$x" = "X$dir"; then
 1704                           haveit=yes
 1705                           break
 1706                         fi
 1707                       done
 1708                       if test -z "$haveit"; then
 1709                         rpathdirs="$rpathdirs $dir"
 1710                       fi
 1711                       dnl Potentially add DIR to ltrpathdirs.
 1712                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
 1713                       haveit=
 1714                       for x in $ltrpathdirs; do
 1715                         if test "X$x" = "X$dir"; then
 1716                           haveit=yes
 1717                           break
 1718                         fi
 1719                       done
 1720                       if test -z "$haveit"; then
 1721                         ltrpathdirs="$ltrpathdirs $dir"
 1722                       fi
 1723                     fi
 1724                     ;;
 1725                   -l*)
 1726                     dnl Handle this in the next round.
 1727                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
 1728                     ;;
 1729                   *.la)
 1730                     dnl Handle this in the next round. Throw away the .la's
 1731                     dnl directory; it is already contained in a preceding -L
 1732                     dnl option.
 1733                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
 1734                     ;;
 1735                   *)
 1736                     dnl Most likely an immediate library name.
 1737                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
 1738                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
 1739                     ;;
 1740                 esac
 1741               done
 1742             fi
 1743           else
 1744             dnl Didn't find the library; assume it is in the system directories
 1745             dnl known to the linker and runtime loader. (All the system
 1746             dnl directories known to the linker should also be known to the
 1747             dnl runtime loader, otherwise the system is severely misconfigured.)
 1748             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
 1749             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
 1750           fi
 1751         fi
 1752       fi
 1753     done
 1754   done
 1755   if test "X$rpathdirs" != "X"; then
 1756     if test -n "$acl_hardcode_libdir_separator"; then
 1757       dnl Weird platform: only the last -rpath option counts, the user must
 1758       dnl pass all path elements in one option. We can arrange that for a
 1759       dnl single library, but not when more than one $LIBNAMEs are used.
 1760       alldirs=
 1761       for found_dir in $rpathdirs; do
 1762         alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
 1763       done
 1764       dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
 1765       acl_save_libdir="$libdir"
 1766       libdir="$alldirs"
 1767       eval flag=\"$acl_hardcode_libdir_flag_spec\"
 1768       libdir="$acl_save_libdir"
 1769       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
 1770     else
 1771       dnl The -rpath options are cumulative.
 1772       for found_dir in $rpathdirs; do
 1773         acl_save_libdir="$libdir"
 1774         libdir="$found_dir"
 1775         eval flag=\"$acl_hardcode_libdir_flag_spec\"
 1776         libdir="$acl_save_libdir"
 1777         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
 1778       done
 1779     fi
 1780   fi
 1781   if test "X$ltrpathdirs" != "X"; then
 1782     dnl When using libtool, the option that works for both libraries and
 1783     dnl executables is -R. The -R options are cumulative.
 1784     for found_dir in $ltrpathdirs; do
 1785       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
 1786     done
 1787   fi
 1788   popdef([PACKLIBS])
 1789   popdef([PACKUP])
 1790   popdef([PACK])
 1791   popdef([NAME])
 1792 ])
 1793 
 1794 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
 1795 dnl unless already present in VAR.
 1796 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
 1797 dnl contains two or three consecutive elements that belong together.
 1798 AC_DEFUN([AC_LIB_APPENDTOVAR],
 1799 [
 1800   for element in [$2]; do
 1801     haveit=
 1802     for x in $[$1]; do
 1803       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1804       if test "X$x" = "X$element"; then
 1805         haveit=yes
 1806         break
 1807       fi
 1808     done
 1809     if test -z "$haveit"; then
 1810       [$1]="${[$1]}${[$1]:+ }$element"
 1811     fi
 1812   done
 1813 ])
 1814 
 1815 dnl For those cases where a variable contains several -L and -l options
 1816 dnl referring to unknown libraries and directories, this macro determines the
 1817 dnl necessary additional linker options for the runtime path.
 1818 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
 1819 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
 1820 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
 1821 dnl otherwise linking without libtool is assumed.
 1822 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
 1823 [
 1824   AC_REQUIRE([AC_LIB_RPATH])
 1825   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 1826   $1=
 1827   if test "$enable_rpath" != no; then
 1828     if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
 1829       dnl Use an explicit option to hardcode directories into the resulting
 1830       dnl binary.
 1831       rpathdirs=
 1832       next=
 1833       for opt in $2; do
 1834         if test -n "$next"; then
 1835           dir="$next"
 1836           dnl No need to hardcode the standard /usr/lib.
 1837           if test "X$dir" != "X/usr/$acl_libdirstem" \
 1838              && test "X$dir" != "X/usr/$acl_libdirstem2"; then
 1839             rpathdirs="$rpathdirs $dir"
 1840           fi
 1841           next=
 1842         else
 1843           case $opt in
 1844             -L) next=yes ;;
 1845             -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
 1846                  dnl No need to hardcode the standard /usr/lib.
 1847                  if test "X$dir" != "X/usr/$acl_libdirstem" \
 1848                     && test "X$dir" != "X/usr/$acl_libdirstem2"; then
 1849                    rpathdirs="$rpathdirs $dir"
 1850                  fi
 1851                  next= ;;
 1852             *) next= ;;
 1853           esac
 1854         fi
 1855       done
 1856       if test "X$rpathdirs" != "X"; then
 1857         if test -n ""$3""; then
 1858           dnl libtool is used for linking. Use -R options.
 1859           for dir in $rpathdirs; do
 1860             $1="${$1}${$1:+ }-R$dir"
 1861           done
 1862         else
 1863           dnl The linker is used for linking directly.
 1864           if test -n "$acl_hardcode_libdir_separator"; then
 1865             dnl Weird platform: only the last -rpath option counts, the user
 1866             dnl must pass all path elements in one option.
 1867             alldirs=
 1868             for dir in $rpathdirs; do
 1869               alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
 1870             done
 1871             acl_save_libdir="$libdir"
 1872             libdir="$alldirs"
 1873             eval flag=\"$acl_hardcode_libdir_flag_spec\"
 1874             libdir="$acl_save_libdir"
 1875             $1="$flag"
 1876           else
 1877             dnl The -rpath options are cumulative.
 1878             for dir in $rpathdirs; do
 1879               acl_save_libdir="$libdir"
 1880               libdir="$dir"
 1881               eval flag=\"$acl_hardcode_libdir_flag_spec\"
 1882               libdir="$acl_save_libdir"
 1883               $1="${$1}${$1:+ }$flag"
 1884             done
 1885           fi
 1886         fi
 1887       fi
 1888     fi
 1889   fi
 1890   AC_SUBST([$1])
 1891 ])
 1892 
 1893 # lib-prefix.m4 serial 14
 1894 dnl Copyright (C) 2001-2005, 2008-2019 Free Software Foundation, Inc.
 1895 dnl This file is free software; the Free Software Foundation
 1896 dnl gives unlimited permission to copy and/or distribute it,
 1897 dnl with or without modifications, as long as this notice is preserved.
 1898 
 1899 dnl From Bruno Haible.
 1900 
 1901 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
 1902 dnl to access previously installed libraries. The basic assumption is that
 1903 dnl a user will want packages to use other packages he previously installed
 1904 dnl with the same --prefix option.
 1905 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
 1906 dnl libraries, but is otherwise very convenient.
 1907 AC_DEFUN([AC_LIB_PREFIX],
 1908 [
 1909   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
 1910   AC_REQUIRE([AC_PROG_CC])
 1911   AC_REQUIRE([AC_CANONICAL_HOST])
 1912   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 1913   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 1914   dnl By default, look in $includedir and $libdir.
 1915   use_additional=yes
 1916   AC_LIB_WITH_FINAL_PREFIX([
 1917     eval additional_includedir=\"$includedir\"
 1918     eval additional_libdir=\"$libdir\"
 1919   ])
 1920   AC_ARG_WITH([lib-prefix],
 1921 [[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
 1922   --without-lib-prefix    don't search for libraries in includedir and libdir]],
 1923 [
 1924     if test "X$withval" = "Xno"; then
 1925       use_additional=no
 1926     else
 1927       if test "X$withval" = "X"; then
 1928         AC_LIB_WITH_FINAL_PREFIX([
 1929           eval additional_includedir=\"$includedir\"
 1930           eval additional_libdir=\"$libdir\"
 1931         ])
 1932       else
 1933         additional_includedir="$withval/include"
 1934         additional_libdir="$withval/$acl_libdirstem"
 1935       fi
 1936     fi
 1937 ])
 1938   if test $use_additional = yes; then
 1939     dnl Potentially add $additional_includedir to $CPPFLAGS.
 1940     dnl But don't add it
 1941     dnl   1. if it's the standard /usr/include,
 1942     dnl   2. if it's already present in $CPPFLAGS,
 1943     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
 1944     dnl   4. if it doesn't exist as a directory.
 1945     if test "X$additional_includedir" != "X/usr/include"; then
 1946       haveit=
 1947       for x in $CPPFLAGS; do
 1948         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1949         if test "X$x" = "X-I$additional_includedir"; then
 1950           haveit=yes
 1951           break
 1952         fi
 1953       done
 1954       if test -z "$haveit"; then
 1955         if test "X$additional_includedir" = "X/usr/local/include"; then
 1956           if test -n "$GCC"; then
 1957             case $host_os in
 1958               linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 1959             esac
 1960           fi
 1961         fi
 1962         if test -z "$haveit"; then
 1963           if test -d "$additional_includedir"; then
 1964             dnl Really add $additional_includedir to $CPPFLAGS.
 1965             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
 1966           fi
 1967         fi
 1968       fi
 1969     fi
 1970     dnl Potentially add $additional_libdir to $LDFLAGS.
 1971     dnl But don't add it
 1972     dnl   1. if it's the standard /usr/lib,
 1973     dnl   2. if it's already present in $LDFLAGS,
 1974     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
 1975     dnl   4. if it doesn't exist as a directory.
 1976     if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
 1977       haveit=
 1978       for x in $LDFLAGS; do
 1979         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 1980         if test "X$x" = "X-L$additional_libdir"; then
 1981           haveit=yes
 1982           break
 1983         fi
 1984       done
 1985       if test -z "$haveit"; then
 1986         if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
 1987           if test -n "$GCC"; then
 1988             case $host_os in
 1989               linux*) haveit=yes;;
 1990             esac
 1991           fi
 1992         fi
 1993         if test -z "$haveit"; then
 1994           if test -d "$additional_libdir"; then
 1995             dnl Really add $additional_libdir to $LDFLAGS.
 1996             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
 1997           fi
 1998         fi
 1999       fi
 2000     fi
 2001   fi
 2002 ])
 2003 
 2004 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
 2005 dnl acl_final_exec_prefix, containing the values to which $prefix and
 2006 dnl $exec_prefix will expand at the end of the configure script.
 2007 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
 2008 [
 2009   dnl Unfortunately, prefix and exec_prefix get only finally determined
 2010   dnl at the end of configure.
 2011   if test "X$prefix" = "XNONE"; then
 2012     acl_final_prefix="$ac_default_prefix"
 2013   else
 2014     acl_final_prefix="$prefix"
 2015   fi
 2016   if test "X$exec_prefix" = "XNONE"; then
 2017     acl_final_exec_prefix='${prefix}'
 2018   else
 2019     acl_final_exec_prefix="$exec_prefix"
 2020   fi
 2021   acl_save_prefix="$prefix"
 2022   prefix="$acl_final_prefix"
 2023   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
 2024   prefix="$acl_save_prefix"
 2025 ])
 2026 
 2027 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
 2028 dnl variables prefix and exec_prefix bound to the values they will have
 2029 dnl at the end of the configure script.
 2030 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
 2031 [
 2032   acl_save_prefix="$prefix"
 2033   prefix="$acl_final_prefix"
 2034   acl_save_exec_prefix="$exec_prefix"
 2035   exec_prefix="$acl_final_exec_prefix"
 2036   $1
 2037   exec_prefix="$acl_save_exec_prefix"
 2038   prefix="$acl_save_prefix"
 2039 ])
 2040 
 2041 dnl AC_LIB_PREPARE_MULTILIB creates
 2042 dnl - a variable acl_libdirstem, containing the basename of the libdir, either
 2043 dnl   "lib" or "lib64" or "lib/64",
 2044 dnl - a variable acl_libdirstem2, as a secondary possible value for
 2045 dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
 2046 dnl   "lib/amd64".
 2047 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
 2048 [
 2049   dnl There is no formal standard regarding lib and lib64.
 2050   dnl On glibc systems, the current practice is that on a system supporting
 2051   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
 2052   dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
 2053   dnl the compiler's default mode by looking at the compiler's library search
 2054   dnl path. If at least one of its elements ends in /lib64 or points to a
 2055   dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
 2056   dnl Otherwise we use the default, namely "lib".
 2057   dnl On Solaris systems, the current practice is that on a system supporting
 2058   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
 2059   dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
 2060   dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
 2061   AC_REQUIRE([AC_CANONICAL_HOST])
 2062   AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
 2063 
 2064   case "$host_os" in
 2065     solaris*)
 2066       AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
 2067         [AC_COMPILE_IFELSE(
 2068            [AC_LANG_SOURCE(
 2069               [[#ifdef _LP64
 2070                  int ok;
 2071                 #else
 2072                  error fail
 2073                 #endif
 2074               ]])],
 2075            [gl_cv_solaris_64bit=yes],
 2076            [gl_cv_solaris_64bit=no])
 2077         ]);;
 2078   esac
 2079 
 2080   dnl Allow the user to override the result by setting acl_cv_libdirstems.
 2081   AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
 2082     [acl_cv_libdirstems],
 2083     [acl_libdirstem=lib
 2084      acl_libdirstem2=
 2085      case "$host_os" in
 2086        solaris*)
 2087          dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
 2088          dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
 2089          dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
 2090          dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
 2091          dnl symlink is missing, so we set acl_libdirstem2 too.
 2092          if test $gl_cv_solaris_64bit = yes; then
 2093            acl_libdirstem=lib/64
 2094            case "$host_cpu" in
 2095              sparc*)        acl_libdirstem2=lib/sparcv9 ;;
 2096              i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
 2097            esac
 2098          fi
 2099          ;;
 2100        *)
 2101          dnl If $CC generates code for a 32-bit ABI, the libraries are
 2102          dnl surely under $prefix/lib, not $prefix/lib64.
 2103          if test "$HOST_CPU_C_ABI_32BIT" != yes; then
 2104            dnl The result is a property of the system. However, non-system
 2105            dnl compilers sometimes have odd library search paths. Therefore
 2106            dnl prefer asking /usr/bin/gcc, if available, rather than $CC.
 2107            searchpath=`(if test -f /usr/bin/gcc \
 2108                            && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \
 2109                           LC_ALL=C /usr/bin/gcc -print-search-dirs; \
 2110                         else \
 2111                           LC_ALL=C $CC -print-search-dirs; \
 2112                         fi) 2>/dev/null \
 2113                        | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
 2114            if test -n "$searchpath"; then
 2115              acl_save_IFS="${IFS= 	}"; IFS=":"
 2116              for searchdir in $searchpath; do
 2117                if test -d "$searchdir"; then
 2118                  case "$searchdir" in
 2119                    */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
 2120                    */../ | */.. )
 2121                      # Better ignore directories of this form. They are misleading.
 2122                      ;;
 2123                    *) searchdir=`cd "$searchdir" && pwd`
 2124                       case "$searchdir" in
 2125                         */lib64 ) acl_libdirstem=lib64 ;;
 2126                       esac ;;
 2127                  esac
 2128                fi
 2129              done
 2130              IFS="$acl_save_IFS"
 2131            fi
 2132          fi
 2133          ;;
 2134      esac
 2135      test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
 2136      acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2"
 2137     ])
 2138   # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2.
 2139   acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
 2140   acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'`
 2141 ])
 2142