lac : a5d56c8d78627ba665b7c9d5bfa63138a010662a

     1: # lib-prefix.m4 serial 8
     2: dnl Copyright (C) 2001-2005, 2008-2017 Free Software Foundation, Inc.
     3: dnl This file is free software; the Free Software Foundation
     4: dnl gives unlimited permission to copy and/or distribute it,
     5: dnl with or without modifications, as long as this notice is preserved.
     6: 
     7: dnl From Bruno Haible.
     8: 
     9: dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
    10: dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
    11: dnl require excessive bracketing.
    12: ifdef([AC_HELP_STRING],
    13: [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
    14: [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
    15: 
    16: dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
    17: dnl to access previously installed libraries. The basic assumption is that
    18: dnl a user will want packages to use other packages he previously installed
    19: dnl with the same --prefix option.
    20: dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
    21: dnl libraries, but is otherwise very convenient.
    22: AC_DEFUN([AC_LIB_PREFIX],
    23: [
    24:   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
    25:   AC_REQUIRE([AC_PROG_CC])
    26:   AC_REQUIRE([AC_CANONICAL_HOST])
    27:   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
    28:   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
    29:   dnl By default, look in $includedir and $libdir.
    30:   use_additional=yes
    31:   AC_LIB_WITH_FINAL_PREFIX([
    32:     eval additional_includedir=\"$includedir\"
    33:     eval additional_libdir=\"$libdir\"
    34:   ])
    35:   AC_LIB_ARG_WITH([lib-prefix],
    36: [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
    37:   --without-lib-prefix    don't search for libraries in includedir and libdir],
    38: [
    39:     if test "X$withval" = "Xno"; then
    40:       use_additional=no
    41:     else
    42:       if test "X$withval" = "X"; then
    43:         AC_LIB_WITH_FINAL_PREFIX([
    44:           eval additional_includedir=\"$includedir\"
    45:           eval additional_libdir=\"$libdir\"
    46:         ])
    47:       else
    48:         additional_includedir="$withval/include"
    49:         additional_libdir="$withval/$acl_libdirstem"
    50:       fi
    51:     fi
    52: ])
    53:   if test $use_additional = yes; then
    54:     dnl Potentially add $additional_includedir to $CPPFLAGS.
    55:     dnl But don't add it
    56:     dnl   1. if it's the standard /usr/include,
    57:     dnl   2. if it's already present in $CPPFLAGS,
    58:     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
    59:     dnl   4. if it doesn't exist as a directory.
    60:     if test "X$additional_includedir" != "X/usr/include"; then
    61:       haveit=
    62:       for x in $CPPFLAGS; do
    63:         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
    64:         if test "X$x" = "X-I$additional_includedir"; then
    65:           haveit=yes
    66:           break
    67:         fi
    68:       done
    69:       if test -z "$haveit"; then
    70:         if test "X$additional_includedir" = "X/usr/local/include"; then
    71:           if test -n "$GCC"; then
    72:             case $host_os in
    73:               linux* | gnu* | k*bsd*-gnu) haveit=yes;;
    74:             esac
    75:           fi
    76:         fi
    77:         if test -z "$haveit"; then
    78:           if test -d "$additional_includedir"; then
    79:             dnl Really add $additional_includedir to $CPPFLAGS.
    80:             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
    81:           fi
    82:         fi
    83:       fi
    84:     fi
    85:     dnl Potentially add $additional_libdir to $LDFLAGS.
    86:     dnl But don't add it
    87:     dnl   1. if it's the standard /usr/lib,
    88:     dnl   2. if it's already present in $LDFLAGS,
    89:     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
    90:     dnl   4. if it doesn't exist as a directory.
    91:     if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
    92:       haveit=
    93:       for x in $LDFLAGS; do
    94:         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
    95:         if test "X$x" = "X-L$additional_libdir"; then
    96:           haveit=yes
    97:           break
    98:         fi
    99:       done
   100:       if test -z "$haveit"; then
   101:         if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
   102:           if test -n "$GCC"; then
   103:             case $host_os in
   104:               linux*) haveit=yes;;
   105:             esac
   106:           fi
   107:         fi
   108:         if test -z "$haveit"; then
   109:           if test -d "$additional_libdir"; then
   110:             dnl Really add $additional_libdir to $LDFLAGS.
   111:             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
   112:           fi
   113:         fi
   114:       fi
   115:     fi
   116:   fi
   117: ])
   118: 
   119: dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
   120: dnl acl_final_exec_prefix, containing the values to which $prefix and
   121: dnl $exec_prefix will expand at the end of the configure script.
   122: AC_DEFUN([AC_LIB_PREPARE_PREFIX],
   123: [
   124:   dnl Unfortunately, prefix and exec_prefix get only finally determined
   125:   dnl at the end of configure.
   126:   if test "X$prefix" = "XNONE"; then
   127:     acl_final_prefix="$ac_default_prefix"
   128:   else
   129:     acl_final_prefix="$prefix"
   130:   fi
   131:   if test "X$exec_prefix" = "XNONE"; then
   132:     acl_final_exec_prefix='${prefix}'
   133:   else
   134:     acl_final_exec_prefix="$exec_prefix"
   135:   fi
   136:   acl_save_prefix="$prefix"
   137:   prefix="$acl_final_prefix"
   138:   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
   139:   prefix="$acl_save_prefix"
   140: ])
   141: 
   142: dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
   143: dnl variables prefix and exec_prefix bound to the values they will have
   144: dnl at the end of the configure script.
   145: AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
   146: [
   147:   acl_save_prefix="$prefix"
   148:   prefix="$acl_final_prefix"
   149:   acl_save_exec_prefix="$exec_prefix"
   150:   exec_prefix="$acl_final_exec_prefix"
   151:   $1
   152:   exec_prefix="$acl_save_exec_prefix"
   153:   prefix="$acl_save_prefix"
   154: ])
   155: 
   156: dnl AC_LIB_PREPARE_MULTILIB creates
   157: dnl - a variable acl_libdirstem, containing the basename of the libdir, either
   158: dnl   "lib" or "lib64" or "lib/64",
   159: dnl - a variable acl_libdirstem2, as a secondary possible value for
   160: dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
   161: dnl   "lib/amd64".
   162: AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
   163: [
   164:   dnl There is no formal standard regarding lib and lib64.
   165:   dnl On glibc systems, the current practice is that on a system supporting
   166:   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
   167:   dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
   168:   dnl the compiler's default mode by looking at the compiler's library search
   169:   dnl path. If at least one of its elements ends in /lib64 or points to a
   170:   dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
   171:   dnl Otherwise we use the default, namely "lib".
   172:   dnl On Solaris systems, the current practice is that on a system supporting
   173:   dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
   174:   dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
   175:   dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
   176:   AC_REQUIRE([AC_CANONICAL_HOST])
   177:   dnl Allow the user to override the result by setting acl_cv_libdirstems.
   178:   AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
   179:     [acl_cv_libdirstems],
   180:     [acl_libdirstem=lib
   181:      acl_libdirstem2=
   182:      case "$host_os" in
   183:        solaris*)
   184:          dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
   185:          dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
   186:          dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
   187:          dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
   188:          dnl symlink is missing, so we set acl_libdirstem2 too.
   189:          AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
   190:            [AC_EGREP_CPP([sixtyfour bits], [
   191: #ifdef _LP64
   192: sixtyfour bits
   193: #endif
   194:               ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
   195:            ])
   196:          if test $gl_cv_solaris_64bit = yes; then
   197:            acl_libdirstem=lib/64
   198:            case "$host_cpu" in
   199:              sparc*)        acl_libdirstem2=lib/sparcv9 ;;
   200:              i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
   201:            esac
   202:          fi
   203:          ;;
   204:        *)
   205:          dnl The result is a property of the system. However, non-system
   206:          dnl compilers sometimes have odd library search paths. Therefore
   207:          dnl prefer asking /usr/bin/gcc, if available, rather than $CC.
   208:          searchpath=`(if test -f /usr/bin/gcc \
   209:                          && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \
   210:                         LC_ALL=C /usr/bin/gcc -print-search-dirs; \
   211:                       else \
   212:                         LC_ALL=C $CC -print-search-dirs; \
   213:                       fi) 2>/dev/null \
   214:                      | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
   215:          if test -n "$searchpath"; then
   216:            acl_save_IFS="${IFS= 	}"; IFS=":"
   217:            for searchdir in $searchpath; do
   218:              if test -d "$searchdir"; then
   219:                case "$searchdir" in
   220:                  */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
   221:                  */../ | */.. )
   222:                    # Better ignore directories of this form. They are misleading.
   223:                    ;;
   224:                  *) searchdir=`cd "$searchdir" && pwd`
   225:                     case "$searchdir" in
   226:                       */lib64 ) acl_libdirstem=lib64 ;;
   227:                     esac ;;
   228:                esac
   229:              fi
   230:            done
   231:            IFS="$acl_save_IFS"
   232:          fi
   233:          ;;
   234:      esac
   235:      test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
   236:      acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2"
   237:     ])
   238:   # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2.
   239:   acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
   240:   acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'`
   241: ])

Generated by git2html.