Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-22 Thread Arkadiusz Miskiewicz
On Friday 22 of June 2007, Jeff Johnson wrote:
 Hmm, apologies for empty message. I swear I wrote something.

 What I said is that there is a possibility that 2 -lz linkages might
 be needed for -lneon external and zlib internal. 

Huh, that would only mean that your libneon.so is broken (not properly 
linked). Fix it. Hack with -lz won't work if you use --as-needed btw.

 73 de Jeff

-- 
Arkadiusz MiśkiewiczPLD/Linux Team
arekm / maven.plhttp://ftp.pld-linux.org/
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-21 Thread Arkadiusz Miskiewicz
On Thursday 21 of June 2007, Ralf S. Engelschall wrote:
 On Wed, Jun 20, 2007, Arkadiusz Miskiewicz wrote:
  On Wednesday 20 of June 2007, Arkadiusz Miskiewicz wrote:
   Right now from config.log:
  
   configure:27985: error: unable to find available BeeCrypt library
  
   but why it told so, you have to guess and digg.
 
  We have beecrypt includes in /usr/include/beecrypt/ so the only option is
  --with-beecrypt=/usr
 
  configure complains:
  find: warning: Unix filenames usually don't contain slashes (though
  pathnames do). That means that '-name beecrypt/api.h' will probably
  evaluate to false all the time on this system.  You might find the
  '-wholename' test more useful, or perhaps '-samefile'. Alternatively, if
  you are using GNU grep, you could use 'find ... -print0 | grep -FzZ
  beecrypt/api.h'.

 Ok, but I'm wondering why line 210 of acinclude.m4 does not already
 catch your /usr/include/beecrypt/api.h?

+ test -f /usr/pkg-config
+ set -x
+ test .no = .no
+ test -f /usr/include/beecrypt/beecrypt/api.h
+ test -f /usr/include/beecrypt/api.h
+ CPPFLAGS= -I/usr/include

btw. isn't adding such system wide paths broken anyway? It will break heavily 
if you have two copies of for example beecrypt, one in /usr/include and one 
in /usr/something/ because checking for other components (let be it) popt 
will add -I/usr/include already and you won't be able to use /usr/something 
beecrypt correctly.

+ __rcl_found=yes
+ break
+ test .yes = .yes
+ __rcl_found=no
+ test -f /usr/lib/beecrypt/libbeecrypt.la

The macro doesn't know that there are 64bit systems out there that use
/usr/lib64/ (for 64bit libs) not /usr/lib/ (for 32bit) (AFAIK FHS says 
something about systems that use /usr/lib32 (for 32bit libs) and /usr/lib 
(for 64bit), too).


Ralf S. Engelschall
[EMAIL PROTECTED]
www.engelschall.com


-- 
Arkadiusz MiśkiewiczPLD/Linux Team
arekm / maven.plhttp://ftp.pld-linux.org/
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-21 Thread Jeff Johnson


On Jun 21, 2007, at 4:20 AM, Ralf S. Engelschall wrote:



Ok, please retry with the latest incarnation of RPM_CHECK_LIB in HEAD.
You should be now able to build with a simple --with-beecrypt[=yes] in
order to build against a BeeCrypt in default system locations. I've
still not tried it myself under Linux, but let's see whether it now
works for you.



Here's another twist:

If, say, building zlib internal, then the zlib library is merged into
librpmio through libtool magic for noinst_LTLIBRARIES helpers.

What is crazier is that 2 -lz linkages are needed, one for -lneon et  
al external,

another with zconf.h uniquified zlib_foo names for rpmlib.

Funner, eh?

73 de Jeff
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Jeff Johnson


On Jun 20, 2007, at 3:04 PM, Ralf S. Engelschall wrote:


On Tue, Jun 19, 2007, Ralf S. Engelschall wrote:


[...]


We investigated another workday and now have the changes bug fixed,
polished up and also tested on a number of non-Linux platforms. We are
still testing under Solaris, but once we have a green light also there
the changeset is ready to be committed. Latest status follows for your
review once again -- in case you are an Autoconf hacker and interested
in diving into it ;-)


I wish to retire with as little knowledge of autoconf in my cranium  
as possible ;-)


Meanwhile, RPM_CHECK_LIB() establishes exactly the right
name space (i.e. 'external:internal:none') for flexibly building
rpm according to many, not just my idiosyncratic, preferences,
no fuss, no muss.

