[sane-devel] Build sane minus scanimage and other binaries

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Thu Dec 13 23:12:36 UTC 2012

Matthew Baker writes:

> Hi,


> I posted a similar question earlier this year to the list with no response
> so I am trying again.
> I am attempting to put together a "how to" regarding cross-compiling sane
> for android and I ideally need to know how turn off the compilation of
> scanimage and other binaries that require functionalities such as getopt
> that do not exist in the android ndk.
> I also noted that the current master blows up on configuration if it finds
> getopt missing. Is it really a requirement to build sane backends that you
> have to build frontends such as scanimage??

Good, configure is checking for getopt availability.

BTW, what do you mean with "blows up on configuration"?  On cursory
inspection of configure.in I don't see why running ./configure would
terminate prematurely or with an error status just because getopt.h
cannot be found.

> Any pointers as to where I can start hacking.

In configure.in, add an AM_CONDITIONAL on getopt availability and
disable anything that depends on getopt in the relevant Makefile.am.
You could even be bold and just disable compilation in tools/ or other
directories completely.

So in configure.in add

  AM_CONDITIONAL([have_getopt], [test xyes = x$ac_cv_header_getopt_h])

and if you want to suppress compilation in tools/, you'd remove tools
from the SUBDIRS variable and add

  if have_getopt
  SUBDIRS += tools

To disable individual tools you can use something similar on the
*_PROGRAMS variable.

For more information on autoconf and automake, see

 [1] http://www.gnu.org/software/autoconf/manual/
 [2] http://www.gnu.org/software/automake/manual/

Hope this helps,
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

More information about the sane-devel mailing list