[sane-devel] Proposal to remove autoconf-generated files from the source repository

r. a. schmied uwppp at flash.net
Mon Jun 17 16:22:14 BST 2019


aloha olaf

i've embedded some more text way down towards the bottom
regarding the AS_CASE(x$host_os,...) call and my solution
history as related to/with solaris 10 sparc and its libusb.

ras


Olaf Meeuwissen wrote:
> Hi,
> 
> r. a. schmied writes:
> 
> 
>>Olaf Meeuwissen wrote:
>>
>>>Hi!
>>>
>>>TL;DR I am going to merge this shortly after 2019-06-12 10:00 UTC unless
>>>someone raises objection here or in the [merge request][0].
>>>[...]
>>
>>aloha olaf and interested saners
>>
>>i've got one of those out-of-band systems (sun solaris 10 sparc update 8).
>>this is a very brief list of my handling of issues with configure as
>>shipped and possibly with configure.ac after this change takes place.
>>nothing that cannot be overcome.
> 
> 
> FTR, configure.ac has not changed.
> 
> 
>>when i run configure i have to set loads of envvars to set things right
>>but something i've been unable to fix with the current autotools system,
>>well two things:
>>
>>1) to get a clean compile of umax_pp.c i had to add -D_XPG6 for gcc 4.9.0
>>   and my system to compile.
>>
>>   i'm still unsure why any of the umax stuff is being compiled as that
>>   backend is not a listed backend unless it is needed for test or net.
> 
> 
> This is a separate issue and unrelated dropping generated files.  I've
> submitted #93 to make support for parallel I/O an option.  That should
> properly address your trouble as well.
> 
>  https://gitlab.com/sane-project/backends/issues/93
> 
> IIRC, the problem is caused by tools/umax_pp.c ...
> 
> 
>>2) my os has libusb at /usr/sfw/lib and provides /usr/sfw/bin/libusb-config
>>   to get the libs and cflags much like pkg-config does.  i've been
>>   struggling to get a workable set of autotool macros to work around
>>   this problem.  i think i have a partial solution but it re-instates the
>>   current override to always use pkg-config for 2 specifically listed
>>   systems.  i can provide these autotool changes if you are interested.
>>   (ax_path_generic.m4 and ax_compare_version.m4 added to m4, 25 lines
>>   or so added to configure.am.  also i've not yet been able to get test
>>   compiles or test links to work for this hack -- i'm expecting the book
>>   'autotools: A Practioner's Guide' to be delivered in the coming week.)
> 
> 
> You should be able to add an extra case to the AS_CASE(x$host_os,...)
> call.  It already special cases beos* and os2*.  You can just add your
> own using a suitable shell glob for the value of your $host_os.
> 
> By all means share your "hack".
> 
> 

first off the AS_CASE(x$host_os,...) in configure.ac is
intentionally disabled because of the leading 'x' char;
as x$host_os is never going to match any $host_os variable.
at least that was what i found when i created a case for solaris*.

what this 'disabling' does do is always forces the *) choice
which employs pkg-config to get the data for libusb.

so without the pkg-config pc file for libusb configure failed
UNLESS i pre-set USB_CFLAGS and USB_LIBS on configure environment.
then, because configure then found usb.h it went ahead and
set #define HAVE_LIBUSB 1

i saw/see no way to force configure to define HAVE_LIBUSB_LEGACY
instead, short of re-working configure.ac as i have done.


>>   the only thing i really needed to change after running the standard
>>   configure with my manual settings for USB_CFLAGS and USB_LIBS was
>>   ./include/sane/config.h:
>>      comment out: /* #define HAVE_LIBUSB 1 */
>>
>>      insert: #define HAVE_LIBUSB_LEGACY 1
> 
> 
> ./include/sane/config.h is a generated file.  Your hack is probably not
> doing the right thing and I guess it may have something to do with your
> libusb-config utility setting HAVE_LIBUSB.  Your configure.ac changes
> need to transfer it value to HAVE_LIBUSB_LEGACY (if it's 0.1) and clear
> the value of HAVE_LIBUSB.

yes -- understood -- i'm just explaining that with a shell script
of fewer than 15 lines (most comments) run after configure,
specifically to adjust ./include/sane/config.h as described
solved my particular problem.

this i did way back in may 2018 when i first built with sane-backends-1.0.27.


but now seeing you saners are going to make a relatively large
delta to configure and friends i figured i try to solve this
solaris usblib problem 'the autotools way'.

it took me, a total novice with autotools, 25 lines added to configure.ac
plus including ax_path_generic.m4 and ax_compare_version.m4 to the
m4 dir to do it.  all that and the changes to configure.ac still don't
run compile/link trial tests like the pkg-config version does.

other things about autotools i've learned about the hard way:
for example the current configure setup uses envvars
USB_CFLAGS and USB_LIBS, but the ax_path_generic.m4 and
ax_compare_version.m4 use/create envvars LIBUSB_CFLAGS and
LIBUSB_LIBS.  that might be because i'm still a nooby with
autotools, but it still is a wrinkle that really should be
ironed out.  i'm sure there are others ....



i'm gonna attach my diffs to configure.ac base on the git
reference version e13b80fa.  in addition, just to be sure they 
are the same ones i've used, the two m4 files to be added to the
m4 dir (ax_path_generic.m4, ax_compare_version.m4).

this configure.ac change does indeed generate the correct
./include/sane/config.h for sol10u8 sparc with the old old
usblib, but it is still somewhat deficient as described.
consider it a starting point for an autotools journeyman.

attached: configure.ac.patch
          m4/ax_compare_version.m4
          m4/ax_path_generic.m4



for historical reference here is the original script that
'fixes' ./include/sane/config.h. it is used immediately
after configure is run with envvars USB_CFLAGS and USB_LIBS
appropriately set, but before any gnu makes are run.
this is not the autotools way; it is a cheap and dirty
hack that is only suited to die-hard solaris using grey-beards.

#!/bin/bash

GSED=$( command -v gsed )

configh=$( find . -name config.h -print )
# echo "found configh == \"$configh\""

#
# if #define HAVE_LIBUSB 1 is present comment it out
# append after #undef HAVE_LIBUSB_LEGACY
# #define HAVE_LIBUSB_LEGACY 1
#
$GSED -i \
      -e "s@^#define HAVE_LIBUSB 1@/* & */@" \
      -e "\@^.*#undef HAVE_LIBUSB_LEGACY.*@ { 
a\
#define HAVE_LIBUSB_LEGACY 1
}" \
$configh


> 
> 
>>   this was trivially done following configure with an edit-in-place
>>   sed command (15 lines as bash script).
> 
> 
> Hope this helps,
> --
> Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
>  GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
>  Support Free Software                        https://my.fsf.org/donate
>  Join the Free Software Foundation              https://my.fsf.org/join
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure.ac.patch
Type: text/x-diff
Size: 1267 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20190617/e55e4f96/attachment-0001.patch>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ax_compare_version.m4
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20190617/e55e4f96/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ax_path_generic.m4
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20190617/e55e4f96/attachment-0003.ksh>


More information about the sane-devel mailing list