And refactoring internal trees to separate cvs repositories reduces  
the

amount of mechanical cvs branch work immensely. All branches
benefit from HEAD fixes in internal repositories with no loss of  
referential
integrity because cvs tags are maintained in the separate internal  
trees.


Nice stuff! You da man!

73 de Jeff
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Ralf S. Engelschall
On Tue, Jun 19, 2007, Ralf S. Engelschall wrote:

 [...]

We investigated another workday and now have the changes bug fixed,
polished up and also tested on a number of non-Linux platforms. We are
still testing under Solaris, but once we have a green light also there
the changeset is ready to be committed. Latest status follows for your
review once again -- in case you are an Autoconf hacker and interested
in diving into it ;-)
   Ralf S. Engelschall
   [EMAIL PROTECTED]
   www.engelschall.com

Index: acinclude.m4
===
RCS file: acinclude.m4
diff -N acinclude.m4
--- /dev/null   1 Jan 1970 00:00:00 -
+++ acinclude.m420 Jun 2007 18:58:03 -
@@ -0,0 +1,346 @@
+dnl ##
+dnl ##  acinclude.m4 -- manually provided local Autoconf macros
+dnl ##
+
+dnl ##
+dnl ##  NAME:
+dnl ##RPM_CHECK_LIB -- Check for third-party libraries
+dnl ##
+dnl ##  COPYRIGHT
+dnl ##Copyright (c) 2007 Ralf S. Engelschall [EMAIL PROTECTED]
+dnl ##
+dnl ##  DESCRIPTION:
+dnl ##This is a rather complex Autoconf macro for sophisticated
+dnl ##checking the availability of third-party libraries and
+dnl ##extending the build environment for correctly building
+dnl ##against it.
+dnl ##
+dnl ##It especially supports the following particular features:
+dnl ##- is aware of old-style libname-config style scripts
+dnl ##- is aware of new-style pkg-config(1) libname.pc configuration 
files
+dnl ##- searches under standard sub-directories include, lib, etc.
+dnl ##- searches under arbitrary sub-areas of a tree like .libs, etc.
+dnl ##- searches in standard system locations (implicitly)
+dnl ##- supports searching for function in multiple libraries
+dnl ##- supports searching for multiple headers
+dnl ##- supports multiple search locations (fallbacks!)
+dnl ##
+dnl ##  USAGE:
+dnl ##  - configure.in:
+dnl ##RPM_CHECK_LIB(
+dnl ##lib-real-name,-- [$1] e.g. GNU bzip2
+dnl ##lib-tag-name, -- [$2] e.g. bzip2
+dnl ##lib-link-name,-- [$3] e.g. bz2
+dnl ##lib-function-name,-- [$4] e.g. BZ2_bzlibVersion
+dnl ##lib-header-filename,  -- [$5] e.g. bzlib.h
+dnl ##with-arg-default[,-- [$6] e.g. external:internal:none
+dnl ##internal-subdir[, -- [$7] e.g. lib/bzip2
+dnl ##success-action[,  -- [$8] e.g. AC_DEFINE(USE_BZIP2, 1, 
[...])
+dnl ##failure-action-- [$9] e.g. AC_ERROR([...])
+dnl ##]]])
+dnl ##
+dnl ##  - Makefile.in:
+dnl ##top_srcdir = @top_srcdir@
+dnl ##srcdir = @srcdir@
+dnl ##WITH_LIB-TAG-NAME= @WITH_LIB-TAG-NAME@
+dnl ##WITH_LIB-TAG-NAME_SUBDIR = @WITH_LIB-TAG-NAME_SUBDIR@
+dnl ##CPPFLAGS   = @CPPFLAGS@
+dnl ##CFLAGS = @CFLAGS@
+dnl ##LDFLAGS= @LDFLAGS@
+dnl ##LIBS   = @LIBS@
+dnl ##
+dnl ##  - CLI:
+dnl ##$ ./configure --with-lib-tag-name[=arg] [...]
+dnl ##arg::= no
+dnl ##   | yes
+dnl ##   | location-spec
+dnl ##location-spec  ::= directory-path
+dnl ##   | location-spec : location-spec
+dnl ##   | external   /* arbitrary system path */
+dnl ##   | internal   /* internal-subdir only */
+dnl ##   | abort  /* explicit error if library not 
found */
+dnl ##   | none   /* no error if library not found */
+dnl ##directory-path ::= [...]/* valid argument for test(1) 
option -d */
+dnl ##
+
+AC_DEFUN([RPM_CHECK_LIB], [
+dnl ##
+dnl ## PROLOG
+dnl ##
+
+if test .${with_$2+set} != .set; then
+dnl # neither --with-foo[=arg] nor --without-foo given
+dnl # on command line so just assume --with-foo=with-arg-default
+with_$2=$6
+fi
+if test .${with_$2} = .yes; then
+dnl # map --with-foo=yes onto --with-foo=with-arg-default
+dnl # unless with-arg-default is a destructive no
+with_$2=m4_if([$6], no, yes, [$6])
+fi
+if test .${with_$2} = .yes; then
+dnl # map a final --with-foo=yes onto a hard-coded default
+with_$2=internal:external:abort
+fi
+
+dnl ##
+dnl ## HANDLING
+dnl ##
+
+__rcl_result_hint=
+__rcl_location_$2=
+WITH_[]m4_translit([$2],[a-z],[A-Z])[]_SUBDIR=
+AC_ARG_WITH($2,
+AS_HELP_STRING([--with-$2=ARG], [build with $1 library [[$6]]]), [dnl
+if test .${with_$2} != .no; then
+dnl # iterate over location path specification for searching 
purposes
+__rcl_location_last=
+__rcl_IFS=${IFS}; IFS=:
+for __rcl_location in ${with_$2}; do
+IFS=${__rcl_IFS}
+   

Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Jay Soffian


On Jun 20, 2007, at 3:06 PM, Ralf S. Engelschall wrote:


+  [external:internal:none], [beecrypt],
+  [], [ AC_ERROR([mandatory BeeCrypt library not found]) ])

...

+  [external:internal:none], [file:src:src],
+  ], [ AC_ERROR([mandatory File (magic) library not found]) ])


Should these be [external:internal:abort] ?

j.
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Ralf S. Engelschall
On Wed, Jun 20, 2007, Jay Soffian wrote:

 On Jun 20, 2007, at 3:06 PM, Ralf S. Engelschall wrote:

 +  [external:internal:none], [beecrypt],
 +  [], [ AC_ERROR([mandatory BeeCrypt library not found]) ])
 ...
 +  [external:internal:none], [file:src:src],
 +  ], [ AC_ERROR([mandatory File (magic) library not found]) ])

 Should these be [external:internal:abort] ?

