* aclocal.m4 configure configure.in: added checks for pthread.h and

added linker option -lpthread if pthread.h is found
* include/sane/config.in.h: added HAVE_PTHREAD_H
* sanei/sanei_thread.c include/sane/sanei_thread.h: added pthread_
  functions to library, so every backend is able to use either fork or
  pthread for its reader-process - see plustek backend for example
* backend/plustek.h backend/plustek.c: added sanei_thread stuff to support
  threading on MacOS X
* backend/plustek_pp*: some cleanup
merge-requests/1/head
Gerhard Jaeger 2003-10-05 16:00:30 +00:00
rodzic 73e905af79
commit 39044887ca
12 zmienionych plików z 369 dodań i 78 usunięć

Wyświetl plik

@ -1,3 +1,15 @@
2003-10-05 Gerhard Jaeger <gerhard@gjaeger.de>
* aclocal.m4 configure configure.in: added checks for pthread.h and
added linker option -lpthread if pthread.h is found
* include/sane/config.in.h: added HAVE_PTHREAD_H
* sanei/sanei_thread.c include/sane/sanei_thread.h: added pthread_
functions to library, so every backend is able to use either fork or
pthread for its reader-process - see plustek backend for example
* backend/plustek.h backend/plustek.c: added sanei_thread stuff to support
threading on MacOS X
* backend/plustek_pp*: some cleanup
2003-10-05 Henning Meier-Geinitz <henning@meier-geinitz.de>
* backend/microtek2.h backend/test.c include/sane/saneopts.h:
@ -57,7 +69,7 @@
#300150).
* doc/descriptions/canon630u.desc: Converted to new format (bug
#300148).
2003-10-03 Karl Heinz Kremer <khk@khk.net>
* doc/descriptions/epson.desc: Changed "status" information

9
aclocal.m4 vendored
Wyświetl plik

@ -20,6 +20,7 @@ dnl SANE_EXTRACT_LDFLAGS(LDFLAGS, LIBS)
dnl SANE_V4L_VERSION
dnl SANE_CHECK_JPEG
dnl SANE_CHECK_IEEE1284
dnl SANE_CHECK_PTHREAD
dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
dnl SANE_LINKER_RPATH
dnl SANE_CHECK_U_TYPES
@ -234,6 +235,14 @@ AC_DEFUN([SANE_CHECK_IEEE1284],
fi
])
#
# Checks for pthread support
AC_DEFUN([SANE_CHECK_PTHREAD],
[
AC_CHECK_HEADER(pthread.h, [
LIBS="${LIBS} -lpthread"
])
])
#
# Checks for jpeg library >= v6B (61), needed for DC210, DC240, and

Wyświetl plik

@ -360,6 +360,7 @@ libsane-pint.la: ../sanei/sanei_constrain_value.lo
libsane-plustek.la: ../sanei/sanei_constrain_value.lo
libsane-plustek.la: ../sanei/sanei_usb.lo
libsane-plustek.la: ../sanei/sanei_lm983x.lo
libsane-plustek.la: ../sanei/sanei_thread.lo
libsane-plustek_pp.la: ../sanei/sanei_constrain_value.lo
libsane-pnm.la: ../sanei/sanei_constrain_value.lo
libsane-qcam.la: ../sanei/sanei_constrain_value.lo

Wyświetl plik

