bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] split AC_LIB_LINKFLAGS_BODY for multi-library packages


From: Bruno Haible
Subject: Re: [PATCH] split AC_LIB_LINKFLAGS_BODY for multi-library packages
Date: Wed, 12 Mar 2008 05:58:50 +0100
User-agent: KMail/1.5.4

Sam Steingold wrote:
> some packages (e.g., GNU libffcall) install multiple libraries, so
> AC_LIB_LINKFLAGS_BODY is insufficient for detecting them.
> this patch splits AC_LIB_LINKFLAGS_BODY into two parts: for adding a
> -with-libname-prefix command line switch and for searching for libraries.

This patch is not complete: lib-link.m4 has 3 entry points
AC_LIB_LINKFLAGS, AC_LIB_HAVE_LINKFLAGS, AC_LIB_LINKFLAGS_BODY, and your
patch splits only one of the three.

Actually I don't want to split these three macros, because the user should
have to write a single macro call, not two. Also, I don't want to add
an extra 'package' argument to the macros, because it would complicate the
calling conventions of the macros for a rare usecase.

Instead, I'm adding a separate macro AC_LIB_FROMPACKAGE, with which you can
declare which library comes from which package. Like this:

   AC_LIB_FROMPACKAGE(avcall, ffcall)
   AC_LIB_FROMPACKAGE(vacall, ffcall)
   AC_LIB_LINKFLAGS(avcall)
   AC_LIB_LINKFLAGS(vacall)


2008-03-11  Bruno Haible  <address@hidden>

        Extend AC_LIB_LINKFLAGS to the situation of several libraries provided
        by a single package.
        * m4/lib-link.m4 (AC_LIB_FROMPACKAGE): New macro.
        (AC_LIB_LINKFLAGS_BODY): Use the information stored by
        AC_LIB_FROMPACKAGE. Use AC_ARG_WITH instead of AC_LIB_ARG_WITH.
        Reported by Sam Steingold <address@hidden>.

*** m4/lib-link.m4.orig 2008-03-12 05:46:15.000000000 +0100
--- m4/lib-link.m4      2008-03-12 05:44:50.000000000 +0100
***************
*** 1,4 ****
! # lib-link.m4 serial 14 (gettext-0.18)
  dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # lib-link.m4 serial 15 (gettext-0.18)
  dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 136,141 ****
--- 136,162 ----
      :, enable_rpath=yes)
  ])
  
+ dnl AC_LIB_FROMPACKAGE(name, package)
+ dnl declares that libname comes from the given package. The configure file
+ dnl will then not have a --with-libname-prefix option but a
+ dnl --with-package-prefix option. Several libraries can come from the same
+ dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+ dnl macro call that searches for libname.
+ AC_DEFUN([AC_LIB_FROMPACKAGE],
+ [
+   pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+   define([acl_frompackage_]NAME, [$2])
+   popdef([NAME])
+   pushdef([PACK],[$2])
+   pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+   define([acl_libsinpackage_]PACKUP,
+     m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, 
]],)[lib$1])
+   popdef([PACKUP])
+   popdef([PACK])
+ ])
+ 
  dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
  dnl the libraries corresponding to explicit and implicit dependencies.
  dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
***************
*** 146,162 ****
    AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
    pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
    dnl Autoconf >= 2.61 supports dots in --with options.
!   
pushdef([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
    dnl By default, look in $includedir and $libdir.
    use_additional=yes
    AC_LIB_WITH_FINAL_PREFIX([
      eval additional_includedir=\"$includedir\"
      eval additional_libdir=\"$libdir\"
    ])
!   AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
! [  --with-lib]N_A_M_E[-prefix[=DIR]  search for lib$1 in DIR/include and 
DIR/lib
!   --without-lib]N_A_M_E[-prefix     don't search for lib$1 in includedir and 
libdir],
  [
      if test "X$withval" = "Xno"; then
        use_additional=no
--- 167,187 ----
    AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
    pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+   pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, 
lib[$1])])
+   pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+   pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, 
[acl_libsinpackage_]PACKUP, lib[$1])])
    dnl Autoconf >= 2.61 supports dots in --with options.
!   
pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
    dnl By default, look in $includedir and $libdir.
    use_additional=yes
    AC_LIB_WITH_FINAL_PREFIX([
      eval additional_includedir=\"$includedir\"
      eval additional_libdir=\"$libdir\"
    ])
!   AC_ARG_WITH(P_A_C_K[-prefix],
! [[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and 
DIR/lib
!   --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir 
and libdir]],
  [
      if test "X$withval" = "Xno"; then
        use_additional=no
***************
*** 609,615 ****
        LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
      done
    fi
!   popdef([N_A_M_E])
    popdef([NAME])
  ])
  
--- 634,643 ----
        LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
      done
    fi
!   popdef([P_A_C_K])
!   popdef([PACKLIBS])
!   popdef([PACKUP])
!   popdef([PACK])
    popdef([NAME])
  ])
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]