Yes, you're right. BeeCrypt and File are de-facto not really optional.
The code base currently does not allow us to keep them out. Now fixed.
Thanks for the feedback.

   Ralf S. Engelschall
   [EMAIL PROTECTED]
   www.engelschall.com

__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Arkadiusz Miskiewicz
On Wednesday 20 of June 2007, Ralf S. Engelschall wrote:
 On Wed, Jun 20, 2007, Jay Soffian wrote:
  On Jun 20, 2007, at 3:06 PM, Ralf S. Engelschall wrote:
  +  [external:internal:none], [beecrypt],
  +  [], [ AC_ERROR([mandatory BeeCrypt library not found]) ])
 
  ...
 
  +  [external:internal:none], [file:src:src],
  +  ], [ AC_ERROR([mandatory File (magic) library not found]) ])
 
  Should these be [external:internal:abort] ?

 Yes, you're right. BeeCrypt and File are de-facto not really optional.
 The code base currently does not allow us to keep them out. Now fixed.
 Thanks for the feedback.

btw. can this macro be more verbose (logging things to config.log) ?

Right now from config.log:

configure:27985: error: unable to find available BeeCrypt library

but why it told so, you have to guess and digg.


Ralf S. Engelschall
[EMAIL PROTECTED]
www.engelschall.com

-- 
Arkadiusz MiśkiewiczPLD/Linux Team
arekm / maven.plhttp://ftp.pld-linux.org/
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Arkadiusz Miskiewicz
On Wednesday 20 of June 2007, Arkadiusz Miskiewicz wrote:

 Right now from config.log:

 configure:27985: error: unable to find available BeeCrypt library

 but why it told so, you have to guess and digg.