@ -733,7 +733,7 @@ _LOC void MiscRestorePort( pScanData ps )
DBG(DBG_LOW,"MiscRestorePort()\n");
/* don´t restore if not necessary */
/* don't restore if not necessary */
if( 0xFFFF == ps->IO.lastPortMode ) {
DBG(DBG_LOW,"- no need to restore portmode !\n");
return;

Wyświetl plik

@ -175,7 +175,7 @@ typedef long long TimerDef, *pTimerDef;
*/
#ifndef __KERNEL__
#define _DO_UDELAY(usecs) { int i; for( i = usecs; i--; ) outb(0x80,0); }
#define _DODELAY(msecs) { int i; for( i = msecs; i--; ) _DO_UDELAY(1); }
#define _DODELAY(msecs) { int i; for( i = msecs; i--; ) _DO_UDELAY(1000); }
#else
#define _DO_UDELAY(usecs) udelay(usecs)
#define _DODELAY(msecs) mdelay(msecs)

Wyświetl plik

@ -63,6 +63,7 @@
* - added altCalibration option
* - removed parallelport support --> new backend: plustek_pp
* - cleanup
* - added pthread support
*.
* <hr>
* This file is part of the SANE package.
@ -141,6 +142,15 @@
#include "sane/sanei_backend.h"
#include "sane/sanei_config.h"
/*we're using this possibility only on MacOS X... */
#if defined HAVE_PTHREAD_H && defined HAVE_IOKIT_IOKITLIB_H
#define _PLUSTEK_USE_THREAD
#endif
#ifdef _PLUSTEK_USE_THREAD
#include "sane/sanei_thread.h"
#endif
/** might be used to disable all USB stuff - esp. for OS/2 */
#ifndef HAVE_OS2_H
# define _PLUSTEK_USB
@ -420,7 +430,7 @@ static RETSIGTYPE sigalarm_handler( int signo )
/** executed as a child process
* read the data from the driver and send them to the parent process
*/
static int reader_process( Plustek_Scanner *scanner, int pipe_fd )
static int reader_process( Plustek_Scanner *scanner, int pipe_fd )
{
int line;
unsigned char *buf;
@ -490,6 +500,33 @@ static int reader_process( Plustek_Scanner *scanner, int pipe_fd )
return SANE_STATUS_GOOD;
}
#ifdef _PLUSTEK_USE_THREAD
/*
* reader thread: need a wrapper, because threads can have
* only one parameter.
*/
static void reader_thread( void *data )
{
Plustek_Scanner *s = (Plustek_Scanner *)data;
sigset_t ignore_set;
struct SIGACTION act;
int status;
DBG( _DBG_SANE_INIT, "reader_thread...\n" );
sigfillset ( &ignore_set );
sigdelset ( &ignore_set, SIGTERM );
sigprocmask( SIG_SETMASK, &ignore_set, 0 );
memset ( &act, 0, sizeof (act));
sigaction( SIGTERM, &act, 0 );
status = reader_process( s, s->pipe );
DBG( _DBG_SANE_INIT, "reader process done, status = %i\n", status );
}
#endif
/** stop the current scan process
*/
static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe )
@ -512,20 +549,34 @@ static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe )
act.sa_handler = sigalarm_handler;
sigaction( SIGALRM, &act, 0 );
/* kill our child process and wait until done */
kill( scanner->reader_pid, SIGUSR1 );
/* give'em 10 seconds 'til done...*/
alarm(10);
res = waitpid( scanner->reader_pid, 0, 0 );
alarm(0);
/* kill our child process and wait until done */
if( scanner->child_forked ) {
kill( scanner->reader_pid, SIGUSR1 );
/* give'em 10 seconds 'til done...*/
alarm(10);
res = waitpid( scanner->reader_pid, 0, 0 );
} else {
#ifdef _PLUSTEK_USE_THREAD
sanei_thread_kill( scanner->reader_pid, SIGUSR1 );
alarm(10);
res = sanei_thread_waitpid( scanner->reader_pid, 0, 0);
#else
res = scanner->reader_pid;
#endif
}
alarm(0);
if( res != scanner->reader_pid ) {
DBG( _DBG_PROC,"waitpid() failed !\n");
#ifdef _PLUSTEK_USE_THREAD
sanei_thread_kill( scanner->reader_pid, SIGKILL );
#else
kill( scanner->reader_pid, SIGKILL );
}
#endif
}
scanner->reader_pid = 0;
DBG( _DBG_PROC,"reader_process killed\n");
}
@ -1193,6 +1244,9 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
sanei_usb_init();
sanei_lm983x_init();
#endif
#ifdef _PLUSTEK_USE_THREAD
sanei_thread_init();
#endif
#if defined PACKAGE && defined VERSION
DBG( _DBG_SANE_INIT, "Plustek backend V"BACKEND_VERSION", part of "
@ -1207,7 +1261,7 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
first_handle = NULL;
num_devices = 0;
/* initialize the configuration structure */
/* initialize the configuration structure */
init_config_struct( &config );
if( version_code != NULL )
@ -2020,8 +2074,14 @@ SANE_Status sane_start( SANE_Handle handle )
/* create reader routine as new process */
s->bytes_read = 0;
s->reader_pid = fork();
#ifdef _PLUSTEK_USE_THREAD
s->child_forked = SANE_FALSE;
s->pipe = fds[1];
s->reader_pid = sanei_thread_begin( reader_thread, s );
#else
s->child_forked = SANE_TRUE;
s->reader_pid = fork();
#endif
cancelRead = SANE_FALSE;
if( s->reader_pid < 0 ) {
@ -2032,9 +2092,9 @@ SANE_Status sane_start( SANE_Handle handle )
}
/* reader_pid = 0 ===> child process */
if( 0 == s->reader_pid ) {
if( 0 == s->reader_pid ) {
sigset_t ignore_set;
sigset_t ignore_set;
struct SIGACTION act;
DBG( _DBG_SANE_INIT, "reader process...\n" );
@ -2058,7 +2118,9 @@ SANE_Status sane_start( SANE_Handle handle )
signal( SIGCHLD, sig_chldhandler );
close(fds[1]);
if( s->child_forked )
close(fds[1]);
s->pipe = fds[0];
DBG( _DBG_SANE_INIT, "sane_start done\n" );

Wyświetl plik

@ -43,6 +43,7 @@
* - 0.46 - flag initialized is now used as device index
* - added calFile to Plustek_Device
* - removed _OPT_HALFTONE
* - added pthread support
* .
* <hr>
* This file is part of the SANE package.
@ -367,24 +368,25 @@ typedef union
typedef struct Plustek_Scanner
{
struct Plustek_Scanner *next;
pid_t reader_pid; /* process id of reader */
SANE_Status exit_code; /* status of the reader process */
int pipe; /* pipe to reader process */
unsigned long bytes_read; /* number of bytes currently read*/
pPlustek_Device hw; /* pointer to current device */
Option_Value val[NUM_OPTIONS];
SANE_Byte *buf; /* the image buffer */
SANE_Bool scanning; /* TRUE during scan-process */
SANE_Parameters params; /* for keeping the parameter */
/************************** gamma tables *********************************/
SANE_Word gamma_table[4][4096];
SANE_Range gamma_range;
int gamma_length;
struct Plustek_Scanner *next;
pid_t reader_pid; /* process id of reader */
SANE_Bool child_forked; /* use fork or pthreads */
SANE_Status exit_code; /* status of the reader process */
int pipe; /* pipe to reader process */
unsigned long bytes_read; /* number of bytes currently read*/
pPlustek_Device hw; /* pointer to current device */
Option_Value val[NUM_OPTIONS];
SANE_Byte *buf; /* the image buffer */
SANE_Bool scanning; /* TRUE during scan-process */
SANE_Parameters params; /* for keeping the parameter */
SANE_Option_Descriptor opt[NUM_OPTIONS];
/************************** gamma tables *********************************/
SANE_Word gamma_table[4][4096];
SANE_Range gamma_range;
int gamma_length;
SANE_Option_Descriptor opt[NUM_OPTIONS];
} Plustek_Scanner, *pPlustek_Scanner;

221
configure vendored
Wyświetl plik

@ -1132,7 +1132,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
cd "$ac_popdir"
cd $ac_popdir
done
fi
@ -1331,7 +1331,7 @@ _ASBOX
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core &&
rm -f core core.* *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
@ -2393,7 +2393,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
'' \
''\
'#include <stdlib.h>' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
@ -2407,8 +2408,8 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
#include <stdlib.h>
$ac_declaration
int
main ()
{
@ -3492,7 +3493,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
@ -5407,6 +5408,144 @@ _ACEOF
fi
if test "${ac_cv_header_pthread_h+set}" = set; then
echo "$as_me:$LINENO: checking for pthread.h" >&5
echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
if test "${ac_cv_header_pthread_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking pthread.h usability" >&5
echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <pthread.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking pthread.h presence" >&5
echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <pthread.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
{ echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
no:yes )
{ echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for pthread.h" >&5
echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
if test "${ac_cv_header_pthread_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_pthread_h=$ac_header_preproc
fi
echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
fi
if test $ac_cv_header_pthread_h = yes; then
LIBS="${LIBS} -lpthread"
fi
# Check whether --with-gphoto2 or --without-gphoto2 was given.
if test "${with_gphoto2+set}" = set; then
@ -5730,7 +5869,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
@ -5780,6 +5919,7 @@ fi
for ac_header in fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \
@ -5790,7 +5930,7 @@ for ac_header in fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \
sys/types.h sys/scsi/scsi.h sys/scsi/sgdefs.h sys/scsi/targets/scgio.h \
apollo/scsi.h sys/sdi_comm.h sys/passthrudef.h linux/ppdev.h \
dev/ppbus/ppi.h machine/cpufunc.h usb.h sys/bitypes.h sys/sem.h sys/poll.h \
IOKit/IOKitLib.h windows.h
IOKit/IOKitLib.h windows.h pthread.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@ -7256,7 +7396,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_c_bigendian=yes
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.$ac_objext conftest.$ac_ext
@ -7747,7 +7887,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_c_stack_direction=-1
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
@ -8149,7 +8289,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_func_mmap_fixed_mapped=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
@ -9233,7 +9373,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 9236 "configure"' > conftest.$ac_ext
echo '#line 9376 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -9995,7 +10135,8 @@ else
fi
fi
for ac_declaration in \
'' \
''\
'#include <stdlib.h>' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
@ -10009,8 +10150,8 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
#include <stdlib.h>
$ac_declaration
int
main ()
{
@ -10411,7 +10552,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:10414:" \
echo "$as_me:10555:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -11416,11 +11557,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11419: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11560: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:11423: \$? = $ac_status" >&5
echo "$as_me:11564: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -11648,11 +11789,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11651: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11792: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:11655: \$? = $ac_status" >&5
echo "$as_me:11796: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -11715,11 +11856,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11718: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11859: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:11722: \$? = $ac_status" >&5
echo "$as_me:11863: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -13727,7 +13868,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 13730 "configure"
#line 13871 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13825,7 +13966,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 13828 "configure"
#line 13969 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -15957,11 +16098,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15960: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16101: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15964: \$? = $ac_status" >&5
echo "$as_me:16105: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -16024,11 +16165,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16027: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16168: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:16031: \$? = $ac_status" >&5
echo "$as_me:16172: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -17267,7 +17408,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17270 "configure"
#line 17411 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17365,7 +17506,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17368 "configure"
#line 17509 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -18187,11 +18328,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18190: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18331: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:18194: \$? = $ac_status" >&5
echo "$as_me:18335: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -18254,11 +18395,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18257: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18398: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:18261: \$? = $ac_status" >&5
echo "$as_me:18402: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -20194,11 +20335,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20197: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20338: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:20201: \$? = $ac_status" >&5
echo "$as_me:20342: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -20426,11 +20567,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20429: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20570: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:20433: \$? = $ac_status" >&5
echo "$as_me:20574: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -20493,11 +20634,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20496: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20637: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:20500: \$? = $ac_status" >&5
echo "$as_me:20641: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -22505,7 +22646,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 22508 "configure"
#line 22649 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -22603,7 +22744,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 22606 "configure"
#line 22747 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

Wyświetl plik

@ -91,6 +91,7 @@ if test "`uname`" != "IRIX" -a "`uname`" != "IRIX64"; then
fi
SANE_CHECK_JPEG
SANE_CHECK_IEEE1284
SANE_CHECK_PTHREAD
SANE_CHECK_GPHOTO2
dnl check sane to make sure we don't have two installations
AC_CHECK_LIB(sane, sane_init, LIBSANE_EXISTS="yes")
@ -107,7 +108,7 @@ AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \
sys/types.h sys/scsi/scsi.h sys/scsi/sgdefs.h sys/scsi/targets/scgio.h \
apollo/scsi.h sys/sdi_comm.h sys/passthrudef.h linux/ppdev.h \
dev/ppbus/ppi.h machine/cpufunc.h usb.h sys/bitypes.h sys/sem.h sys/poll.h \
IOKit/IOKitLib.h windows.h)
IOKit/IOKitLib.h windows.h pthread.h )
AC_CHECK_HEADERS([asm/io.h],,,[#include <sys/types.h>])
SANE_CHECK_MISSING_HEADERS
SANE_V4L_VERSION

Wyświetl plik

@ -169,6 +169,9 @@
/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the `scsireq_enter' function. */
#undef HAVE_SCSIREQ_ENTER

Wyświetl plik

@ -65,6 +65,8 @@
/** @name Internal functions
* @{
*/
extern void sanei_thread_init( void );
/** <b>Do not use in backends</b>
*
* Wrapper for @c fork.
@ -96,9 +98,9 @@ extern int sanei_thread_wait( int *stat_loc);
* argument. Add a function to you backend with this name and let it call your
* own reader process. See mustek.c for an example.
*/
#ifdef HAVE_OS2_H
static void os2_reader_process( void* data);
#ifdef HAVE_OS2_H
#define fork() sanei_thread_begin( os2_reader_process)
#define kill( a, b) sanei_thread_kill( a,b)
#define waitpid( a, b, c) sanei_thread_waitpid( a, b, c)

Wyświetl plik

@ -1,5 +1,6 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 1998-2001 Yuri Dario
Copyright (C) 2003 Gerhard Jaeger
This file is part of the SANE package.
This program is free software; you can redistribute it and/or
@ -41,6 +42,8 @@
Helper functions for the OS/2 port (using threads instead of forked
processes). Don't use them in the backends, they are used automatically by
macros.
Added pthread support (as found in hp-handle.c) - Gerhard Jaeger
*/
#include "../include/sane/config.h"
@ -94,3 +97,58 @@ sanei_thread_wait( int *stat_loc)
}
#endif /* HAVE_OS2_H */
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#include <sane/sanei_thread.h>
#define BACKEND_NAME sanei_thread /**< the name of this module for dbg */
#include "../include/sane/sane.h"
#include "../include/sane/sanei_debug.h"
void
sanei_thread_init( void )
{
DBG_INIT();
}
int
sanei_thread_begin( void (*start)(void *arg), void* arg_list )
{
int hd;
pthread_t thread;
hd = pthread_create( &thread, NULL, start, arg_list );
if ( hd != 0 ) {
DBG(1, "pthread_create() failed with %d\n", hd );
return -1;
}
DBG( 2, "pthread_create() created thread %d\n", (int)thread );
return (int)thread;
}
int
sanei_thread_kill( int pid, int sig)
{
DBG(2, "pthread_kill() will kill %d\n", (int)pid);
return pthread_kill((pthread_t)pid, sig );
}
int
sanei_thread_waitpid( int pid, int *stat_loc, int options )
{
if (stat_loc)
*stat_loc = 0;
if( 0 == pthread_join((pthread_t)pid, (void*)stat_loc ))
pthread_detach((pthread_t)pid );
return pid;
}
#endif /* HAVE_PTHREAD_H */