./PaxHeaders/image-acquisition-0.3.30000644000000000000000000000013215000642613014260 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.563464851 30 ctime=1745044875.563464851 image-acquisition-0.3.3/0000755000175000017500000000000015000642613015072 5ustar00andyandy00000000000000image-acquisition-0.3.3/PaxHeaders/NEWS0000644000000000000000000000013215000642613014677 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/NEWS0000644000175000017500000000502415000642613015572 0ustar00andyandy00000000000000 Summary of important changes for image-acquisition 0.3.2 (2025/04/14): ------------------------------------------------------------------------ ** fix missing header for Media Foundation build Summary of important changes for image-acquisition 0.3.1 (2025/04/12): ------------------------------------------------------------------------ ** videoinput: Use first available device when no adapter given. Summary of important changes for image-acquisition 0.3.0 (2025/03/15): ------------------------------------------------------------------------ ** Support for Media Foundation (MF) on MS-Windows ** New internal conversion routines for YCbCr -> RGB3 Summary of important changes for image-acquisition 0.2.5 (2024/08/31): ------------------------------------------------------------------------ ** Bugfix release Octave version >= 6 removed error_state. Bug #63136) Ignore v4l2 Metadata Interface devices in imaqhwinfo. Example if /dev/video0 AND /dev/video1 are created simultaneously. Summary of important changes for image-acquisition 0.2.1 (2014/12/27): ------------------------------------------------------------------------ ** Support for VideoFormats - RAW Bayer SBGGR8, SGBRG8, SGRBG8, SRGGB8, SBGGR10, SGRBG10, SRGGB10, SBGGR12, SGBRG12, SGBRG12, SGRBG12, SRGGB12 - YVU420 aka YV12, YUV420 aka YV12, YUYV aka YUV 4:2:2 - MJPEG ** New functions: save_mjpeg_as_jpg.m: save MJPEG capture as JPEG SGRBGtoRGB.m: Convert RAW Bayer SGRBG to RGB without interpolation Summary of important changes for image-acquisition 0.1.3 (2014/03/06): ------------------------------------------------------------------------ ** new setter/getter for VideoFormat. This internally sets the pixelformat, see http://www.linuxtv.org/downloads/v4l-dvb-apis/pixfmt.html. You can use the short 4 char FOURCC format ('RGB3', 'YUYV', 'MJPG' etc.) or the long format, for example 'SGRBG12' instead of 'BA12'. Summary of minor changes for image-acquisition 0.1.2 (2014/01/28): ------------------------------------------------------------------------ ** Use of autoconf ** Fix to build with fltk1.1 ** Some fixes for tests with different cams ** Print warning if driver limits set values Summary of important changes for image-acquisition 0.1.0 (2014/01/18): ------------------------------------------------------------------------ ** Initial release. Most of the functions which are required to get/set properties, start/stop streaming, preview and capture images are implemented for v4l2 devices. image-acquisition-0.3.3/PaxHeaders/INDEX0000644000000000000000000000013215000642613014772 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/INDEX0000644000175000017500000000031415000642613015662 0ustar00andyandy00000000000000image >> Image acquisition list devices imaqhwinfo videoinput @videoinput/videoinput @videoinput/get @videoinput/set @videoinput/start @videoinput/preview @videoinput/getsnapshot @videoinput/stop image-acquisition-0.3.3/PaxHeaders/src0000644000000000000000000000013215000642613014712 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.563464851 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/0000755000175000017500000000000015000642613015661 5ustar00andyandy00000000000000image-acquisition-0.3.3/src/PaxHeaders/cl_img_win.h0000644000000000000000000000013215000642613017247 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_img_win.h0000644000175000017500000000322315000642613020141 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . /*! fast and simple image viewer based on FLTK. Currently RGB24 (8bit red, green, blue) and Grayvalues with 8bit are supported. */ #include #include #include #include #include #include //for memcpy #ifndef _CIMAGEWINDOW_H_ #define _CIMAGEWINDOW_H_ //! width and height of border around actual image #define BORDER_PX 1 class img_win : public Fl_Double_Window { private: uchar* pixel; //!< internal memory for image bool is_RGB; int img_w () { return w () - 2 * BORDER_PX; } int img_h () { return h () - 2 * BORDER_PX; } int pixel_len() { return img_w () * img_h () * ((is_RGB)? 3: 1); } public: img_win (int x, int y, int w, int h); ~img_win (); void draw (); void copy_img (const unsigned char* p, unsigned int w, unsigned int h, bool rgb); void custom_label (const char *device, unsigned int seq, double fps); }; #endif image-acquisition-0.3.3/src/PaxHeaders/cl_imaq_handler.h0000644000000000000000000000013215000642613020242 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_imaq_handler.h0000644000175000017500000001304615000642613021140 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #ifndef _IMAQ_HANDLER_ #define _IMAQ_HANDLER_ //~ #include //~ #include //~ #include //~ #include //~ #include #include //#ifdef WIN32 //typedef unsigned int uint32; //#endif #include #include //#include #include #include "cl_img_win.h" // See https://savannah.gnu.org/bugs/?61994#comment30 // jwe: ... any .oct file that introduces a new type should derive from octave_base_dld_value instead of just octave_base_value ... class imaq_handler: public octave_base_dld_value { public: imaq_handler (); //~ octave_base_dld_value *clone (void) const // TODO: check if this is okay //~ { //~ octave_stdout << "v4l2_handler clone" << endl; //~ return new v4l2_handler (*this); //~ } //~ octave_base_dld_value *empty_clone (void) const // TODO: check if this is okay //~ { //~ octave_stdout << "v4l2_handler empty_clone" << endl; //~ return new v4l2_handler (); //~ } ~imaq_handler (void); virtual octave_map enum_devices () { return octave_map (); } virtual octave_value enum_inputs () { return octave_value (); //!< Enumerate video inputs } virtual int get_input () { return 0; //!< Query the current video input } virtual void set_input (int index) {} //!< Select video input virtual octave_value enum_formats () { return octave_value (); //!< Enumerate image formats } virtual void print (std::ostream& os, bool pr_as_read_syntax); //!< print itself on ostream virtual octave_scalar_map open (std::string d, bool quiet); virtual octave_value querycap () { return octave_value (); //!< Query device capabilities } virtual Matrix enum_framesizes (std::string pixelformat) { return Matrix (); //!< Enumerate frame sizes } virtual octave_scalar_map g_fmt () { return octave_scalar_map (); //!< Get current format } virtual void s_fmt (std::string fmtstr, uint32_t xres, uint32_t yres) {} //!< Set format virtual Matrix enum_frameintervals (std::string pixelformat, uint32_t width, uint32_t height) { return Matrix (); //!< Enumerate frame intervals } virtual Matrix get_frameinterval () { return Matrix (); } virtual void set_frameinterval (Matrix timeperframe) {} virtual octave_value queryctrl () { return octave_value (); //!< Query controls } virtual int g_ctrl (int id) { return 0; //!< Get control } virtual void s_ctrl (int id, octave_value val) {} //!< Set control virtual void streamon (unsigned int n) {} //!< start streaming with n buffers virtual void streamoff () {} //!< stop streaming virtual octave_value_list capture (int nargout, bool preview, bool raw_output) //!< Retrieve captured image from buffer { return ovl(); } //virtual void capture_to_ppm (const char *fn); //!< Retrieve captured image from buffer and save it as ppm bool preview_window_is_shown() { Fl::wait(0); return (preview_window)? preview_window->shown() : false; } void set_ITU_standard (int standard){ ITU_standard = standard; }; static uint8NDArray YCbCr_to_RGB (const octave_value& in, int ITU_standard = 601); static uint8NDArray JPG_to_RGB (const octave_value& in); virtual void close (); //!< close device // Properties bool is_defined (void) const { return true; } // Attention/FIXME: some examples show overloading rows + columns, some dims // It looks like Octave 9.3 only uses "dims" //int rows () const { return 1; } //int columns () const { return 1; } dim_vector dims (void) const { static dim_vector dv(1, 1); return dv; } bool is_constant (void) const { return true; } bool isobject (void) const { return true;} //bool print_as_scalar () const { return true; } protected: img_win *preview_window; int ITU_standard; static octave_value get_RGB24 (void *start, size_t length, uint32_t width, uint32_t height); static octave_value get_raw_bayer1 (void *start, size_t length, uint32_t width, uint32_t height); static octave_value get_raw_bayer2 (void *start, size_t length, uint32_t width, uint32_t height); static octave_value get_YUYV (void *start, size_t length, uint32_t width, uint32_t height); static octave_value get_YVU420 (void *start, size_t length, uint32_t width, uint32_t height, bool is_YUV = false); static octave_value get_NV12 (void *start, size_t length, uint32_t width, uint32_t height); static octave_value get_raw_bytes (void *start, size_t length); private: imaq_handler (const imaq_handler& m); static bool type_loaded; DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; imaq_handler* get_imaq_handler_from_ov (octave_value ov); #endif image-acquisition-0.3.3/src/PaxHeaders/cl_mf_handler.h0000644000000000000000000000013215000642613017715 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_mf_handler.h0000644000175000017500000001002415000642613020604 0ustar00andyandy00000000000000// Copyright (C) 2024-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #ifndef _MF_HANDLER_ #define _MF_HANDLER_ #include #include #include #include #include "cl_imaq_handler.h" #include "cl_img_win.h" #include #include #include #include // for MF_E_NO_MORE_TYPES #include // for IID_IAMCameraControl, IID_IAMVideoProcAmp #include _COM_SMARTPTR_TYPEDEF(IAMCameraControl, IID_IAMCameraControl); _COM_SMARTPTR_TYPEDEF(IAMVideoProcAmp, IID_IAMVideoProcAmp); class mf_handler: public imaq_handler { public: mf_handler (); octave_base_dld_value *clone (void) const // TODO: check if this is okay { octave_stdout << "mf_handler clone" << std::endl; return new mf_handler (*this); } octave_base_dld_value *empty_clone (void) const // TODO: check if this is okay { octave_stdout << "mf_handler empty_clone" << std::endl; return new mf_handler (); } ~mf_handler (void); octave_map enum_devices (); octave_scalar_map open (std::string d, bool quiet); void print (std::ostream& os, bool pr_as_read_syntax); //!< print itself on ostream // TODO: querycap not yet implemented for mf octave_value querycap (); //!< Query device capabilities // TODO: enum_inputs, get_input, set_input not yet implemented for media foundation octave_value enum_inputs (); //!< Enumerate video inputs int get_input (); //!< Query the current video input void set_input (int index); //!< Select video input // loops reader->GetNativeMediaType // returns all possible combinations of pixelformat, frame size and frame interval octave_map loop_native_media_types (); octave_value enum_formats (); //!< Enumerate image formats void s_fmt (std::string fmtstr, uint32_t xres, uint32_t yres); //!< Set format octave_scalar_map g_fmt (IMFMediaType *pType); //!< Get current format octave_scalar_map g_fmt (); Matrix enum_framesizes (std::string pixelformat); //!< Enumerate frame sizes Matrix enum_frameintervals (std::string pixelformat, uint32_t width, uint32_t height); //!< Enumerate frame intervals Matrix get_frameinterval (); void set_frameinterval (Matrix timeperframe); octave_value queryctrl (); //!< Query controls int g_ctrl (int id); //!< Get control void s_ctrl (int id, octave_value val); //!< Set control octave_value_list capture (int nargout, bool preview, bool raw_output); //!< Retrieve captured image from buffer /* void capture_to_ppm (const char *fn); //!< Retrieve captured image from buffer and save it as ppm void streamon (unsigned int n); //!< start streaming with n buffers void streamoff (); //!< stop streaming */ void close (); //!< close device //int rows () const { return 5; } //int columns () const { return 5; } //bool is_constant (void) const { return true; } //bool is_defined (void) const { return true; } //bool is_object (void) const { return true;} // 4.4+ //bool isobject (void) const { return true;} //bool print_as_scalar () const { return true; } private: mf_handler (const mf_handler& m); IMFMediaSource* device; IMFSourceReader* reader; // bool streaming; }; #endif image-acquisition-0.3.3/src/PaxHeaders/config.sub0000644000000000000000000000013215000642613016747 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/config.sub0000644000175000017500000011544115000642613017647 0ustar00andyandy00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale timestamp='2024-05-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in cloudabi*-eabi* \ | kfreebsd*-gnu* \ | knetbsd*-gnu* \ | kopensolaris*-gnu* \ | linux-* \ | managarm-* \ | netbsd*-eabi* \ | netbsd*-gnu* \ | nto-qnx* \ | os2-emx* \ | rtmk-nova* \ | storm-chaos* \ | uclinux-gnu* \ | uclinux-uclibc* \ | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) case $field1-$field2 in # Shorthands that happen to contain a single dash convex-c[12] | convex-c3[248]) basic_machine=$field2-convex basic_os= ;; decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Do not treat sunos as a manufacturer sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers 3100* \ | 32* \ | 3300* \ | 3600* \ | 7300* \ | acorn \ | altos* \ | apollo \ | apple \ | atari \ | att* \ | axis \ | be \ | bull \ | cbm \ | ccur \ | cisco \ | commodore \ | convergent* \ | convex* \ | cray \ | crds \ | dec* \ | delta* \ | dg \ | digital \ | dolphin \ | encore* \ | gould \ | harris \ | highlevel \ | hitachi* \ | hp \ | ibm* \ | intergraph \ | isi* \ | knuth \ | masscomp \ | microblaze* \ | mips* \ | motorola* \ | ncr* \ | news \ | next \ | ns \ | oki \ | omron* \ | pc533* \ | rebel \ | rom68k \ | rombug \ | semi \ | sequent* \ | siemens \ | sgi* \ | siemens \ | sim \ | sni \ | sony* \ | stratus \ | sun \ | sun[234]* \ | tektronix \ | tti* \ | ultra \ | unicom* \ | wec \ | winbond \ | wrs) basic_machine=$field1-$field2 basic_os= ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300) cpu=m68k vendor=motorola ;; # This used to be dpx2*, but that gets the RS6000-based # DPX/20 and the x86-based DPX/2-100 wrong. See # https://oldskool.silicium.org/stations/bull_dpx20.htm # https://www.feb-patrimoine.com/english/bull_dpx2.htm # https://www.feb-patrimoine.com/english/unix_and_bull.htm dpx2 | dpx2[23]00 | dpx2[23]xx) cpu=m68k vendor=bull ;; dpx2100 | dpx21xx) cpu=i386 vendor=bull ;; dpx20) cpu=rs6000 vendor=bull ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x"$basic_os" != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. obj= case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) saved_IFS=$IFS IFS="-" read kernel os <&2 fi ;; *) echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac case $obj in aout* | coff* | elf* | pe*) ;; '') # empty is fine ;; *) echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 exit 1 ;; esac # Here we handle the constraint that a (synthetic) cpu and os are # valid only in combination with each other and nowhere else. case $cpu-$os in # The "javascript-unknown-ghcjs" triple is used by GHC; we # accept it here in order to tolerate that, but reject any # variations. javascript-ghcjs) ;; javascript-* | *-ghcjs) echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ | linux-relibc*- | linux-uclibc*- | linux-ohos*- ) ;; uclinux-uclibc*- | uclinux-gnu*- ) ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) ;; -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel*- ) echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel*- ) echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 exit 1 ;; *-msvc*- ) echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-) ;; vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ;; nto-qnx*-) ;; os2-emx-) ;; rtmk-nova-) ;; *-eabi*- | *-gnueabi*-) ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format ;; -*-) # Blank kernel with real OS is always fine. ;; --*) # Blank kernel and OS with real machine code file format is always fine. ;; *-*-*) echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos* | *-solaris*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: image-acquisition-0.3.3/src/PaxHeaders/__imaq_handler__.cc0000644000000000000000000000013215000642613020516 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/__imaq_handler__.cc0000644000175000017500000005242315000642613021416 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #include #include #include #include "config.h" #ifdef HAVE_LIBV4L2_H #include "cl_v4l2_handler.h" #endif #ifdef HAVE_MFAPI_H #include "cl_mf_handler.h" #endif using namespace std; // PKG_ADD: autoload ("__imaq_enum_devices__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_enum_devices__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_enum_devices__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{l} =} __imaq_enum_devices__ ()\n\ List image capture devices.\n\ @end deftypefn") { #ifdef HAVE_LIBV4L2_H v4l2_handler imgh; #endif #ifdef HAVE_MFAPI_H mf_handler imgh; #endif return octave_value (imgh.enum_devices ()); } // PKG_ADD: autoload ("__imaq_handler_open__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_open__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_open__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{h} =} __imaq_handler_open__ (@var{type}, @var{device})\n\ Creates an instance of imaq_handler for a v4l2 or MF device and opens it.\n\ @seealso{getsnapshot}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage(); return retval; } string type = args(0).string_value (); string device = args(1).string_value (); imaq_handler *h = 0; if (type == "v4l2") #ifdef HAVE_LIBV4L2_H h = new v4l2_handler (); #else error ("octave-image-acquisition was built without v4l2 support"); #endif else if (type == "mf") #ifdef HAVE_MFAPI_H h = new mf_handler (); #else error ("octave-image-acquisition was built without media foundation support"); #endif else error ("unknown interface '%s'", type.c_str()); //octave_stdout << "h = " << h << std::endl; if (h) { h->open (device.c_str (), false); retval.append (octave_value (h)); } return retval; } // PKG_ADD: autoload ("__imaq_handler_querycap__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_querycap__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_querycap__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{c} = } __imaq_handler_querycap__ (@var{h})\n\ Query device capabilities, driver name, card type etc. from imaq_handler @var{h}.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = imgh->querycap (); } return retval; } // INPUTS // PKG_ADD: autoload ("__imaq_handler_enum_inputs__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_enum_inputs__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_enum_inputs__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{inputs} = } __imaq_handler_enum_inputs__ (@var{h})\n\ Enumerate video inputs from @var{h}.\n\ Returns a struct with information for all available inputs.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = imgh->enum_inputs (); } return retval; } // PKG_ADD: autoload ("__imaq_handler_get_input__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_get_input__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_get_input__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{N} =} __imaq_handler_get_input__ (@var{h})\n\ Query the current video input from @var{h}.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = octave_value(imgh->get_input ()); } return retval; } // PKG_ADD: autoload ("__imaq_handler_set_input__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_set_input__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_set_input__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __imaq_handler_set_input__ (@var{h}, @var{n})\n\ Select video input @var{n} for @var{h}.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { if (! args(1).isnumeric()) error("N has to be a integer selecting the desired video input, starting from 0."); else { int num = args(1).int_value (); imgh->set_input (num); } } return retval; } // FORMAT // PKG_ADD: autoload ("__imaq_handler_enum_formats__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_enum_formats__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_enum_formats__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{formats} = } __imaq_handler_enum_formats__ (@var{h})\n\ Enumerate image formats from @var{h}.\n\ Returns a struct with information for all available formats.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = imgh->enum_formats (); } return retval; } // PKG_ADD: autoload ("__imaq_handler_enum_framesizes__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_enum_framesizes__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_enum_framesizes__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{sizes} = } __imaq_handler_enum_framesizes__ (@var{h}, @var{format})\n\ Enumerate available frame sizes from imaq_handler @var{h} for given pixelformat (FOURCC).\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { string pixel_format = args(1).string_value (); retval = octave_value(imgh->enum_framesizes (pixel_format)); } return retval; } // PKG_ADD: autoload ("__imaq_handler_enum_frameintervals__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_enum_frameintervals__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_enum_frameintervals__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{T} = } __imaq_handler_enum_frameintervals__ (@var{h}, @var{fmt}, @var{size})\n\ Enumerate available frame intervals from imaq_handler @var{h}.\n\ Return a Nx2 matrix with numerator, denominator.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 3) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { if (!args (2).is_matrix_type()) print_usage(); else { Matrix s = args(2).matrix_value (); unsigned int width = s(0); unsigned int height = s(1); string pixel_format = args(1).string_value (); retval = octave_value(imgh->enum_frameintervals (pixel_format, width, height)); } } return retval; } // PKG_ADD: autoload ("__imaq_handler_get_frameinterval__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_get_frameinterval__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_get_frameinterval__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{T} = } __imaq_handler_get_frameinterval__ (@var{h})\n\ Return current frame interval as numerator, denominator.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = octave_value(imgh->get_frameinterval ()); } return retval; } // PKG_ADD: autoload ("__imaq_handler_set_frameinterval__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_set_frameinterval__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_set_frameinterval__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{T} = } __imaq_handler_set_frameinterval_ (@var{h}, @var{s})\n\ Set frame interval numerator and denominator.\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { imgh->set_frameinterval(args(1).matrix_value ()); } return retval; } // PKG_ADD: autoload ("__imaq_handler_g_fmt__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_g_fmt__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_g_fmt__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} @var{fmt} = __imaq_handler_g_fmt__ (@var{h})\n\ Get format pixelformat, size[width height].\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = octave_value(imgh->g_fmt ()); } return retval; } // PKG_ADD: autoload ("__imaq_handler_s_fmt__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_s_fmt__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_s_fmt__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __imaq_handler_s_fmt__ (@var{h}, @var{fmt}, @var{size})\n\ Set format @var{fmt}, @var{size} (V4L2_FIELD_INTERLACED).\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 3) { print_usage (); return retval; } if (!args (1).is_string() || !args (2).is_matrix_type()) { print_usage(); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { string fmt = args(1).string_value (); Matrix s = args(2).matrix_value (); unsigned int xres = s(0); unsigned int yres = s(1); imgh->s_fmt (fmt, xres, yres); } return retval; } // CONTROLS // PKG_ADD: autoload ("__imaq_handler_queryctrl__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_queryctrl__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_queryctrl__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{controls} = } __imaq_handler_queryctrl__ (@var{h})\n\ Query controls like brightness, contrast, saturation etc. from imaq_handler @var{h}.\n\ Use the field id for calls to __imaq_handler_s_ctrl__.\n\ @seealso{__imaq_handler_s_ctrl__}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = imgh->queryctrl (); } return retval; } // PKG_ADD: autoload ("__imaq_handler_g_ctrl__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_g_ctrl__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_g_ctrl__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{value} =} __imaq_handler_g_ctrl__ (@var{h}, @var{id})\n\ Get value for control @var{id} from imaq_handler @var{h}.\n\ Use the field id from __imaq_handler_queryctrl__.\n\ @seealso{__imaq_handler_queryctrl__}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage (); return retval; } if (!args (1).isnumeric()) { error("ID has to be an integer value"); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { unsigned int id = args(1).int_value (); retval = octave_value(imgh->g_ctrl (id)); } return retval; } // PKG_ADD: autoload ("__imaq_handler_s_ctrl__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_s_ctrl__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_s_ctrl__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __imaq_handler_s_ctrl__ (@var{h}, @var{id}, @var{value})\n\ Set control @var{id} like brightness, contrast, saturation etc. in imaq_handler @var{h}.\n\ Use the field id from __imaq_handler_queryctrl__.\n\ @seealso{__imaq_handler_queryctrl__}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 3) { print_usage (); return retval; } if (!args (1).isnumeric() || !args (2).isnumeric()) { error("ID and VALUE has to be integer values"); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { unsigned int id = args(1).int_value (); imgh->s_ctrl (id, args(2)); } return retval; } // STREAMING // PKG_ADD: autoload ("__imaq_handler_streamoff__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_streamoff__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_streamoff__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __imaq_handler_streamoff__ (@var{h})\n\ Stop streaming.\n\ @seealso{streamoff}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 1) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) imgh->streamoff (); return retval; } // PKG_ADD: autoload ("__imaq_handler_streamon__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_streamon__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_streamon__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __imaq_handler_streamon__ (@var{h}, @var{n})\n\ Start streaming with @var{n} buffers. It is recommended to use at least 2 buffers.\n\ @seealso{streamoff, getsnapshot}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 2) { print_usage (); return retval; } if (!args (1).isnumeric()) { return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { unsigned int n_buffers = args(1).int_value (); imgh->streamon (n_buffers); } return retval; } // PKG_ADD: autoload ("__imaq_handler_capture__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_capture__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_capture__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{f} =} __imaq_handler_capture__ (@var{h}, @var{preview}, @var{raw_output})\n\ Get a snapshot from @var{h}\n\ @end deftypefn") { octave_value_list retval; int nargin = args.length (); if (nargin != 3) { print_usage (); return retval; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { retval = imgh->capture (nargout, args(1).bool_value (), args(2).bool_value ()); } return retval; } // PKG_ADD: autoload ("__imaq_preview_window_is_shown__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_preview_window_is_shown__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_preview_window_is_shown__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{l} =} __imaq_preview_window_is_shown__ (@var{h})\n\ Return preview_window->shown().\n\ @end deftypefn") { octave_value ret; if (args.length () != 1) { print_usage (); return ret; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) { ret = imgh->preview_window_is_shown (); } return ret; } // PKG_ADD: autoload ("__imaq_handler_set_ITU_standard__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_set_ITU_standard__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_det_ITU_standard__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{l} =} __imaq_handler_set_ITU_standard__ (@var{h}, @var{standard})\n\ Internally set the used ITU standard for YCbCr conversions in capture.\n\ @end deftypefn") { octave_value ret; if (args.length () != 2) { print_usage (); return ret; } imaq_handler* imgh = get_imaq_handler_from_ov (args(0)); if (imgh) imgh->set_ITU_standard (args(1).int_value()); return ret; } // PKG_ADD: autoload ("__imaq_handler_YCbCr_to_RGB__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_YCbCr_to_RGB__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_YCbCr_to_RGB__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{rgb} =} __imaq_handler_YCbCr_to_RGB__ (@var{yuv}, @var{ITU_standard})\n\ Convert YCbCr image (scalar struct with fields Y, Cb, Cr) into uint8 RGB image.\n\ Interpolation of chroma subsampling is done internally.\n\ ITU_standard might be 601, 709 or 2020.\n\ See also ycbcr2rgb from the image package.\n\ @end deftypefn") { return ovl(imaq_handler::YCbCr_to_RGB (args(0), args(1).int_value())); } // PKG_ADD: autoload ("__imaq_handler_JPG_to_RGB__", which ("__imaq_handler__.oct")); // PKG_DEL: autoload ("__imaq_handler_JPG_to_RGB__", which ("__imaq_handler__.oct"), "remove"); DEFUN_DLD(__imaq_handler_JPG_to_RGB__, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{rgb} =} __imaq_handler_JPG_to_RGB__ (@var{jpg})\n\ Convert raw mjpg stream (as returned from the camera) into uint8 RGB image.\n\ @end deftypefn") { return ovl(imaq_handler::JPG_to_RGB (args(0))); } /* %!demo %! vi = __imaq_handler_open__(__test__device__{:}); %! s = __imaq_handler_enum_framesizes__(vi, "MJPG"); # get available frame sizes %! __imaq_handler_s_fmt__(vi, "MJPG", s(1,:)); # use the default framesize %! __imaq_handler_streamon__(vi, 2); # enable streaming with 2 buffers %! l = 200; %! for i=1:l %! __imaq_handler_capture__(vi, 1, 0); # capture 200 frames and show preview %! endfor %! __imaq_handler_streamoff__(vi); # diable streaming %! __imaq_handler_s_fmt__(vi, "MJPG", s(2,:)); # use smales available format %! disp("The image size is now") %! disp(__imaq_handler_g_fmt__(vi)) %! __imaq_handler_streamon__(vi, 2); # enable streaming with 2 buffers %! for i=1:l %! __imaq_handler_capture__(vi, 1, 0); %! endfor %! __imaq_handler_streamoff__(vi); */ /* %!demo %! x = __imaq_handler_open__(__test__device__{:}); %! disp("get controls") %! ctrls = __imaq_handler_queryctrl__(x) %! fieldnames(__imaq_handler_queryctrl__(x)) */ /* %!test %! x = __imaq_handler_open__(__test__device__{:}); %! s = __imaq_handler_enum_framesizes__(x, "MJPG")(end,:); %! __imaq_handler_s_fmt__(x, "MJPG", s); %! t = __imaq_handler_enum_frameintervals__(x, "MJPG", s); %! __imaq_handler_streamon__(x, 2); %! [img, seq, timestamp] = __imaq_handler_capture__(x, 0, 0); %! assert(size(img), [s(2), s(1), 3]); */ /* change controls %!test %! x = __imaq_handler_open__(__test__device__{:}); %! s = __imaq_handler_enum_framesizes__(x, "MJPG"); %! __imaq_handler_s_fmt__(x, "MJPG", s(end,:)); %! ctrls = __imaq_handler_queryctrl__(x); %! if (isfield(ctrls, "brightness")) %! min_brightness = ctrls.brightness.min; %! max_brightness = ctrls.brightness.max; %! __imaq_handler_s_ctrl__(x, ctrls.brightness.id, min_brightness); %! assert(__imaq_handler_g_ctrl__(x, ctrls.brightness.id), min_brightness) %! __imaq_handler_s_ctrl__(x, ctrls.brightness.id, max_brightness); %! assert(__imaq_handler_g_ctrl__(x, ctrls.brightness.id), max_brightness) %! v = round(max_brightness/2); %! __imaq_handler_s_ctrl__(x, ctrls.brightness.id, v); %! assert(__imaq_handler_g_ctrl__(x, ctrls.brightness.id), v); %! endif */ /* check get timeperframe (1/fps). * This may fail for example with some sn9c20x cameras %!test %! x = __imaq_handler_open__(__test__device__{:}); %! r = __imaq_handler_get_frameinterval__(x); */ image-acquisition-0.3.3/src/PaxHeaders/cl_imaq_handler.cc0000644000000000000000000000013215000642613020400 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_imaq_handler.cc0000644000175000017500000003154415000642613021301 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #include #include "cl_imaq_handler.h" #include // for JPG_to_RGB DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(imaq_handler, "imaq_handler", "imaq_handler"); bool imaq_handler::type_loaded = false; imaq_handler::imaq_handler () : octave_base_dld_value(), preview_window(0), ITU_standard (601) { //octave_stdout << "imaq_handler C'Tor, type_loaded = " << type_loaded << endl; if (!type_loaded) { type_loaded = true; imaq_handler::register_type(); //octave_stdout << "imaq_handler C'Tor, type_id() = " << type_id() << std::endl; } } //~ v4l2_handler::v4l2_handler (const v4l2_handler& m) //~ : octave_base_dld_value() //~ { //~ octave_stdout << "v4l2_handler: the copy constructor shouldn't be called" << std::endl; //~ } imaq_handler::~imaq_handler () { //octave_stdout << "imaq_handler D'Tor " << std::endl; // delete preview_window if active if (preview_window) { delete preview_window; preview_window = 0; } } void imaq_handler::print (std::ostream& os, bool pr_as_read_syntax = false) { os << "This is class imaq_handler" << std::endl; //os << "dev = " << dev << ", fd = " << fd << ", n_buffer = " << n_buffer << ", streaming = " << ((streaming)? "true":"false") << std::endl; } octave_scalar_map imaq_handler::open (std::string d, bool quiet) { octave_scalar_map ret; octave_stdout << "imaq_handler::open (d = " << d << " called" << std::endl; return ret; } void imaq_handler::close () { } // RGB3 aka RGB24 // return [height x width x 3] uint8 matrix octave_value imaq_handler::get_RGB24 (void *start, size_t length, uint32_t width, uint32_t height) { dim_vector dv (3, width, height); uint8NDArray img (dv); assert(img.numel() == int(length)); unsigned char *p = reinterpret_cast(img.fortran_vec()); memcpy(p, start, length); Array perm (dim_vector (3, 1)); perm(0) = 2; perm(1) = 1; perm(2) = 0; return octave_value(img.permute (perm)); } // RAW Bayer, 1 byte per pixel // return [height * width] uint8 matrix octave_value imaq_handler::get_raw_bayer1 (void *start, size_t length, uint32_t width, uint32_t height) { dim_vector dv (width, height); uint8NDArray img (dv); assert(img.numel() == int(length)); unsigned char *p = reinterpret_cast(img.fortran_vec()); memcpy(p, start, length); return octave_value(img.transpose ()); } // RAW Bayer, 2 bytes per pixel // return [height * width] uint16 matrix octave_value imaq_handler::get_raw_bayer2 (void *start, size_t length, uint32_t width, uint32_t height) { dim_vector dv (width, height); uint16NDArray img (dv); assert(img.numel()*2 == int(length)); unsigned char *p = reinterpret_cast(img.fortran_vec()); memcpy(p, start, length); return octave_value(img.transpose ()); } // YUYV aka YUV 4:2:2 // https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/pixfmt-yuyv.html // V4L2_PIX_FMT_YUYV is known in the Windows environment as YUY2 // return struct with fields Y, Cb, Cr octave_value imaq_handler::get_YUYV (void *start, size_t length, uint32_t width, uint32_t height) { dim_vector dvy (width, height); dim_vector dvc (width/2, height); uint8NDArray y (dvy); uint8NDArray cb (dvc); uint8NDArray cr (dvc); assert ((y.numel() + cb.numel() + cr.numel()) == int(length)); unsigned int i; unsigned char *s = reinterpret_cast(start); for (i=0; i < (width * height); ++i) y(i) = s[2 * i]; for (i=0; i < (width * height / 2); ++i) { cb(i) = s[4 * i + 1]; cr(i) = s[4 * i + 3]; } octave_scalar_map img; img.assign ("Y", y.transpose ()); img.assign ("Cb", cb.transpose ()); img.assign ("Cr", cr.transpose ()); return octave_value(img); } // YVU420 aka YV12 // see also is_YUV // https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-yuv420.html octave_value imaq_handler::get_YVU420 (void *start, size_t length, uint32_t width, uint32_t height, bool is_YUV) { dim_vector dvy (width, height); dim_vector dvc (width/2, height/2); uint8NDArray y (dvy); uint8NDArray c1 (dvc); uint8NDArray c2 (dvc); assert ((y.numel() + c1.numel() + c2.numel()) == int(length)); // Y unsigned char *p = reinterpret_cast(y.fortran_vec()); memcpy(p, start, y.numel ()); // C1 p = reinterpret_cast(c1.fortran_vec()); memcpy(p, (unsigned char*)start + y.numel (), c1.numel ()); // C2 p = reinterpret_cast(c2.fortran_vec()); memcpy(p, (unsigned char*)start + y.numel () + c1.numel (), c2.numel ()); octave_scalar_map img; img.assign ("Y", y.transpose ()); if (is_YUV) // V4L2_PIX_FMT_YUV420 { img.assign ("Cb", c1.transpose ()); img.assign ("Cr", c2.transpose ()); } else // V4L2_PIX_FMT_YVU420 { img.assign ("Cb", c2.transpose ()); img.assign ("Cr", c1.transpose ()); } return octave_value(img); } // NV12 // https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-nv12.html octave_value imaq_handler::get_NV12 (void *start, size_t length, uint32_t width, uint32_t height) { dim_vector dvy (width, height); dim_vector dvc (width/2, height/2); uint8NDArray y (dvy); uint8NDArray cb (dvc); uint8NDArray cr (dvc); assert ((y.numel() + cb.numel() + cr.numel()) == int(length)); // Y unsigned char *p = reinterpret_cast(y.fortran_vec()); memcpy(p, start, y.numel ()); unsigned char *s = reinterpret_cast(start) + y.numel (); for (unsigned int i = 0; i < (width * height / 4); ++i) { cb(i) = s[2 * i]; cr(i) = s[2 * i + 1]; } octave_scalar_map img; img.assign ("Y", y.transpose ()); img.assign ("Cb", cb.transpose ()); img.assign ("Cr", cr.transpose ()); return octave_value(img); } // Just return the bytes as vector octave_value imaq_handler::get_raw_bytes (void *start, size_t length) { dim_vector dv (length, 1); uint8NDArray img (dv); unsigned char *p = reinterpret_cast(img.fortran_vec()); memcpy(p, start, length); return octave_value(img); } // YCbCr_to_RGB to RGB24 // returns [HxWx3] uint8 matrix with RGB values in the range 0..255 // See also ycbcrfunc.m from the image package and ./tests/cap_yuv.m uint8NDArray imaq_handler::YCbCr_to_RGB (const octave_value& in, int ITU_standard) { //LARGE_INTEGER PerformanceFrequency; //LARGE_INTEGER StartingCounts; //LARGE_INTEGER EndCounts; //QueryPerformanceFrequency(&PerformanceFrequency); //QueryPerformanceCounter(&StartingCounts); // prüfen, ob der input ein octave_scalar_map ist if (! in.isstruct ()) error ("imaq_handler::YCbCr_to_RGB: IN must be a struct"); const octave_scalar_map tmp = in.scalar_map_value (); // prüfen, ob die Felder Y, Cb, Cr vorhanden sind if (! tmp.contents ("Y").is_defined ()) error ("imaq_handler::YCbCr_to_RGB: IN has no field 'Y'"); if (! tmp.contents ("Cb").is_defined ()) error ("imaq_handler::YCbCr_to_RGB: IN has no field 'Cb'"); if (! tmp.contents ("Cr").is_defined ()) error ("imaq_handler::YCbCr_to_RGB: IN has no field 'Cr'"); uint8NDArray Y = tmp.contents ("Y").uint8_array_value(); uint32_t width = Y.dims ()(1); uint32_t height = Y.dims ()(0); uint8NDArray Cb = tmp.contents ("Cb").uint8_array_value(); uint8NDArray Cr = tmp.contents ("Cr").uint8_array_value(); if ((Cb.dims ()(0) != Cr.dims ()(0)) || (Cb.dims ()(1) != Cr.dims ()(1))) error ("imaq_handler::YCbCr_to_RGB: this code expects, that Cb and Cr have the same size"); int v_subs = height / Cb.dims ()(0); int h_subs = width / Cb.dims ()(1); //printf ("DEBUG: v_subs = %i\n", v_subs); //printf ("DEBUG: h_subs = %i\n", h_subs); if (v_subs * Cb.dims ()(0) != height) error ("imaq_handler::YCbCr_to_RGB: vertical subsampling is not an integer"); if (h_subs * Cb.dims ()(1) != width) error ("imaq_handler::YCbCr_to_RGB: horizontal subsampling is not an integer"); unsigned char *pY = reinterpret_cast(Y.fortran_vec()); unsigned char *pCb = reinterpret_cast(Cb.fortran_vec()); unsigned char *pCr = reinterpret_cast(Cr.fortran_vec()); dim_vector dv (height, width, 3); uint8NDArray img (dv); unsigned char *pImg = reinterpret_cast(img.fortran_vec()); double Kb = 0; double Kr = 0; switch (ITU_standard) { // ITU-R BT.601 (formerly CCIR 601) case 601: Kb = 0.114; Kr = 0.299; break; // ITU-R BT.709 standard case 709: Kb = 0.0722; Kr = 0.2116; break; // ITU-R BT.2020 standard case 2020: Kb = 0.0593; Kr = 0.2627; break; default: error ("imaq_handler:YCbCr_to_RGB: unkown ITU_standard %i", ITU_standard); } double Kg = 1 - Kb - Kr; // Directly based on // https://en.wikipedia.org/wiki/YCbCr double f02 = 2 - 2*Kr; double f11 = - Kb/Kg*(2-2*Kb); double f12 = - Kr/Kg*(2-2*Kr); double f21 = 2 - 2*Kb; for (octave_idx_type r = 0; r < height; r++) for (octave_idx_type c = 0; c < width; c++) { // step 1: undo footroom/headroom offset and scaling // y = nominal 0..1 but 8% overshoot and 6% undershoot due to filtering is possible // cb+cr = nominal -0.5..0.5 but 6% over- and undershoot possible double y = (pY[r + c * height] - 16) / 219.0; int chroma_idx = r/v_subs + (c/h_subs) * (height/v_subs); double cb = (pCb[chroma_idx] - 16) / 224.0 - 0.5; double cr = (pCr[chroma_idx] - 16) / 224.0 - 0.5; double rv = 255 * (y + f02 * cr); double gv = 255 * (y + f11*cb + f12*cr); double bv = 255 * (y + f21*cb); rv = (rv > 255)? 255 : ((rv < 0)? 0 : rv); gv = (gv > 255)? 255 : ((gv < 0)? 0 : gv); bv = (bv > 255)? 255 : ((bv < 0)? 0 : bv); pImg [r + c * height + 0 * width * height] = rv; pImg [r + c * height + 1 * width * height] = gv; pImg [r + c * height + 2 * width * height] = bv; } //QueryPerformanceCounter(&EndCounts); //double d = (EndCounts.QuadPart - StartingCounts.QuadPart) / double (PerformanceFrequency.QuadPart); //printf ("d = %.3f ms\n", d * 1e3); return img; } // returns uint8 RGB image uint8NDArray imaq_handler::JPG_to_RGB (const octave_value& in) { // ToDo: Wie prüfen, ob es ein uint8 vector ist? Das müsste bei (M)JPEG der fall sein uint8NDArray img = in.uint8_array_value(); int len = img.numel (); //printf ("len = %i\n", len); unsigned char *p = reinterpret_cast(img.fortran_vec()); struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); jpeg_mem_src(&cinfo, p, len); int r = jpeg_read_header(&cinfo, TRUE); if (r != JPEG_HEADER_OK) fprintf (stderr, "header error r = %i\n", r); //fprintf (stderr, "JPEG_HEADER_TABLES_ONLY = %i\n", JPEG_HEADER_TABLES_ONLY); jpeg_start_decompress(&cinfo); int width = cinfo.output_width; int height = cinfo.output_height; int pixel_size = cinfo.output_components; assert (pixel_size == 3); // FIXME: kann es auch andere geben? Graustufen? //printf ("width = %d, height = %d, pixel_size = %d\n", width, height, pixel_size); // create uint8 RGB image dim_vector dv (3, width, height); uint8NDArray out_img (dv); unsigned char *p_out = reinterpret_cast(out_img.fortran_vec()); while (cinfo.output_scanline < cinfo.output_height) { unsigned char *buffer_array[1]; buffer_array[0] = p_out + (cinfo.output_scanline) * width * pixel_size; jpeg_read_scanlines(&cinfo, buffer_array, 1); //printf ("read line %i\n", cinfo.output_scanline); } //printf ("Proc: Done reading scanlines\n"); jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); Array perm (dim_vector (3, 1)); perm(0) = 2; perm(1) = 1; perm(2) = 0; return out_img.permute (perm); } imaq_handler* get_imaq_handler_from_ov (octave_value ov) { //octave_stdout << "get_imaq_handler_from_ov ov.type_id() = " << ov.type_id() << std::endl; if (ov.type_id() != imaq_handler::static_type_id()) { error("get_imaq_handler_from_ov: Not a valid imaq_handler"); return 0; } imaq_handler* imgh = 0; const octave_base_value& rep = ov.get_rep(); imgh = &((imaq_handler &)rep); return imgh; } image-acquisition-0.3.3/src/PaxHeaders/cl_v4l2_handler.h0000644000000000000000000000013215000642613020102 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_v4l2_handler.h0000644000175000017500000001116115000642613020774 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #ifndef _V4L2_HANDLER_ #define _V4L2_HANDLER_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "cl_imaq_handler.h" #include "cl_img_win.h" #define CLEAR(x) memset(&(x), 0, sizeof(x)) #define xioctl(n, r, p) xioctl_name(n, r, p, #r, __FILE__, __LINE__) //! buffers for mmap struct buffer { void *start; //!< start of buffer size_t length; //!< length in bytes, e.g. 3*640*480 (nColors*width*height) }; /*! * v4l2 wrapper for octave-image-acquisition * * A big help was the Video Grabber example using libv4l by Mauro Carvalho Cheha * https://www.linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/v4l2grab-example.html */ class v4l2_handler: public imaq_handler { public: v4l2_handler (); octave_base_dld_value *clone (void) const // TODO: check if this is okay { octave_stdout << "v4l2_handler clone" << std::endl; return new v4l2_handler (*this); } octave_base_dld_value *empty_clone (void) const // TODO: check if this is okay { octave_stdout << "v4l2_handler empty_clone" << std::endl; return new v4l2_handler (); } ~v4l2_handler (void); octave_map enum_devices (); octave_scalar_map open (std::string d, bool quiet); //!< open a v4l2 device e.g. /dev/video0 void print (std::ostream& os, bool pr_as_read_syntax); //!< print itself on ostream octave_value querycap (); //!< Query device capabilities octave_value enum_inputs (); //!< Enumerate video inputs int get_input (); //!< Query the current video input void set_input (int index); //!< Select video input octave_value enum_formats (); //!< Enumerate image formats Matrix enum_framesizes (std::string pixelformat); //!< Enumerate frame sizes octave_scalar_map g_fmt (); //!< Get current format void s_fmt (std::string fmtstr, uint32_t xres, uint32_t yres); //!< Set format Matrix enum_frameintervals (std::string pixelformat, uint32_t width, uint32_t height); //!< Enumerate frame intervals Matrix get_frameinterval (); void set_frameinterval (Matrix timeperframe); octave_value queryctrl (); //!< Query controls int g_ctrl (int id); //!< Get control void s_ctrl (int id, octave_value val); //!< Set control octave_value_list capture (int nargout, bool preview, bool raw_output);//!< Retrieve captured image from buffer void capture_to_ppm (const char *fn); //!< Retrieve captured image from buffer and save it as ppm void streamon (unsigned int n); //!< start streaming with n buffers void streamoff (); //!< stop streaming void close (); //!< close v4l2 device bool is_video_capture () { return _is_video_capture; } // see https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device // why today video0 and video1 are created simulateneously bool is_meta_capture () { return _is_meta_capture; } private: v4l2_handler (const v4l2_handler& m); static bool type_loaded; int fd; std::string dev; unsigned int n_buffer; struct buffer *buffers; bool streaming; //img_win *preview_window; bool _is_video_capture; bool _is_meta_capture; void xioctl_name (int fh, unsigned long int request, void *arg, const char* name, const char* file, const int line); octave_scalar_map get_osm (struct v4l2_queryctrl queryctrl); void reqbufs (unsigned int n); //!< Initiate Memory Mapping or User Pointer I/O void mmap (); void qbuf (); void munmap (); octave_scalar_map expand_cap (unsigned int cap); }; #endif image-acquisition-0.3.3/src/PaxHeaders/configure0000644000000000000000000000013215000642613016673 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/configure0000755000175000017500000044073315000642613017603 0ustar00andyandy00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for Octave-Forge image-acquisition package 0.3.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: andy.weber.aw@gmail.com about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Octave-Forge image-acquisition package' PACKAGE_TARNAME='octave-forge-image-acquisition-package' PACKAGE_VERSION='0.3.0' PACKAGE_STRING='Octave-Forge image-acquisition package 0.3.0' PACKAGE_BUGREPORT='andy.weber.aw@gmail.com' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_cxx_list= ac_func_cxx_list= ac_subst_vars='LTLIBOBJS host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBOBJS FLTK_CONFIG HAVE_MKOCTFILE OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Octave-Forge image-acquisition package 0.3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/octave-forge-image-acquisition-package] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Octave-Forge image-acquisition package 0.3.0:";; esac cat <<\_ACEOF Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Octave-Forge image-acquisition package configure 0.3.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_cxx_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_compile # ac_fn_cxx_check_func LINENO FUNC VAR # ------------------------------------ # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_cxx_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. */ #include #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_func # ac_fn_cxx_try_run LINENO # ------------------------ # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_cxx_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Octave-Forge image-acquisition package $as_me 0.3.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " as_fn_append ac_header_cxx_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_cxx_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_cxx_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_cxx_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_cxx_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_cxx_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_cxx_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_cxx_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_cxx_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_cxx_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" as_fn_append ac_func_cxx_list " getpagesize HAVE_GETPAGESIZE" # Auxiliary files required by this configure script. ac_aux_files="config.guess config.sub" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 printf %s "checking whether the C++ compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 printf %s "checking for C++ compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Extract the first word of "mkoctfile", so it can be a program name with args. set dummy mkoctfile; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_HAVE_MKOCTFILE+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$HAVE_MKOCTFILE"; then ac_cv_prog_HAVE_MKOCTFILE="$HAVE_MKOCTFILE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_MKOCTFILE="yes" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_HAVE_MKOCTFILE" && ac_cv_prog_HAVE_MKOCTFILE="no" fi fi HAVE_MKOCTFILE=$ac_cv_prog_HAVE_MKOCTFILE if test -n "$HAVE_MKOCTFILE"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $HAVE_MKOCTFILE" >&5 printf "%s\n" "$HAVE_MKOCTFILE" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test $HAVE_MKOCTFILE = "no"; then as_fn_error $? "mkoctfile required to install $PACKAGE_NAME" "$LINENO" 5 fi # Extract the first word of "fltk-config", so it can be a program name with args. set dummy fltk-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_FLTK_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop case $FLTK_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_FLTK_CONFIG="$FLTK_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_FLTK_CONFIG="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_FLTK_CONFIG" && ac_cv_path_FLTK_CONFIG="no" ;; esac fi FLTK_CONFIG=$ac_cv_path_FLTK_CONFIG if test -n "$FLTK_CONFIG"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FLTK_CONFIG" >&5 printf "%s\n" "$FLTK_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test $FLTK_CONFIG = "no"; then as_fn_error $? "fltk-config required to install $PACKAGE_NAME" "$LINENO" 5 else LIBS="`$FLTK_CONFIG --ldflags` $LIBS" printf "%s\n" "#define HAVE_FLTK 1" >>confdefs.h fi # Checks for libraries. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for v4l2_open in -lv4l2" >&5 printf %s "checking for v4l2_open in -lv4l2... " >&6; } if test ${ac_cv_lib_v4l2_v4l2_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lv4l2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int v4l2_open (); } int main (void) { return conftest::v4l2_open (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_v4l2_v4l2_open=yes else $as_nop ac_cv_lib_v4l2_v4l2_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_v4l2_v4l2_open" >&5 printf "%s\n" "$ac_cv_lib_v4l2_v4l2_open" >&6; } if test "x$ac_cv_lib_v4l2_v4l2_open" = xyes then : printf "%s\n" "#define HAVE_LIBV4L2 1" >>confdefs.h LIBS="-lv4l2 $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jpeg_destroy_compress in -ljpeg" >&5 printf %s "checking for jpeg_destroy_compress in -ljpeg... " >&6; } if test ${ac_cv_lib_jpeg_jpeg_destroy_compress+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ljpeg $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int jpeg_destroy_compress (); } int main (void) { return conftest::jpeg_destroy_compress (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_jpeg_jpeg_destroy_compress=yes else $as_nop ac_cv_lib_jpeg_jpeg_destroy_compress=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_destroy_compress" >&5 printf "%s\n" "$ac_cv_lib_jpeg_jpeg_destroy_compress" >&6; } if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = xyes then : printf "%s\n" "#define HAVE_LIBJPEG 1" >>confdefs.h LIBS="-ljpeg $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MFStartup in -lmfplat" >&5 printf %s "checking for MFStartup in -lmfplat... " >&6; } if test ${ac_cv_lib_mfplat_MFStartup+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmfplat $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int MFStartup (); } int main (void) { return conftest::MFStartup (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_mfplat_MFStartup=yes else $as_nop ac_cv_lib_mfplat_MFStartup=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mfplat_MFStartup" >&5 printf "%s\n" "$ac_cv_lib_mfplat_MFStartup" >&6; } if test "x$ac_cv_lib_mfplat_MFStartup" = xyes then : LIBS="-lmfplat -lmf -lmfreadwrite -lmfuuid -lshlwapi -lole32 -lksguid -lamstrmid $LIBS" fi # Checks for header files. ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 printf %s "checking for $ac_hdr that defines DIR... " >&6; } if eval test \${$as_ac_Header+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main (void) { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval "$as_ac_Header=yes" else $as_nop eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes" then : cat >>confdefs.h <<_ACEOF #define `printf "%s\n" "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 printf %s "checking for library containing opendir... " >&6; } if test ${ac_cv_search_opendir+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int opendir (); } int main (void) { return conftest::opendir (); ; return 0; } _ACEOF for ac_lib in '' dir do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO" then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_opendir+y} then : break fi done if test ${ac_cv_search_opendir+y} then : else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 printf %s "checking for library containing opendir... " >&6; } if test ${ac_cv_search_opendir+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int opendir (); } int main (void) { return conftest::opendir (); ; return 0; } _ACEOF for ac_lib in '' x do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO" then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_opendir+y} then : break fi done if test ${ac_cv_search_opendir+y} then : else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi ac_header= ac_cache= for ac_item in $ac_header_cxx_list do if test $ac_cache; then ac_fn_cxx_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes then : printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes then : printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes then : printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ioctl_h" = xyes then : printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h fi # check for v4l2 headers ac_fn_cxx_check_header_compile "$LINENO" "libv4l2.h" "ac_cv_header_libv4l2_h" "$ac_includes_default" if test "x$ac_cv_header_libv4l2_h" = xyes then : printf "%s\n" "#define HAVE_LIBV4L2_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "linux/videodev2.h" "ac_cv_header_linux_videodev2_h" "$ac_includes_default" if test "x$ac_cv_header_linux_videodev2_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_VIDEODEV2_H 1" >>confdefs.h fi # check for jpeg headers ac_fn_cxx_check_header_compile "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default" if test "x$ac_cv_header_jpeglib_h" = xyes then : printf "%s\n" "#define HAVE_JPEGLIB_H 1" >>confdefs.h fi # check for Media Foundation headers ac_fn_cxx_check_header_compile "$LINENO" "mfapi.h" "ac_cv_header_mfapi_h" "$ac_includes_default" if test "x$ac_cv_header_mfapi_h" = xyes then : printf "%s\n" "#define HAVE_MFAPI_H 1" >>confdefs.h fi # check for fltk headers for ac_header in FL/Fl.H FL/Fl_Double_Window.H FL/fl_draw.H do : as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes" then : cat >>confdefs.h <<_ACEOF #define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else $as_nop as_fn_error $? "unable to find the needed fltk headers" "$LINENO" 5 fi done # Checks for library functions. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 printf %s "checking for error_at_line... " >&6; } if test ${ac_cv_lib_error_at_line+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_error_at_line=yes else $as_nop ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 printf "%s\n" "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then case " $LIBOBJS " in *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_func= for ac_item in $ac_func_cxx_list do if test $ac_func; then ac_fn_cxx_check_func "$LINENO" $ac_func ac_cv_func_$ac_func if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then echo "#define $ac_item 1" >> confdefs.h fi ac_func= else ac_func=$ac_item fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 printf %s "checking for working mmap... " >&6; } if test ${ac_cv_func_mmap_fixed_mapped+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # (( # Guess yes on platforms where we know the result. linux*) ac_cv_func_mmap_fixed_mapped=yes ;; # If we don't know, assume the worst. *) ac_cv_func_mmap_fixed_mapped=no ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main (void) { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); free (data); free (data3); return 0; } _ACEOF if ac_fn_cxx_try_run "$LINENO" then : ac_cv_func_mmap_fixed_mapped=yes else $as_nop ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 printf "%s\n" "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then printf "%s\n" "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 printf %s "checking for GNU libc compatible realloc... " >&6; } if test ${ac_cv_func_realloc_0_nonnull+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : case "$host_os" in # (( # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | hpux* | solaris* | cygwin* | mingw* | msys* ) ac_cv_func_realloc_0_nonnull=yes ;; # If we don't know, assume the worst. *) ac_cv_func_realloc_0_nonnull=no ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { void *p = realloc (0, 0); int result = !p; free (p); return result; ; return 0; } _ACEOF if ac_fn_cxx_try_run "$LINENO" then : ac_cv_func_realloc_0_nonnull=yes else $as_nop ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 printf "%s\n" "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes then : printf "%s\n" "#define HAVE_REALLOC 1" >>confdefs.h else $as_nop printf "%s\n" "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac printf "%s\n" "#define realloc rpl_realloc" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "munmap" "ac_cv_func_munmap" if test "x$ac_cv_func_munmap" = xyes then : printf "%s\n" "#define HAVE_MUNMAP 1" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = xyes then : printf "%s\n" "#define HAVE_SELECT 1" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes then : printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Octave-Forge image-acquisition package $as_me 0.3.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ Octave-Forge image-acquisition package config.status 0.3.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $PACKAGE_NAME is now configured with LIBS: $LIBS " >&5 printf "%s\n" "$as_me: $PACKAGE_NAME is now configured with LIBS: $LIBS " >&6;} image-acquisition-0.3.3/src/PaxHeaders/Makefile.in0000644000000000000000000000013215000642613017034 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/Makefile.in0000644000175000017500000000107115000642613017725 0ustar00andyandy00000000000000.PHONY: all clean distclean realclean OCT := __imaq_handler__.oct OBJ := cl_imaq_handler.o cl_v4l2_handler.o cl_mf_handler.o cl_img_win.o MKOCTFILE ?= mkoctfile MKOCTFLAGS ?= -Wall -v all: $(OBJ) $(OCT) debug : MKOCTFLAGS += -ggdb -O0 debug : all %.o: %.cc %.h $(MKOCTFILE) $(MKOCTFLAGS) -c $< %.oct: %.cc $(OBJ) $(MKOCTFILE) $(MKOCTFLAGS) $^ @LIBS@ -o $@ clean: rm -f *.oct *.o rm -f octave-core octave-workspace distclean: clean rm -f Makefile config.status config.log config.h realclean: distclean rm -f configure config.h.in rm -rf autom4te.cache image-acquisition-0.3.3/src/PaxHeaders/config.guess0000644000000000000000000000013215000642613017304 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/config.guess0000644000175000017500000014306715000642613020211 0ustar00andyandy00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2024-07-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system '$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still # use 'HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c17 c99 c89 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #if defined(__ANDROID__) LIBC=android #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #elif defined(__LLVM_LIBC__) LIBC=llvm #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like '4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-pc-managarm-mlibc" ;; *:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __ARM_EABI__ #ifdef __ARM_PCS_VFP ABI=eabihf #else ABI=eabi #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; esac fi GUESS=$CPU-unknown-linux-$LIBCABI ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:cos:*:*) GUESS=$UNAME_MACHINE-unknown-cos ;; kvx:mbr:*:*) GUESS=$UNAME_MACHINE-unknown-mbr ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __i386__ ABI=x86 #else #ifdef __ILP32__ ABI=x32 #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in x86) CPU=i686 ;; x32) LIBCABI=${LIBC}x32 ;; esac fi GUESS=$CPU-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; ppc:Haiku:*:*) # Haiku running on Apple PowerPC GUESS=powerpc-apple-haiku ;; *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) GUESS=$UNAME_MACHINE-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; *:Ironclad:*:*) GUESS=$UNAME_MACHINE-unknown-ironclad ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif int main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: image-acquisition-0.3.3/src/PaxHeaders/cl_img_win.cc0000644000000000000000000000013215000642613017405 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_img_win.cc0000644000175000017500000000477515000642613020314 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . /*! 10.01.2014 Andreas Weber /file img_win.cpp */ #include "config.h" #ifdef HAVE_FLTK #include "cl_img_win.h" #include #include img_win::img_win (int x, int y, int w, int h) :Fl_Double_Window (x, y, w, h, "img_win"), pixel(NULL), is_RGB(0) { Fl::visual(FL_RGB); //cout << "img_win::img_win C'Tor w = " << w << ", h = " << h << endl; // create test image uchar *tmp = (uchar *) malloc (w*h); for(int x=0; x // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #include "config.h" #ifdef HAVE_MFAPI_H #include #include #include // for transform #include "cl_mf_handler.h" #define CHECK(hr) if (!SUCCEEDED(hr)) fprintf (stderr, "%s:%s:%i failed with %li\n", __FILE__, __FUNCTION__, __LINE__, GetLastError()); mf_handler::mf_handler () : imaq_handler(), device (0), reader (0) /*streaming(0), preview_window(0)*/ { //octave_stdout << "mf_handler C'Tor, type_id() = " << type_id() << std::endl; HRESULT hr; hr = CoInitializeEx(0, COINIT_MULTITHREADED); CHECK(hr); hr = MFStartup(MF_VERSION, MFSTARTUP_NOSOCKET); CHECK(hr); } mf_handler::mf_handler (const mf_handler& m) : imaq_handler(), device (0), reader (0) { octave_stdout << "mf_handler: the copy constructor shouldn't be called" << std::endl; } mf_handler::~mf_handler () { //octave_stdout << "mf_handler D'Tor " << endl; // stop streaming, unmap & free buffers, close device close(); MFShutdown(); CoUninitialize(); } void mf_handler::print (std::ostream& os, bool pr_as_read_syntax = false) { os << "This is class mf_handler" << std::endl; if (reader) { octave_scalar_map fmt = g_fmt (); std::string fourcc = fmt.contents("fourcc").string_value (); uint32NDArray s = fmt.contents("size").uint32_array_value (); os << " fourcc = " << fourcc << std::endl; os << " size = " << s(0) << "x" << s(1) << std::endl; } else os << " closed (reader == NULL)" << std::endl; } // https://learn.microsoft.com/en-us/archive/msdn-magazine/2016/september/c-unicode-encoding-conversions-with-stl-strings-and-win32-apis std::string wchar_to_utf8 (LPWSTR val) { int len = WideCharToMultiByte(CP_UTF8, 0, val, -1, 0, 0, 0, 0); //printf ("DEBUG: len = %i\n", len); // FIXME/TODO: check if the conversion can be made directly into std::string char buf[len]; WideCharToMultiByte(CP_UTF8, 0, val, -1, buf, len, 0, 0); //printf ("DEBUG: wchar_to_utf8 returns '%s'\n", buf); return buf; } std::string GetAllocatedString (IMFActivate* device, REFGUID guidKey) { UINT32 length; LPWSTR val; HRESULT hr = device->GetAllocatedString(guidKey, &val, &length); CHECK(hr); std::string ret = wchar_to_utf8 (val); CoTaskMemFree(val); return ret; } std::wstring utf8_to_wstring (const std::string &in) { int len = MultiByteToWideChar(CP_UTF8, 0, in.c_str(), -1, 0, 0); if (len == 0) { fprintf (stderr, "ERROR: in utf8_to_wchar, MultiByteToWideChar returned len = %i\n", len); return std::wstring(); } else { std::wstring wide_str (len, 0); MultiByteToWideChar(CP_UTF8, 0, in.c_str(), -1, &wide_str[0], len); //wcout << L"DEBUG: Converted wide string: " << wide_str << std::endl; return wide_str; } } octave_map mf_handler::enum_devices () { octave_map retval; HRESULT hr; // Wie viele Geräte gibt es? UINT32 count; IMFActivate** devices; { IMFAttributes* attr; hr = MFCreateAttributes(&attr, 1); CHECK(hr); attr->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID); CHECK(hr); hr = MFEnumDeviceSources(attr, &devices, &count); CHECK(hr); attr->Release(); } //printf("Detected %u devices...\n", count); // Über alle erkannten devices loopen for (UINT32 i = 0; i < count; i++) { octave_scalar_map dev; dev.assign ("name", GetAllocatedString (devices[i], MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME)); dev.assign ("symlink", GetAllocatedString (devices[i], MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK)); //uint32_t tmp; //hr = devices[i]->GetUINT32 (MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_MAX_BUFFERS, &tmp); //CHECK (hr); //dev.assign ("max_buffers", tmp); retval.assign(octave_idx_type(i), dev); devices[i]->Release(); } CoTaskMemFree(devices); return retval; } octave_scalar_map mf_handler::open (std::string d, bool quiet) { HRESULT hr; octave_scalar_map ret; //octave_stdout << "DEBUG: mf_handler::open (d = '" << d << "') called" << std::endl; // ToDo: Muss man schauen, welche ID unter windoze Sinn macht. Vorerst symlink weil eindeutig std::wstring symlink = utf8_to_wstring (d); // create device from symlink { IMFAttributes* attr; hr = MFCreateAttributes(&attr, 2); CHECK(hr); hr = attr->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID); CHECK(hr); // Bis hier fast identisch zu enum_devices, jetzt wird weiter eingeschränkt über symlink hr = attr->SetString(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, symlink.c_str()); CHECK(hr); // bei enum_devices MFEnumDeviceSources... hr = MFCreateDeviceSource(attr, &device); CHECK(hr); // man könnte überlegen den Code hier mit dem aus enum_devices zusammenzulegen und // den Filter nach symlink optional... attr->Release(); } // create reader hr = MFCreateSourceReaderFromMediaSource(device, NULL, &reader); CHECK(hr); //enum_formats (); //s_fmt ("MJPG", 640, 480); return ret; } octave_value mf_handler::querycap () { // ToDo: Is it possible to get some infos from the media foundation device? octave_scalar_map st; st.assign ("driver", "uvcvideo"); st.assign ("card", "not implemented"); st.assign ("bus_info", "not implemented"); st.assign ("version", "not implemented"); st.assign ("capabilities", "not implemented"); return octave_value (st); } octave_value mf_handler::enum_inputs () { //octave_stdout << "warning: mf_handler::enum_inputs isn't implemented yet, it always returns one dummy entry" << std::endl; octave_map ret; octave_scalar_map st; st.assign ("name", "dummy input"); st.assign ("type", "not yet implemented"); st.assign ("audioset", (unsigned int) 0); st.assign ("tuner", (unsigned int) 0); st.assign ("std", (unsigned int) 0); st.assign ("status", (unsigned int) 0); st.assign ("capabilities", (unsigned int) 0); ret.assign(0, st); return octave_value(ret); } int mf_handler::get_input () { //octave_stdout << "warning: mf_handler::get_input isn't implemented yet, it always returns 0" << std::endl; return 0; } void mf_handler::set_input (int index) { //octave_stdout << "warning: mf_handler::set_input isn't implemented yet, a function call has no effect" << std::endl; } octave_map mf_handler::loop_native_media_types () { octave_map ret; // enumerating output formats from // https://learn.microsoft.com/en-us/windows/win32/medfound/processing-media-data-with-the-source-reader // https://stackoverflow.com/questions/7968547/how-to-get-a-list-of-all-microsoft-media-foundation-transforms-mfts-available HRESULT hr; IMFMediaType *pType = NULL; DWORD dwMediaTypeIndex = 0; while (SUCCEEDED(hr = reader->GetNativeMediaType(MF_SOURCE_READER_FIRST_VIDEO_STREAM, dwMediaTypeIndex, &pType))) { //printf ("dwMediaTypeIndex = %i\n", dwMediaTypeIndex); ret.assign(octave_idx_type(dwMediaTypeIndex), g_fmt (pType)); pType->Release(); ++dwMediaTypeIndex; } return ret; } octave_value mf_handler::enum_formats () { Cell tmp = loop_native_media_types().contents("fourcc"); string_vector sv = tmp.string_vector_value ().sort (true); // make struct array for v4l2 compatibility octave_map ret; for (int k = 0; k < sv.numel (); ++k) { octave_scalar_map sm; sm.assign ("fourcc", sv(k)); ret.assign(octave_idx_type(k), sm); } return octave_value(ret); } Matrix mf_handler::enum_framesizes (std::string pixelformat) { octave_map tmp = loop_native_media_types(); dim_vector dv (tmp.numel (), 2); Matrix ret(dv); int n = 0; for (int k = 0; k < tmp.numel (); ++k) { if (tmp.contents("fourcc")(k).string_value() == pixelformat) { Matrix frame_size = tmp.contents("size")(k).matrix_value(); //printf ("%i %f %f\n", k, frame_size(0), frame_size(1)); ret(n, 0) = frame_size(0); ret(n++, 1) = frame_size(1); } } ret.resize(n, 2); Array ridx = ret.sort_rows_idx (ASCENDING); ret = ret.index (ridx, octave::idx_vector::colon); // unique for (int k = ret.rows() - 1; k > 0; k--) { if (ret(k, 0) == ret (k-1, 0) && ret(k, 1) == ret (k-1, 1)) ret.delete_elements(0, k); } return ret; } Matrix mf_handler::enum_frameintervals (std::string pixelformat, uint32_t width, uint32_t height) { octave_map tmp = loop_native_media_types(); dim_vector dv (tmp.numel (), 2); Matrix ret(dv); int n = 0; for (int k = 0; k < tmp.numel (); ++k) { if (tmp.contents("fourcc")(k).string_value() == pixelformat) { Matrix frame_size = tmp.contents("size")(k).matrix_value(); //printf ("%i %f %f\n", k, frame_size(0), frame_size(1)); if (frame_size (0) == width && frame_size(1) == height) { Matrix frame_interval = tmp.contents("frame_rate")(k).matrix_value(); //printf ("%i %f %f\n", k, frame_interval(0), frame_interval(1)); ret(n, 0) = frame_interval(0); ret(n++, 1) = frame_interval(1); } } } ret.resize(n, 2); Array ridx = ret.sort_rows_idx (ASCENDING); ret = ret.index (ridx, octave::idx_vector::colon); // unique for (int k = ret.rows() - 1; k > 0; k--) { if (ret(k, 0) == ret (k-1, 0) && ret(k, 1) == ret (k-1, 1)) ret.delete_elements(0, k); } return ret; } Matrix mf_handler::get_frameinterval () { octave_scalar_map tmp = g_fmt (); return tmp.contents("frame_rate").matrix_value (); } // TODO/FIXME: If the set frame_rate is not within MF_MT_FRAME_RATE_RANGE_MIN and MF_MT_FRAME_RATE_RANGE_MAX, // it's silently ignored. (get_frameinterval still returns the set frame_rate) void mf_handler::set_frameinterval (Matrix timeperframe) { IMFMediaType* type; HRESULT hr = MFCreateMediaType(&type); CHECK(hr); hr = reader->GetCurrentMediaType (MF_SOURCE_READER_FIRST_VIDEO_STREAM, &type); CHECK(hr); UINT32 unDenominator = timeperframe(0); UINT32 unNumerator = timeperframe(1); hr = MFSetAttributeRatio(type, MF_MT_FRAME_RATE, unNumerator, unDenominator); CHECK (hr); hr = reader->SetCurrentMediaType (MF_SOURCE_READER_FIRST_VIDEO_STREAM, NULL, type); CHECK(hr); if (! SUCCEEDED (hr)) error ("mf_handler::set_frameinterval (%u, %u) SetCurrentMediaType failed", unNumerator, unDenominator); type->Release (); } static GUID GetMediaTypeGUIDFromFourCC (const std::string& fourCC) { if (fourCC.length () != 4) error ("FourCC must have exactly 4 characters."); // corresponds to: // #define FCC(ch4) ((((DWORD) (ch4) &0xff) << 24) | (((DWORD) (ch4) &0xff00) << 8) | (((DWORD) (ch4) &0xff0000) >> 8) | (((DWORD) (ch4) &0xff000000) >> 24)) DWORD fourCCValue = (DWORD)fourCC[0] | ((DWORD)fourCC[1] << 8) | ((DWORD)fourCC[2] << 16) | ((DWORD)fourCC[3] << 24); // corresponds to: // #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } // From https://learn.microsoft.com/en-us/windows/win32/medfound/video-subtype-guids: // ...A range of GUIDs is reserved for representing these FOURCC values as subtypes. // These GUIDs have the form XXXXXXXX-0000-0010-8000-00AA00389B71, // where XXXXXXXX is the 4-byte FOURCC code or D3DFORMAT value... // #define DEFINE_MEDIATYPE_GUID(name, format) DEFINE_GUID (name, format, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); return {fourCCValue, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}}; } std::string GetFourCCFromMediaTypeGUID (GUID sub) { // get FOURCC // https://learn.microsoft.com/en-us/windows/win32/medfound/video-subtype-guids // https://learn.microsoft.com/en-us/windows/win32/api/guiddef/ns-guiddef-guid // Data1: first 8 hexadecimal digits // Data2: first group of 4 hexadecimal digits // Data3: second group of 4 hexadecimal digits // Data4: Array of 8 bytes. // The first 2 bytes contain the third group of 4 hexadecimal digits. // The remaining 6 bytes contain the final 12 hexadecimal digits. // First 4 bytes are FOURCC char tmp_fourcc[5]; tmp_fourcc[0] = int8_t (sub.Data1 & 0xff); tmp_fourcc[1] = int8_t ((sub.Data1 & 0xff00) >> 8); tmp_fourcc[2] = int8_t ((sub.Data1 & 0xff0000) >> 16); tmp_fourcc[3] = int8_t ((sub.Data1 & 0xff000000) >> 24); tmp_fourcc[4] = 0; return std::string(tmp_fourcc); } void mf_handler::s_fmt (std::string fmtstr, uint32_t xres, uint32_t yres) { //cout << "mf_handler::s_fmt (" << fmtstr << ", " << xres << ", " << yres << ") called" << endl; // typically webcams provide YUV2 format, you'll need to convert it to // RGB yourself or with help of IMFTransform // you can enumerate all supported types with IMFSourceReader_GetNativeMediaType // if (streaming) // { // error("mf_handler::s_fmt: you have to stop streaming first"); // } // else { { IMFMediaType* type; HRESULT hr = MFCreateMediaType(&type); CHECK(hr); hr = type->SetGUID (MF_MT_MAJOR_TYPE, MFMediaType_Video); CHECK(hr); // first try some mapping if user uses non FourCC code if (fmtstr == "YUYV") // GNU/Linux v4l2 compatibility hr = type->SetGUID (MF_MT_SUBTYPE, MFVideoFormat_YUY2); #if WDK_NTDDI_VERSION >= NTDDI_WIN10_RS3 else if (fmtstr == "AV1") hr = type->SetGUID (MF_MT_SUBTYPE, MFVideoFormat_AV1); #endif else if (fmtstr == "HEVC_ES") hr = type->SetGUID (MF_MT_SUBTYPE, MFVideoFormat_HEVC_ES); #if NTDDI_VERSION >= NTDDI_WIN10_FE else if (fmtstr == "Theora") hr = type->SetGUID (MF_MT_SUBTYPE, MFVideoFormat_Theora); #endif else if (fmtstr == "DVC") hr = type->SetGUID (MF_MT_SUBTYPE, MFVideoFormat_DVC); else // the standard path: convert FourCC to GUID hr = type->SetGUID (MF_MT_SUBTYPE, GetMediaTypeGUIDFromFourCC (fmtstr)); CHECK(hr); if (xres && yres) { // set frame size UINT64 tmp = ((UINT64)xres << 32) | yres; hr = type->SetUINT64(MF_MT_FRAME_SIZE, tmp); CHECK(hr); } // finally call SetCurrentMediaType hr = reader->SetCurrentMediaType (MF_SOURCE_READER_FIRST_VIDEO_STREAM, NULL, type); CHECK(hr); if (! SUCCEEDED (hr)) error ("mf_handler::s_fmt (%s, %u, %u) SetCurrentMediaType failed", fmtstr.c_str(), xres, yres); type->Release (); } // ToDo: hier wie bei v4l2 warning, wenn der Treiber das Format geändert hat? g_fmt (); } } octave_scalar_map mf_handler::g_fmt (IMFMediaType *pType) { octave_scalar_map ret; HRESULT hr; // get frame size { UINT64 tmp; hr = pType->GetUINT64(MF_MT_FRAME_SIZE, &tmp); CHECK(hr); UINT32 width = (UINT32)(tmp >> 32); UINT32 height = (UINT32)(tmp); //printf("DEBUG: Readback Size = %ux%u\n", width, height); Matrix s(1,2); s(0) = width; s(1) = height; ret.assign ("size", s); } // get frame rate range { UINT32 unNumerator_min = 0; UINT32 unDenominator_min = 0; hr = MFGetAttributeRatio(pType, MF_MT_FRAME_RATE_RANGE_MIN, &unNumerator_min, &unDenominator_min); CHECK (hr); //printf ("MF_MT_FRAME_RATE_RANGE_MIN = %i/%i\n", unNumerator_min, unDenominator_min); UINT32 unNumerator_max = 0; UINT32 unDenominator_max = 0; hr = MFGetAttributeRatio(pType, MF_MT_FRAME_RATE_RANGE_MAX, &unNumerator_max, &unDenominator_max); CHECK (hr); //printf ("MF_MT_FRAME_RATE_RANGE_MAX = %i/%i\n", unNumerator_max, unDenominator_max); UINT32 unNumerator = 0; UINT32 unDenominator = 0; hr = MFGetAttributeRatio(pType, MF_MT_FRAME_RATE, &unNumerator, &unDenominator); CHECK (hr); //printf ("MF_MT_FRAME_RATE = %i/%i\n", unNumerator, unDenominator); // TODO: all of my tests with uvcvideo returned equal values for _MIN and _MAX // but can we be sure? assert (unNumerator_min == unNumerator_max); assert (unDenominator_min == unDenominator_max); assert (unNumerator_min == unNumerator); assert (unDenominator_min == unDenominator); // Some items return odd ratios, for example uvcvideo C270 // MF_MT_SUBTYPE_CLSID = {32595559-0000-0010-8000-00AA00389B71} // YUY2 1280x720 // unNumerator = 10000000, unDenominator = 1333333 // where v4l2 return 15/2 as expected... // FIXME: if all three are equal, there is no need to return them all //Matrix fr_min (1, 2); //fr_min(0) = unDenominator_min; //fr_min(1) = unNumerator_min; //ret.assign ("frame_rate_min", fr_min); //Matrix fr_max (1, 2); //fr_max(0) = unDenominator_max; //fr_max(1) = unNumerator_max; //ret.assign ("frame_rate_max", fr_max); Matrix fr (1, 2); fr(0) = unDenominator; fr(1) = unNumerator; ret.assign ("frame_rate", fr); } // get FourCC { GUID sub; hr = pType->GetGUID (MF_MT_SUBTYPE, &sub); CHECK(hr); ret.assign ("fourcc", GetFourCCFromMediaTypeGUID (sub)); // get CLSID as string (informational purpose only) OLECHAR* guidString; StringFromCLSID(sub, &guidString); //printf ("DEBUG: guidString = '%S'\n", guidString); ret.assign ("MF_MT_SUBTYPE_CLSID", wchar_to_utf8 (guidString)); ::CoTaskMemFree(guidString); } // check if it's a compressed format // TODO/FIXME: not tested yet { int fCompressed = 0; hr = pType->IsCompressedFormat (&fCompressed); CHECK(hr) ret.assign ("flags_compressed", fCompressed); // GetNativeMediaType should only return native formats ret.assign ("flags_emulated", false); } return ret; } octave_scalar_map mf_handler::g_fmt () { octave_scalar_map ret; IMFMediaType* pType; HRESULT hr = reader->GetCurrentMediaType (MF_SOURCE_READER_FIRST_VIDEO_STREAM, &pType); CHECK(hr); ret = g_fmt (pType); pType->Release (); return ret; } octave_scalar_map get_ctrl_range (IMFMediaSource* device, long src_obj, long prop) { octave_scalar_map ctrl; long min, max, step, def, control; long current_value = 0; long flags = 0; HRESULT hr = 0; HRESULT hr2 = 0; if (src_obj == 0) { IAMCameraControlPtr spCameraControl(device); if(spCameraControl) { hr = spCameraControl->GetRange(prop, &min, &max, &step, &def, &control); hr2 = spCameraControl->Get(prop, ¤t_value, &flags); } } else if (src_obj == 1) { IAMVideoProcAmpPtr spVideo(device); if(spVideo) { hr = spVideo->GetRange(prop, &min, &max, &step, &def, &control); hr2 = spVideo->Get(prop, ¤t_value, &flags); } } if(SUCCEEDED(hr)) { ctrl.assign ("id", int((src_obj << 16) + prop)); // von Andy erdacht. Möglicherweise wäre die UUID hier sinnvoller ctrl.assign ("min", min); ctrl.assign ("max", max); ctrl.assign ("step", step); ctrl.assign ("default", def); ctrl.assign ("control", control); } if(SUCCEEDED(hr2)) { ctrl.assign ("value", current_value); ctrl.assign ("flags", flags); } return ctrl; } octave_value mf_handler::queryctrl () { octave_scalar_map ctrls; // It looks like media foundation has a fixed num of properties, see // https://learn.microsoft.com/de-de/windows/win32/api/strmif/ne-strmif-cameracontrolproperty // or https://learn.microsoft.com/de-de/windows/win32/api/strmif/ne-strmif-videoprocampproperty // as opposed to v4l2 which supports dynamic controls. // Die id würde ich zusammenstückeln aus der property und einer Konstante oder der UUID? // Ich denke ich sollte hier die interessanten controls aus // IAMCameraControl und IAMVideoProcAmp händisch reinpacken, wenn es sie gibt ctrls.assign("pan", get_ctrl_range (device, 0, CameraControl_Pan)); ctrls.assign("tilt", get_ctrl_range (device, 0, CameraControl_Tilt)); ctrls.assign("roll", get_ctrl_range (device, 0, CameraControl_Roll)); ctrls.assign("zoom", get_ctrl_range (device, 0, CameraControl_Zoom)); ctrls.assign("exposure", get_ctrl_range (device, 0, CameraControl_Exposure)); ctrls.assign("iris", get_ctrl_range (device, 0, CameraControl_Iris)); ctrls.assign("focus", get_ctrl_range (device, 0, CameraControl_Focus)); ctrls.assign("brightness", get_ctrl_range (device, 1, VideoProcAmp_Brightness)); ctrls.assign("contrast", get_ctrl_range (device, 1, VideoProcAmp_Contrast)); ctrls.assign("hue", get_ctrl_range (device, 1, VideoProcAmp_Hue)); ctrls.assign("saturation", get_ctrl_range (device, 1, VideoProcAmp_Saturation)); ctrls.assign("sharpness", get_ctrl_range (device, 1, VideoProcAmp_Sharpness)); ctrls.assign("gamma", get_ctrl_range (device, 1, VideoProcAmp_Gamma)); ctrls.assign("colorenable", get_ctrl_range (device, 1, VideoProcAmp_ColorEnable)); ctrls.assign("white_balance", get_ctrl_range (device, 1, VideoProcAmp_WhiteBalance)); ctrls.assign("backlightcompensation", get_ctrl_range (device, 1, VideoProcAmp_BacklightCompensation)); // power_line_frequency in v4l2 ctrls.assign("gain", get_ctrl_range (device, 1, VideoProcAmp_Gain)); // FIXME: currently the not available controls are also returned // What yould be the best solution? Remove the empty ones? return ctrls; } int mf_handler::g_ctrl (int id) { int src_obj = id >> 16; long prop = id & 0xFFFF; //printf ("DEBUG: mf_handler::g_ctrl (%i), src_obj = %i, prop = %li\n", id, src_obj, prop); octave_scalar_map tmp = get_ctrl_range (device, src_obj, prop); return tmp.contents ("value").int_value(); } void mf_handler::s_ctrl (int id, octave_value val) { // This uses the old dshow API (looks like there is nothin in native media foundation) // See also https://github.com/opencv/opencv/blob/14396b802947d69d3cc44f0e809977b891ef8f4a/modules/videoio/src/cap_dshow.cpp#L1948 // Attention: after switching back to CameraControl_Flags_Auto // you need to capture some frames to let the param settle (for example auto gain) // See ./devel/check_controls.m HRESULT hr = 0; int src_obj = id >> 16; long prop = id & 0xFFFF; //printf ("DEBUG: val.isempty () = %i\n", val.isempty()); if (src_obj == 0) { IAMCameraControlPtr spCameraControl(device); if(spCameraControl) { if (val.isempty()) hr = spCameraControl->Set(prop, 0, CameraControl_Flags_Auto); else hr = spCameraControl->Set(prop, val.int_value(), CameraControl_Flags_Manual); } } else if (src_obj == 1) { IAMVideoProcAmpPtr spVideo(device); if(spVideo) { if (val.isempty()) hr = spVideo->Set(prop, 0, VideoProcAmp_Flags_Auto); else hr = spVideo->Set(prop, val.int_value(), VideoProcAmp_Flags_Manual); } } CHECK(hr) } octave_value_list mf_handler::capture (int nargout, bool preview, bool raw_output) { octave_value_list ret; HRESULT hr; DWORD stream; DWORD flags; LONGLONG timestamp; IMFSample* sample; //printf ("DEBUG mf_handler::capture (%i, %i, %i)\n", nargout, preview, raw_output); for (;;) { // this is reading in syncronous blocking mode, MF supports also async calls hr = reader->ReadSample (MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &stream, &flags, ×tamp, &sample); CHECK(hr); if (! SUCCEEDED (hr)) error ("mf_handler::capture IMFSourceReader->ReadSample failed"); if (flags & MF_SOURCE_READERF_STREAMTICK) { //printf ("DEBUG: mf_handler::capture: waiting for sample...\n"); continue; } //printf ("timestamp = %llu\n", timestamp); break; } // näher anschauen: IMFTransform // https://learn.microsoft.com/en-us/windows/win32/medfound/processing-data-in-the-encoder // nach 2 Tagen komme ich zu dem Schluss, das MJPG -> RGB24 mit den mitgelieferten MFTs gar nicht möglich ist { IMFMediaBuffer* buffer; hr = sample->ConvertToContiguousBuffer (&buffer); CHECK(hr); BYTE* data; DWORD size; hr = buffer->Lock (&data, NULL, &size); CHECK(hr); //printf ("DEBUG: mf_handler::capture: buffer size = %lu\n", size); //for (int k = 0; k < 10; ++k) // printf ("%x ", data[k]); //printf ("\n"); // get current formats octave_scalar_map fmt_map = g_fmt (); std::string fmt = fmt_map.contents("fourcc").string_value (); //printf ("DEBUG: mf_handler::capture: fmt = '%s'\n", fmt.c_str()); uint32NDArray s = fmt_map.contents("size").uint32_array_value (); UINT32 width = s(0); UINT32 height = s(1); //printf ("DEBUG: mf_handler::capture: size = [%i %i]\n", width, height); // basic, underlying color space bool is_mjpg = false; bool is_ycbcr = false; if (fmt == "YUY2") // YUYV aka YUV 4:2:2 aka YUY2 // return struct with fields Y, Cb, Cr { ret(0) = imaq_handler::get_YUYV (data, size, width, height); is_ycbcr = true; } else if (fmt == "NV12") { ret(0) = imaq_handler::get_NV12 (data, size, width, height); is_ycbcr = true; } else { is_mjpg = (fmt == "MJPG"); // return buffer verbatim dim_vector dv (size, 1); uint8NDArray img (dv); unsigned char *p = reinterpret_cast(img.fortran_vec()); memcpy(p, data, size); ret(0) = octave_value(img); } buffer->Unlock (); buffer->Release (); // Fake other return values, some not yet implemented // TODO/FIXME: try to implement timecode static int sequence_nr = 0; if (nargout > 1) // sequence ret(1) = octave_value(sequence_nr++); if (nargout > 2) // timestamp { // pllTimestamp // Receives the time stamp of the sample, or the time of the stream event indicated in pdwStreamFlags. // The time is given in 100-nanosecond units. ret(2) = timestamp / 1.0e7; } if (nargout > 3) // timecode { octave_scalar_map timecode; timecode.assign ("type", 0); timecode.assign ("flags", 0); timecode.assign ("frames", 0); timecode.assign ("seconds", 0); timecode.assign ("minutes", 0); timecode.assign ("hours", 0); ret(3) = octave_value(timecode); } // Do we need an rgb image? if (! raw_output || preview) { octave_value rgb_img; //printf ("DEBUG: we need to convert %s to RGB3...\n", fmt.c_str()); if (is_ycbcr) rgb_img = YCbCr_to_RGB (ret(0), ITU_standard); else if (is_mjpg) rgb_img = JPG_to_RGB (ret(0)); else error_with_id ("image-acquisition:getsnapshot:unsupported-video-format", "mf_handler::capture: no conversion from '%s' to RGB3 implemented yet, please try another VideoFormat or use RAW = true.", fmt.c_str()); if (preview) { if (!preview_window) { //printf ("mf_handler::capture: create an new preview_window\n"); preview_window = new img_win(10, 10, width, height); preview_window->show(); } if (preview_window) { if(preview == 1 && !preview_window->shown()) preview_window->show(); uint8NDArray tmp = rgb_img.uint8_array_value(); Array perm (dim_vector (3, 1)); perm(0) = 2; perm(1) = 1; perm(2) = 0; tmp = tmp.permute (perm); unsigned char *p = reinterpret_cast(tmp.fortran_vec()); preview_window->copy_img(p, width, height, 1); // FIXME: dt könnte man auch über QueryPerformanceCounter auf windoze machen //preview_window->custom_label(dev.c_str(), sequence_nr, 1.0/dt); } } else if (preview_window) { delete preview_window; preview_window = 0; } if (! raw_output) ret(0) = rgb_img; } } sample->Release (); return ret; } void mf_handler::close () { //octave_stdout << "DEBUG: mf_handler::close called" << std::endl; //~ streamoff(); if (device) { device->Release(); device = 0; } if (reader) { reader->Release (); reader = 0; } } #endif image-acquisition-0.3.3/src/PaxHeaders/config.h.in0000644000000000000000000000013215000642613017012 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/config.h.in0000644000175000017500000000713415000642613017711 0ustar00andyandy00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have fltk-config */ #undef HAVE_FLTK /* Define to 1 if you have the header file. */ #undef HAVE_FL_FL_DOUBLE_WINDOW_H /* Define to 1 if you have the header file. */ #undef HAVE_FL_FL_DRAW_H /* Define to 1 if you have the header file. */ #undef HAVE_FL_FL_H /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_JPEGLIB_H /* Define to 1 if you have the `jpeg' library (-ljpeg). */ #undef HAVE_LIBJPEG /* Define to 1 if you have the `v4l2' library (-lv4l2). */ #undef HAVE_LIBV4L2 /* Define to 1 if you have the header file. */ #undef HAVE_LIBV4L2_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_VIDEODEV2_H /* Define to 1 if you have the header file. */ #undef HAVE_MFAPI_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc image-acquisition-0.3.3/src/PaxHeaders/cl_v4l2_handler.cc0000644000000000000000000000013215000642613020240 xustar0030 mtime=1745044875.559464867 30 atime=1745044875.559464867 30 ctime=1745044875.563464851 image-acquisition-0.3.3/src/cl_v4l2_handler.cc0000644000175000017500000010602115000642613021132 0ustar00andyandy00000000000000// Copyright (C) 2014-2025 Andreas Weber // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #include "config.h" #ifdef HAVE_LIBV4L2_H #include #include //#include #include "cl_v4l2_handler.h" #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) static std::string num2s (unsigned num) //taken from v4l2-ctl.cpp { char buf[10]; sprintf(buf, "%08x", num); return buf; } static std::string buftype2s (int type) //taken from v4l2-ctl.cpp { switch (type) { case 0: return "Invalid"; case V4L2_BUF_TYPE_VIDEO_CAPTURE: return "Video Capture"; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: return "Video Capture Multiplanar"; case V4L2_BUF_TYPE_VIDEO_OUTPUT: return "Video Output"; case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: return "Video Output Multiplanar"; case V4L2_BUF_TYPE_VIDEO_OVERLAY: return "Video Overlay"; case V4L2_BUF_TYPE_VBI_CAPTURE: return "VBI Capture"; case V4L2_BUF_TYPE_VBI_OUTPUT: return "VBI Output"; case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: return "Sliced VBI Capture"; case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: return "Sliced VBI Output"; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: return "Video Output Overlay"; default: return "Unknown (" + num2s(type) + ")"; } } static struct //taken from yavta Copyright (C) 2005-2010 Laurent Pinchart { const char *name; unsigned int fourcc; } pixel_formats[] = { { "RGB332", V4L2_PIX_FMT_RGB332 }, { "RGB555", V4L2_PIX_FMT_RGB555 }, { "RGB565", V4L2_PIX_FMT_RGB565 }, { "RGB555X", V4L2_PIX_FMT_RGB555X }, { "RGB565X", V4L2_PIX_FMT_RGB565X }, { "BGR24", V4L2_PIX_FMT_BGR24 }, { "RGB24", V4L2_PIX_FMT_RGB24 }, { "BGR32", V4L2_PIX_FMT_BGR32 }, { "RGB32", V4L2_PIX_FMT_RGB32 }, { "Y8", V4L2_PIX_FMT_GREY }, { "Y10", V4L2_PIX_FMT_Y10 }, { "Y12", V4L2_PIX_FMT_Y12 }, { "Y16", V4L2_PIX_FMT_Y16 }, { "UYVY", V4L2_PIX_FMT_UYVY }, { "VYUY", V4L2_PIX_FMT_VYUY }, { "YUYV", V4L2_PIX_FMT_YUYV }, { "YVYU", V4L2_PIX_FMT_YVYU }, { "NV12", V4L2_PIX_FMT_NV12 }, { "NV21", V4L2_PIX_FMT_NV21 }, { "NV16", V4L2_PIX_FMT_NV16 }, { "NV61", V4L2_PIX_FMT_NV61 }, // { "NV24", V4L2_PIX_FMT_NV24 }, // { "NV42", V4L2_PIX_FMT_NV42 }, { "SBGGR8", V4L2_PIX_FMT_SBGGR8 }, { "SGBRG8", V4L2_PIX_FMT_SGBRG8 }, { "SGRBG8", V4L2_PIX_FMT_SGRBG8 }, { "SRGGB8", V4L2_PIX_FMT_SRGGB8 }, // { "SBGGR10_DPCM8", V4L2_PIX_FMT_SBGGR10DPCM8 }, // { "SGBRG10_DPCM8", V4L2_PIX_FMT_SGBRG10DPCM8 }, { "SGRBG10_DPCM8", V4L2_PIX_FMT_SGRBG10DPCM8 }, // { "SRGGB10_DPCM8", V4L2_PIX_FMT_SRGGB10DPCM8 }, { "SBGGR10", V4L2_PIX_FMT_SBGGR10 }, { "SGBRG10", V4L2_PIX_FMT_SGBRG10 }, { "SGRBG10", V4L2_PIX_FMT_SGRBG10 }, { "SRGGB10", V4L2_PIX_FMT_SRGGB10 }, { "SBGGR12", V4L2_PIX_FMT_SBGGR12 }, { "SGBRG12", V4L2_PIX_FMT_SGBRG12 }, { "SGRBG12", V4L2_PIX_FMT_SGRBG12 }, { "SRGGB12", V4L2_PIX_FMT_SRGGB12 }, { "DV", V4L2_PIX_FMT_DV }, { "MJPEG", V4L2_PIX_FMT_MJPEG }, { "MPEG", V4L2_PIX_FMT_MPEG }, }; static std::string v4l2_fourcc_name(unsigned int fourcc) { static char name[5]; for (int i = 0; i < 4; ++i) { name[i] = fourcc & 0xff; fourcc >>= 8; } name[4] = '\0'; return std::string(name); } static std::string v4l2_format_name(unsigned int fourcc) { for (unsigned int i = 0; i < ARRAY_SIZE(pixel_formats); ++i) { if (pixel_formats[i].fourcc == fourcc) return std::string(pixel_formats[i].name); } return v4l2_fourcc_name(fourcc); } static unsigned int v4l2_format_code(const char *name) { for (unsigned int i = 0; i < ARRAY_SIZE(pixel_formats); ++i) { if (strcasecmp(pixel_formats[i].name, name) == 0) return pixel_formats[i].fourcc; } //try fourcc format unsigned int fourcc = 0; for (int i = 3; i >=0; i--) { fourcc <<= 8; fourcc += name[i]; } return fourcc; } //DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(v4l2_handler, "v4l2_handler", "v4l2_handler"); //bool v4l2_handler::type_loaded = false; v4l2_handler::v4l2_handler () : imaq_handler(), fd(-1), n_buffer(0), buffers(0), streaming(0), _is_video_capture (0), _is_meta_capture(0) { //octave_stdout << "v4l2_handler C'Tor, type_id() = " << type_id() << std::endl; } v4l2_handler::v4l2_handler (const v4l2_handler& m) : imaq_handler(), fd(-1), n_buffer(0), buffers(0), streaming(0), _is_video_capture (0), _is_meta_capture(0) { octave_stdout << "v4l2_handler: the copy constructor shouldn't be called" << std::endl; } v4l2_handler::~v4l2_handler () { //octave_stdout << "v4l2_handler D'Tor " << endl; // stop streaming, unmap & free buffers, close v4l2 device close(); } void v4l2_handler::print (std::ostream& os, bool pr_as_read_syntax = false) { os << "This is class v4l2_handler" << std::endl; os << "dev = " << dev << ", fd = " << fd << ", n_buffer = " << n_buffer << ", streaming = " << ((streaming)? "true":"false") << std::endl; } typedef std::vector dev_vec; static bool is_v4l_dev(const char *name) { return !memcmp(name, "video", 5) || !memcmp(name, "radio", 5) || !memcmp(name, "vbi", 3) || !memcmp(name, "v4l-subdev", 10); } octave_map v4l2_handler::enum_devices () { // Most of this code was taken from v4l2-ctl-common.cpp:list_devices() // which is part of the v4l-utils (http://git.linuxtv.org/v4l-utils.git). // Thanks to Kevin Thayer (Copyright (C) 2003-2004), // Hans Verkuil (Copyright (C) 2004, 2006, 2007) and the linuxtv community. //octave_stdout << "Use '$ v4l2-ctl --list-devices' for more details." << std::endl; octave_map retval; DIR *dp; struct dirent *ep; dev_vec files; dp = opendir("/dev"); if (dp == NULL) { error ("Couldn't open /dev/ directory"); return octave_map(); } while ((ep = readdir(dp))) if (is_v4l_dev(ep->d_name)) files.push_back(std::string("/dev/") + ep->d_name); closedir(dp); octave_idx_type i=0; for (dev_vec::iterator iter = files.begin(); iter != files.end(); ++iter) { //printf ("trying '%s'...\n", iter->c_str()); //fflush(stdout); v4l2_handler h; octave_scalar_map caps = h.open(iter->c_str(), true); if (! h.is_meta_capture ()) { caps.assign ("device", *iter); retval.assign(i++, caps); } //else //printf ("INFO: list device ignores metadata interface '%s'...\n", iter->c_str()); } return retval; } // calls to xioctl should never fail. // If it fails something unexpected happened void v4l2_handler::xioctl_name (int fh, unsigned long int request, void *arg, const char* name, const char* file, const int line) { int r; do { r = v4l2_ioctl(fh, request, arg); } while (r == -1 && ((errno == EINTR) || (errno == EAGAIN))); if (r == -1) { error("%s:%i xioctl %s error %d, %s\n", file, line, name, errno, strerror(errno)); } } octave_scalar_map v4l2_handler::open (std::string d, bool quiet) { //octave_stdout << "v4l2_handler::open d = " << d << " called" << std::endl; octave_scalar_map ret; fd = v4l2_open(d.c_str(), O_RDWR | O_NONBLOCK, 0); if (fd < 0) { error("Cannot open device '%s'. Error %d, '%s'\n", d.c_str(), errno, strerror(errno)); } else { dev = d; // store device path for later info output ret = querycap ().scalar_map_value (); if (!quiet && is_meta_capture ()) warning ("Device '%s' is a metadata interface device", d.c_str()); } return ret; } /*! * Convert bitfield to scalar struct * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-querycap.html#device-capabilities * See also videodev2.h */ octave_scalar_map v4l2_handler::expand_cap (unsigned int cap) { octave_scalar_map ret; ret.assign ("raw", cap); #define CHECK_DEVICE_CAPABILITIES_FIELD(X) ret.assign (#X, (bool)(cap & X)) CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_CAPTURE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_OUTPUT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_OVERLAY); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VBI_CAPTURE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VBI_OUTPUT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_SLICED_VBI_CAPTURE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_SLICED_VBI_OUTPUT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_RDS_CAPTURE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_OUTPUT_OVERLAY); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_HW_FREQ_SEEK); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_RDS_OUTPUT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_CAPTURE_MPLANE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_OUTPUT_MPLANE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_M2M_MPLANE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_VIDEO_M2M); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_TUNER); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_AUDIO); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_RADIO); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_MODULATOR); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_SDR_CAPTURE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_EXT_PIX_FORMAT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_SDR_OUTPUT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_META_CAPTURE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_READWRITE); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_STREAMING); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_META_OUTPUT); CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_TOUCH); #ifdef V4L2_CAP_IO_MC CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_IO_MC); #endif CHECK_DEVICE_CAPABILITIES_FIELD (V4L2_CAP_DEVICE_CAPS); return ret; } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-querycap.html * v4l2-ctl -D * \return octave_scalar_map with device capabilities */ octave_value v4l2_handler::querycap () { struct v4l2_capability cap; CLEAR(cap); xioctl (fd, VIDIOC_QUERYCAP, &cap); octave_scalar_map st; st.assign ("driver", std::string((const char*)cap.driver)); st.assign ("card", std::string((const char*)cap.card)); st.assign ("bus_info", std::string((const char*)cap.bus_info)); char tmp[15]; snprintf (tmp, 15, "%u.%u.%u", (cap.version >> 16) & 0xFF, (cap.version >> 8) & 0xFF, cap.version & 0xFF); st.assign ("version", std::string(tmp)); st.assign ("capabilities", expand_cap (cap.capabilities)); // The driver fills the device_caps field. This capability can only // appear in the capabilities field and never in the device_caps field. if (cap.capabilities & V4L2_CAP_DEVICE_CAPS) { st.assign ("device_caps", expand_cap (cap.device_caps)); _is_video_capture = cap.device_caps & V4L2_CAP_VIDEO_CAPTURE; _is_meta_capture = cap.device_caps & V4L2_CAP_META_CAPTURE; } else { _is_video_capture = cap.capabilities & V4L2_CAP_VIDEO_CAPTURE; _is_meta_capture = cap.capabilities & V4L2_CAP_META_CAPTURE; } return octave_value (st); } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-enuminput.html * see also output from "v4l2-ctl -n" * \return octave_map with the enumeration of all inputs */ octave_value v4l2_handler::enum_inputs () { octave_map ret; struct v4l2_input inp; CLEAR (inp); inp.index = 0; while (v4l2_ioctl (fd, VIDIOC_ENUMINPUT, &inp) >= 0) { octave_scalar_map st; st.assign ("name", std::string((const char*)inp.name)); switch (inp.type) { case V4L2_INPUT_TYPE_TUNER: st.assign ("type", "V4L2_INPUT_TYPE_TUNER"); break; case V4L2_INPUT_TYPE_CAMERA: st.assign ("type", "V4L2_INPUT_TYPE_CAMERA"); break; } st.assign ("audioset", (unsigned int)inp.audioset); st.assign ("tuner", (unsigned int)inp.tuner); st.assign ("std", (unsigned int)inp.std); st.assign ("status", (unsigned int)inp.status); st.assign ("capabilities", (unsigned int)inp.capabilities); ret.assign(octave_idx_type(inp.index), st); inp.index++; } return octave_value(ret); } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-g-input.html */ int v4l2_handler::get_input () { int index; xioctl (fd, VIDIOC_G_INPUT, &index); return index; } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-g-input.html */ void v4l2_handler::set_input (int index) { xioctl (fd, VIDIOC_S_INPUT, &index); } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-enum-fmt.html * see also "v4l2-ctl -w --list-formats" * \return octave_map with available video formats */ octave_value v4l2_handler::enum_formats () { octave_map ret; struct v4l2_fmtdesc fmt; CLEAR(fmt); fmt.index = 0; fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; while (v4l2_ioctl (fd, VIDIOC_ENUM_FMT, &fmt) >= 0) { octave_scalar_map sm; sm.assign ("type", buftype2s(fmt.type)); sm.assign ("description", std::string((const char*)fmt.description)); sm.assign ("pixelformat", std::string(v4l2_format_name(fmt.pixelformat))); sm.assign ("fourcc", std::string(v4l2_fourcc_name(fmt.pixelformat))); sm.assign ("flags_compressed", fmt.flags == V4L2_FMT_FLAG_COMPRESSED); sm.assign ("flags_emulated", fmt.flags == V4L2_FMT_FLAG_EMULATED); ret.assign(octave_idx_type(fmt.index), sm); fmt.index++; } return octave_value(ret); } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-enum-framesizes.html * see also v4l2-ctl --list-formats-ext * \param pixel_format e.g. 'RGB24' * \return Nx2 Matrix with width, height * \sa enum_frameintervals */ Matrix v4l2_handler::enum_framesizes (std::string pixelformat) { Matrix ret; uint32_t pfcode = v4l2_format_code(pixelformat.c_str()); struct v4l2_frmsizeenum frmsize; CLEAR(frmsize); frmsize.pixel_format = pfcode; frmsize.index = 0; while (v4l2_ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) >= 0) { if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) { ret.resize(frmsize.index+1, 2); ret(frmsize.index, 0) = frmsize.discrete.width; ret(frmsize.index, 1) = frmsize.discrete.height; } else error("frmsize.type not implemented"); frmsize.index++; } return ret; } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-enum-frameintervals.html * see also v4l2-ctl --list-formats-ext * \param pixel_format e.g. 'RGB24' * \param width in px * \param height in px * \return Nx2 matrix with frame interval numerator, denominator * \sa enum_framesizes */ Matrix v4l2_handler::enum_frameintervals (std::string pixelformat, uint32_t width, uint32_t height) { Matrix ret; uint32_t pfcode = v4l2_format_code(pixelformat.c_str()); struct v4l2_frmivalenum frmival; CLEAR(frmival); frmival.pixel_format = pfcode; frmival.width = width; frmival.height = height; frmival.index = 0; while (v4l2_ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmival) >= 0) { if (frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE) { ret.resize(frmival.index+1, 2); ret(frmival.index, 0) = frmival.discrete.numerator; ret(frmival.index, 1) = frmival.discrete.denominator; } else if (frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) { error("Sorry, this isn't implemented yet"); //TODO } frmival.index++; } return ret; } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-g-parm.html */ Matrix v4l2_handler::get_frameinterval () { Matrix ret(1,2); struct v4l2_streamparm sparam; CLEAR(sparam); sparam.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_G_PARM, &sparam); if(sparam.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) { const struct v4l2_fract &tf = sparam.parm.capture.timeperframe; ret(0) = tf.numerator; ret(1) = tf.denominator; } else { warning("v4l2_handler::get_frameinterval: V4L2_CAP_TIMEPERFRAME is not supported"); return Matrix(0,0); } return ret; } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-g-parm.html */ void v4l2_handler::set_frameinterval (Matrix timeperframe) { struct v4l2_streamparm sparam; CLEAR(sparam); sparam.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_G_PARM, &sparam); if (sparam.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) { sparam.parm.capture.timeperframe.numerator = timeperframe(0); sparam.parm.capture.timeperframe.denominator = timeperframe(1); xioctl(fd, VIDIOC_S_PARM, &sparam); struct v4l2_fract *tf = &sparam.parm.capture.timeperframe; if (!tf->denominator || !tf->numerator) error("v4l2_handler::set_frameinterval: Invalid framerate"); if (tf->numerator != uint32_t(timeperframe(0)) || tf->denominator != uint32_t(timeperframe(1))) warning("v4l2_handler::set_frameinterval: driver is using %d/%d as timeperframe but %d/%d was requested", tf->numerator, tf->denominator, uint32_t(timeperframe(0)), uint32_t(timeperframe(1))); } else { warning("v4l2_handler::set_frameinterval: V4L2_CAP_TIMEPERFRAME is not supported"); } } // get octave_scalar_map from v4l2_queryctrl octave_scalar_map v4l2_handler::get_osm (struct v4l2_queryctrl queryctrl) { octave_scalar_map ctrl; ctrl.assign ("id", int(queryctrl.id)); //ctrl.assign ("value", g_ctrl(queryctrl.id)); ctrl.assign ("min", int(queryctrl.minimum)); ctrl.assign ("max", int(queryctrl.maximum)); if (queryctrl.type == V4L2_CTRL_TYPE_INTEGER) ctrl.assign ("step", int(queryctrl.step)); if ( queryctrl.type == V4L2_CTRL_TYPE_INTEGER ||queryctrl.type == V4L2_CTRL_TYPE_BOOLEAN ||queryctrl.type == V4L2_CTRL_TYPE_MENU) ctrl.assign ("default", int(queryctrl.default_value)); if (queryctrl.type == V4L2_CTRL_TYPE_MENU) { struct v4l2_querymenu querymenu; CLEAR(querymenu); std::stringstream menu_str; querymenu.id = queryctrl.id; for (querymenu.index = queryctrl.minimum; int(querymenu.index) <= queryctrl.maximum; querymenu.index++) { if (0 == ioctl (fd, VIDIOC_QUERYMENU, &querymenu)) { menu_str << querymenu.index << ":" << querymenu.name << ";"; } } ctrl.assign ("menu", menu_str.str()); } return ctrl; } /*! * https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/vidioc-queryctrl.html * or better https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/extended-controls.html * because most "Exposure" ctrls are "extended controls" * * see also v4l2-ctl -L * * Use id for calls to s_ctrl * \sa s_ctrl */ octave_value v4l2_handler::queryctrl () { struct v4l2_queryctrl queryctrl; CLEAR(queryctrl); octave_scalar_map ctrls; queryctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL; while (0 == ioctl (fd, VIDIOC_QUERYCTRL, &queryctrl)) { if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) continue; // convert name to lower, replace spaces with _ and remove others std::string field; const char* n= (const char*)queryctrl.name; int len = strlen(n); for (int i=0; i= 0 && (n > 0 || n_buffer > 0)) { struct v4l2_requestbuffers req; CLEAR(req); req.count = n; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; xioctl(fd, VIDIOC_REQBUFS, &req); if (req.count < n) error("v4l2_handler::reqbufs: VIDIOC_REQBUFS: running out of free memory\n"); n_buffer = req.count; } } void v4l2_handler::mmap () { struct v4l2_buffer buf; buffers = (buffer*)calloc(n_buffer, sizeof(*buffers)); for (unsigned int i = 0; i < n_buffer; ++i) { CLEAR(buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; buf.index = i; xioctl(fd, VIDIOC_QUERYBUF, &buf); buffers[i].length = buf.length; buffers[i].start = v4l2_mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset); if (buffers[i].start == MAP_FAILED) { error("v4l2_handler::mmap: MAP_FAILED %s", strerror(errno)); } } } void v4l2_handler::qbuf () { struct v4l2_buffer buf; for (unsigned int i = 0; i < n_buffer; ++i) { CLEAR(buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; buf.index = i; // enqueu buffer xioctl(fd, VIDIOC_QBUF, &buf); } } /*! * \param nargout Number of output Parameter [image, sequence, timestamp, timecode] * \param preview * \param raw_output return colorspace of image as raw as reasonable. * YUV formats are unpacked, semiplanar pages are merged but chroma subsampling and colorspace is left unchanged. * \return image, sequence, timestamp, [timecode] */ octave_value_list v4l2_handler::capture (int nargout, bool preview, bool raw_output) { octave_value_list ret; if(!streaming) { error("v4l2_handler::capture: Streaming wasn't enabled. Please use 'start(obj)'"); return octave_value(); } //printf ("v4l2_handler::capture (%i, %i, %i)\n", nargout, preview, raw_output); struct v4l2_format fmt; CLEAR(fmt); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_G_FMT, &fmt); struct v4l2_buffer buf; fd_set fds; struct timeval tv; int r = -1; // wait for image do { FD_ZERO(&fds); FD_SET(fd, &fds); // 3s Timeout TODO: make this configurable tv.tv_sec = 3; tv.tv_usec = 0; r = select(fd + 1, &fds, NULL, NULL, &tv); } while ((r == -1 && (errno == EINTR))); if (r == -1) { error("v4l2_handler::capture: Select returned code %i (%s)", errno, strerror(errno)); return octave_value(); } if (r == 0) { error("v4l2_handler::capture: Select timeout"); return octave_value(); } CLEAR(buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; // dequeue buffers xioctl(fd, VIDIOC_DQBUF, &buf); // calculate real fps static double last_timestamp = 0; double timestamp = buf.timestamp.tv_sec+buf.timestamp.tv_usec/1.0e6; double dt = (last_timestamp)? timestamp - last_timestamp: -1; last_timestamp = timestamp; //debug output //octave_stdout << "INFO: pixelformat = " << v4l2_format_name(fmt.fmt.pix.pixelformat) << endl; //octave_stdout << "INFO: width = " << fmt.fmt.pix.width << ", height = " << fmt.fmt.pix.height << endl; //octave_stdout << "INFO: Bytes captured = " << buf.bytesused << endl; // basic, underlying color space bool is_rgb3 = false; bool is_mjpg = false; bool is_ycbcr = false; if ( fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_RGB24 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_BGR24) // RGB3 aka RGB24 bzw. BGR // return [height x width x 3] uint8 matrix { ret(0) = imaq_handler::get_RGB24 (buffers[buf.index].start, buf.bytesused, fmt.fmt.pix.width, fmt.fmt.pix.height); is_rgb3 = true; if (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_BGR24) { // wtf? There must be a better way to do this... // ret = ret (:,:,[3 2 1]) Array ia (dim_vector (3, 1), octave::idx_vector::colon); Array x (dim_vector (3, 1), 0); x(0) = 2; x(1) = 1; x(2) = 0; ia (2) = x; ret(0) = ret(0).uint8_array_value().index (ia); } } else if ( fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SBGGR10 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SGRBG10 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SRGGB10 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SBGGR12 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SGBRG12 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SGRBG12 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SRGGB12 ) // RAW Bayer, 2 bytes per pixel // return [height * width] uint16 matrix { ret(0) = imaq_handler::get_raw_bayer2 (buffers[buf.index].start, buf.bytesused, fmt.fmt.pix.width, fmt.fmt.pix.height); } else if ( fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SBGGR8 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SGBRG8 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SGRBG8 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_SRGGB8 ) // RAW Bayer, 1 byte per pixel // return [height * width] uint8 matrix { ret(0) = imaq_handler::get_raw_bayer1 (buffers[buf.index].start, buf.bytesused, fmt.fmt.pix.width, fmt.fmt.pix.height); } else if (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUYV) // YUYV aka YUV 4:2:2 // https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-yuyv.html // V4L2_PIX_FMT_YUYV is known in the Windows environment as YUY2 // return struct with fields Y, Cb, Cr { ret(0) = imaq_handler::get_YUYV (buffers[buf.index].start, buf.bytesused, fmt.fmt.pix.width, fmt.fmt.pix.height); is_ycbcr = true; } else if ( fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YVU420 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420) // YVU420 aka YV12 // https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-yuv420.html { ret(0) = imaq_handler::get_YVU420 (buffers[buf.index].start, buf.bytesused, fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420); is_ycbcr = true; } else if ( fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_NV12 || fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_NV21) // https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-nv12.html { ret(0) = imaq_handler::get_NV12 (buffers[buf.index].start, buf.bytesused, fmt.fmt.pix.width, fmt.fmt.pix.height); is_ycbcr = true; } else // No conversion for this format (perhaps a compressed format like MPEG) // https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/pixfmt-compressed.html // -> Just return the bytes as vector in this case. { //octave_stdout << "INFO: No conversion for " // << v4l2_format_name(fmt.fmt.pix.pixelformat) // << " implemented, returning raw stream..." << endl; ret(0) = imaq_handler::get_raw_bytes (buffers[buf.index].start, buf.bytesused); is_mjpg = (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MPEG) || (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG); } // return sequence if (nargout > 1) ret(1) = octave_value(buf.sequence); // return timestamp. Attention, there is also an calculated timestamp above if (nargout > 2) { // add timestamp to frame ret(2) = octave_value(buf.timestamp.tv_sec + buf.timestamp.tv_usec / 1e6); } // return timecode if (nargout > 3) { if (buf.flags & V4L2_BUF_FLAG_TIMECODE) { octave_scalar_map timecode; timecode.assign ("type", int(buf.timecode.type)); timecode.assign ("flags", int(buf.timecode.flags)); timecode.assign ("frames", int(buf.timecode.frames)); timecode.assign ("seconds", int(buf.timecode.seconds)); timecode.assign ("minutes", int(buf.timecode.minutes)); timecode.assign ("hours", int(buf.timecode.hours)); ret(3) = octave_value(timecode); } else { warning("v4l2_handler::capture: Timecode not available"); ret(3) = octave_value(); } } // Do we need an rgb image? if (! raw_output || preview) { octave_value rgb_img; //printf ("DEBUG: we need a RGB3 image...\n"); if (!is_rgb3) { //printf ("DEBUG: we need to convert %s to RGB3...\n", v4l2_format_name(fmt.fmt.pix.pixelformat).c_str()); if (is_ycbcr) rgb_img = YCbCr_to_RGB (ret(0), ITU_standard); else if (is_mjpg) rgb_img = JPG_to_RGB (ret(0)); else error ("v4l2_handler::capture: no conversion from '%s' to RGB3 implemented yet", v4l2_format_name(fmt.fmt.pix.pixelformat).c_str()); } //else //printf ("DEBUG: already an RGB3 image, do nothing...\n"); if (preview) { if (!preview_window) { preview_window = new img_win(10, 10, fmt.fmt.pix.width, fmt.fmt.pix.height); preview_window->show(); } if (preview_window) { if(preview == 1 && !preview_window->shown()) preview_window->show(); uint8NDArray tmp = rgb_img.uint8_array_value(); Array perm (dim_vector (3, 1)); perm(0) = 2; perm(1) = 1; perm(2) = 0; tmp = tmp.permute (perm); unsigned char *p = reinterpret_cast(tmp.fortran_vec()); preview_window->copy_img(p, fmt.fmt.pix.width, fmt.fmt.pix.height, 1); preview_window->custom_label(dev.c_str(), buf.sequence, 1.0/dt); } } else if (preview_window) { delete preview_window; preview_window = 0; } if (! raw_output && ! is_rgb3) ret(0) = rgb_img; } xioctl(fd, VIDIOC_QBUF, &buf); return ret; } /*! * Main purpose is for debugging this class */ void v4l2_handler::capture_to_ppm (const char *fn) { NDArray rgb = capture (1, 0, 1)(0).array_value(); uint8NDArray img = rgb * 255.0; Matrix per(3,1); per(0) = 2; per(1) = 1; per(2) = 0; img = img.permute(per); unsigned char* p=reinterpret_cast(img.fortran_vec()); FILE *fout = fopen (fn, "w"); if (!fout) { error("v4l2_handler::capture_to_ppm: Cannot open file '%s'", fn); } fprintf (fout, "P6\n%d %d 255\n", (int)img.dim2(), (int)img.dim3()); fwrite (p, img.numel(), 1, fout); fclose (fout); } /*! * - Set field to V4L2_FIELD_INTERLACED * - Requests buffers * - mmap the buffers * - enque the buffers * - start streaming */ void v4l2_handler::streamon (unsigned int n) { if(streaming) { warning("v4l2_handler::streamon: Streaming already enabled. Buffer size unchanged."); } else { // set needed pixelformat and field s_fmt("", 0, 0); // request buffers reqbufs(n); // mmap the buffers mmap(); // enque the buffers qbuf(); enum v4l2_buf_type type; type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_STREAMON, &type); streaming = 1; } } /*! * - Stop streaming * - unmap the buffers * - free buffers */ void v4l2_handler::streamoff () { if(streaming) { if (preview_window) preview_window->hide(); Fl::wait(0); enum v4l2_buf_type type; type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_STREAMOFF, &type); streaming = 0; } // unmap the buffers munmap(); // free the buffers reqbufs(0); } void v4l2_handler::munmap () { if(buffers) { for (unsigned int i = 0; i < n_buffer; ++i) v4l2_munmap(buffers[i].start, buffers[i].length); free(buffers); buffers = 0; } } void v4l2_handler::close () { streamoff(); if (fd >= 0) v4l2_close(fd); fd = -1; } //~ v4l2_handler* //~ get_v4l2_handler_from_ov (octave_value ov) //~ { //~ if (ov.type_id() != v4l2_handler::static_type_id()) //~ { //~ error("get_v4l2_handler_from_ov: Not a valid v4l2_handler"); //~ return 0; //~ } //~ v4l2_handler* imgh = 0; //~ const octave_base_dld_value& rep = ov.get_rep(); //~ imgh = &((v4l2_handler &)rep); //~ return imgh; //~ } #endif image-acquisition-0.3.3/PaxHeaders/inst0000644000000000000000000000013215000642613015100 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.563464851 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/0000755000175000017500000000000015000642613016047 5ustar00andyandy00000000000000image-acquisition-0.3.3/inst/PaxHeaders/imaqhwinfo.m0000644000000000000000000000013215000642613017475 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/imaqhwinfo.m0000644000175000017500000000245515000642613020375 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {@var{list} =} imaqhwinfo () ## Returns a struct array with v4l2 devices in /dev/. Links are not resolved. ## ## @group ## @example ## imaqhwinfo() ## @result{} scalar structure containing the fields: ## ## driver = uvcvideo ## card = UVC Camera (046d:0825) ## bus_info = usb-0000:00:16.2-2 ## version = 3.2.51 ## capabilities = 83886081 ## device = /dev/video0 ## @end example ## @end group ## @end deftypefn function ret = imaqhwinfo() ret = __imaq_enum_devices__ (); endfunction %!test %! d = imaqhwinfo(); %! assert (numel (d) >= 1); image-acquisition-0.3.3/inst/PaxHeaders/save_mjpeg_as_jpg.m0000644000000000000000000000013215000642613020776 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/save_mjpeg_as_jpg.m0000644000175000017500000001115215000642613021670 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## ## This script is based on mjpeg2jpeg.py from Laurent Pinchart and Luc Saillard. ## https://github.com/TimSC/mjpeg/blob/master/mjpeg2jpeg.py has a copy ## -*- texinfo -*- ## @deftypefn {Function File} save_mjpeg_as_jpg (@var{fn}, @var{mjpeg}) ## Add a huffman table to the MPJEG capture and save it as JPG. ## Useful if you have set VideoFormat of videoinput to MJPEG and want ## to convert the result from getsnapshot to JPG. ## @seealso{@@videoinput/getsnapshot} ## @end deftypefn function save_mjpeg_as_jpg (fn, mjpeg) persistent huffman_table = uint8(... [0xFF 0xC4 0x01 0xA2 0x00 0x00 0x01 0x05 0x01 0x01 0x01 0x01 ... 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 ... 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x01 0x00 0x03 ... 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x00 0x00 0x00 ... 0x00 0x00 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 ... 0x0A 0x0B 0x10 0x00 0x02 0x01 0x03 0x03 0x02 0x04 0x03 0x05 ... 0x05 0x04 0x04 0x00 0x00 0x01 0x7D 0x01 0x02 0x03 0x00 0x04 ... 0x11 0x05 0x12 0x21 0x31 0x41 0x06 0x13 0x51 0x61 0x07 0x22 ... 0x71 0x14 0x32 0x81 0x91 0xA1 0x08 0x23 0x42 0xB1 0xC1 0x15 ... 0x52 0xD1 0xF0 0x24 0x33 0x62 0x72 0x82 0x09 0x0A 0x16 0x17 ... 0x18 0x19 0x1A 0x25 0x26 0x27 0x28 0x29 0x2A 0x34 0x35 0x36 ... 0x37 0x38 0x39 0x3A 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A ... 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x63 0x64 0x65 0x66 ... 0x67 0x68 0x69 0x6A 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7A ... 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x92 0x93 0x94 0x95 ... 0x96 0x97 0x98 0x99 0x9A 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 0xA8 ... 0xA9 0xAA 0xB2 0xB3 0xB4 0xB5 0xB6 0xB7 0xB8 0xB9 0xBA 0xC2 ... 0xC3 0xC4 0xC5 0xC6 0xC7 0xC8 0xC9 0xCA 0xD2 0xD3 0xD4 0xD5 ... 0xD6 0xD7 0xD8 0xD9 0xDA 0xE1 0xE2 0xE3 0xE4 0xE5 0xE6 0xE7 ... 0xE8 0xE9 0xEA 0xF1 0xF2 0xF3 0xF4 0xF5 0xF6 0xF7 0xF8 0xF9 ... 0xFA 0x11 0x00 0x02 0x01 0x02 0x04 0x04 0x03 0x04 0x07 0x05 ... 0x04 0x04 0x00 0x01 0x02 0x77 0x00 0x01 0x02 0x03 0x11 0x04 ... 0x05 0x21 0x31 0x06 0x12 0x41 0x51 0x07 0x61 0x71 0x13 0x22 ... 0x32 0x81 0x08 0x14 0x42 0x91 0xA1 0xB1 0xC1 0x09 0x23 0x33 ... 0x52 0xF0 0x15 0x62 0x72 0xD1 0x0A 0x16 0x24 0x34 0xE1 0x25 ... 0xF1 0x17 0x18 0x19 0x1A 0x26 0x27 0x28 0x29 0x2A 0x35 0x36 ... 0x37 0x38 0x39 0x3A 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A ... 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x63 0x64 0x65 0x66 ... 0x67 0x68 0x69 0x6A 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7A ... 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x92 0x93 0x94 ... 0x95 0x96 0x97 0x98 0x99 0x9A 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 ... 0xA8 0xA9 0xAA 0xB2 0xB3 0xB4 0xB5 0xB6 0xB7 0xB8 0xB9 0xBA ... 0xC2 0xC3 0xC4 0xC5 0xC6 0xC7 0xC8 0xC9 0xCA 0xD2 0xD3 0xD4 ... 0xD5 0xD6 0xD7 0xD8 0xD9 0xDA 0xE2 0xE3 0xE4 0xE5 0xE6 0xE7 ... 0xE8 0xE9 0xEA 0xF2 0xF3 0xF4 0xF5 0xF6 0xF7 0xF8 0xF9 0xFA]); if (! isvector (mjpeg)) error ("MJPEG hast to be a vector"); endif mjpeg = mjpeg(:); [fid, msg] = fopen (fn, "w"); if (fid < 0) error ("Failed to create file %s for writing. %s", fn, msg); endif hdr = mjpeg(1:2); mjpeg(1:2) = []; if (hdr != [0xFF; 0xD8]) error ("img header (first two bytes) not valid. [0x%2x 0x%2x]", hdr) endif fwrite (fid, uint8(hdr)); has_dht = false; while (! has_dht) hdr = mjpeg(1:4); mjpeg(1:4) = []; if (hdr(1) != 0xFF) error ("img header not valid") endif if (hdr(2) == 0xC4) has_dht = true; elseif (hdr(2) == 0xDA) break; endif # Skip to the next marker. s = hdr(3) * 2^8 + hdr(4); fwrite (fid, uint8(hdr)); fwrite (fid, mjpeg(1:s-2)); mjpeg(1:s-2) = []; endwhile if (! has_dht) fwrite (fid, huffman_table); fwrite (fid, hdr); endif # Process the remaining data in one go fwrite (fid, mjpeg); fclose (fid); endfunction image-acquisition-0.3.3/inst/PaxHeaders/SGRBGtoRGB.m0000644000000000000000000000013215000642613017075 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/SGRBGtoRGB.m0000644000175000017500000000241415000642613017770 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {@var{rgb} =} SGRBGtoRGB (@var{raw}) ## Convert RAW bayer image with SGRBG filter alignment to RGB image ## without interpolation. ## ## FIXME: We should implement "demosaic" instead and use this. ## @end deftypefn function rgb = SGRBGtoRGB(img) # cast to uint16 to avoid overflow # in average calculation g = (g1+g2)/2 below g1 = uint16 (img(1:2:end, 1:2:end)); g2 = uint16 (img(2:2:end, 2:2:end)); g = (g1 + g2) / 2; r = img(1:2:end, 2:2:end); b = img(2:2:end, 1:2:end); rgb = cat (3, r, g, b); endfunction image-acquisition-0.3.3/inst/PaxHeaders/__test__device__.m0000644000000000000000000000013215000642613020564 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/__test__device__.m0000644000175000017500000000330715000642613021461 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {@var{dev} =} __test__device__ () ## Return device which should be used in tests. ## @end deftypefn function ret = __test__device__() persistent warning_shown = 0; l = imaqhwinfo(); if (ispc () && numel(l) > 0) ret{1} = "mf"; # quick workaround [l.device] = deal(l.symlink); elseif (isunix ()) ret{1} = "v4l2"; endif if ( numel(l) > 1) dev = l(1).device; # show warning only once if (!warning_shown) warning("It appears that you have more than one capture device. We will just use %s (the first returned by imaqhwinfo) for tests.", dev); warning_shown = 1; endif elseif (numel(l) == 0) error("It appears that you have no video capture device installed. Almost all tests will fail. Please connect one or try\n $ modprobe v4l2loopback\n $ gst-launch videotestsrc ! v4l2sink device=/dev/video0"); dev = "/dev/null"; else dev = l.device; endif ret{2} = dev; endfunction %!assert (1) image-acquisition-0.3.3/inst/PaxHeaders/@videoinput0000644000000000000000000000013215000642613017366 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.563464851 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/0000755000175000017500000000000015000642613020335 5ustar00andyandy00000000000000image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/stop.m0000644000000000000000000000013215000642613020606 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/stop.m0000644000175000017500000000175315000642613021506 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {} stop (@var{vi}) ## Stop streaming. ## @seealso{@@videoinput/start} ## @end deftypefn function stop (vi) if (nargin != 1) print_usage(); endif __imaq_handler_streamoff__(vi.imaqh); endfunction # already tested in getsnapshot image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/start.m0000644000000000000000000000013215000642613020756 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/start.m0000644000175000017500000000211615000642613021650 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {} start (@var{vi}, @var{n}) ## Start streaming with @var{n} buffers. It is recommended to use at least 2 buffers. ## @seealso{@@videoinput/stop} ## @end deftypefn function start (vi, n = 2) if (nargin > 2 || nargin < 1) print_usage(); endif __imaq_handler_streamon__(vi.imaqh, n); endfunction # already tested in getsnapshot image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/preview.m0000644000000000000000000000013215000642613021302 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/preview.m0000644000175000017500000000250015000642613022171 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {} preview (@var{vi}) ## Repeatedly get a snapshot from a videoinput object buffer and display ## it in a FLTK window. Stop execution with CTRL-C. ## @end deftypefn function preview (vi) if (nargin != 1) print_usage(); endif unwind_protect __imaq_handler_streamon__(vi.imaqh, 2); disp("Hit CTRL+C or close preview window to exit") fflush(stdout); do __imaq_handler_capture__(vi.imaqh, 1, 0); until(!__imaq_preview_window_is_shown__(vi.imaqh)) unwind_protect_cleanup __imaq_handler_streamoff__(vi.imaqh); end_unwind_protect endfunction image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/getsnapshot.m0000644000000000000000000000013215000642613022160 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/getsnapshot.m0000644000175000017500000001167615000642613023065 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{img}, @var{seq}, @var{ts}, @var{tc}] =} getsnapshot (@var{vi}, [@var{preview}], [@var{raw}]) ## Get a snapshot from a videoinput object. ## Streaming has to be enabled before calling getsnapshot. ## If @var{preview} == true the captured image is also shown in a separate window. ## ## @table @var ## @item img ## Captured image. ## ## If @var{raw} == false (default) the format returned from the driver is ## converted to RGB3. Width and height matches @code{get(VI, "VideoResolution")} ## ## If @var{raw} == true the format returned by the driver ## (see @qcode{VideoFormat} property) is returned. ## ## @table @var ## @item @qcode{RGB3}, @qcode{RGB24} ## @nospell{HxWx3} uint8 matrix with RGB values ## ## @item @qcode{YUYV}, @qcode{YUV422} ## scalar struct with fieldnames Y, Cb and Cr. The horizontal resolution of Cb and ## Cr is half the horizontal resolution of Y. ## ## @item @qcode{YV12}, @qcode{YVU420}, @qcode{YU12}, @qcode{YUV420} ## scalar struct with fieldnames Y, Cb and Cr. The horizontal and vertical resolution ## of Cb and Cr is half the resolution of Y. ## ## @item @qcode{MJPG}, @qcode{MJPEG} ## uint8 row vector with compressed MJPEG data. The length may vary from ## frame to frame due to compression. You can save this as JPEG (add a huffman table) with ## @example ## @group ## obj = videoinput(); ## set (obj, "VideoFormat", "MJPG"); ## start (obj); ## img = getsnapshot (obj); ## save_mjpeg_as_jpg ("capture.jpg", img); ## @end group ## @end example ## @end table ## @item seq ## Set by the driver, counting the frames (not fields!) in sequence. ## ## @item struct @var{ts} ## For input streams this is time when the first data byte was captured, ## as returned by the clock_gettime() function for the relevant clock id. ## ## @table @var ## @item tv_sec ## seconds ## @item tv_usec ## microseconds ## @end table ## ## @item struct @var{tc} ## Timecode, see @url{https://www.kernel.org/doc/html/v6.1/userspace-api/media/v4l/buffer.html#c.V4L.v4l2_timecode} ## @end table ## @seealso {@@videoinput/start, @@videoinput/preview} ## @end deftypefn function [img, seq, timestamp, timecode] = getsnapshot (vi, preview = 0, raw = 0) if (nargin < 1 || nargin > 3) print_usage(); endif if (nargout <= 3) [img, seq, timestamp] = __imaq_handler_capture__(vi.imaqh, preview, raw); else [img, seq, timestamp, timecode] = __imaq_handler_capture__(vi.imaqh, preview, raw); endif #fmt = __imaq_handler_g_fmt__(vi.imaqh).pixelformat; #printf ("pixelformat = -%s-\n", fmt); endfunction %!test %! obj = videoinput(__test__device__{:}); %! oldval = get(obj, "VideoResolution"); %! default_size = set (obj, "VideoResolution")(1,:); %! set (obj, "VideoResolution", default_size); %! # We expect here, that every driver (v4l2 and Media Foundation) %! # on earth would support YUYV. This might not be the case... %! set (obj, 'VideoFormat', 'YUYV'); %! start (obj, 2) %! img = getsnapshot (obj); %! do_preview = !isempty(getenv("DISPLAY")); # only if there is a display %! img = getsnapshot (obj, do_preview); %! [img, seq] = getsnapshot (obj, do_preview); %! # The v4l2 loopback device doesn't support the seqence numbering and returns always 0 %! if (!strcmp(get(obj, "DeviceCapabilities").driver, "v4l2 loopback")) %! assert (seq >= 2); %! endif %! [img, seq, T] = getsnapshot(obj, 0); %! stop (obj) %! set (obj, "VideoResolution", oldval); %!test %! obj = videoinput (__test__device__{:}); %! fmts = {set(obj,"VideoFormat").fourcc}; %! for k = 1:numel (fmts) %! set (obj, "VideoFormat", fmts{k}); %! s = get (obj, "VideoResolution"); %! start (obj) %! # try to internally convert to RGB3 %! # this might fail if there is no converter (yet) %! try %! img = getsnapshot (obj); %! assert (size (img), [fliplr(s) 3]); %! catch ME %! if (! strcmp (ME.identifier, 'image-acquisition:getsnapshot:unsupported-video-format')) %! stop (obj); %! rethrow (ME); %! endif %! end_try_catch %! # getting a raw representation (like for H264) should always work %! img = getsnapshot (obj, false, true); # ret raw %! stop (obj) %! endfor %!demo %! obj = videoinput (); %! start (obj) %! img = getsnapshot (obj); %! image (img) %! stop (obj) image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/videoinput.m0000644000000000000000000000013215000642613022007 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/videoinput.m0000644000175000017500000000443315000642613022705 0ustar00andyandy00000000000000## Copyright (C) 2024-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {@var{vi} =} videoinput ([@var{adaptorname}, @var{device}, [@var{format}]]) ## Initializes a new video input object. Currently only "v4l2" and "mf" is available as adaptorname. ## If called without arguments, the first available device is used. ## ## @group ## @example ## obj = videoinput("v4l2", "/dev/video0") ## @result{} obj = videoinput ## device = /dev/video0 ## driver = uvcvideo ## card = UVC Camera (046d:0825) ## VideoInput = 0 ## VideoResolution = 960 x 720 px ## VideoFormat = MJPEG ## @end example ## @end group ## @seealso{imaqhwinfo, @@videoinput/getsnapshot} ## @end deftypefn function vi = videoinput (adaptorname, device, format) if (nargin == 0) l = imaqhwinfo (); n = numel (l); if (n == 0) error("It appears that you do not have have a compatible video capture device installed."); else # silently ignore if there is more than one device if (ispc ()) adaptorname = "mf"; vidata.PrettyName = l(1).name; device = l(1).symlink; elseif (isunix ()) adaptorname = "v4l2"; device = l(1).device; endif endif elseif (nargin == 1 || nargin > 3 || (nargin >= 2 && ! ischar(device))) print_usage(); endif vidata.SelectedSourceName = device; vidata.imaqh = __imaq_handler_open__(adaptorname, device); vi = class (vidata, "videoinput"); if (nargin == 3) set (vi, "VideoResolution", format); endif endfunction %!test %! obj = videoinput(__test__device__(){:}); image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/set.m0000644000000000000000000000013215000642613020414 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/set.m0000644000175000017500000001677715000642613021330 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see .. ## -*- texinfo -*- ## @deftypefn {Function File} {@var{props} =} set (@var{vi}, @var{prop}) ## @deftypefnx {Function File} {@var{val} =} set (@var{vi}, @var{prop}, @var{value}) ## @deftypefnx {Function File} {@var{val} =} set (@var{vi}, @var{prop}, @var{value}, @dots{}) ## Set or modify properties of videoinput objects. ## ## The first variant (without @var{value}) returns a struct with possible values or range. ## ## @example ## @group ## obj = videoinput("v4l2", "/dev/video0"); ## set (obj, 'brightness') ## @result{} scalar structure containing the fields: ## ## min = 0 ## max = 255 ## step = 1 ## default = 128 ## @end group ## @end example ## ## There is a number of properties starting with an upper letter ## which are available on all videoinput devices. Only the non-obvious are ## described here. ## ## @table @var ## @item 'VideoResolution' ## Sets the width and height of the captured images. The driver attemps to ## adjust the values if the size requested is unavailable. ## ## @example ## obj = videoinput("v4l2", "/dev/video0"); ## set(obj, "VideoResolution", [960 700]) ## @result{} warning: v4l2_handler::s_fmt: Driver is sending image at 960x720 although 960x700 was requested ## @end example ## ## @item 'VideoFrameInterval' ## Time between frames in seconds as [numerator, denominator]. Conceptually fps=1/frame_interval. ## ## @item 'VideoFormat' ## Set the VideoFormat using FOURCC code (for example RGB3) or long name (RGB24). ## See set(obj, "VideoFormat") for a list. ## @end table ## ## @seealso{@@videoinput/get} ## @end deftypefn function ret = set (vi, varargin) if (length (varargin) == 1) # show available values for control ret = __list_range__(vi, varargin{1}); elseif (length (varargin) < 2 || rem (length (varargin), 2) != 0) error ('set: expecting property/value pairs'); else while (length (varargin) > 1) prop = varargin{1}; val = varargin{2}; varargin(1:2) = []; if(ischar (prop)) switch prop case 'ReturnedColorSpace' error ("Use set (VI, 'VideoFormat', FMT) to specify the returned image format"); case 'BayerSensorAlignment' error ("Use set (VI, 'VideoFormat', FMT) to specify the returned image format"); case 'VideoResolution' if (isvector (val) && isreal (val) && length (val) == 2) current_fmt = get(vi, "VideoFormat"); __imaq_handler_s_fmt__(vi.imaqh, current_fmt, val); else error ('set VideoResolution: expects a real vector [width height]'); endif case 'VideoInput' if (isscalar (val) && isreal (val)) __imaq_handler_set_input__(vi.imaqh, val); else error ('set VideoInput: expecting the value to be a scalar integer'); endif case 'VideoFrameInterval' if (ismatrix (val) && isreal (val) && numel (val) == 2) __imaq_handler_set_frameinterval__(vi.imaqh, val); else error ('set VideoFrameInterval: expecting a 1x2 matrix with [numerator, denominator]'); endif case 'VideoFormat' if (ischar (val)) __imaq_handler_s_fmt__(vi.imaqh, val, [0 0]); else error ('set VideoFormat: expecting a string'); endif otherwise if (!__is_read_only_property__(prop)) ctrls = __imaq_handler_queryctrl__(vi.imaqh); if (isfield(ctrls, prop)) __imaq_handler_s_ctrl__(vi.imaqh, ctrls.(prop).id, val); v = __imaq_handler_g_ctrl__(vi.imaqh, ctrls.(prop).id); if ( val != v) warning("driver limited set value %d to %d", val, v); endif else error ('set: invalid property of videoinput class'); endif endif endswitch endif endwhile endif endfunction ## List possible range or values for prop function ret = __list_range__ (vi, prop) if (prop) if (!__is_read_only_property__ (prop)) switch prop case 'ReturnedColorSpace' error ("Use set (VI, 'VideoFormat') to get a list of supported formats.") case 'BayerSensorAlignment' error ("Use set (VI, 'VideoFormat') to get a list of supported formats.") case 'VideoInput' # enumerate available inputs ret = __imaq_handler_enum_inputs__ (vi.imaqh); case 'VideoResolution' # enumerate possible framerates fmt = __imaq_handler_g_fmt__(vi.imaqh).fourcc; ret = __imaq_handler_enum_framesizes__ (vi.imaqh, fmt); case 'VideoFrameInterval' # return possible frameintervals for currently selected framesize fmt = __imaq_handler_g_fmt__(vi.imaqh).fourcc; current_frame_size = __imaq_handler_g_fmt__ (vi.imaqh).size; ret = __imaq_handler_enum_frameintervals__ (vi.imaqh, fmt, current_frame_size); case 'VideoFormat' ret = __imaq_handler_enum_formats__(vi.imaqh); otherwise ## perhaps a v4l2 control? ctrls = __imaq_handler_queryctrl__(vi.imaqh); if (isfield(ctrls, prop)) # yes, it is a v4l2 property ret = getfield(ctrls, prop); ret = rmfield(ret , 'id'); # mask id else error('unknown property %s', prop); endif endswitch endif else error('PROP has to be a character array'); endif endfunction function ret = __is_read_only_property__ (prop) switch prop case {'SelectedSourceName', 'DeviceCapabilities'} error('%s is a read-only property', prop); ret = 1; otherwise ret = 0; endswitch endfunction %!test %! obj = videoinput (__test__device__{:}); %! svi = set (obj, "VideoInput"); %! assert (isstruct(svi)) %! set(obj, "VideoInput", 0); %! s = set(obj, "VideoResolution"); %! assert (ismatrix(s)) %! set (obj, "VideoResolution", s(1,:)) %! if (rows(s)>1) %! set (obj, "VideoResolution", s(end,:)) %! endif %!error set(obj, "SelectedSourceName") %!error set(obj, "DeviceCapabilities") %!test %! obj = videoinput (__test__device__{:}); %! fmts = set (obj, 'VideoFormat'); %! set (obj, 'VideoFormat', fmts(1).fourcc); %! set (obj, 'VideoFormat', fmts(end).fourcc); %!test %! obj = videoinput (__test__device__{:}); %! T = set (obj, 'VideoFrameInterval'); %! # not all drives support enumeration and query of frameintervals %! if (rows(T) >= 1) %! set (obj, 'VideoFrameInterval', T(1,:)); %! set (obj, 'VideoFrameInterval', T(end,:)); %! endif # FIXME: this only works for v4l2 #%!warning #%! obj = videoinput (__test__device__{:}); #%! # This shouldn't be supported by any camera and the driver #%! # clamps this to valid values but a warning should be displayed #%! set (obj, 'VideoFrameInterval', [1 10000]); image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/__property_names__.m0000644000000000000000000000013215000642613023464 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/__property_names__.m0000644000175000017500000000224415000642613024360 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{props}] =} __property_names__ () ## Return the list of fixed properties for class videoinput. ## @end deftypefn function [props] = __property_names__ (vi) props = {"SelectedSourceName"; "ReturnedColorSpace"; "BayerSensorAlignment"; "DeviceCapabilities"; "VideoInput"; "VideoResolution"; "VideoFrameInterval", "VideoFormat"}; endfunction image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/get.m0000644000000000000000000000013215000642613020400 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/get.m0000644000175000017500000000752715000642613021305 0ustar00andyandy00000000000000## Copyright (C) 2014-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {@var{props} =} get (@var{vi}) ## @deftypefnx {Function File} {@var{val} =} get (@var{vi}, @var{prop}) ## Access property values of videoinput objects. ## ## Without @var{prop} a cell with available properties is returned. ## The entries starting with a upper letter are available on all devices, the others ## queried from and specific to the used driver. ## ## @example ## @group ## obj = videoinput ("v4l2", "/dev/video0"); ## get (obj) ## @result{} ## @{ ## [1,1] = SelectedSourceName ## [2,1] = ReturnedColorSpace ## [3,1] = BayerSensorAlignment ## [4,1] = DeviceCapabilities ## [5,1] = VideoInput ## [6,1] = VideoResolution ## [7,1] = VideoFrameInterval ## [8,1] = VideoFormat ## [9,1] = user_controls ## [10,1] = brightness ## [11,1] = contrast ## [12,1] = saturation ## [13,1] = white_balance_automatic ## [14,1] = gain ## [15,1] = power_line_frequency ## [16,1] = white_balance_temperature ## [17,1] = sharpness ## [18,1] = backlight_compensation ## [19,1] = camera_controls ## [20,1] = auto_exposure ## [21,1] = exposure_time_absolute ## [22,1] = exposure_dynamic_framerate ## @} ## @end group ## @end example ## ## @example ## @group ## obj = videoinput("v4l2", "/dev/video0"); ## get (obj, "SelectedSourceName") ## @result{} /dev/video0 ## @end group ## @end example ## ## @example ## @group ## obj = videoinput ("v4l2", "/dev/video0"); ## set(obj, "VideoResolution", [640 480]); ## get (obj, "VideoResolution") ## @result{} 640 480 ## @end group ## @end example ## @seealso{@@videoinput/set} ## @end deftypefn function val = get (vi, prop) if (nargin > 2) print_usage(); endif if (nargin == 1) ctrls = __imaq_handler_queryctrl__(vi.imaqh); val = vertcat(__property_names__(vi), fieldnames(ctrls)); else switch (prop) case "SelectedSourceName" val = vi.SelectedSourceName; case "DeviceCapabilities" val = __imaq_handler_querycap__(vi.imaqh); case "VideoInput" val = __imaq_handler_get_input__(vi.imaqh); case "VideoFrameInterval" val = __imaq_handler_get_frameinterval__(vi.imaqh); case "VideoResolution" val = __imaq_handler_g_fmt__(vi.imaqh).size; case "VideoFormat" val = __imaq_handler_g_fmt__(vi.imaqh).fourcc; otherwise # get controls ctrls = __imaq_handler_queryctrl__(vi.imaqh); if (isfield(ctrls, prop)) val = __imaq_handler_g_ctrl__(vi.imaqh, ctrls.(prop).id); else error ("videoinput: get: invalid property name '%s'", prop); endif endswitch endif endfunction %!test %! obj = videoinput(__test__device__{:}); %! props = get(obj); %! assert(get(obj, "SelectedSourceName"), __test__device__{2}); %! caps = get(obj, "DeviceCapabilities"); %! video_in = get(obj, "VideoInput"); %! s = get(obj, "VideoResolution"); %!test %! obj = videoinput(__test__device__{:}); %! T = get(obj, "VideoFrameInterval"); %!test %! obj = videoinput(__test__device__{:}); %! f = get(obj, "VideoFormat"); %!error get(videoinput(__test__device__{:}), "there_is_no_such_property") image-acquisition-0.3.3/inst/@videoinput/PaxHeaders/display.m0000644000000000000000000000013215000642613021266 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/inst/@videoinput/display.m0000644000175000017500000000311315000642613022156 0ustar00andyandy00000000000000## Copyright (C) 2024-2025 Andreas Weber ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . function display (vi) printf("%s = videoinput\n", inputname(1)); sp = repmat(' ',1,length(inputname(1))+3); printf("%sdevice = %s\n", sp, get(vi, "SelectedSourceName")); caps = get(vi, "DeviceCapabilities"); printf("%sdriver = %s\n", sp, caps.driver); if (isprop (vi, "PrettyName")) # use pretty name for media foundation printf("%scard = %s\n", sp, vi.PrettyName); else printf("%scard = %s\n", sp, caps.card); endif printf("%sVideoInput = %d\n", sp, get(vi, "VideoInput")); s = get(vi, "VideoResolution"); printf("%sVideoResolution = %d x %d px\n", sp, s(1), s(2)); fmt = get(vi, "VideoFormat"); printf("%sVideoFormat = %s\n", sp, fmt); T = get(vi, "VideoFrameInterval"); printf("%sVideoFrameInterval = %d/%d s (%.1f fps)\n", sp, T(1), T(2), T(2)/T(1)); endfunction image-acquisition-0.3.3/PaxHeaders/COPYING0000644000000000000000000000013215000642613015233 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/COPYING0000644000175000017500000010451415000642613016132 0ustar00andyandy00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . image-acquisition-0.3.3/PaxHeaders/DESCRIPTION0000644000000000000000000000013215000642613015706 xustar0030 mtime=1745044875.555464883 30 atime=1745044875.555464883 30 ctime=1745044875.563464851 image-acquisition-0.3.3/DESCRIPTION0000644000175000017500000000100015000642613016567 0ustar00andyandy00000000000000Name: image-acquisition Version: 0.3.3 Date: 2025-04-19 Author: Andreas Weber Maintainer: Andreas Weber Title: Image Acquisition Description: The Octave-forge Image Acquisition package provides functions to capture images from connected devices via v4l2 on GNU/Linux or "Media Foundation" on MS-Windows Vista and later. Depends: octave (>= 5.1.0) BuildRequires: libv4l-dev (>= 0.8.8) on GNU/Linux, libfltk1.1-dev (>= 1.1.0) or libfltk1.3-dev License: GPLv3+