We have beecrypt includes in /usr/include/beecrypt/ so the only option is
--with-beecrypt=/usr

configure complains:
find: warning: Unix filenames usually don't contain slashes (though pathnames 
do).
That means that '-name beecrypt/api.h' will probably evaluate to false all the 
time
on this system.  You might find the '-wholename' test more useful, or perhaps 
'-samefile'.
Alternatively, if you are using GNU grep, you could use 'find ... -print0 | 
grep -FzZ beecrypt/api.h'.

maybe (not sure about non-coreutils find)

--- acinclude.m4 2007-06-20 23:10:19.0 +0200
+++ acinclude.m42007-06-20 23:51:42.123505988 +0200
@@ -241,7 +241,7 @@
 dnl # in any sub-area
 if test .${__rcl_found} = .no; then
 dnl changequote(, )dnl
-for __rcl_file in _ `find ${__rcl_location} -name $5 
-type f -print`; do
+for __rcl_file in _ `find ${__rcl_location} -wholename 
$5 -type f -print`; do
 test .${__rcl_file} = ._  continue
 __rcl_dir=`echo ${__rcl_file} | sed -e 
's;[[^/]]*[$];;' -e 's;\(.\)/[$];\1;'`
 CPPFLAGS=${CPPFLAGS} -I${__rcl_dir}
