[sane-devel] make errors with 1.07
Henning Meier-Geinitz
henning at meier-geinitz.de
Sat Mar 9 20:08:53 GMT 2002
Hi,
On Sat, Mar 09, 2002 at 03:39:33PM +0100, abel deuring wrote:
> For a general fix, this should be done with configure, I think.
>
> The information from host_status and friends is quite useful, both for a
> better error handling and for diagnosis, if sanei_scsi has a bug or if
> something goes wrong inside the kernel, so I'd like to use these fields
> if possible. The problem is that I am not very familiar with configure
> -- is it possible to include a test like the following in configure?
>
> - try to compile the test program:
>
> #include <sys/types.h>
> #include <scsi/sg.h>
> int main(int argc, char **argv)
> {
> struct sg_header hdr;
> hdr.target_status = 1;
> return 0;
> }
>
> - if the succeeds, define HAVE_SG_TARGET_STATUS ; enclose the lines
> above (and a preceding DBG statement) in #ifdef HAVE_SG_TARGET_STATUS .
Have a look at AC_TRY_COMPILE. There are some examples in
configure.in. The first argument are the includes, the second is the
code that's inside the main function, the third is executed when
compilation wa successful and the fourth when it wasn't successful.
Maybe something like this (untested):
AC_MSG_CHECKING([for sg_header.target_status in <scsi/sg.h>])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <scsi/sg.h>
],[
struct sg_header hdr;
hdr.target_status = 1;
return 0;
],[AC_MSG_RESULT(yes);
AC_DEFINE(HAVE_SG_TARGET_STATUS,1,[Define if sg_header.target_status is available.])],
AC_MSG_RESULT(no))
Also, HAVE_SG_TARGET_STATUS must be added to include/sane/config.h.in.
Bye,
Henning
More information about the sane-devel
mailing list