# lib-prefix.m4 serial 2 (gettext-0.12)dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.dnl This file is free software, distributed under the terms of the GNUdnl General Public License. As a special exception to the GNU Generaldnl Public License, this file may be distributed as part of a programdnl that contains a configuration script generated by Autoconf, underdnl the same distribution terms as the rest of that program.dnl From Bruno Haible.dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, anddnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn'tdnl require excessive bracketing.ifdef([AC_HELP_STRING],[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are neededdnl to access previously installed libraries. The basic assumption is thatdnl a user will want packages to use other packages he previously installeddnl with the same --prefix option.dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locatednl libraries, but is otherwise very convenient.AC_DEFUN([AC_LIB_PREFIX],[AC_BEFORE([$0], [AC_LIB_LINKFLAGS])AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_CANONICAL_HOST])AC_REQUIRE([AC_LIB_PREPARE_PREFIX])dnl By default, look in $includedir and $libdir.use_additional=yesAC_LIB_WITH_FINAL_PREFIX([eval additional_includedir=\"$includedir\"eval additional_libdir=\"$libdir\"])AC_LIB_ARG_WITH([lib-prefix],[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib--without-lib-prefix don't search for libraries in includedir and libdir],[if test "X$withval" = "Xno"; thenuse_additional=noelseif test "X$withval" = "X"; thenAC_LIB_WITH_FINAL_PREFIX([eval additional_includedir=\"$includedir\"eval additional_libdir=\"$libdir\"])elseadditional_includedir="$withval/include"additional_libdir="$withval/lib"fifi])if test $use_additional = yes; thendnl Potentially add $additional_includedir to $CPPFLAGS.dnl But don't add itdnl 1. if it's the standard /usr/include,dnl 2. if it's already present in $CPPFLAGS,dnl 3. if it's /usr/local/include and we are using GCC on Linux,dnl 4. if it doesn't exist as a directory.if test "X$additional_includedir" != "X/usr/include"; thenhaveit=for x in $CPPFLAGS; doAC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])if test "X$x" = "X-I$additional_includedir"; thenhaveit=yesbreakfidoneif test -z "$haveit"; thenif test "X$additional_includedir" = "X/usr/local/include"; thenif test -n "$GCC"; thencase $host_os inlinux*) haveit=yes;;esacfifiif test -z "$haveit"; thenif test -d "$additional_includedir"; thendnl Really add $additional_includedir to $CPPFLAGS.CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"fifififidnl Potentially add $additional_libdir to $LDFLAGS.dnl But don't add itdnl 1. if it's the standard /usr/lib,dnl 2. if it's already present in $LDFLAGS,dnl 3. if it's /usr/local/lib and we are using GCC on Linux,dnl 4. if it doesn't exist as a directory.if test "X$additional_libdir" != "X/usr/lib"; thenhaveit=for x in $LDFLAGS; doAC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])if test "X$x" = "X-L$additional_libdir"; thenhaveit=yesbreakfidoneif test -z "$haveit"; thenif test "X$additional_libdir" = "X/usr/local/lib"; thenif test -n "$GCC"; thencase $host_os inlinux*) haveit=yes;;esacfifiif test -z "$haveit"; thenif test -d "$additional_libdir"; thendnl Really add $additional_libdir to $LDFLAGS.LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"fififififi])dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,dnl acl_final_exec_prefix, containing the values to which $prefix anddnl $exec_prefix will expand at the end of the configure script.AC_DEFUN([AC_LIB_PREPARE_PREFIX],[dnl Unfortunately, prefix and exec_prefix get only finally determineddnl at the end of configure.if test "X$prefix" = "XNONE"; thenacl_final_prefix="$ac_default_prefix"elseacl_final_prefix="$prefix"fiif test "X$exec_prefix" = "XNONE"; thenacl_final_exec_prefix='${prefix}'elseacl_final_exec_prefix="$exec_prefix"fiacl_save_prefix="$prefix"prefix="$acl_final_prefix"eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"prefix="$acl_save_prefix"])dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with thednl variables prefix and exec_prefix bound to the values they will havednl at the end of the configure script.AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],[acl_save_prefix="$prefix"prefix="$acl_final_prefix"acl_save_exec_prefix="$exec_prefix"exec_prefix="$acl_final_exec_prefix"$1exec_prefix="$acl_save_exec_prefix"prefix="$acl_save_prefix"])