@@ -251,7 +251,7 @@
 if test .${__rcl_found} = .yes; then
 __rcl_found=no
 m4_foreach_w([__rcl_lib], [$3], [
-for __rcl_file in _ `find ${__rcl_location} 
-name lib[]m4_defn([__rcl_lib]).* -type f -print | \
+for __rcl_file in _ `find ${__rcl_location} 
-wholename lib[]m4_defn([__rcl_lib]).* -type f -print | \
 egrep '\.(a|so|sl|dylib)$'`; do
 test .${__rcl_file} = ._  continue
 __rcl_dir=`echo ${__rcl_file} | sed -e 
's;[[^/]]*[$];;' -e 's;\(.\)/[$];\1;'`

configure: error: unable to find available File (magic) library

The same for file package :-)

 Ralf S. Engelschall
 [EMAIL PROTECTED]
 www.engelschall.com



-- 
Arkadiusz MiśkiewiczPLD/Linux Team
arekm / maven.plhttp://ftp.pld-linux.org/
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-20 Thread Olivier Thauvin
Le jeudi 21 juin 2007, Ralf S. Engelschall a écrit :
 On Wed, Jun 20, 2007, Arkadiusz Miskiewicz wrote:
  On Wednesday 20 of June 2007, Arkadiusz Miskiewicz wrote:
   Right now from config.log:
  
   configure:27985: error: unable to find available BeeCrypt library
  
   but why it told so, you have to guess and digg.
 
  We have beecrypt includes in /usr/include/beecrypt/ so the only option is
  --with-beecrypt=/usr
 
  configure complains:
  find: warning: Unix filenames usually don't contain slashes (though
  pathnames do). That means that '-name beecrypt/api.h' will probably
  evaluate to false all the time on this system.  You might find the
  '-wholename' test more useful, or perhaps '-samefile'. Alternatively, if
  you are using GNU grep, you could use 'find ... -print0 | grep -FzZ
  beecrypt/api.h'.

 Ok, but I'm wondering why line 210 of acinclude.m4 does not already
 catch your /usr/include/beecrypt/api.h?

  maybe (not sure about non-coreutils find)

 That's the problem, we have to be portable here.
 I'll investigate on this issue tomorrow morning.

  configure: error: unable to find available File (magic) library
 
  The same for file package :-)

I didn't follow the whole thread but I submit a fix about .h location on 4.5 
branch:

http://rpm5.org/cvs/chngview?cn=7221



signature.asc
Description: This is a digitally signed message part.


Re: Flexibly building against third-party libraries (RPM_CHECK_LIB)

2007-06-19 Thread Ralf S. Engelschall
On Tue, Jun 19, 2007, Ralf S. Engelschall wrote:

 [...]
 gcc -Wall -fPIC -DPIC -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith 
 -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -o rpmdeps 
 rpmdeps.o  -L/d2/u/rse/prj/rpm/src/rpm/../sqlite-3.3.17/.libs 
 -L/d2/u/rse/prj/rpm/src/rpm/../popt-1.11/.libs 
 -L/d2/u/rse/prj/rpm/src/neon-0.26.3/../expat-2007-06-05/.libs 
 -L/d2/u/rse/prj/rpm/src/rpm/../beecrypt-4.1.2/.libs 
 -L/d2/u/rse/prj/rpm/src/rpm/../bzip2-1.0.4/.libs 
 -L/d2/u/rse/prj/rpm/src/rpm/../zlib-1.2.3 
 -L/d2/u/rse/prj/rpm/src/rpm/../bzip2-1.0.4 
 -L/d2/u/rse/prj/rpm/src/rpm/../beecrypt-4.1.2 
 -L/d2/u/rse/prj/rpm/src/rpm/../neon-0.26.3/src/.libs 
 -L/d2/u/rse/prj/rpm/src/rpm/../file-4.21/src/.libs 
 -L/d2/u/rse/prj/rpm/src/rpm/../popt-1.11 
 -L/d2/u/rse/prj/rpm/src/rpm/../sqlite-3.3.17 -L/d2/u/rse/prj/rpm/src/rpm/db3 
 -L/d2/u/rse/prj/rpm/src/rpm/lua ../lib/.libs/librpm.a -L/tmp/rpm/lib 
 /d2/u/rse/prj/rpm/src/rpm/rpmdb/.libs/librpmdb.a -L/usr/opkg/lib 
 -L/usr/opkg/lib/lib /d2/u/rse/prj/rpm/src/rpm/rpmio/.libs/librpmio.a 
 /usr/opkg/lib/libsqlite3.a /usr/opkg/lib/libpopt.a /usr/opkg/lib/libmagic.a 
 /usr/opkg/lib/libneon.a /usr/opkg/lib/libxml2.a -liconv 
 /usr/opkg/lib/libbeecrypt.a -lm -ldmalloc 
 /d2/u/rse/prj/rpm/src/rpm/../sqlite-3.3.17/.libs/libsqlite3.a 
 /d2/u/rse/prj/rpm/src/rpm/../popt-1.11/.libs/libpopt.a 
 /d2/u/rse/prj/rpm/src/rpm/../file-4.21/src/.libs/libmagic.a 
 /d2/u/rse/prj/rpm/src/rpm/../neon-0.26.3/src/.libs/libneon.a -L/tmp/lib 
 -L/d2/u/rse/prj/rpm/src/neon-0.26.3/../openssl-0.9.8e/lib 
 -L/d2/u/rse/prj/rpm/src/neon-0.26.3/../zlib-1.2.3 
 -L/d2/u/rse/prj/rpm/src/neon-0.26.3/../expat-2007-06-05 
 /d2/u/rse/prj/rpm/src/neon-0.26.3/../expat-2007-06-05/.libs/libexpat.a 
 /d2/u/rse/prj/rpm/src/rpm/../beecrypt-4.1.2/.libs/libbeecrypt.a -lpthread 
 /d2/u/rse/prj/rpm/src/rpm/../bzip2-1.0.4/.libs/libbz2.a -lz -lssl -lcrypto 
 /d2/u/rse/prj/rpm/src/rpm/db3/.libs/libdb-4.5.a 
 /d2/u/rse/prj/rpm/src/rpm/lua/.libs/liblua.a
 /usr/opkg/lib/libdmalloc.a(malloc.o): In function `strndup':
 malloc.c:(.text+0xd40): multiple definition of `strndup'
 /usr/opkg/lib/libmagic.a(softmagic.o):softmagic.c:(.text+0x21c): first 
 defined here
 /usr/opkg/bin/ld: Warning: size of symbol `strndup' changed from 100 in 
 /usr/opkg/lib/libmagic.a(softmagic.o) to 171 in 
 /usr/opkg/lib/libdmalloc.a(malloc.o)
 collect2: ld returned 1 exit status
 [...]

Oh, I forgot: just ignore this part of the logfile. This is
an unrelated problem which I already fixed (in OpenPKG):
http://cvs.openpkg.org/chngview?cn=35693 The stock file exports its
own strndup function which obviously makes trouble when RPM is built
against DMalloc. Just ignore this part, it has nothing to do with
RPM_CHECK_LIB...

   Ralf S. Engelschall
   [EMAIL PROTECTED]
   www.engelschall.com

__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org