diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38c3958ee..2bbf5ac47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,6 +102,7 @@ option(WITH_BEEFOCUS "Install Bee Focuser Driver" On)
option(WITH_SHELYAK "Install Shelyak Spectrograph Driver" On)
option(WITH_SKYWALKER "Install AOK SkyWalker Mount Driver" On)
option(WITH_TALON6 "Install Talon6 Mount Driver" On)
+option(WITH_PENTAX "Install Pentax Driver" On)
find_package(FFmpeg)
@@ -184,6 +185,12 @@ if (WITH_SBIG)
add_subdirectory(libsbig)
endif (WITH_SBIG)
+#libpentax
+if (WITH_PENTAX)
+add_subdirectory(libricohcamerasdk)
+add_subdirectory(libpktriggercord)
+endif (WITH_PENTAX)
+
#toupbase dependencies
if (WITH_TOUPBASE)
add_subdirectory(libtoupcam)
@@ -482,6 +489,19 @@ if (WITH_AVALON)
add_subdirectory(indi-avalon)
endif(WITH_AVALON)
+# Pentax
+if (WITH_PENTAX)
+find_package(PENTAX)
+if (PENTAX_FOUND)
+add_subdirectory(indi-pentax)
+else (PENTAX_FOUND)
+add_subdirectory(libpentax)
+add_subdirectory(libpktriggercord)
+SET(LIBRARIES_FOUND FALSE)
+endif (PENTAX_FOUND)
+endif(WITH_PENTAX)
+
+
# Check if libraries are found. If not, we must build them, install them, THEN run CMake again to build and instal the drivers. If all the libraraies are installed, then we build and install the drivers only now.
if (LIBRARIES_FOUND)
@@ -548,6 +568,10 @@ if (WITH_RTLSDR AND NOT RTLSDR)
message(STATUS "librtlsdr was not found. Please install librtlsdr first before running cmake again to install indi-rtlsdr.")
endif (WITH_RTLSDR AND NOT RTLSDR)
+if (WITH_PENTAX AND NOT PENTAX_FOUND)
+message(STATUS "libpktriggercord and/or libricohcamerasdk were not found and will now be built. Please install these libraries first before running cmake again to install indi-pentax.")
+endif (WITH_PENTAX AND NOT PENTAX_FOUND)
+
message(STATUS "####################################################################################################################################")
endif (LIBRARIES_FOUND)
diff --git a/cmake_modules/FindPENTAX.cmake b/cmake_modules/FindPENTAX.cmake
new file mode 100644
index 000000000..94034d13b
--- /dev/null
+++ b/cmake_modules/FindPENTAX.cmake
@@ -0,0 +1,79 @@
+# - Try to find PENTAX Universal Libraries
+# Once done this will define
+#
+# PENTAX_FOUND - system has PENTAX
+# PENTAX_INCLUDE_DIR - the PENTAX include directory
+# PENTAX_LIBRARIES - Link these to use PENTAX
+
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
+
+ # in cache already
+ set(PENTAX_FOUND TRUE)
+ message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}")
+
+else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
+
+ find_path(RICOH_INCLUDE_DIR ricoh_camera_sdk.hpp
+ PATH_SUFFIXES libpentax libricohcamerasdk
+ ${_obIncDir}
+ ${GNUWIN32_DIR}/include
+ )
+
+ find_path(PKTRIGGERCORD_INCLUDE_DIR libpktriggercord.h
+ PATH_SUFFIXES libpktriggercord
+ ${_obIncDir}
+ ${GNUWIN32_DIR}/include
+ )
+
+ if (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR)
+ set(PENTAX_INCLUDE_DIR ${RICOH_INCLUDE_DIR} ${PKTRIGGERCORD_INCLUDE_DIR})
+ endif (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR)
+
+ find_library(RICOH_LIBRARIES NAMES RicohCameraSDKCpp
+ PATHS
+ ${_obLinkDir}
+ ${GNUWIN32_DIR}/lib
+ PATH_SUFFIXES indipentax
+ )
+
+ find_library(RICOHMTP_LIBRARIES NAMES libmtp.so.9.3.0
+ PATHS
+ ${_obLinkDir}
+ ${GNUWIN32_DIR}/lib
+ PATH_SUFFIXES indipentax
+ )
+
+ find_library(PKTRIGGERCORD_LIBRARIES NAMES pktriggercord
+ PATHS
+ ${_obLinkDir}
+ ${GNUWIN32_DIR}/lib
+ PATH_SUFFIXES indipentax
+ )
+
+ if (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES)
+ set(PENTAX_LIBRARIES ${RICOH_LIBRARIES} ${RICOHMTP_LIBRARIES} ${PKTRIGGERCORD_LIBRARIES})
+ endif (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES)
+
+ if(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
+ set(PENTAX_FOUND TRUE)
+ else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
+ set(PENTAX_FOUND FALSE)
+ endif(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
+
+
+ if (PENTAX_FOUND)
+ if (NOT PENTAX_FIND_QUIETLY)
+ message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}")
+ endif (NOT PENTAX_FIND_QUIETLY)
+ else (PENTAX_FOUND)
+ if (PENTAX_FIND_REQUIRED)
+ message(FATAL_ERROR "One or both of libricohcamersdk and libpktriggercord are not found. Please install them. See http://www.indilib.org.")
+ endif (PENTAX_FIND_REQUIRED)
+ endif (PENTAX_FOUND)
+
+ mark_as_advanced(PENTAX_INCLUDE_DIR PENTAX_LIBRARIES)
+
+endif (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES)
diff --git a/indi-gphoto/indi_gphoto.xml.cmake b/indi-gphoto/indi_gphoto.xml.cmake
index 36ba47e91..0dfb5a27f 100644
--- a/indi-gphoto/indi_gphoto.xml.cmake
+++ b/indi-gphoto/indi_gphoto.xml.cmake
@@ -9,7 +9,7 @@
indi_nikon_ccd
@INDI_GPHOTO_VERSION_MAJOR@.@INDI_GPHOTO_VERSION_MINOR@
-
+
indi_pentax_ccd
@INDI_GPHOTO_VERSION_MAJOR@.@INDI_GPHOTO_VERSION_MINOR@
diff --git a/indi-pentax/AUTHORS b/indi-pentax/AUTHORS
new file mode 100644
index 000000000..24a9cdc0a
--- /dev/null
+++ b/indi-pentax/AUTHORS
@@ -0,0 +1 @@
+Karl Rees
diff --git a/indi-pentax/CMakeLists.txt b/indi-pentax/CMakeLists.txt
new file mode 100644
index 000000000..dfc0eea5b
--- /dev/null
+++ b/indi-pentax/CMakeLists.txt
@@ -0,0 +1,54 @@
+cmake_minimum_required(VERSION 2.8)
+PROJECT(indi_pentax CXX C)
+
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
+
+include(GNUInstallDirs)
+
+set (INDI_PENTAX_VERSION_MAJOR 1)
+set (INDI_PENTAX_VERSION_MINOR 0)
+
+#libmtp needs the runpath, but is an indirect dependency and therefore will only get runpath if we set the following flags
+set (CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags")
+
+find_package(CFITSIO REQUIRED)
+find_package(INDI REQUIRED)
+find_package(ZLIB REQUIRED)
+find_package(LibRaw REQUIRED)
+find_package(JPEG REQUIRED)
+find_package(GPHOTO2 REQUIRED)
+find_package(PENTAX REQUIRED)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_pentax.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_pentax.xml )
+
+include_directories( ${CMAKE_CURRENT_BINARY_DIR})
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR})
+include_directories( ${INDI_INCLUDE_DIR})
+include_directories( ${CFITSIO_INCLUDE_DIR})
+include_directories( ${LibRaw_INCLUDE_DIR})
+include_directories( ${PENTAX_INCLUDE_DIR})
+include_directories( ${PKTRIGGERCORD_INCLUDE_DIR})
+include_directories( ${GPHOTO2_INCLUDE_DIR})
+
+include(CMakeCommon)
+
+############# PENTAX CCD ###############
+set(indipentax_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/indi_pentax.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/pentax_ccd.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/pentax_event_handler.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/pktriggercord_ccd.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../indi-gphoto/gphoto_readimage.cpp
+)
+
+#need to use rpath to find libraries, since they need to be in a subfolder to avoid conflicts with the standard version of libmtp
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+add_executable(indi_pentax ${indipentax_SRCS})
+
+target_link_libraries(indi_pentax pthread ${PENTAX_LIBRARIES} ${INDI_LIBRARIES} ${JPEG_LIBRARIES} ${LibRaw_LIBRARIES} ${CFITSIO_LIBRARIES} ${ZLIB_LIBRARY})
+
+install(TARGETS indi_pentax RUNTIME DESTINATION bin)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_pentax.xml DESTINATION ${INDI_DATA_DIR})
diff --git a/indi-pentax/INSTALL b/indi-pentax/INSTALL
new file mode 100644
index 000000000..22df1381a
--- /dev/null
+++ b/indi-pentax/INSTALL
@@ -0,0 +1,14 @@
+INSTALL
+============
+
+Prerequisites:
+
+libpktriggercord (install from indi-3rdparty repo)
+libricohcamerasdk (install from indi-3rdparty repo)
+
+Instructions:
+
+1) $ cmake -DCMAKE_INSTALL_PREFIX=/usr .
+2) $ make
+3) $ sudo make install
+
diff --git a/indi-pentax/README.md b/indi-pentax/README.md
new file mode 100644
index 000000000..0e1241b55
--- /dev/null
+++ b/indi-pentax/README.md
@@ -0,0 +1,159 @@
+# Pentax Camera Driver for Indi
+
+## Introduction
+
+This driver supports various Pentax cameras in PTP and/or MSC mode.
+
+## Installation
+
+The driver requires two libraries: libRicohCameraSDKCpp and libPkTriggerCord. These are included with indi-pentax in the indi-3rdparty repository.
+
+*TODO (once packages are generated): Add instructions for installing packages.*
+
+To build/install everything manually, first clone the indi-3rdparty repository:
+
+```
+mkdir -p ~/Projects
+cd ~/Projects
+git clone https://github.com/karlrees/indi-3rdparty.git
+```
+
+*TODO (once pulled): update clone location to the main repository.*
+
+Next install libRicohCameraSDK:
+
+```
+cd ~/Projects/indi-3rdparty/libricohcamerasdk
+cmake -DCMAKE_INSTALL_PREFIX=/usr .
+make
+sudo make install
+```
+
+Next build/install libPkTriggerCord:
+
+```
+cd ~/Projects/indi-3rdparty/libpktriggercord
+cmake -DCMAKE_INSTALL_PREFIX=/usr .
+make
+sudo make install
+```
+
+Finally, build/install indi-pentax:
+
+```
+cd ~/Projects/indi-3rdparty/indi-pentax
+cmake -DCMAKE_INSTALL_PREFIX=/usr .
+make
+sudo make install
+```
+
+## Compatibility
+
+In general, a greater number of cameras are supported in MSC mode. However, for more recent cameras, PTP mode will probably be more reliable.
+
+Based on the documentation for the libraries that this driver relies upon, the following cameras *should* work. However, only cameras with an asterisk are actually confirmed. Please update this list if you verify support for any camera:
+
+- Pentax K-01 (MSC - known bugs)
+- PENTAX K-1 (PTP, MSC?)
+- PENTAX K-1 Mark II (PTP, MSC?)
+- Pentax K-3 / K-3 II (MSC)
+- Pentax K-5 (MSC)
+- Pentax K-5 II / K-5 IIs (MSC)
+- Pentax K-7 (MSC)
+- Pentax K10D / Samsung GX-10 (MSC - fw 1.20 or later)
+- Pentax K20D / Samsung GX-20 (MSC)
+- Pentax K-30 (MSC)
+- Pentax K-50 (MSC - known bugs)
+- PENTAX K-70 (PTP, MSC - with bugs) *
+- Pentax K200D (MSC)
+- Pentax K-500 (MSC)
+- PENTAX 645Z (PTP, MSC?)
+- Pentax K-r (MSC)
+- Pentax K-m / K2000 (MSC)
+- PENTAX KP (PTP, MSC?)
+
+Cameras suspected to have limited MSC support include:
+
+- Pentax istDS2
+- Pentax istDL
+- Pentax K100D Super
+
+Cameras likely *not* to work include:
+
+- Pentax istDS
+- Pentax istD
+- Samsung GX-1L
+- Pentax K110D
+- Pentax K100D
+- Pentax K-S2
+
+## Features
+
+The exact set of features available will depend on the current USB mode and capture mode of the camera. Not all features will be available on all cameras. The following is a rough list of what to expect:
+
+- Still image capture
+- Live View (PTP mode only)
+- Capture as FITS (processor intensive), Native, or both
+- Change image format (JPEG, PEF, or DNG) (DNG is saved as a .raw file)
+- Predefined capture mode support (e.g. Auto, Manual, etc.)
+- Bulb mode support (MSC mode only)
+- Set shutter speed to any supported by the capture mode to which the camera is currently set
+- Change ISO (For certain cameras, such as K70, works in PTP mode only)
+- Change Exposure (For certain cameras, such as K70, works in PTP mode only)
+- Change White Balance
+- Change JPEG image quality
+- Change JPEG image resolution (PTP mode only)
+- Toggle save to SD Card (PTP mode only)
+- Monitor battery level
+
+The driver *should* support multiple cameras at once, and the author is happy to verify that if anyone wants to donate another camera.
+
+*If there's a feature that PkTriggerCord supports for your camera, but the driver currently does not, it should be possible to add support. Contact the author with requests.*
+
+## Operation
+
+1. First, be sure the camera is in the desired USB mode (PTP or MSC). Then connect the camera via a USB cable to the Indi host and power the camera on.
+2. Set the camera to the appropriate capture mode. For PTP mode, Manual (M) is suggested for maximum flexibility. For MSC mode, Bulb (B) provides maximum flexibility.
+
+*However, if your exposures are 30 seconds or less, other modes (e.g. Manual) are close to twice as fast at starting the exposure and returning the image.*
+
+3. Start indiserver on the host with "Pentax DSLR (Native)" selected as a driver.
+
+If you are starting indiserver from the command line, you can use:
+
+```
+indiserver indi_pentax
+```
+
+4. Launch your Indi client, if you are not already in the client, and click "Connect" if you are not already connected.
+5. Once connected, you should see a device pane for your Pentax camera. The device pane will have a number of tabs. You may change most settings in the Image Settings tab of the Indi Control Panel, though FITs/Native settings are in the Options tab.
+6. To capture an image using the Indi Control Panel, go to the Main Control tab and select an exposure duration. Then click "Set" to start the exposure.
+
+*Note that unless you are in bulb mode, the exposure time you choose will not be the exact exposure time, but will be matched to the closest predefined exposure time of your current capture mode.*
+
+7. For Live View, be sure you are in PTP mode, and select the Streaming tab.
+
+Images and Live View are also supported through Ekos, as explained in the Ekos documentation.
+
+### Switching operational modes
+
+You may switch capture modes (e.g. switch from Auto to Manual or Manual to Bulb) at any time.
+
+To switch between PTP and MSC, you will need to unplug the camera from the host and change to the desired USB mode using the on-camera menu. You may need to manually disconnect from the driver in the Indi client (e.g. using the "Disconnect" button) if you are in MSC mode. Then, plug the camera back into the host and click on "Connect" again. A separate device pane will be created for your new USB mode, if it does not already exist. Switch to the new device pane and cick "Connect" to continue in the new USB mode.
+
+## Known Issues
+
+- Bulb mode does not work in PTP mode.
+- Changing ISO and exposure do not work on the K-70 in MSC mode (probably other cameras as well).
+- When DNG format is selected, images are currently saved with a "raw" extension. This is because Indi seems to have a bug with .DNG files where it grabs the JPEG preview out of DNGs and discards the rest of the DNG file. The raw files may be safely renamed to ".DNG."
+- When compiled on Ubuntu Mate 18.0.4 (Raspberry Pi 3B), PTP mode does not work. This appears to be because the indi_pentax binary generated by the compiler is for armv7, whereas the library files provided by Ricoh are for armv6. Yet, I currently cannot figure out how to get indi-pentax to compile if I force the compiler to armv6. A workaraound is to use a binary generated on Rasbian.
+- The Ricoh Camera SDK uses a custom version of libmtp with a version number of 9.3.0. Not surprisingly, this can cause problems if the
+standard version of libmtp is installed. To avoid these problems, the requisite libraries are configured to be installed in the "indipentax" subdirectory of CMAKE_INSTALL_LIBDIR. That subdirectory is then listed in the RPATH of the indi_pentax binary (not the RUNPATH, since libmtp is an indirect dependency). I'm sure this negatively affects the modularity of indi-pentax. I'm happy to take suggestions if there's a better way to deal with this issue.
+
+## Author / Acknowledgments
+
+This driver was developed by Karl Rees, copyright 2020.
+
+Thanks to Andras Salamon for PkTrigercord, which is used for MSC mode. Specifically, this driver wraps PkTriggerCord into a shared library called libPkTriggerCord. More information about PkTriggerCord and source code available from: https://api.ricoh/products/camera-sdk/.
+
+Thanks also to Ricoh Company, Ltd. for providing the Ricoh Camera SDK (libRicohCameraSDKCpp), which is used for PTP mode. The SDK is available from: https://api.ricoh/products/camera-sdk/.
diff --git a/indi-pentax/config.h.cmake b/indi-pentax/config.h.cmake
new file mode 100644
index 000000000..059f7d16a
--- /dev/null
+++ b/indi-pentax/config.h.cmake
@@ -0,0 +1,10 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+/* Define INDI Data Dir */
+#cmakedefine INDI_DATA_DIR "@INDI_DATA_DIR@"
+/* Define Driver version */
+#define INDI_PENTAX_VERSION_MAJOR @INDI_PENTAX_VERSION_MAJOR@
+#define INDI_PENTAX_VERSION_MINOR @INDI_PENTAX_VERSION_MINOR@
+
+#endif // CONFIG_H
diff --git a/indi-pentax/indi_pentax.cpp b/indi-pentax/indi_pentax.cpp
new file mode 100644
index 000000000..2f119f546
--- /dev/null
+++ b/indi-pentax/indi_pentax.cpp
@@ -0,0 +1,183 @@
+/*
+ Pentax CCD Driver for Indi (using Ricoh Camera SDK)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "indi_pentax.h"
+
+static void cleanup()
+{
+ for (int i = 0; i < cameraCount; i++)
+ {
+ delete cameras[i];
+ }
+}
+
+static bool isInit = false;
+
+//idea here is to allow users to switch between PTP and MSC mode automatically when driver is disconnected
+//which requires looking for new cameras. This is a little problemmatic if more than one camera is connected, but I don't think that'd be a common use case
+bool cameraIsConnected() {
+ for (int j=0; jisConnected()) return true;
+ }
+ return false;
+}
+
+void ISInit()
+{
+ if (!isInit)
+ {
+ std::vector> detectedCameraDevices = CameraDeviceDetector::detect(DeviceInterface::USB);
+ int detectedCameraCount = detectedCameraDevices.size();
+ int registeredSDKCameraCount = registeredSDKCams.size();
+
+ // look for SDK supported cameras (PTP mode) first
+ if (detectedCameraCount > 0) {
+ for (int i = 0; (i < detectedCameraCount) && (i < MAX_DEVICES); i++) {
+ bool camalreadyregistered = false;
+ for (int j=0; jgetDeviceName(),strlen(camname))) camalreadyregistered = true;
+ }
+ if (!camalreadyregistered) {
+ cameras[cameraCount++] = new PkTriggerCordCCD(camname);
+ }
+ pslr_disconnect(camhandle);
+ pslr_shutdown(camhandle);
+ }
+ }
+ if (cameraCount <= 0)
+ DEBUGDEVICE(logdevicename,INDI::Logger::DBG_ERROR, "No supported Pentax cameras were found. Perhaps the camera is not supported, not powered up, or needs to be in MSC mode?");
+
+
+ atexit(cleanup);
+ isInit = true;
+ }
+}
+
+void ISGetProperties(const char *dev)
+{
+ ISInit();
+ for (int i = 0; i < cameraCount; i++)
+ {
+ INDI::CCD *camera = cameras[i];
+ if (dev == nullptr || !strcmp(dev, camera->getDeviceName()))
+ {
+ camera->ISGetProperties(dev);
+ if (dev != nullptr)
+ break;
+ }
+ }
+}
+
+void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int num)
+{
+ for (int i = 0; i < cameraCount; i++)
+ {
+ INDI::CCD *camera = cameras[i];
+ if (dev == nullptr || !strcmp(dev, camera->getDeviceName()))
+ {
+ camera->ISNewSwitch(dev, name, states, names, num);
+ if (dev != nullptr)
+ break;
+ }
+ }
+
+ //also check for new cameras and add them
+ if (!strcmp(name, "CONNECTION")) {
+ int oldCameraCount = cameraCount;
+ if (cameraCount == 0 || !cameraIsConnected()) isInit = false;
+ ISInit();
+ for (int i=oldCameraCount; iISGetProperties(cameras[i]->getDeviceName());
+ }
+ }
+}
+
+void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int num)
+{
+ ISInit();
+ for (int i = 0; i < cameraCount; i++)
+ {
+ INDI::CCD *camera = cameras[i];
+ if (dev == nullptr || !strcmp(dev, camera->getDeviceName()))
+ {
+ camera->ISNewText(dev, name, texts, names, num);
+ if (dev != nullptr)
+ break;
+ }
+ }
+}
+
+void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num)
+{
+ ISInit();
+ for (int i = 0; i < cameraCount; i++)
+ {
+ INDI::CCD *camera = cameras[i];
+ if (dev == nullptr || !strcmp(dev, camera->getDeviceName()))
+ {
+ camera->ISNewNumber(dev, name, values, names, num);
+ if (dev != nullptr)
+ break;
+ }
+ }
+}
+
+void ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
+ char *names[], int n)
+{
+ INDI_UNUSED(dev);
+ INDI_UNUSED(name);
+ INDI_UNUSED(sizes);
+ INDI_UNUSED(blobsizes);
+ INDI_UNUSED(blobs);
+ INDI_UNUSED(formats);
+ INDI_UNUSED(names);
+ INDI_UNUSED(n);
+}
+
+void ISSnoopDevice(XMLEle *root)
+{
+ ISInit();
+
+ for (int i = 0; i < cameraCount; i++)
+ {
+ INDI::CCD *camera = cameras[i];
+ camera->ISSnoopDevice(root);
+ }
+}
diff --git a/indi-pentax/indi_pentax.h b/indi-pentax/indi_pentax.h
new file mode 100644
index 000000000..f6c424c62
--- /dev/null
+++ b/indi-pentax/indi_pentax.h
@@ -0,0 +1,35 @@
+/*
+ Pentax drivers for Indi
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ */
+
+#ifndef INDI_PENTAX_H
+#define INDI_PENTAX_H
+
+#include "pentax_ccd.h"
+#include "pentax_event_handler.h"
+#include "pktriggercord_ccd.h"
+
+#define MAX_DEVICES 20 /* Max device cameraCount */
+
+static int cameraCount = 0;
+static INDI::CCD *cameras[MAX_DEVICES];
+static char logdevicename[14]= "Pentax Driver";
+std::vector> registeredSDKCams;
+
+#endif // INDI_PENTAX_H
diff --git a/indi-pentax/indi_pentax.xml.cmake b/indi-pentax/indi_pentax.xml.cmake
new file mode 100644
index 000000000..d572bf4ce
--- /dev/null
+++ b/indi-pentax/indi_pentax.xml.cmake
@@ -0,0 +1,9 @@
+
+
+
+
+ indi_pentax
+ @INDI_PENTAX_VERSION_MAJOR@.@INDI_PENTAX_VERSION_MINOR@
+
+
+
diff --git a/indi-pentax/pentax_ccd.cpp b/indi-pentax/pentax_ccd.cpp
new file mode 100644
index 000000000..af3362022
--- /dev/null
+++ b/indi-pentax/pentax_ccd.cpp
@@ -0,0 +1,653 @@
+/*
+ Pentax CCD Driver for Indi (using Ricoh Camera SDK)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "pentax_ccd.h"
+
+
+PentaxCCD::PentaxCCD(std::shared_ptr camera)
+{
+ this->device = camera;
+ snprintf(this->name, 32, "%s (PTP)", camera->getModel().c_str());
+ setDeviceName(this->name);
+ InExposure = false;
+ InDownload = false;
+
+ setVersion(INDI_PENTAX_VERSION_MAJOR, INDI_PENTAX_VERSION_MINOR);
+ LOG_INFO("The Pentax camera driver for PTP mode uses Ricoh Camera SDK, courtesy of Ricoh Company, Ltd. See https://api.ricoh/products/camera-sdk.");
+}
+
+PentaxCCD::~PentaxCCD()
+{
+}
+
+const char *PentaxCCD::getDefaultName()
+{
+ return "Pentax DSLR";
+}
+
+bool PentaxCCD::initProperties()
+{
+ // Init parent properties first
+ INDI::CCD::initProperties();
+
+ IUFillText(&DeviceInfoT[0], "MANUFACTURER", "Manufacturer", device->getManufacturer().c_str());
+ IUFillText(&DeviceInfoT[1], "MODEL", "Model", device->getModel().c_str());
+ IUFillText(&DeviceInfoT[2], "FIRMWARE_VERSION", "Firmware", device->getFirmwareVersion().c_str());
+ IUFillText(&DeviceInfoT[3], "SERIAL_NUMBER", "Serial", device->getSerialNumber().c_str());
+ IUFillText(&DeviceInfoT[4], "BATTERY", "Battery", "");
+ IUFillText(&DeviceInfoT[5], "EXPPROGRAM", "Program", "");
+ IUFillText(&DeviceInfoT[6], "UCMODE", "User Mode", "");
+ IUFillTextVector(&DeviceInfoTP, DeviceInfoT, NARRAY(DeviceInfoT), getDeviceName(), "DEVICE_INFO", "Device Info", INFO_TAB, IP_RO, 60, IPS_IDLE);
+ registerProperty(&DeviceInfoTP, INDI_TEXT);
+
+ IUFillSwitch(&autoFocusS[0], "ON", "On", ISS_OFF);
+ IUFillSwitch(&autoFocusS[1], "OFF", "Off", ISS_ON);
+ IUFillSwitchVector(&autoFocusSP, autoFocusS, 2, getDeviceName(), "AUTO_FOCUS", "Auto Focus", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
+
+ IUFillSwitch(&transferFormatS[0], "FORMAT_FITS", "FITS", ISS_ON);
+ IUFillSwitch(&transferFormatS[1], "FORMAT_NATIVE", "Native", ISS_OFF);
+ IUFillSwitchVector(&transferFormatSP, transferFormatS, 2, getDeviceName(), "CCD_TRANSFER_FORMAT", "Output", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
+
+ IUFillSwitch(&preserveOriginalS[1], "PRESERVE_ON", "Also Copy Native Image", ISS_OFF);
+ IUFillSwitch(&preserveOriginalS[0], "PRESERVE_OFF", "Keep FITS Only", ISS_ON);
+ IUFillSwitchVector(&preserveOriginalSP, preserveOriginalS, 2, getDeviceName(), "PRESERVE_ORIGINAL", "Copy Option", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
+
+ PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0, 30, 1, false);
+
+ IUSaveText(&BayerT[2], "RGGB");
+
+ PrimaryCCD.getCCDInfo()->p = IP_RW;
+
+ uint32_t cap = CCD_HAS_BAYER | CCD_HAS_STREAMING;
+ SetCCDCapability(cap);
+
+ Streamer->setStreamingExposureEnabled(false);
+ Streamer->setPixelFormat(INDI_JPG);
+
+ addConfigurationControl();
+ addDebugControl();
+ return true;
+}
+
+void PentaxCCD::ISGetProperties(const char *dev)
+{
+ INDI::CCD::ISGetProperties(dev);
+}
+
+bool PentaxCCD::updateProperties()
+{
+ INDI::CCD::updateProperties();
+
+ if (isConnected())
+ {
+ deleteProperty("CCD_COMPRESSION");
+ setupParams();
+
+ buildCaptureSwitches();
+
+ defineSwitch(&transferFormatSP);
+ defineSwitch(&autoFocusSP);
+ if (transferFormatS[0].s == ISS_ON) {
+ defineSwitch(&preserveOriginalSP);
+ }
+
+ timerID = SetTimer(POLLMS);
+ }
+ else
+ {
+ deleteCaptureSwitches();
+
+ deleteProperty(autoFocusSP.name);
+ deleteProperty(transferFormatSP.name);
+ deleteProperty(preserveOriginalSP.name);
+
+ rmTimer(timerID);
+ }
+
+ return true;
+}
+
+void PentaxCCD::buildCaptureSwitches() {
+ buildCaptureSettingSwitch(&mIsoSP,&iso,"ISO","CCD_ISO");
+ buildCaptureSettingSwitch(&mApertureSP,&aperture,"Aperture");
+ buildCaptureSettingSwitch(&mExpCompSP,&exposurecomp,"Exp Comp");
+ buildCaptureSettingSwitch(&mWhiteBalanceSP,&whitebalance,"White Balance");
+ buildCaptureSettingSwitch(&mIQualitySP,&imagequality,"Quality");
+ buildCaptureSettingSwitch(&mFormatSP,&imageformat,"Format","CAPTURE_FORMAT");
+ buildCaptureSettingSwitch(&mStorageWritingSP,&storagewriting, "Write to SD");
+
+ refreshBatteryStatus();
+ IUSaveText(&DeviceInfoT[5],exposureprogram.toString().c_str());
+ IUSaveText(&DeviceInfoT[6],usercapturesettingsmode.toString().c_str());
+ IDSetText(&DeviceInfoTP,nullptr);
+}
+
+void PentaxCCD::deleteCaptureSwitches() {
+ if (mIsoSP.nsp > 0) deleteProperty(mIsoSP.name);
+ if (mApertureSP.nsp > 0) deleteProperty(mApertureSP.name);
+ if (mExpCompSP.nsp > 0) deleteProperty(mExpCompSP.name);
+ if (mWhiteBalanceSP.nsp > 0) deleteProperty(mWhiteBalanceSP.name);
+ if (mIQualitySP.nsp > 0) deleteProperty(mIQualitySP.name);
+ if (mFormatSP.nsp > 0) deleteProperty(mFormatSP.name);
+ if (mStorageWritingSP.nsp > 0) deleteProperty(mStorageWritingSP.name);
+}
+
+void PentaxCCD::refreshBatteryStatus() {
+ char batterylevel[10];
+ sprintf(batterylevel,"%d%%",device->getStatus().getBatteryLevel());
+ IUSaveText(&DeviceInfoT[4],batterylevel);
+ IDSetText(&DeviceInfoTP,nullptr);
+}
+
+bool PentaxCCD::Connect()
+{
+ if (device->getEventListeners().size() == 0) {
+ listener = std::make_shared(this);
+ device->addEventListener(listener);
+ }
+ Response response = device->connect(DeviceInterface::USB);
+ if (response.getResult() == Result::Ok) {
+ LOG_INFO("Camera connected.");
+ } else {
+ LOG_INFO("Error connecting to camera.");
+ for (const auto& error : response.getErrors()) {
+ LOGF_INFO("Error Code: %d (%s)",static_cast(error->getCode()),error->getMessage().c_str());
+ }
+ return false;
+ }
+ LOG_INFO("Connected to Pentax camera in PTP mode.");
+ return true;
+}
+
+bool PentaxCCD::Disconnect()
+{
+ if (device->isConnected(DeviceInterface::USB)) {
+ Response response = device->disconnect(DeviceInterface::USB);
+ if (response.getResult() == Result::Ok) {
+ LOG_INFO("Camera disconnected.");
+ } else {
+ LOG_INFO("Error disconnecting from camera.");
+ for (const auto& error : response.getErrors()) {
+ LOGF_INFO("Error Code: %d (%s)",static_cast(error->getCode()),error->getMessage().c_str());
+ }
+ return false;
+ }
+ }
+ return true;
+
+}
+
+bool PentaxCCD::setupParams()
+{
+ getCaptureSettingsState();
+ return true;
+}
+
+
+bool PentaxCCD::StartExposure(float duration)
+{
+ if (InExposure)
+ {
+ LOG_ERROR("Camera is already exposing.");
+ return false;
+ }
+ else if (Streamer->isBusy()) {
+ LOG_WARN("Cannot start exposure because the camera is streaming. Please stop streaming first.");
+ return false;
+ }
+ else {
+
+ InExposure = true;
+
+ //update shutter speed if needed
+ double ret = updateShutterSpeed(duration);
+ if (ret) duration = ret;
+ PrimaryCCD.setExposureDuration(duration);
+ ExposureRequest = duration;
+
+ //apply any outstanding capture settings changes
+ if (updatedCaptureSettings.size()>0) {
+ LOG_INFO("Updating camera capture settings.");
+ Response response = device->setCaptureSettings(updatedCaptureSettings);
+ if (response.getResult() == Result::Error) {
+ for (const auto& error : response.getErrors()) {
+ LOGF_ERROR("Error setting updating capture settings (%d): %s", static_cast(error->getCode()), error->getMessage().c_str());
+ }
+ }
+ updatedCaptureSettings.clear();
+ getCaptureSettingsState();
+ }
+
+ //start capture
+ gettimeofday(&ExpStart, nullptr);
+ LOGF_INFO("Taking a %g seconds frame...", ExposureRequest);
+ try
+ {
+ StartCaptureResponse response = device->startCapture((autoFocusS[0].s == ISS_ON));
+ if (response.getResult() == Result::Ok) {
+ pendingCapture = response.getCapture();
+ LOGF_INFO("Capture has started. Capture ID: %s",response.getCapture()->getId().c_str());
+ InDownload = false;
+ } else {
+ LOGF_ERROR("Capture failed to start (%s)",response.getErrors()[0]->getMessage().c_str());
+ InExposure = false;
+ return false;
+ }
+ }
+ catch (std::runtime_error e){
+ LOGF_ERROR("runtime_error: %s",e.what());
+ InExposure = false;
+ return false;
+ }
+
+ return true;
+ }
+}
+
+bool PentaxCCD::AbortExposure()
+{
+ if (Streamer->isBusy()) {
+ LOG_INFO("Camera is currently streaming. Driver will abort without stopping camera.");
+ }
+ else {
+ Response response = device->stopCapture();
+ if (response.getResult() == Result::Ok) {
+ LOG_INFO("Capture aborted.");
+ InExposure = false;
+ } else {
+ LOGF_ERROR("Capture failed to abort (%s)",response.getErrors()[0]->getMessage().c_str());
+ return false;
+ }
+ }
+ return true;
+}
+
+bool PentaxCCD::UpdateCCDFrameType(INDI::CCDChip::CCD_FRAME fType)
+{
+ INDI::CCDChip::CCD_FRAME imageFrameType = PrimaryCCD.getFrameType();
+
+ if (fType == imageFrameType)
+ return true;
+
+ switch (imageFrameType)
+ {
+ case INDI::CCDChip::BIAS_FRAME:
+ case INDI::CCDChip::DARK_FRAME:
+ /**********************************************************
+ *
+ *
+ *
+ * IMPORTANT: Put here your CCD Frame type here
+ * BIAS and DARK are taken with shutter closed, so _usually_
+ * most CCD this is a call to let the CCD know next exposure shutter
+ * must be closed. Customize as appropiate for the hardware
+ * If there is an error, report it back to client
+ * e.g.
+ * LOG_INFO( "Error, unable to set frame type to ...");
+ * return false;
+ *
+ *
+ **********************************************************/
+ break;
+
+ case INDI::CCDChip::LIGHT_FRAME:
+ case INDI::CCDChip::FLAT_FRAME:
+ /**********************************************************
+ *
+ *
+ *
+ * IMPORTANT: Put here your CCD Frame type here
+ * LIGHT and FLAT are taken with shutter open, so _usually_
+ * most CCD this is a call to let the CCD know next exposure shutter
+ * must be open. Customize as appropiate for the hardware
+ * If there is an error, report it back to client
+ * e.g.
+ * LOG_INFO( "Error, unable to set frame type to ...");
+ * return false;
+ *
+ *
+ **********************************************************/
+ break;
+ }
+
+ PrimaryCCD.setFrameType(fType);
+
+ return true;
+}
+
+
+float PentaxCCD::CalcTimeLeft()
+{
+ double timesince;
+ double timeleft;
+ struct timeval now;
+ gettimeofday(&now, nullptr);
+
+ timesince = (double)(now.tv_sec * 1000.0 + now.tv_usec / 1000) -
+ (double)(ExpStart.tv_sec * 1000.0 + ExpStart.tv_usec / 1000);
+ timesince = timesince / 1000;
+
+ timeleft = ExposureRequest - timesince;
+ return timeleft;
+}
+
+void PentaxCCD::TimerHit()
+{
+ int timerID = -1;
+ long timeleft;
+
+ if (isConnected() == false)
+ return; // No need to reset timer if we are not connected anymore
+
+ if (InExposure)
+ {
+ timeleft = CalcTimeLeft();
+ if (pendingCapture->getState()==CaptureState::Complete) {
+ InExposure = false;
+ InDownload = true;
+ }
+ if (timeleft < 1.0)
+ {
+ if (timeleft > 0.25)
+ {
+ // a quarter of a second or more
+ // just set a tighter timer
+ timerID = SetTimer(250);
+ }
+ else
+ {
+ if (timeleft > 0.07)
+ {
+ // use an even tighter timer
+ timerID = SetTimer(50);
+ }
+ else
+ {
+ InDownload = true;
+ LOG_INFO("Capture finished. Waiting for image download...");
+ InExposure=false;
+ timeleft=0;
+ PrimaryCCD.setExposureLeft(0);
+ }
+ }
+ }
+ else
+ {
+ if (isDebug())
+ {
+ IDLog("With time left %ld\n", timeleft);
+ IDLog("image not yet ready....\n");
+ }
+ PrimaryCCD.setExposureLeft(timeleft);
+ }
+ }
+
+ if (InDownload) {
+ if (pendingCapture->getState()==CaptureState::Complete) {
+ if (bufferIsBayered) SetCCDCapability(GetCCDCapability() | CCD_HAS_BAYER);
+ else SetCCDCapability(GetCCDCapability() & ~CCD_HAS_BAYER);
+ InDownload = false;
+ ExposureComplete(&PrimaryCCD);
+ }
+ else if (pendingCapture->getState()==CaptureState::Unknown) {
+ LOG_ERROR("Capture entered unknown state. Aborting...");
+ AbortExposure();
+ }
+ else if (isDebug())
+ {
+ IDLog("Still waiting for download...");
+ }
+ }
+
+ if (timerID == -1)
+ SetTimer(POLLMS);
+ return;
+}
+
+bool PentaxCCD::StartStreaming()
+{
+ if (InExposure) {
+ LOG_WARN("Camera is in the middle of an exposure. Please wait until finished, or abort.");
+ return false;
+ }
+ else if (Streamer->isBusy()) {
+ LOG_WARN("Streamer is already active.");
+ return false;
+ }
+ else {
+ Response response = device->startLiveView();
+ if (response.getResult() == Result::Ok) {
+ LOG_INFO("Started streamer.");
+ return true;
+ } else {
+ LOG_ERROR("Could not start streamer.");
+ return false;
+ }
+ }
+}
+
+bool PentaxCCD::StopStreaming()
+{
+ Response response = device->stopLiveView();
+ if (response.getResult() == Result::Ok) {
+ LOG_INFO("Stopped streamer.");
+ return true;
+ } else {
+ LOG_ERROR("Could not stop streamer.");
+ return false;
+ }
+}
+
+
+ISwitch * PentaxCCD::create_switch(const char * basestr, std::vector options, int setidx)
+{
+
+ ISwitch * sw = static_cast(calloc(sizeof(ISwitch), options.size()));
+ ISwitch * one_sw = sw;
+
+ char sw_name[MAXINDINAME];
+ char sw_label[MAXINDILABEL];
+ ISState sw_state;
+
+ for (int i = 0; i < (int)options.size(); i++)
+ {
+ snprintf(sw_name, MAXINDINAME, "%s%d", basestr, i);
+ strncpy(sw_label, options[i].c_str(), MAXINDILABEL);
+ sw_state = (i == setidx) ? ISS_ON : ISS_OFF;
+
+ IUFillSwitch(one_sw++, sw_name, sw_label, sw_state);
+ }
+
+ return sw;
+}
+
+float convertShutterSpeedString(string str) {
+ float num = stof(str);
+ int dividx = str.find("/");
+ int denom = 1;
+ if (dividx>-1) {
+ denom = stoi(str.substr(dividx+1,str.length()-dividx));
+ }
+ return num/denom;
+}
+
+float PentaxCCD::updateShutterSpeed(float requestedSpeed) {
+
+ double lowestdiff = 7200;
+ const CaptureSetting *targetSpeed = nullptr;
+ float targetSpeed_f;
+ for (const auto ss : shutter.getAvailableSettings()) {
+ float ss_f = convertShutterSpeedString(ss->getValue().toString());
+ double currentdiff = abs(ss_f - requestedSpeed);
+ if (currentdiff < lowestdiff) {
+ targetSpeed = ss;
+ targetSpeed_f = ss_f;
+ lowestdiff = currentdiff;
+ }
+ else if (targetSpeed) {
+ break;
+ }
+ }
+ if (targetSpeed) {
+ if (requestedSpeed != targetSpeed_f) {
+ LOGF_INFO("Requested shutter speed of %f not supported. Setting to closest supported speed: %f.",requestedSpeed,targetSpeed_f);
+ }
+ if (convertShutterSpeedString(shutter.getValue().toString()) != targetSpeed_f) {
+ //updatedCaptureSettings.push_back(targetSpeed);
+ updatedCaptureSettings.insert(updatedCaptureSettings.begin(),targetSpeed);
+ }
+ else {
+ LOGF_DEBUG("Shutter speed already %f, not setting.",targetSpeed_f);
+ }
+ return targetSpeed_f;
+ }
+ LOG_INFO("The camera is currently in an exposure program that does not permit setting the shutter speed externally. Shutter speed will instead be controlled by camera.");
+ return requestedSpeed;
+}
+
+void PentaxCCD::updateCaptureSetting(CaptureSetting *setting, string newval) {
+ for (auto i : setting->getAvailableSettings()) {
+ if (i->getValue().toString() == newval) {
+ updatedCaptureSettings.push_back(i);
+ return;
+ }
+ }
+ LOGF_ERROR("Error setting %S to %s: not supported in current camera mode", setting->getName(), newval.c_str());
+}
+
+bool PentaxCCD::ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n)
+{
+
+ if (!strcmp(name, autoFocusSP.name)) {
+ IUUpdateSwitch(&autoFocusSP, states, names, n);
+ autoFocusSP.s = IPS_OK;
+ IDSetSwitch(&autoFocusSP, nullptr);
+ }
+ else if (!strcmp(name, transferFormatSP.name)) {
+ IUUpdateSwitch(&transferFormatSP, states, names, n);
+ transferFormatSP.s = IPS_OK;
+ IDSetSwitch(&transferFormatSP, nullptr);
+ if (transferFormatS[0].s == ISS_ON) {
+ defineSwitch(&preserveOriginalSP);
+ } else {
+ deleteProperty(preserveOriginalSP.name);
+ }
+ }
+ else if (!strcmp(name, preserveOriginalSP.name)) {
+ IUUpdateSwitch(&preserveOriginalSP, states, names, n);
+ preserveOriginalSP.s = IPS_OK;
+ IDSetSwitch(&preserveOriginalSP, nullptr);
+ }
+ else if (!strcmp(name, mIsoSP.name)) {
+ updateCaptureSettingSwitch(&iso,&mIsoSP,states,names,n);
+ }
+ else if (!strcmp(name, mApertureSP.name)) {
+ updateCaptureSettingSwitch(&aperture,&mApertureSP,states,names,n);
+ }
+ else if (!strcmp(name, mExpCompSP.name)) {
+ updateCaptureSettingSwitch(&exposurecomp,&mExpCompSP,states,names,n);
+ }
+ else if (!strcmp(name, mWhiteBalanceSP.name)) {
+ updateCaptureSettingSwitch(&whitebalance,&mWhiteBalanceSP,states,names,n);
+ }
+ else if (!strcmp(name, mIQualitySP.name)) {
+ updateCaptureSettingSwitch(&imagequality,&mIQualitySP,states,names,n);
+ }
+ else if (!strcmp(name, mFormatSP.name)) {
+ updateCaptureSettingSwitch(&imageformat,&mFormatSP,states,names,n);
+ }
+ else if (!strcmp(name, mStorageWritingSP.name)) {
+ updateCaptureSettingSwitch(&storagewriting,&mStorageWritingSP,states,names,n);
+ }
+ else {
+ return INDI::CCD::ISNewSwitch(dev, name, states, names, n);
+ }
+ return true;
+}
+
+void PentaxCCD::updateCaptureSettingSwitch(CaptureSetting * setting, ISwitchVectorProperty * sw, ISState * states, char * names[], int n) {
+ ISwitch * previous = IUFindOnSwitch(sw);
+ IUUpdateSwitch(sw, states, names, n);
+ sw->s = IPS_OK;
+ IDSetSwitch(sw, nullptr);
+ ISwitch * selected = IUFindOnSwitch(sw);
+ if (previous != selected) updateCaptureSetting(setting,selected->label);
+}
+
+bool PentaxCCD::saveConfigItems(FILE * fp) {
+
+ for (auto sw : std::vector{&mIsoSP,&mApertureSP,&mExpCompSP,&mWhiteBalanceSP,&mIQualitySP,&mFormatSP,&mStorageWritingSP}) {
+ if (sw->nsp>0) IUSaveConfigSwitch(fp, sw);
+ }
+
+ // Save regular CCD properties
+ return INDI::CCD::saveConfigItems(fp);
+}
+
+void PentaxCCD::addFITSKeywords(fitsfile * fptr, INDI::CCDChip * targetChip)
+{
+ INDI::CCD::addFITSKeywords(fptr, targetChip);
+
+ int status = 0;
+
+ if (mIsoSP.nsp > 0)
+ {
+ ISwitch * onISO = IUFindOnSwitch(&mIsoSP);
+ if (onISO)
+ {
+ int isoSpeed = atoi(onISO->label);
+ if (isoSpeed > 0)
+ fits_update_key_s(fptr, TUINT, "ISOSPEED", &isoSpeed, "ISO Speed", &status);
+ }
+ }
+}
+
+void PentaxCCD::buildCaptureSettingSwitch(ISwitchVectorProperty *control, CaptureSetting *setting, const char *label, const char *name) {
+ std::vector optionList;
+ int set_idx=0, i=0;
+ for (const auto s : setting->getAvailableSettings()) {
+ optionList.push_back(s->getValue().toString());
+ if (s->getValue().toString() == setting->getValue().toString()) set_idx=i;
+ i++;
+ }
+
+ if (optionList.size() > 0)
+ {
+ IUFillSwitchVector(control, create_switch(setting->getName().c_str(), optionList, set_idx),
+ optionList.size(), getDeviceName(),
+ name ? name : setting->getName().c_str(),
+ label ? label : setting->getName().c_str(),
+ IMAGE_SETTINGS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
+ defineSwitch(control);
+ }
+}
+
+void PentaxCCD::getCaptureSettingsState() {
+ Response response = device->getCaptureSettings(std::vector{&iso,&shutter,&aperture,&exposurecomp,&whitebalance,&imagequality,&imageformat,&exposureprogram,&storagewriting,&usercapturesettingsmode});
+ if (response.getResult() != Result::Ok) {
+ for (const auto& error : response.getErrors()) {
+ LOGF_ERROR("Error getting camera state (%d): %s", static_cast(error->getCode()), error->getMessage().c_str());
+ }
+ }
+}
+
+string PentaxCCD::getUploadFilePrefix() {
+ return UploadSettingsT[UPLOAD_DIR].text + string("/") + UploadSettingsT[UPLOAD_PREFIX].text;
+}
diff --git a/indi-pentax/pentax_ccd.h b/indi-pentax/pentax_ccd.h
new file mode 100644
index 000000000..f132a114e
--- /dev/null
+++ b/indi-pentax/pentax_ccd.h
@@ -0,0 +1,145 @@
+/*
+ Pentax CCD Driver for Indi (using Ricoh Camera SDK)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ */
+
+#ifndef PENTAX_CCD_H
+#define PENTAX_CCD_H
+
+#include
+#include
+#include
+
+#include "config.h"
+#include "eventloop.h"
+#include "pentax_event_handler.h"
+
+using namespace std;
+using namespace Ricoh::CameraController;
+
+class PentaxEventHandler;
+
+class PentaxCCD : public INDI::CCD
+{
+ public:
+ PentaxCCD(std::shared_ptr camera);
+ virtual ~PentaxCCD();
+
+ const char *getDefaultName();
+
+ bool initProperties();
+ void ISGetProperties(const char *dev);
+ bool updateProperties();
+
+ bool Connect();
+ bool Disconnect();
+
+ bool StartExposure(float duration);
+ bool AbortExposure();
+
+
+protected:
+ friend class PentaxEventHandler;
+ void TimerHit();
+
+ virtual bool UpdateCCDFrameType(INDI::CCDChip::CCD_FRAME fType);
+
+ bool StartStreaming() override;
+ bool StopStreaming() override;
+
+ bool bufferIsBayered;
+
+ string getUploadFilePrefix();
+
+ private:
+
+ std::shared_ptr device;
+ std::shared_ptr pendingCapture;
+ std::shared_ptr listener;
+
+ char name[32];
+
+ int timerID;
+
+ bool InDownload;
+
+ INDI::CCDChip::CCD_FRAME imageFrameType;
+
+ struct timeval ExpStart;
+
+ float ExposureRequest;
+
+ float CalcTimeLeft();
+ bool setupParams();
+
+ ISO iso;
+ ShutterSpeed shutter;
+ FNumber aperture;
+ ExposureCompensation exposurecomp;
+ WhiteBalance whitebalance;
+ StillImageQuality imagequality;
+ StillImageCaptureFormat imageformat;
+ ExposureProgram exposureprogram;
+ StorageWriting storagewriting;
+ UserCaptureSettingsMode usercapturesettingsmode;
+
+ void getCaptureSettingsState();
+
+ std::vector updatedCaptureSettings;
+
+ float updateShutterSpeed(float requestedSpeed);
+ void updateCaptureSetting(CaptureSetting *setting, string newiso);
+
+ ISwitchVectorProperty mIsoSP,mApertureSP,mExpCompSP,mWhiteBalanceSP,mIQualitySP,mFormatSP,mStorageWritingSP;
+
+ ISwitch transferFormatS[2];
+ ISwitchVectorProperty transferFormatSP;
+
+ ISwitch preserveOriginalS[2];
+ ISwitchVectorProperty preserveOriginalSP;
+
+ ISwitch autoFocusS[2];
+ ISwitchVectorProperty autoFocusSP;
+
+ ISwitch * create_switch(const char * basestr, std::vector options, int setidx);
+
+ IText DeviceInfoT[7] {};
+ ITextVectorProperty DeviceInfoTP;
+
+ bool saveConfigItems(FILE * fp);
+
+ bool ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n);
+ void addFITSKeywords(fitsfile * fptr, INDI::CCDChip * targetChip);
+
+ void buildCaptureSettingSwitch(ISwitchVectorProperty *control, CaptureSetting *setting, const char *label = nullptr, const char *name = nullptr);
+ void updateCaptureSettingSwitch(CaptureSetting *setting, ISwitchVectorProperty *sw, ISState *states, char *names[], int n);
+
+ void deleteCaptureSwitches();
+ void buildCaptureSwitches();
+ void refreshBatteryStatus();
+
+ friend void ::ISGetProperties(const char *dev);
+ friend void ::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int num);
+ friend void ::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int num);
+ friend void ::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num);
+ friend void ::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
+ char *formats[], char *names[], int n);
+
+};
+
+#endif // PENTAX_CCD_H
diff --git a/indi-pentax/pentax_event_handler.cpp b/indi-pentax/pentax_event_handler.cpp
new file mode 100644
index 000000000..5257379d6
--- /dev/null
+++ b/indi-pentax/pentax_event_handler.cpp
@@ -0,0 +1,160 @@
+/*
+ Pentax CCD Driver for Indi (using Ricoh Camera SDK)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "pentax_event_handler.h"
+
+
+
+const char * getFormatFileExtension(ImageFormat format) {
+ if (format==ImageFormat::JPEG) {
+ return "jpg";
+ }
+ else if (format==ImageFormat::DNG) {
+ return "raw";
+ }
+ else {
+ return "pef";
+ }
+}
+
+PentaxEventHandler::PentaxEventHandler(PentaxCCD *driver) {
+ this->driver = driver;
+}
+
+const char * PentaxEventHandler::getDeviceName() {
+ return driver->getDeviceName();
+}
+
+void PentaxEventHandler::imageStored(const std::shared_ptr& sender, const std::shared_ptr& image)
+{
+
+ if (driver->transferFormatS[1].s != ISS_ON) {
+ uint8_t * memptr = driver->PrimaryCCD.getFrameBuffer();
+ size_t memsize = 0;
+ int naxis = 2, w = 0, h = 0, bpp = 8;
+
+ //write image to file
+ std::ofstream o;
+ char filename[32] = "/tmp/indi_pentax_";
+ strcat(filename,image->getName().c_str());
+ o.open(filename, std::ofstream::out | std::ofstream::binary);
+ Response response = image->getData(o);
+ o.close();
+ if (response.getResult() == Result::Ok) {
+ LOGF_DEBUG("Temp Image path: %s",filename);
+ } else {
+ for (const auto& error : response.getErrors()) {
+ LOGF_ERROR("Error Code: %d (%s)", static_cast(error->getCode()), error->getMessage().c_str());
+ }
+ return;
+ }
+
+ //convert it for image buffer
+ if (image->getFormat()==ImageFormat::JPEG) {
+ if (read_jpeg(filename, &memptr, &memsize, &naxis, &w, &h))
+ {
+ LOG_ERROR("Exposure failed to parse jpeg.");
+ return;
+ }
+ LOGF_DEBUG("read_jpeg: memsize (%d) naxis (%d) w (%d) h (%d) bpp (%d)", memsize, naxis, w, h, bpp);
+
+ driver->bufferIsBayered = false;
+ }
+ else {
+ char bayer_pattern[8] = {};
+
+ if (read_libraw(filename, &memptr, &memsize, &naxis, &w, &h, &bpp, bayer_pattern))
+ {
+ LOG_ERROR("Exposure failed to parse raw image.");
+ return;
+ }
+
+ LOGF_DEBUG("read_libraw: memsize (%d) naxis (%d) w (%d) h (%d) bpp (%d) bayer pattern (%s)",memsize, naxis, w, h, bpp, bayer_pattern);
+
+ driver->bufferIsBayered = true;
+ }
+
+ driver->PrimaryCCD.setImageExtension("fits");
+
+ if (driver->PrimaryCCD.getSubW() != 0 && (w > driver->PrimaryCCD.getSubW() || h > driver->PrimaryCCD.getSubH()))
+ LOGF_WARN("Camera image size (%dx%d) is different than requested size (%d,%d). Purging configuration and updating frame size to match camera size.", w, h, driver->PrimaryCCD.getSubW(), driver->PrimaryCCD.getSubH());
+
+ driver->PrimaryCCD.setFrame(0, 0, w, h);
+ driver->PrimaryCCD.setFrameBuffer(memptr);
+ driver->PrimaryCCD.setFrameBufferSize(memsize, false);
+ driver->PrimaryCCD.setResolution(w, h);
+ driver->PrimaryCCD.setNAxis(naxis);
+ driver->PrimaryCCD.setBPP(bpp);
+
+ //(re)move image file
+ if (driver->preserveOriginalS[1].s == ISS_ON) {
+ char ts[32];
+ struct tm * tp;
+ time_t t = image->getDateTime();
+ tp = localtime(&t);
+ strftime(ts, sizeof(ts), "%Y-%m-%dT%H-%M-%S", tp);
+ std::string prefix = driver->getUploadFilePrefix();
+ prefix = std::regex_replace(prefix, std::regex("XXX"), string(ts));
+ char newname[255];
+ snprintf(newname, 255, "%s.%s",prefix.c_str(),getFormatFileExtension(image->getFormat()));
+ if (std::rename(filename, newname)) {
+ LOGF_ERROR("File system error prevented saving original image to %s. Saved to %s instead.", newname,filename);
+ }
+ else {
+ LOGF_INFO("Saved original image to %s.", newname);
+ }
+ }
+ else {
+ std::remove(filename);
+ }
+ }
+ else {
+ driver->PrimaryCCD.setImageExtension(getFormatFileExtension(image->getFormat()));
+
+ stringstream img;
+ image->getData(img);
+ driver->PrimaryCCD.setFrameBufferSize(image->getSize());
+ char * memptr = (char *)driver->PrimaryCCD.getFrameBuffer();
+ img.read(memptr,image->getSize());
+ driver->PrimaryCCD.setFrameBuffer((unsigned char *)memptr);
+
+ }
+
+ LOG_INFO("Copied to frame buffer.");
+}
+
+void PentaxEventHandler::liveViewFrameUpdated(const std::shared_ptr& sender, const std::shared_ptr& liveViewFrame, uint64_t frameSize)
+{
+ std::unique_lock ccdguard(driver->ccdBufferLock);
+ driver->Streamer->newFrame(liveViewFrame.get(), frameSize);
+ ccdguard.unlock();
+}
+
+void PentaxEventHandler::deviceDisconnected (const std::shared_ptr< const CameraDevice > &sender, DeviceInterface inf) {
+ if (driver->Disconnect()) {
+ driver->setConnected(false, IPS_IDLE);
+ driver->updateProperties();
+ }
+}
+
+void PentaxEventHandler::captureSettingsChanged(const std::shared_ptr& sender, const std::vector>& newSettings) {
+ driver->getCaptureSettingsState();
+ driver->deleteCaptureSwitches();
+ driver->buildCaptureSwitches();
+}
diff --git a/indi-pentax/pentax_event_handler.h b/indi-pentax/pentax_event_handler.h
new file mode 100644
index 000000000..8d31ab8f7
--- /dev/null
+++ b/indi-pentax/pentax_event_handler.h
@@ -0,0 +1,54 @@
+/*
+ Pentax CCD Driver for Indi (using Ricoh Camera SDK)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ */
+
+#ifndef PENTAXEVENTLISTENER_H
+#define PENTAXEVENTLISTENER_H
+
+#include
+#include
+#include
+
+#include "../indi-gphoto/gphoto_readimage.h"
+
+#include "pentax_ccd.h"
+
+
+using namespace Ricoh::CameraController;
+
+class PentaxCCD;
+
+class PentaxEventHandler : public CameraEventListener
+{
+public:
+ PentaxEventHandler(PentaxCCD *driver);
+ PentaxCCD *driver;
+
+ const char *getDeviceName(); //so we can use the logger
+
+ void imageStored(const std::shared_ptr& sender, const std::shared_ptr& image) override;
+
+ void liveViewFrameUpdated(const std::shared_ptr& sender, const std::shared_ptr& liveViewFrame, uint64_t frameSize) override;
+
+ void deviceDisconnected (const std::shared_ptr< const CameraDevice > &sender, DeviceInterface inf);
+
+ void captureSettingsChanged(const std::shared_ptr &sender, const std::vector > &newSettings);
+};
+
+#endif // PENTAXEVENTLISTENER_H
diff --git a/indi-pentax/pentax_settings.json b/indi-pentax/pentax_settings.json
new file mode 100644
index 000000000..af22dfc12
--- /dev/null
+++ b/indi-pentax/pentax_settings.json
@@ -0,0 +1,214 @@
+{
+ "0x13222": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "address": "0x178"
+ },
+ {
+ "name": "one_push_bracketing",
+ "type": "boolean",
+ "address": "0x17e"
+ },
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "address": "0x133"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "address": "0x134"
+ },
+ {
+ "name": "using_aperture_ring",
+ "type": "boolean",
+ "address": "0x18c"
+ },
+ {
+ "name": "shake_reduction",
+ "type": "boolean!",
+ "address": "0x07d"
+ },
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "address": "0x087"
+ },
+ {
+ "name": "horizon_correction",
+ "type": "boolean!",
+ "address": "0x080"
+ }
+ ]
+ },
+ "0x12dfe": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "remote_bulb_mode_press_press",
+ "type": "boolean!",
+ "address": "0x132"
+ },
+ {
+ "name": "one_push_bracketing",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "value": 0
+ },
+ {
+ "name": "using_aperture_ring",
+ "type": "boolean",
+ "address": "0x142"
+ },
+ {
+ "name": "shake_reduction",
+ "type": "boolean!",
+ "address": "0x065"
+ },
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "astrotracer_timer_sec",
+ "type": "uint16",
+ "value": "0"
+ },
+ {
+ "name": "horizon_correction",
+ "type": "boolean",
+ "value": "false"
+ }
+ ]
+ },
+ "0x12f70": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "remote_bulb_mode_press_press",
+ "type": "boolean!",
+ "address": "0x0db"
+ },
+ {
+ "name": "one_push_bracketing",
+ "type": "boolean",
+ "address": "0x0d1"
+ },
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "value": 0
+ },
+ {
+ "name": "using_aperture_ring",
+ "type": "boolean",
+ "address": "0x0e3"
+ },
+ {
+ "name": "shake_reduction",
+ "type": "boolean!",
+ "address": "0x092"
+ },
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "address": "0x0be"
+ },
+ {
+ "name": "astrotracer_timer_sec",
+ "type": "uint16",
+ "address": "0x0bf"
+ },
+ {
+ "name": "horizon_correction",
+ "type": "boolean!",
+ "address": "0x091"
+ }
+ ]
+ },
+ "0x12fb6": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "address": "0x0f2"
+ }
+ ]
+ },
+ "0x12ef8": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "address": "0x0f2"
+ }
+ ]
+ },
+ "0x13092": {
+ "fields": [
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "address": "0x131"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "address": "0x132"
+ }
+ ]
+ },
+ "0x1309c": {
+ "fields": [
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "address": "0x1ac"
+ },
+ {
+ "name": "astrotracer_timer_sec",
+ "type": "uint16",
+ "address": "0x1ad"
+ }
+ ]
+ },
+ "0x13240": {
+ "fields": [
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "address": "0x131"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "address": "0x132"
+ }
+ ]
+ }
+}
diff --git a/indi-pentax/pktriggercord_ccd.cpp b/indi-pentax/pktriggercord_ccd.cpp
new file mode 100644
index 000000000..55f115b93
--- /dev/null
+++ b/indi-pentax/pktriggercord_ccd.cpp
@@ -0,0 +1,741 @@
+/*
+ Pentax CCD Driver for Indi (using PkTriggerCord)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "pktriggercord_ccd.h"
+#include "pslr.h"
+
+#define MINISO 100
+#define MAXISO 102400
+
+#define TMPFILEBASE (char *)"/tmp/indipentax.tmp"
+
+PkTriggerCordCCD::PkTriggerCordCCD(const char * name)
+{
+ snprintf(this->name, 32, "%s", name);
+ char displayname[32];
+ snprintf(displayname, 32, "PENTAX %s (MSC)", name);
+ setDeviceName(displayname);
+
+ InExposure = false;
+ InDownload = false;
+
+ setVersion(INDI_PENTAX_VERSION_MAJOR, INDI_PENTAX_VERSION_MINOR);
+ LOG_INFO("The Pentax camera driver for MSC mode uses PkTriggerCord, courtesy of Andras Salamon. See https://pktriggercord.melda.info");
+}
+
+PkTriggerCordCCD::~PkTriggerCordCCD()
+{
+}
+
+const char *PkTriggerCordCCD::getDefaultName()
+{
+ return "Pentax DSLR";
+}
+
+bool PkTriggerCordCCD::initProperties()
+{
+ // Init parent properties first
+ INDI::CCD::initProperties();
+
+ IUFillText(&DeviceInfoT[0], "MODEL", "Model", name);
+ IUFillText(&DeviceInfoT[1], "FIRMWARE_VERSION", "Firmware", "");
+ IUFillText(&DeviceInfoT[2], "BATTERY", "Battery", "");
+ IUFillText(&DeviceInfoT[3], "EXPPROGRAM", "Program", "");
+ IUFillText(&DeviceInfoT[4], "UCMODE", "User Mode", "");
+ IUFillText(&DeviceInfoT[5], "SCENEMODE", "Scene Mode", "");
+
+ IUFillTextVector(&DeviceInfoTP, DeviceInfoT, NARRAY(DeviceInfoT), getDeviceName(), "DEVICE_INFO", "Device Info", INFO_TAB, IP_RO, 60, IPS_IDLE);
+ registerProperty(&DeviceInfoTP, INDI_TEXT);
+
+ IUFillSwitch(&autoFocusS[0], "ON", "On", ISS_OFF);
+ IUFillSwitch(&autoFocusS[1], "OFF", "Off", ISS_ON);
+ IUFillSwitchVector(&autoFocusSP, autoFocusS, 2, getDeviceName(), "AUTO_FOCUS", "Auto Focus", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
+
+ IUFillSwitch(&transferFormatS[0], "FORMAT_FITS", "FITS", ISS_ON);
+ IUFillSwitch(&transferFormatS[1], "FORMAT_NATIVE", "Native", ISS_OFF);
+ IUFillSwitchVector(&transferFormatSP, transferFormatS, 2, getDeviceName(), "CCD_TRANSFER_FORMAT", "Output", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
+
+ IUFillSwitch(&preserveOriginalS[1], "PRESERVE_ON", "Also Copy Native Image", ISS_OFF);
+ IUFillSwitch(&preserveOriginalS[0], "PRESERVE_OFF", "Keep FITS Only", ISS_ON);
+ IUFillSwitchVector(&preserveOriginalSP, preserveOriginalS, 2, getDeviceName(), "PRESERVE_ORIGINAL", "Copy Option", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
+
+ PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0, 7200, 1, false);
+
+ IUSaveText(&BayerT[2], "RGGB");
+
+ PrimaryCCD.getCCDInfo()->p = IP_RW;
+
+ uint32_t cap = CCD_HAS_BAYER;
+ SetCCDCapability(cap);
+
+ addConfigurationControl();
+ addDebugControl();
+ return true;
+}
+
+void PkTriggerCordCCD::ISGetProperties(const char *dev)
+{
+ INDI::CCD::ISGetProperties(dev);
+}
+
+bool PkTriggerCordCCD::updateProperties()
+{
+ INDI::CCD::updateProperties();
+
+ if (isConnected())
+ {
+ setupParams();
+
+ buildCaptureSwitches();
+
+ defineSwitch(&transferFormatSP);
+ defineSwitch(&autoFocusSP);
+ if (transferFormatS[0].s == ISS_ON) {
+ defineSwitch(&preserveOriginalSP);
+ }
+
+ timerID = SetTimer(POLLMS);
+ }
+ else
+ {
+ deleteCaptureSwitches();
+
+ deleteProperty(autoFocusSP.name);
+ deleteProperty(transferFormatSP.name);
+ deleteProperty(preserveOriginalSP.name);
+
+ rmTimer(timerID);
+ }
+
+ return true;
+}
+
+
+void PkTriggerCordCCD::buildCaptureSwitches() {
+
+ string iso[] = {"100","200","400","800","1000","1600","3200","6400","12800","25600","51200","102400"};
+ string aperture[] = { "1.0", "1.1", "1.2", "1.4", "1.6", "1.7", "1.8",
+ "2.0", "2.2", "2.4", "2.5", "2.8", "3.2", "3.5",
+ "4.0", "4.5", "5.0", "5.6", "6.3", "6.7", "7.1",
+ "8.0", "9.0", "9.5", "10.0", "11.0", "13.0", "14.0",
+ "16.0", "18.0", "19.0", "20.0", "22.0", "25.0", "28.0",
+ "32.0", "36.0", "40.0", "45.0", "51.0", "57.0"};
+ string exposurecomp1_3[] = {"-3.0", "-2.7", "-2.3", "-2.0", "-1.7", "-1.3", "-1.0", "-0.7", "-0.3", "0", "0.3", "0.7", "1.0", "1.3", "1.7", "2.0", "2.3", "2.7", "3.0"};
+ string exposurecomp1_2[] = { "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5", "0", "0.5", "1.0", "1.5", "2.0", "3.0"};
+
+ string whitebalance[] = {"Auto", "Daylight", "Shade", "Cloudy", "Fluorescent_D", "Fluorescent_N", "Fluorescent_W", "Fluorescent_L", "Tungsten", "Flash", "Manual", "Manual2", "Manual3", "Kelvin1", "Kelvin2", "Kelvin3", "CTE", "MultiAuto"};
+ string imagequality[] = {"1","2","3","4"};
+ string imageformat[] = {"JPEG","PEF","DNG"};
+
+ buildCaptureSettingSwitch(&mIsoSP,iso,NARRAY(iso),"ISO","CCD_ISO",to_string(status.current_iso));
+ char current[5];
+ sprintf(current,"%.1f",(float)status.current_aperture.nom/status.current_aperture.denom);
+ buildCaptureSettingSwitch(&mApertureSP,aperture,NARRAY(aperture),"Aperture","CCD_APERTURE",string(current));
+ buildCaptureSettingSwitch(&mWhiteBalanceSP,whitebalance,NARRAY(whitebalance),"White Balance","CCD_WB",string(get_pslr_white_balance_mode_str((pslr_white_balance_mode_t)status.white_balance_mode)));
+ buildCaptureSettingSwitch(&mIQualitySP,imagequality,pslr_get_model_max_jpeg_stars(device),"Quality","CAPTURE_QUALITY",to_string(status.jpeg_quality));
+ sprintf(current,"%.1f",(float)status.ec.nom/status.ec.denom);
+ if (status.custom_ev_steps == PSLR_CUSTOM_EV_STEPS_1_2)
+ buildCaptureSettingSwitch(&mExpCompSP,exposurecomp1_2,NARRAY(exposurecomp1_2),"Exp Comp","CCD_EC",string(current));
+ else
+ buildCaptureSettingSwitch(&mExpCompSP,exposurecomp1_3,NARRAY(exposurecomp1_3),"Exp Comp","CCD_EC",string(current));
+
+ string f = "JPEG";
+ if (uff == USER_FILE_FORMAT_DNG) {
+ f = "DNG";
+ } else if (uff == USER_FILE_FORMAT_PEF) {
+ f = "PEF";
+ }
+ buildCaptureSettingSwitch(&mFormatSP,imageformat,NARRAY(imageformat),"Format","CAPTURE_FORMAT",f);
+
+ refreshBatteryStatus();
+
+ char exposuremode[10];
+ char usermode[10];
+ char firmware[16];
+
+ sprintf(exposuremode,"%d",status.exposure_mode);
+ sprintf(usermode,"%d",status.user_mode_flag);
+
+ pslr_read_dspinfo( (pslr_handle_t *)device, firmware );
+
+ IUSaveText(&DeviceInfoT[1],firmware);
+ IUSaveText(&DeviceInfoT[3],exposuremode);
+ IUSaveText(&DeviceInfoT[4],usermode);
+ IUSaveText(&DeviceInfoT[5],get_pslr_scene_mode_str((pslr_scene_mode_t)status.scene_mode));
+
+ IDSetText(&DeviceInfoTP,nullptr);
+}
+
+void PkTriggerCordCCD::deleteCaptureSwitches() {
+ if (mIsoSP.nsp > 0) deleteProperty(mIsoSP.name);
+ if (mApertureSP.nsp > 0) deleteProperty(mApertureSP.name);
+ if (mExpCompSP.nsp > 0) deleteProperty(mExpCompSP.name);
+ if (mWhiteBalanceSP.nsp > 0) deleteProperty(mWhiteBalanceSP.name);
+ if (mIQualitySP.nsp > 0) deleteProperty(mIQualitySP.name);
+ if (mFormatSP.nsp > 0) deleteProperty(mFormatSP.name);
+}
+
+
+void PkTriggerCordCCD::buildCaptureSettingSwitch(ISwitchVectorProperty *control, string optionList[], size_t numOptions, const char *label, const char *name, string currentsetting) {
+
+ int set_idx=0;
+ if (numOptions > 0)
+ {
+ for (size_t i=0; i30) {
+ duration = 30;
+ LOG_INFO("Exposures longer than 30 seconds not supported in current mode. Setting exposure time to 30 seconds. Change camera to bulb mode for longer expsoures.");
+ }
+ else {
+ LOGF_INFO("Only pre-defined shutter speeds are supported in current mode. The camera will select the pre-defined shutter speed that most closely matches %f.",duration);
+ }
+ }
+ PrimaryCCD.setExposureDuration(duration);
+ ExposureRequest = duration;
+ pslr_rational_t shutter_speed = {(int)(duration*100),100};
+ //Doesn't look like we need to actually set the shutter speed in bulb mode
+ if ( status.exposure_mode != PSLR_GUI_EXPOSURE_MODE_B ) {
+ if (duration != (float)status.current_shutter_speed.nom/status.current_shutter_speed.denom)
+ pslr_set_shutter(device, shutter_speed);
+ }
+
+ if (autoFocusS[0].s == ISS_ON) pslr_focus(device);
+
+
+ //start capture
+ gettimeofday(&ExpStart, nullptr);
+ LOGF_INFO("Taking a %g seconds frame...", ExposureRequest);
+
+ if ( status.exposure_mode == PSLR_GUI_EXPOSURE_MODE_B ) {
+ if (pslr_get_model_old_bulb_mode(device)) {
+ struct timeval prev_time;
+ gettimeofday(&prev_time, NULL);
+ bulb_old(device, shutter_speed, prev_time);
+ } else {
+ need_bulb_new_cleanup = true;
+ bulb_new(device, shutter_speed);
+ }
+ } else {
+ DPRINT("not bulb\n");
+ if (1) {
+ pslr_shutter(device);
+ } else {
+ // TODO: fix waiting time
+ sleep_sec(1);
+ }
+ }
+
+ user_file_format_t ufft = *get_file_format_t(uff);
+ char * output_file = TMPFILEBASE;
+ fd = open_file(output_file, 1, ufft);
+
+ return true;
+ }
+}
+
+bool PkTriggerCordCCD::AbortExposure()
+{
+
+ return true;
+}
+
+bool PkTriggerCordCCD::UpdateCCDFrameType(INDI::CCDChip::CCD_FRAME fType)
+{
+ INDI::CCDChip::CCD_FRAME imageFrameType = PrimaryCCD.getFrameType();
+
+ if (fType == imageFrameType)
+ return true;
+
+ switch (imageFrameType)
+ {
+ case INDI::CCDChip::BIAS_FRAME:
+ case INDI::CCDChip::DARK_FRAME:
+ /**********************************************************
+ *
+ *
+ *
+ * IMPORTANT: Put here your CCD Frame type here
+ * BIAS and DARK are taken with shutter closed, so _usually_
+ * most CCD this is a call to let the CCD know next exposure shutter
+ * must be closed. Customize as appropiate for the hardware
+ * If there is an error, report it back to client
+ * e.g.
+ * LOG_INFO( "Error, unable to set frame type to ...");
+ * return false;
+ *
+ *
+ **********************************************************/
+ break;
+
+ case INDI::CCDChip::LIGHT_FRAME:
+ case INDI::CCDChip::FLAT_FRAME:
+ /**********************************************************
+ *
+ *
+ *
+ * IMPORTANT: Put here your CCD Frame type here
+ * LIGHT and FLAT are taken with shutter open, so _usually_
+ * most CCD this is a call to let the CCD know next exposure shutter
+ * must be open. Customize as appropiate for the hardware
+ * If there is an error, report it back to client
+ * e.g.
+ * LOG_INFO( "Error, unable to set frame type to ...");
+ * return false;
+ *
+ *
+ **********************************************************/
+ break;
+ }
+
+ PrimaryCCD.setFrameType(fType);
+
+ return true;
+}
+
+
+float PkTriggerCordCCD::CalcTimeLeft()
+{
+ double timesince;
+ double timeleft;
+ struct timeval now;
+ gettimeofday(&now, nullptr);
+
+ timesince = (double)(now.tv_sec * 1000.0 + now.tv_usec / 1000) -
+ (double)(ExpStart.tv_sec * 1000.0 + ExpStart.tv_usec / 1000);
+ timesince = timesince / 1000;
+
+ timeleft = ExposureRequest - timesince;
+ return timeleft;
+}
+
+void PkTriggerCordCCD::TimerHit()
+{
+ int timerID = -1;
+ long timeleft;
+
+ if (isConnected() == false)
+ return; // No need to reset timer if we are not connected anymore
+
+ if (InExposure)
+ {
+ if ( !save_buffer(device, 0, fd, &status, uff, quality )) {
+
+ InDownload = false;
+ InExposure = false;
+ pslr_delete_buffer(device, 0);
+ if (fd != 1) {
+ close(fd);
+ }
+ if (need_bulb_new_cleanup) {
+ bulb_new_cleanup(device);
+ }
+ grabImage();
+ ExposureComplete(&PrimaryCCD);
+ } else if (!InDownload && isDebug()) {
+ IDLog("Still waiting for download...");
+ }
+
+ timeleft = CalcTimeLeft();
+
+ if (!InDownload) {
+ if (timeleft < 1.0)
+ {
+ if (timeleft > 0.25)
+ {
+ // a quarter of a second or more
+ // just set a tighter timer
+ timerID = SetTimer(250);
+ }
+ else
+ {
+ if (timeleft > 0.07)
+ {
+ // use an even tighter timer
+ timerID = SetTimer(50);
+ }
+ else
+ {
+ LOG_INFO("Capture finished. Waiting for image download...");
+ InDownload = true;
+ timeleft=0;
+ PrimaryCCD.setExposureLeft(0);
+ }
+ }
+ }
+ else
+ {
+ if (isDebug())
+ {
+ IDLog("With time left %ld\n", timeleft);
+ IDLog("image not yet ready....\n");
+ }
+ PrimaryCCD.setExposureLeft(timeleft);
+ }
+ }
+ }
+
+ if (timerID == -1)
+ SetTimer(POLLMS);
+ return;
+}
+
+bool PkTriggerCordCCD::grabImage()
+{
+ //set correct tmpfile location
+ char tmpfile[256];
+ if (uff==USER_FILE_FORMAT_JPEG) {
+ snprintf(tmpfile, 256, "%s-0001.jpg", TMPFILEBASE);
+ } else if (uff==USER_FILE_FORMAT_DNG) {
+ snprintf(tmpfile, 256, "%s-0001.dng", TMPFILEBASE);
+ } else {
+ snprintf(tmpfile, 256, "%s-0001.pef", TMPFILEBASE);
+ }
+
+ // fits handling code
+ if (transferFormatS[0].s == ISS_ON)
+ {
+ PrimaryCCD.setImageExtension("fits");
+ uint8_t * memptr = PrimaryCCD.getFrameBuffer();
+ size_t memsize = 0;
+ int naxis = 2, w = 0, h = 0, bpp = 8;
+
+ if (uff==USER_FILE_FORMAT_JPEG)
+ {
+ if (read_jpeg(tmpfile, &memptr, &memsize, &naxis, &w, &h))
+ {
+ LOG_ERROR("Exposure failed to parse jpeg.");
+ unlink(tmpfile);
+ return false;
+ }
+
+
+ LOGF_DEBUG("read_jpeg: memsize (%d) naxis (%d) w (%d) h (%d) bpp (%d)", memsize, naxis,
+ w, h, bpp);
+
+ SetCCDCapability(GetCCDCapability() & ~CCD_HAS_BAYER);
+ }
+ else
+ {
+ char bayer_pattern[8] = {};
+
+ if (read_libraw(tmpfile, &memptr, &memsize, &naxis, &w, &h, &bpp, bayer_pattern))
+ {
+ LOG_ERROR("Exposure failed to parse raw image.");
+ unlink(tmpfile);
+ return false;
+ }
+
+ LOGF_DEBUG("read_libraw: memsize (%d) naxis (%d) w (%d) h (%d) bpp (%d) bayer pattern (%s)",
+ memsize, naxis, w, h, bpp, bayer_pattern);
+
+ IUSaveText(&BayerT[2], bayer_pattern);
+ IDSetText(&BayerTP, nullptr);
+ SetCCDCapability(GetCCDCapability() | CCD_HAS_BAYER);
+ }
+
+ if (PrimaryCCD.getSubW() != 0 && (w > PrimaryCCD.getSubW() || h > PrimaryCCD.getSubH()))
+ LOGF_WARN("Camera image size (%dx%d) is different than requested size (%d,%d). Purging configuration and updating frame size to match camera size.", w, h, PrimaryCCD.getSubW(), PrimaryCCD.getSubH());
+
+ PrimaryCCD.setFrame(0, 0, w, h);
+ PrimaryCCD.setFrameBuffer(memptr);
+ PrimaryCCD.setFrameBufferSize(memsize, false);
+ PrimaryCCD.setResolution(w, h);
+ PrimaryCCD.setNAxis(naxis);
+ PrimaryCCD.setBPP(bpp);
+
+ if (preserveOriginalS[1].s == ISS_ON) {
+ char ts[32];
+ struct tm * tp;
+ time_t t;
+ time(&t);
+ tp = localtime(&t);
+ strftime(ts, sizeof(ts), "%Y-%m-%dT%H-%M-%S", tp);
+ std::string prefix = getUploadFilePrefix();
+ prefix = std::regex_replace(prefix, std::regex("XXX"), string(ts));
+ char newname[255];
+ snprintf(newname, 255, "%s.%s",prefix.c_str(),getFormatFileExtension(uff));
+ if (std::rename(tmpfile, newname)) {
+ LOGF_ERROR("File system error prevented saving original image to %s. Saved to %s instead.", newname,tmpfile);
+ }
+ else {
+ LOGF_INFO("Saved original image to %s.", newname);
+ }
+ }
+ else {
+ std::remove(tmpfile);
+ }
+
+ }
+ // native handling code
+ else
+ {
+ PrimaryCCD.setImageExtension(getFormatFileExtension(uff));
+
+ FILE* f = fopen(tmpfile, "r");
+ fseek(f, 0, SEEK_END);
+ size_t size = ftell(f);
+ rewind(f);
+
+ PrimaryCCD.setFrameBufferSize(size);
+ char * memptr = (char *)PrimaryCCD.getFrameBuffer();
+ fread(memptr, sizeof(char), size, f);
+ PrimaryCCD.setFrameBuffer((unsigned char *)memptr);
+ fclose(f);
+ std::remove(tmpfile);
+ }
+
+ return true;
+}
+
+
+ISwitch * PkTriggerCordCCD::create_switch(const char * basestr, string options[], size_t numOptions, int setidx)
+{
+
+ ISwitch * sw = static_cast(calloc(sizeof(ISwitch), numOptions));
+ ISwitch * one_sw = sw;
+
+ char sw_name[MAXINDINAME];
+ char sw_label[MAXINDILABEL];
+ ISState sw_state;
+
+ for (int i = 0; i < (int)numOptions; i++)
+ {
+ snprintf(sw_name, MAXINDINAME, "%s%d", basestr, i);
+ strncpy(sw_label, options[i].c_str(), MAXINDILABEL);
+ sw_state = (i == setidx) ? ISS_ON : ISS_OFF;
+
+ IUFillSwitch(one_sw++, sw_name, sw_label, sw_state);
+ }
+
+ return sw;
+}
+
+bool PkTriggerCordCCD::ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n)
+{
+
+ if (!strcmp(name, autoFocusSP.name)) {
+ IUUpdateSwitch(&autoFocusSP, states, names, n);
+ autoFocusSP.s = IPS_OK;
+ IDSetSwitch(&autoFocusSP, nullptr);
+ }
+ else if (!strcmp(name, transferFormatSP.name)) {
+ IUUpdateSwitch(&transferFormatSP, states, names, n);
+ transferFormatSP.s = IPS_OK;
+ IDSetSwitch(&transferFormatSP, nullptr);
+ if (transferFormatS[0].s == ISS_ON) {
+ defineSwitch(&preserveOriginalSP);
+ } else {
+ deleteProperty(preserveOriginalSP.name);
+ }
+ }
+ else if (!strcmp(name, preserveOriginalSP.name)) {
+ IUUpdateSwitch(&preserveOriginalSP, states, names, n);
+ preserveOriginalSP.s = IPS_OK;
+ IDSetSwitch(&preserveOriginalSP, nullptr);
+ }
+ else if (!strcmp(name, mIsoSP.name)) {
+ updateCaptureSettingSwitch(&mIsoSP,states,names,n);
+ pslr_set_iso(device,atoi(IUFindOnSwitch(&mIsoSP)->label),MINISO,MAXISO);
+ LOG_WARN("Unfortunately, changing the ISO does not appear to work currently on some (all?) models in MSC mode. You may need to change manually.");
+ }
+ else if (!strcmp(name, mApertureSP.name)) {
+ updateCaptureSettingSwitch(&mApertureSP,states,names,n);
+ pslr_rational_t ap = {(int)(atof(IUFindOnSwitch(&mApertureSP)->label)*10), 10};
+ pslr_set_aperture(device, ap);
+ }
+ else if (!strcmp(name, mExpCompSP.name)) {
+ updateCaptureSettingSwitch(&mExpCompSP,states,names,n);
+ pslr_rational_t ec = {(int)(atof(IUFindOnSwitch(&mExpCompSP)->label)*10), 10};
+ pslr_set_ec( device, ec );
+ LOG_WARN("Unfortunately, changing the exposure compensation does not work currently on some (all?) models in MSC mode. You may need to change manually.");
+ }
+ else if (!strcmp(name, mWhiteBalanceSP.name)) {
+ updateCaptureSettingSwitch(&mWhiteBalanceSP,states,names,n);
+ pslr_white_balance_mode_t white_balance_mode = get_pslr_white_balance_mode(IUFindOnSwitch(&mWhiteBalanceSP)->label);
+ if ( white_balance_mode == -1 ) {
+ LOG_WARN("Could not set desired white balance: Invalid setting for current camera mode.");
+ }
+ else {
+ pslr_set_white_balance( device, white_balance_mode );
+ }
+ }
+ else if (!strcmp(name, mIQualitySP.name)) {
+ updateCaptureSettingSwitch(&mIQualitySP,states,names,n);
+ pslr_set_jpeg_stars(device, atoi(IUFindOnSwitch(&mIQualitySP)->label));
+ }
+ else if (!strcmp(name, mFormatSP.name)) {
+ updateCaptureSettingSwitch(&mFormatSP,states,names,n);
+ char *f = IUFindOnSwitch(&mFormatSP)->label;
+ if (!strcmp(f, "DNG")) {
+ uff = USER_FILE_FORMAT_DNG;
+ } else if (!strcmp(f, "PEF")) {
+ uff = USER_FILE_FORMAT_PEF;
+ } else {
+ uff = USER_FILE_FORMAT_JPEG;
+ }
+ pslr_set_user_file_format(device, uff);
+ }
+ else {
+ return INDI::CCD::ISNewSwitch(dev, name, states, names, n);
+ }
+ if (!getCaptureSettingsState()) return false;
+ return true;
+}
+
+void PkTriggerCordCCD::updateCaptureSettingSwitch(ISwitchVectorProperty * sw, ISState * states, char * names[], int n) {
+ IUUpdateSwitch(sw, states, names, n);
+ sw->s = IPS_OK;
+ IDSetSwitch(sw, nullptr);
+}
+
+bool PkTriggerCordCCD::saveConfigItems(FILE * fp) {
+
+ for (auto sw : std::vector{&mIsoSP,&mApertureSP,&mExpCompSP,&mWhiteBalanceSP,&mIQualitySP,&mFormatSP}) {
+ if (sw->nsp>0) IUSaveConfigSwitch(fp, sw);
+ }
+
+ // Save regular CCD properties
+ return INDI::CCD::saveConfigItems(fp);
+}
+
+void PkTriggerCordCCD::addFITSKeywords(fitsfile * fptr, INDI::CCDChip * targetChip)
+{
+ INDI::CCD::addFITSKeywords(fptr, targetChip);
+
+ int status = 0;
+
+ if (mIsoSP.nsp > 0)
+ {
+ ISwitch * onISO = IUFindOnSwitch(&mIsoSP);
+ if (onISO)
+ {
+ int isoSpeed = atoi(onISO->label);
+ if (isoSpeed > 0)
+ fits_update_key_s(fptr, TUINT, "ISOSPEED", &isoSpeed, "ISO Speed", &status);
+ }
+ }
+}
+
+// returns true if still connected
+bool PkTriggerCordCCD::getCaptureSettingsState() {
+ pslr_get_status(device, &status);
+ //assume that if we don't see battery info in status, the camera is disconnected
+ if (!status.battery_1 && !status.battery_2 && !status.battery_3 && !status.battery_4) {
+ if (Disconnect()) {
+ setConnected(false, IPS_IDLE);
+ updateProperties();
+ }
+ LOG_ERROR("Error: the camera appears to no longer be connected.");
+ return false;
+ }
+ else return true;
+}
+
+string PkTriggerCordCCD::getUploadFilePrefix() {
+ return UploadSettingsT[UPLOAD_DIR].text + string("/") + UploadSettingsT[UPLOAD_PREFIX].text;
+}
+
+const char * PkTriggerCordCCD::getFormatFileExtension(user_file_format format) {
+ if (format==USER_FILE_FORMAT_JPEG) {
+ return "jpg";
+ }
+ else if (format==USER_FILE_FORMAT_DNG) {
+ return "raw";
+ }
+ else {
+ return "pef";
+ }
+}
+
+void PkTriggerCordCCD::refreshBatteryStatus() {
+ char batterylevel[25];
+ sprintf(batterylevel,"%.2fV %.2fV %.2fV %.2fV\n", 0.01 * status.battery_1, 0.01 * status.battery_2, 0.01 * status.battery_3, 0.01 * status.battery_4);
+ IUSaveText(&DeviceInfoT[2],batterylevel);
+ IDSetText(&DeviceInfoTP,nullptr);
+}
diff --git a/indi-pentax/pktriggercord_ccd.h b/indi-pentax/pktriggercord_ccd.h
new file mode 100644
index 000000000..fcd061707
--- /dev/null
+++ b/indi-pentax/pktriggercord_ccd.h
@@ -0,0 +1,126 @@
+/*
+ Pentax CCD Driver for Indi (using PkTriggerCord)
+ Copyright (C) 2020 Karl Rees
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ */
+
+#ifndef PKTRIGGERCORD_CCD_H
+#define PKTRIGGERCORD_CCD_H
+
+#include
+#include
+#include
+#include
+
+#include "config.h"
+#include "eventloop.h"
+
+#include "../indi-gphoto/gphoto_readimage.h"
+
+extern "C" {
+#include "libpktriggercord.h"
+}
+
+using namespace std;
+
+class PkTriggerCordCCD : public INDI::CCD
+{
+ public:
+ PkTriggerCordCCD(const char *name);
+ virtual ~PkTriggerCordCCD();
+
+ const char *getDefaultName();
+
+ bool initProperties();
+ void ISGetProperties(const char *dev);
+ bool updateProperties();
+
+ bool Connect();
+ bool Disconnect();
+
+ bool StartExposure(float duration);
+ bool AbortExposure();
+
+
+protected:
+
+ void TimerHit();
+
+ virtual bool UpdateCCDFrameType(INDI::CCDChip::CCD_FRAME fType);
+
+ private:
+
+ char name[32];
+ pslr_handle_t device;
+ pslr_status status;
+ user_file_format uff;
+ int fd, quality;
+ bool InDownload, need_bulb_new_cleanup;
+ bool bufferIsBayered;
+
+ int timerID;
+
+ INDI::CCDChip::CCD_FRAME imageFrameType;
+
+ struct timeval ExpStart;
+
+ float ExposureRequest;
+
+ float CalcTimeLeft();
+ bool setupParams();
+
+ bool getCaptureSettingsState();
+
+ ISwitchVectorProperty mIsoSP,mApertureSP,mExpCompSP,mWhiteBalanceSP,mIQualitySP,mFormatSP;
+
+ ISwitch transferFormatS[2];
+ ISwitchVectorProperty transferFormatSP;
+
+ ISwitch preserveOriginalS[2];
+ ISwitchVectorProperty preserveOriginalSP;
+
+ ISwitch autoFocusS[2];
+ ISwitchVectorProperty autoFocusSP;
+
+ ISwitch * create_switch(const char * basestr, string options[], size_t numOptions, int setidx);
+
+ IText DeviceInfoT[6] {};
+ ITextVectorProperty DeviceInfoTP;
+
+ bool saveConfigItems(FILE * fp);
+
+ bool ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n);
+ void addFITSKeywords(fitsfile * fptr, INDI::CCDChip * targetChip);
+
+ friend void ::ISGetProperties(const char *dev);
+ friend void ::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int num);
+ friend void ::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int num);
+ friend void ::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num);
+ friend void ::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
+ char *formats[], char *names[], int n);
+
+ void updateCaptureSettingSwitch(ISwitchVectorProperty *sw, ISState *states, char *names[], int n);
+ bool grabImage();
+ string getUploadFilePrefix();
+ const char * getFormatFileExtension(user_file_format format);
+ void refreshBatteryStatus();
+ void buildCaptureSwitches();
+ void deleteCaptureSwitches();
+ void buildCaptureSettingSwitch(ISwitchVectorProperty *control, string optionList[], size_t numOptions, const char *label, const char *name, string currentsetting = "");
+};
+
+#endif // PKTRIGGERCORD_CCD_H
diff --git a/libpktriggercord/.gitignore b/libpktriggercord/.gitignore
new file mode 100644
index 000000000..1a6d353d2
--- /dev/null
+++ b/libpktriggercord/.gitignore
@@ -0,0 +1,3 @@
+95-pentax.rules
+95-samsung.rules
+libpktriggercord.c
diff --git a/libpktriggercord/CMakeLists.txt b/libpktriggercord/CMakeLists.txt
new file mode 100644
index 000000000..cbe678663
--- /dev/null
+++ b/libpktriggercord/CMakeLists.txt
@@ -0,0 +1,59 @@
+cmake_minimum_required(VERSION 3.0.2)
+PROJECT(libpktriggercord CXX C)
+
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
+include(GNUInstallDirs)
+
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/indipentax")
+
+set (PK_VERSION 0.85.01)
+set (PK_SOVERSION 0)
+set (PK_DATADIR /usr/share/pktriggercord)
+set (PK_DEBUG true)
+set (PK_WARNINGS true)
+
+set(UDEVRULES_INSTALL_DIR "/lib/udev/rules.d" CACHE STRING "Base directory for udev rules")
+
+add_definitions(-DPKTDATADIR="${PK_DATADIR}")
+add_definitions(-DVERSION="${PK_VERSION}")
+
+#strip main function from pktriggercord
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/pktriggercord-cli.c PK_CLI)
+string(REGEX REPLACE "int main.*$" "" PK_CLI "${PK_CLI}")
+file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/libpktriggercord.c "${PK_CLI}")
+
+include_directories( ${CMAKE_CURRENT_BINARY_DIR})
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include)
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src)
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src/src/external/js0n)
+
+set(libpktriggercord_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_model.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_lens.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_enum.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_scsi.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/src/external/js0n/js0n.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/libpktriggercord.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/pktriggercord-servermode.c
+)
+
+add_library(pktriggercord SHARED ${libpktriggercord_SRCS})
+
+set_target_properties(pktriggercord PROPERTIES VERSION ${PK_VERSION} SOVERSION ${PK_SOVERSION})
+
+exec_program(cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/src/pentax.rules ${CMAKE_BINARY_DIR}/95-pentax.rules)
+exec_program(cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/src/samsung.rules ${CMAKE_BINARY_DIR}/95-samsung.rules)
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+install(FILES ${CMAKE_BINARY_DIR}/95-pentax.rules ${CMAKE_BINARY_DIR}/95-samsung.rules DESTINATION ${UDEVRULES_INSTALL_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pentax_settings.json DESTINATION ${PK_DATADIR})
+endif()
+
+install(TARGETS pktriggercord DESTINATION ${LIB_INSTALL_DIR}${LIB_POSTFIX})
+
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ DESTINATION include/libpktriggercord FILES_MATCHING PATTERN "*.h")
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/libpktriggercord)
+
+
diff --git a/libpktriggercord/INSTALL b/libpktriggercord/INSTALL
new file mode 100644
index 000000000..ff7bf5524
--- /dev/null
+++ b/libpktriggercord/INSTALL
@@ -0,0 +1,8 @@
+INSTALL
+============
+
+
+1) $ cmake -DCMAKE_INSTALL_PREFIX=/usr .
+2) $ make
+3) $ sudo make install
+
diff --git a/libpktriggercord/README.md b/libpktriggercord/README.md
new file mode 100644
index 000000000..e190feadb
--- /dev/null
+++ b/libpktriggercord/README.md
@@ -0,0 +1,13 @@
+# libpktriggercord
+
+Shared library wrapper for pktriggercord
+by Karl Rees (2020)
+
+The files in the source directory are copied from PkTriggerCord. Thanks to Andras Salamon for developing PkTriggerCord. See http://pktriggercord.melda.info/
+
+To update for new versions of PkTriggerCord, copy over the latest versions of the corresponding PkTriggerCord source files found in the src subfolder. You may need to update the header file include/libpktriggercord.h if any functions in pktriggercord-cli.c have changed. (TODO: automate extraction of header file directly from pktriggercord-cli.c).
+
+Then run:
+
+cmake .
+sudo make install
diff --git a/libpktriggercord/include/libpktriggercord.h b/libpktriggercord/include/libpktriggercord.h
new file mode 100644
index 000000000..9aae3d1cb
--- /dev/null
+++ b/libpktriggercord/include/libpktriggercord.h
@@ -0,0 +1,56 @@
+/*
+ Header file for libpktriggercord
+ Shared library wrapper for pkTriggerCord
+ Copyright (c) 2020 Karl Rees
+
+ for:
+
+ pkTriggerCord
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2011-2019 Andras Salamon
+
+ which is based on:
+
+ pslr-shoot
+
+ Command line remote control of Pentax DSLR cameras.
+ Copyright (C) 2009 Ramiro Barreiro
+ With fragments of code from PK-Remote by Pontus Lidman.
+
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#include "pslr.h"
+#include "pktriggercord-servermode.h"
+
+// Header file for functions in pktriggercord-cli.c
+
+int save_buffer(pslr_handle_t camhandle, int bufno, int fd, pslr_status *status, user_file_format filefmt, int jpeg_stars);
+void save_memory(pslr_handle_t camhandle, int fd, uint32_t length);
+
+void print_status_info( pslr_handle_t h, pslr_status status );
+void print_settings_info( pslr_handle_t h, pslr_settings settings );
+
+int open_file(char* output_file, int frameNo, user_file_format_t ufft);
+void warning_message( const char* message, ... );
+
+void process_wbadj( const char* argv0, const char chr, uint32_t adj, uint32_t *wbadj_mg, uint32_t *wbadj_ba );
+char *copyright_version(char *name, char *version);
+
+void bulb_old(pslr_handle_t camhandle, pslr_rational_t shutter_speed, struct timeval prev_time);
+void bulb_new(pslr_handle_t camhandle, pslr_rational_t shutter_speed);
+void bulb_new_cleanup(pslr_handle_t camhandle);
+
diff --git a/libpktriggercord/src/.gitignore b/libpktriggercord/src/.gitignore
new file mode 100644
index 000000000..6f5fcdb5a
--- /dev/null
+++ b/libpktriggercord/src/.gitignore
@@ -0,0 +1,23 @@
+/old_releases
+*.o
+/pktriggercord
+/pktriggercord-cli
+*~
+*.exe
+/pktriggercord_commandline.html
+/pktriggercord-*-win.zip
+/pkTriggerCord-*.src.tar.gz
+/pktriggercord-*.rpm
+/pktriggercord*.deb
+/*PkTriggerCord*.apk
+/android/bin
+/android/gen
+/android/libs
+/android/assets
+/android/obj
+/android/local.properties
+/android/.gradle/
+/android/build/
+.#*
+*.orig
+/i686-w64-mingw32
diff --git a/libpktriggercord/src/.travis.yml b/libpktriggercord/src/.travis.yml
new file mode 100644
index 000000000..0dcd75c8e
--- /dev/null
+++ b/libpktriggercord/src/.travis.yml
@@ -0,0 +1,46 @@
+language: android
+android:
+ components:
+ - tools
+ - platform-tools
+ - build-tools-28.0.3
+ - android-28
+ licenses:
+ - 'android-sdk-license-.+'
+addons:
+ apt:
+ packages:
+ - binutils-mingw-w64-i686
+ - g++-mingw-w64-i686
+ - gcc-mingw-w64-i686
+ - wine
+ - groff
+ - gtk2.0
+ - libgtk2.0
+ - libgtk2.0-dev
+before_install:
+ - git clone https://github.com/urho3d/android-ndk.git $HOME/android-ndk-root
+ - pushd $HOME/android-ndk-root
+ - git checkout 9afc86eae45a544562bc7052ca6f529772754f16 .
+ - popd
+ - export ANDROID_NDK_HOME=$HOME/android-ndk-root
+ - mkdir -p "/usr/local/android-sdk/licenses"
+ - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > /usr/local/android-sdk/licenses/android-sdk-license
+before_script:
+ - wget -O astyle_3.1_linux.tar.gz http://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz/download
+ - tar -xf astyle_3.1_linux.tar.gz -C $HOME
+ - make -C $HOME/astyle/build/gcc
+ - make -C $HOME/astyle/build/gcc prefix=$HOME install
+script:
+ - if [[ -n $(make astyle | grep Formatted) ]]; then echo "Code formatting error. Please check astyle"; exit -1; fi
+ - make android
+ - make localwin
+ - make srczip
+ - make clean
+ - make
+ - ./pktriggercord-cli --version
+ - mkdir -p windows_test
+ - cd windows_test
+ - unzip ../pktriggercord-*-win.zip
+ - wine ./pktriggercord-cli.exe --version
+ - cd ..
diff --git a/libpktriggercord/src/COPYING b/libpktriggercord/src/COPYING
new file mode 100644
index 000000000..65c5ca88a
--- /dev/null
+++ b/libpktriggercord/src/COPYING
@@ -0,0 +1,165 @@
+ GNU LESSER 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.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser 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
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/libpktriggercord/src/exiftool_pentax_lens.txt b/libpktriggercord/src/exiftool_pentax_lens.txt
new file mode 100644
index 000000000..9d8d6bef7
--- /dev/null
+++ b/libpktriggercord/src/exiftool_pentax_lens.txt
@@ -0,0 +1,218 @@
+{0, 0, "M-42 or No Lens"},
+{1, 0, "K or M Lens"},
+{2, 0, "A Series Lens"},
+{3, 0, "Sigma"},
+{3, 17, "smc PENTAX-FA SOFT 85mm F2.8"},
+{3, 18, "smc PENTAX-F 1.7X AF ADAPTER"},
+{3, 19, "smc PENTAX-F 24-50mm F4"},
+{3, 20, "smc PENTAX-F 35-80mm F4-5.6"},
+{3, 21, "smc PENTAX-F 80-200mm F4.7-5.6"},
+{3, 22, "smc PENTAX-F FISH-EYE 17-28mm F3.5-4.5"},
+{3, 23, "smc PENTAX-F 100-300mm F4.5-5.6 or Sigma Lens"},
+{3, 24, "smc PENTAX-F 35-135mm F3.5-4.5"},
+{3, 25, "smc PENTAX-F 35-105mm F4-5.6 or Sigma or Tokina Lens"},
+{3, 26, "smc PENTAX-F* 250-600mm F5.6 ED[IF]"},
+{3, 27, "smc PENTAX-F 28-80mm F3.5-4.5 or Tokina Lens"},
+{3, 28, "smc PENTAX-F 35-70mm F3.5-4.5 or Tokina Lens"},
+{3, 29, "PENTAX-F 28-80mm F3.5-4.5 or Sigma or Tokina Lens"},
+{3, 30, "PENTAX-F 70-200mm F4-5.6"},
+{3, 31, "smc PENTAX-F 70-210mm F4-5.6 or Tokina or Takumar Lens"},
+{3, 32, "smc PENTAX-F 50mm F1.4"},
+{3, 33, "smc PENTAX-F 50mm F1.7"},
+{3, 34, "smc PENTAX-F 135mm F2.8 [IF]"},
+{3, 35, "smc PENTAX-F 28mm F2.8"},
+{3, 36, "Sigma 20mm F1.8 EX DG Aspherical RF"},
+{3, 38, "smc PENTAX-F* 300mm F4.5 ED[IF]"},
+{3, 39, "smc PENTAX-F* 600mm F4 ED[IF]"},
+{3, 40, "smc PENTAX-F Macro 100mm F2.8"},
+{3, 41, "smc PENTAX-F Macro 50mm F2.8 or Sigma Lens"},
+{3, 42, "Sigma 300mm F2.8 EX DG APO IF"},
+{3, 44, "Sigma or Tamron Lens (3 44)"},
+{3, 46, "Sigma or Samsung Lens (3 46)"},
+{3, 50, "smc PENTAX-FA 28-70mm F4 AL"},
+{3, 51, "Sigma 28mm F1.8 EX DG Aspherical Macro"},
+{3, 52, "smc PENTAX-FA 28-200mm F3.8-5.6 AL[IF] or Tamron Lens"},
+{3, 53, "smc PENTAX-FA 28-80mm F3.5-5.6 AL"},
+{3, 247, "smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]"},
+{3, 248, "smc PENTAX-DA 12-24mm F4 ED AL[IF]"},
+{3, 250, "smc PENTAX-DA 50-200mm F4-5.6 ED"},
+{3, 251, "smc PENTAX-DA 40mm F2.8 Limited"},
+{3, 252, "smc PENTAX-DA 18-55mm F3.5-5.6 AL"},
+{3, 253, "smc PENTAX-DA 14mm F2.8 ED[IF]"},
+{3, 254, "smc PENTAX-DA 16-45mm F4 ED AL"},
+{3, 255, "Sigma Lens (3 255)"},
+{4, 1, "smc PENTAX-FA SOFT 28mm F2.8"},
+{4, 2, "smc PENTAX-FA 80-320mm F4.5-5.6"},
+{4, 3, "smc PENTAX-FA 43mm F1.9 Limited"},
+{4, 6, "smc PENTAX-FA 35-80mm F4-5.6"},
+{4, 9, "Irix 11mm F4 Firefly"},
+{4, 10, "Irix 15mm F2.4"},
+{4, 12, "smc PENTAX-FA 50mm F1.4"},
+{4, 15, "smc PENTAX-FA 28-105mm F4-5.6 [IF]"},
+{4, 16, "Tamron AF 80-210mm F4-5.6 (178D)"},
+{4, 19, "Tamron SP AF 90mm F2.8 (172E)"},
+{4, 20, "smc PENTAX-FA 28-80mm F3.5-5.6"},
+{4, 21, "Cosina AF 100-300mm F5.6-6.7"},
+{4, 22, "Tokina 28-80mm F3.5-5.6"},
+{4, 23, "smc PENTAX-FA 20-35mm F4 AL"},
+{4, 24, "smc PENTAX-FA 77mm F1.8 Limited"},
+{4, 25, "Tamron SP AF 14mm F2.8"},
+{4, 26, "smc PENTAX-FA Macro 100mm F3.5 or Cosina Lens"},
+{4, 27, "Tamron AF 28-300mm F3.5-6.3 LD Aspherical[IF] Macro (185D/285D)"},
+{4, 28, "smc PENTAX-FA 35mm F2 AL"},
+{4, 29, "Tamron AF 28-200mm F3.8-5.6 LD Super II Macro (371D)"},
+{4, 34, "smc PENTAX-FA 24-90mm F3.5-4.5 AL[IF]"},
+{4, 35, "smc PENTAX-FA 100-300mm F4.7-5.8"},
+{4, 36, "Tamron AF 70-300mm F4-5.6 LD Macro 1:2"},
+{4, 37, "Tamron SP AF 24-135mm F3.5-5.6 AD AL (190D)"},
+{4, 38, "smc PENTAX-FA 28-105mm F3.2-4.5 AL[IF]"},
+{4, 39, "smc PENTAX-FA 31mm F1.8 AL Limited"},
+{4, 41, "Tamron AF 28-200mm Super Zoom F3.8-5.6 Aspherical XR [IF] Macro (A03)"},
+{4, 43, "smc PENTAX-FA 28-90mm F3.5-5.6"},
+{4, 44, "smc PENTAX-FA J 75-300mm F4.5-5.8 AL"},
+{4, 45, "Tamron Lens (4 45)"},
+{4, 46, "smc PENTAX-FA J 28-80mm F3.5-5.6 AL"},
+{4, 47, "smc PENTAX-FA J 18-35mm F4-5.6 AL"},
+{4, 49, "Tamron SP AF 28-75mm F2.8 XR Di LD Aspherical [IF] Macro"},
+{4, 51, "smc PENTAX-D FA 50mm F2.8 Macro"},
+{4, 52, "smc PENTAX-D FA 100mm F2.8 Macro"},
+{4, 55, "Samsung/Schneider D-XENOGON 35mm F2"},
+{4, 56, "Samsung/Schneider D-XENON 100mm F2.8 Macro"},
+{4, 75, "Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)"},
+{4, 214, "smc PENTAX-DA 35mm F2.4 AL"},
+{4, 229, "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"},
+{4, 230, "Tamron SP AF 17-50mm F2.8 XR Di II"},
+{4, 231, "smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]"},
+{4, 237, "Samsung/Schneider D-XENOGON 10-17mm F3.5-4.5"},
+{4, 239, "Samsung/Schneider D-XENON 12-24mm F4 ED AL [IF]"},
+{4, 242, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)"},
+{4, 243, "smc PENTAX-DA 70mm F2.4 Limited"},
+{4, 244, "smc PENTAX-DA 21mm F3.2 AL Limited"},
+{4, 245, "Samsung/Schneider D-XENON 50-200mm F4-5.6"},
+{4, 246, "Samsung/Schneider D-XENON 18-55mm F3.5-5.6"},
+{4, 247, "smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]"},
+{4, 248, "smc PENTAX-DA 12-24mm F4 ED AL [IF]"},
+{4, 249, "Tamron XR DiII 18-200mm F3.5-6.3 (A14)"},
+{4, 250, "smc PENTAX-DA 50-200mm F4-5.6 ED"},
+{4, 251, "smc PENTAX-DA 40mm F2.8 Limited"},
+{4, 252, "smc PENTAX-DA 18-55mm F3.5-5.6 AL"},
+{4, 253, "smc PENTAX-DA 14mm F2.8 ED[IF]"},
+{4, 254, "smc PENTAX-DA 16-45mm F4 ED AL"},
+{5, 1, "smc PENTAX-FA* 24mm F2 AL[IF]"},
+{5, 2, "smc PENTAX-FA 28mm F2.8 AL"},
+{5, 3, "smc PENTAX-FA 50mm F1.7"},
+{5, 4, "smc PENTAX-FA 50mm F1.4"},
+{5, 5, "smc PENTAX-FA* 600mm F4 ED[IF]"},
+{5, 6, "smc PENTAX-FA* 300mm F4.5 ED[IF]"},
+{5, 7, "smc PENTAX-FA 135mm F2.8 [IF]"},
+{5, 8, "smc PENTAX-FA Macro 50mm F2.8"},
+{5, 9, "smc PENTAX-FA Macro 100mm F2.8"},
+{5, 10, "smc PENTAX-FA* 85mm F1.4 [IF]"},
+{5, 11, "smc PENTAX-FA* 200mm F2.8 ED[IF]"},
+{5, 12, "smc PENTAX-FA 28-80mm F3.5-4.7"},
+{5, 13, "smc PENTAX-FA 70-200mm F4-5.6"},
+{5, 14, "smc PENTAX-FA* 250-600mm F5.6 ED[IF]"},
+{5, 15, "smc PENTAX-FA 28-105mm F4-5.6"},
+{5, 16, "smc PENTAX-FA 100-300mm F4.5-5.6"},
+{5, 98, "smc PENTAX-FA 100-300mm F4.5-5.6"},
+{6, 1, "smc PENTAX-FA* 85mm F1.4 [IF]"},
+{6, 2, "smc PENTAX-FA* 200mm F2.8 ED[IF]"},
+{6, 3, "smc PENTAX-FA* 300mm F2.8 ED[IF]"},
+{6, 4, "smc PENTAX-FA* 28-70mm F2.8 AL"},
+{6, 5, "smc PENTAX-FA* 80-200mm F2.8 ED[IF]"},
+{6, 6, "smc PENTAX-FA* 28-70mm F2.8 AL"},
+{6, 7, "smc PENTAX-FA* 80-200mm F2.8 ED[IF]"},
+{6, 8, "smc PENTAX-FA 28-70mm F4AL"},
+{6, 9, "smc PENTAX-FA 20mm F2.8"},
+{6, 10, "smc PENTAX-FA* 400mm F5.6 ED[IF]"},
+{6, 13, "smc PENTAX-FA* 400mm F5.6 ED[IF]"},
+{6, 14, "smc PENTAX-FA* Macro 200mm F4 ED[IF]"},
+{7, 0, "smc PENTAX-DA 21mm F3.2 AL Limited"},
+{7, 58, "smc PENTAX-D FA Macro 100mm F2.8 WR"},
+{7, 75, "Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)"},
+{7, 201, "smc Pentax-DA L 50-200mm F4-5.6 ED WR"},
+{7, 202, "smc PENTAX-DA L 18-55mm F3.5-5.6 AL WR"},
+{7, 203, "HD PENTAX-DA 55-300mm F4-5.8 ED WR"},
+{7, 204, "HD PENTAX-DA 15mm F4 ED AL Limited"},
+{7, 205, "HD PENTAX-DA 35mm F2.8 Macro Limited"},
+{7, 206, "HD PENTAX-DA 70mm F2.4 Limited"},
+{7, 207, "HD PENTAX-DA 21mm F3.2 ED AL Limited"},
+{7, 208, "HD PENTAX-DA 40mm F2.8 Limited"},
+{7, 212, "smc PENTAX-DA 50mm F1.8"},
+{7, 213, "smc PENTAX-DA 40mm F2.8 XS"},
+{7, 214, "smc PENTAX-DA 35mm F2.4 AL"},
+{7, 216, "smc PENTAX-DA L 55-300mm F4-5.8 ED"},
+{7, 217, "smc PENTAX-DA 50-200mm F4-5.6 ED WR"},
+{7, 218, "smc PENTAX-DA 18-55mm F3.5-5.6 AL WR"},
+{7, 220, "Tamron SP AF 10-24mm F3.5-4.5 Di II LD Aspherical [IF]"},
+{7, 221, "smc PENTAX-DA L 50-200mm F4-5.6 ED"},
+{7, 222, "smc PENTAX-DA L 18-55mm F3.5-5.6"},
+{7, 223, "Samsung/Schneider D-XENON 18-55mm F3.5-5.6 II"},
+{7, 224, "smc PENTAX-DA 15mm F4 ED AL Limited"},
+{7, 225, "Samsung/Schneider D-XENON 18-250mm F3.5-6.3"},
+{7, 226, "smc PENTAX-DA* 55mm F1.4 SDM (SDM unused)"},
+{7, 227, "smc PENTAX-DA* 60-250mm F4 [IF] SDM (SDM unused)"},
+{7, 228, "Samsung 16-45mm F4 ED"},
+{7, 229, "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"},
+{7, 230, "Tamron AF 17-50mm F2.8 XR Di-II LD (Model A16)"},
+{7, 231, "smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]"},
+{7, 233, "smc PENTAX-DA 35mm F2.8 Macro Limited"},
+{7, 234, "smc PENTAX-DA* 300mm F4 ED [IF] SDM (SDM unused)"},
+{7, 235, "smc PENTAX-DA* 200mm F2.8 ED [IF] SDM (SDM unused)"},
+{7, 236, "smc PENTAX-DA 55-300mm F4-5.8 ED"},
+{7, 238, "Tamron AF 18-250mm F3.5-6.3 Di II LD Aspherical [IF] Macro"},
+{7, 241, "smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM (SDM unused)"},
+{7, 242, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)"},
+{7, 243, "smc PENTAX-DA 70mm F2.4 Limited"},
+{7, 244, "smc PENTAX-DA 21mm F3.2 AL Limited"},
+{8, 0, "Sigma 50-150mm F2.8 II APO EX DC HSM"},
+{8, 3, "Sigma 18-125mm F3.8-5.6 DC HSM"},
+{8, 4, "Sigma 50mm F1.4 EX DG HSM"},
+{8, 6, "Sigma 4.5mm F2.8 EX DC Fisheye"},
+{8, 7, "Sigma 24-70mm F2.8 IF EX DG HSM"},
+{8, 8, "Sigma 18-250mm F3.5-6.3 DC OS HSM"},
+{8, 11, "Sigma 10-20mm F3.5 EX DC HSM"},
+{8, 12, "Sigma 70-300mm F4-5.6 DG OS"},
+{8, 13, "Sigma 120-400mm F4.5-5.6 APO DG OS HSM"},
+{8, 14, "Sigma 17-70mm F2.8-4.0 DC Macro OS HSM"},
+{8, 15, "Sigma 150-500mm F5-6.3 APO DG OS HSM"},
+{8, 16, "Sigma 70-200mm F2.8 EX DG Macro HSM II"},
+{8, 17, "Sigma 50-500mm F4.5-6.3 DG OS HSM"},
+{8, 18, "Sigma 8-16mm F4.5-5.6 DC HSM"},
+{8, 20, "Sigma 18-50mm F2.8-4.5 DC HSM"},
+{8, 21, "Sigma 17-50mm F2.8 EX DC OS HSM"},
+{8, 22, "Sigma 85mm F1.4 EX DG HSM"},
+{8, 23, "Sigma 70-200mm F2.8 APO EX DG OS HSM"},
+{8, 25, "Sigma 17-50mm F2.8 EX DC HSM"},
+{8, 27, "Sigma 18-200mm F3.5-6.3 II DC HSM"},
+{8, 28, "Sigma 18-250mm F3.5-6.3 DC Macro HSM"},
+{8, 29, "Sigma 35mm F1.4 DG HSM"},
+{8, 30, "Sigma 17-70mm F2.8-4 DC Macro HSM | C"},
+{8, 31, "Sigma 18-35mm F1.8 DC HSM"},
+{8, 32, "Sigma 30mm F1.4 DC HSM | A"},
+{8, 33, "Sigma 18-200mm F3.5-6.3 DC Macro HSM"},
+{8, 34, "Sigma 18-300mm F3.5-6.3 DC Macro HSM"},
+{8, 59, "HD PENTAX-D FA 150-450mm F4.5-5.6 ED DC AW"},
+{8, 60, "HD PENTAX-D FA* 70-200mm F2.8 ED DC AW"},
+{8, 61, "HD PENTAX-D FA 28-105mm F3.5-5.6 ED DC WR"},
+{8, 62, "HD PENTAX-D FA 24-70mm F2.8 ED SDM WR"},
+{8, 63, "HD PENTAX-D FA 15-30mm F2.8 ED SDM WR"},
+{8, 64, "HD PENTAX-D FA* 50mm F1.4 SDM AW"},
+{8, 196, "HD PENTAX-DA* 11-18mm F2.8 ED DC AW"},
+{8, 197, "HD PENTAX-DA 55-300mm F4.5-6.3 ED PLM WR RE"},
+{8, 198, "smc PENTAX-DA L 18-50mm F4-5.6 DC WR RE"},
+{8, 199, "HD PENTAX-DA 18-50mm F4-5.6 DC WR RE"},
+{8, 200, "HD PENTAX-DA 16-85mm F3.5-5.6 ED DC WR"},
+{8, 209, "HD PENTAX-DA 20-40mm F2.8-4 ED Limited DC WR"},
+{8, 210, "smc PENTAX-DA 18-270mm F3.5-6.3 ED SDM"},
+{8, 211, "HD PENTAX-DA 560mm F5.6 ED AW"},
+{8, 215, "smc PENTAX-DA 18-135mm F3.5-5.6 ED AL [IF] DC WR"},
+{8, 226, "smc PENTAX-DA* 55mm F1.4 SDM"},
+{8, 227, "smc PENTAX-DA* 60-250mm F4 [IF] SDM"},
+{8, 232, "smc PENTAX-DA 17-70mm F4 AL [IF] SDM"},
+{8, 234, "smc PENTAX-DA* 300mm F4 ED [IF] SDM"},
+{8, 235, "smc PENTAX-DA* 200mm F2.8 ED [IF] SDM"},
+{8, 241, "smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM"},
+{8, 242, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM"},
+{8, 255, "Sigma Lens (8 255)"},
+{9, 0, "645 Manual Lens"},
diff --git a/libpktriggercord/src/pentax.rules b/libpktriggercord/src/pentax.rules
new file mode 100644
index 000000000..4079ad47d
--- /dev/null
+++ b/libpktriggercord/src/pentax.rules
@@ -0,0 +1,14 @@
+ACTION!="add", GOTO="pentax_rules_end"
+
+SUBSYSTEM=="scsi_generic", GOTO="pentax_rules_start"
+
+SUBSYSTEM!="scsi_generic", GOTO="pentax_rules_end"
+
+LABEL="pentax_rules_start"
+# WAIT_FOR_SYSFS="device/vendor"
+ATTRS{vendor}=="PENTAX", ATTRS{model}=="DIGITAL_CAMERA", MODE="0666", GROUP="users"
+ATTRS{vendor}=="PENTAX", ATTRS{model}=="DSC*", MODE="0666", GROUP="users"
+ATTRS{vendor}=="RICOHIMG", ATTRS{model}=="DSC*", MODE="0666", GROUP="users"
+ATTRS{vendor}=="PENTAX", ATTRS{model}=="K*", MODE="0666", GROUP="users"
+
+LABEL="pentax_rules_end"
diff --git a/libpktriggercord/src/pentax_settings.json b/libpktriggercord/src/pentax_settings.json
new file mode 100644
index 000000000..af22dfc12
--- /dev/null
+++ b/libpktriggercord/src/pentax_settings.json
@@ -0,0 +1,214 @@
+{
+ "0x13222": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "address": "0x178"
+ },
+ {
+ "name": "one_push_bracketing",
+ "type": "boolean",
+ "address": "0x17e"
+ },
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "address": "0x133"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "address": "0x134"
+ },
+ {
+ "name": "using_aperture_ring",
+ "type": "boolean",
+ "address": "0x18c"
+ },
+ {
+ "name": "shake_reduction",
+ "type": "boolean!",
+ "address": "0x07d"
+ },
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "address": "0x087"
+ },
+ {
+ "name": "horizon_correction",
+ "type": "boolean!",
+ "address": "0x080"
+ }
+ ]
+ },
+ "0x12dfe": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "remote_bulb_mode_press_press",
+ "type": "boolean!",
+ "address": "0x132"
+ },
+ {
+ "name": "one_push_bracketing",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "value": 0
+ },
+ {
+ "name": "using_aperture_ring",
+ "type": "boolean",
+ "address": "0x142"
+ },
+ {
+ "name": "shake_reduction",
+ "type": "boolean!",
+ "address": "0x065"
+ },
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "astrotracer_timer_sec",
+ "type": "uint16",
+ "value": "0"
+ },
+ {
+ "name": "horizon_correction",
+ "type": "boolean",
+ "value": "false"
+ }
+ ]
+ },
+ "0x12f70": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "remote_bulb_mode_press_press",
+ "type": "boolean!",
+ "address": "0x0db"
+ },
+ {
+ "name": "one_push_bracketing",
+ "type": "boolean",
+ "address": "0x0d1"
+ },
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "value": "false"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "value": 0
+ },
+ {
+ "name": "using_aperture_ring",
+ "type": "boolean",
+ "address": "0x0e3"
+ },
+ {
+ "name": "shake_reduction",
+ "type": "boolean!",
+ "address": "0x092"
+ },
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "address": "0x0be"
+ },
+ {
+ "name": "astrotracer_timer_sec",
+ "type": "uint16",
+ "address": "0x0bf"
+ },
+ {
+ "name": "horizon_correction",
+ "type": "boolean!",
+ "address": "0x091"
+ }
+ ]
+ },
+ "0x12fb6": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "address": "0x0f2"
+ }
+ ]
+ },
+ "0x12ef8": {
+ "fields": [
+ {
+ "name": "bulb_mode_press_press",
+ "type": "boolean",
+ "address": "0x0f2"
+ }
+ ]
+ },
+ "0x13092": {
+ "fields": [
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "address": "0x131"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "address": "0x132"
+ }
+ ]
+ },
+ "0x1309c": {
+ "fields": [
+ {
+ "name": "astrotracer",
+ "type": "boolean",
+ "address": "0x1ac"
+ },
+ {
+ "name": "astrotracer_timer_sec",
+ "type": "uint16",
+ "address": "0x1ad"
+ }
+ ]
+ },
+ "0x13240": {
+ "fields": [
+ {
+ "name": "bulb_timer",
+ "type": "boolean",
+ "address": "0x131"
+ },
+ {
+ "name": "bulb_timer_sec",
+ "type": "uint16",
+ "address": "0x132"
+ }
+ ]
+ }
+}
diff --git a/libpktriggercord/src/pktriggercord-cli.c b/libpktriggercord/src/pktriggercord-cli.c
new file mode 100644
index 000000000..cf803cbf8
--- /dev/null
+++ b/libpktriggercord/src/pktriggercord-cli.c
@@ -0,0 +1,1152 @@
+/*
+ pkTriggerCord
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2011-2019 Andras Salamon
+
+ based on:
+
+ pslr-shoot
+
+ Command line remote control of Pentax DSLR cameras.
+ Copyright (C) 2009 Ramiro Barreiro
+ With fragments of code from PK-Remote by Pontus Lidman.
+
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "pslr.h"
+#include "pktriggercord-servermode.h"
+
+#ifdef WIN32
+#define FILE_ACCESS O_WRONLY | O_CREAT | O_TRUNC | O_BINARY
+#else
+#define FILE_ACCESS O_WRONLY | O_CREAT | O_TRUNC
+#endif
+
+bool debug = false;
+bool warnings = false;
+
+const char *shortopts = "m:q:a:r:d:t:o:i:F:fghvsSw";
+
+pslr_settings settings;
+bool bulb_timer_before=false;
+bool astrotracer_before=false;
+bool need_bulb_new_cleanup=false;
+bool need_one_push_bracketing_cleanup=false;
+
+static struct option const longopts[] = {
+ {"exposure_mode", required_argument, NULL, 'm'},
+ {"resolution", required_argument, NULL, 'r'},
+ {"quality", required_argument, NULL, 'q'},
+ {"aperture", required_argument, NULL, 'a'},
+ {"shutter_speed", required_argument, NULL, 't'},
+ {"iso", required_argument, NULL, 'i'},
+ {"file_format", required_argument, NULL, 1},
+ {"output_file", required_argument, NULL, 'o'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'v'},
+ {"status", no_argument, NULL, 's'},
+ {"status_hex", no_argument, NULL, 2},
+ {"frames", required_argument, NULL, 'F'},
+ {"delay", required_argument, NULL, 'd'},
+ {"auto_focus", no_argument, NULL, 'f'},
+ {"green", no_argument, NULL, 'g'},
+ {"warnings", no_argument, NULL, 'w'},
+ {"exposure_compensation", required_argument, NULL, 3},
+ {"flash_exposure_compensation", required_argument, NULL, 5},
+ {"debug", no_argument, NULL, 4},
+ {"dust_removal", no_argument, NULL, 6},
+ {"color_space", required_argument, NULL, 7},
+ {"af_mode", required_argument, NULL, 8},
+ {"ae_metering", required_argument, NULL, 9},
+ {"flash_mode", required_argument, NULL, 10},
+ {"drive_mode", required_argument, NULL, 11},
+ {"select_af_point", required_argument, NULL, 12},
+ {"jpeg_image_tone", required_argument, NULL, 13},
+ {"white_balance_mode", required_argument, NULL, 14},
+ {"white_balance_adjustment", required_argument, NULL, 15},
+ {"model", required_argument, NULL, 16},
+ {"nowarnings", no_argument, NULL, 17},
+ {"device", required_argument, NULL, 18},
+ {"reconnect", no_argument, NULL, 19},
+ {"timeout", required_argument, NULL, 20},
+ {"noshutter", no_argument, NULL, 21},
+ {"servermode", no_argument, NULL, 22},
+ {"servermode_timeout", required_argument, NULL, 23},
+ {"pentax_debug_mode", required_argument, NULL,24},
+ {"dangerous", no_argument, NULL, 25},
+ {"read_datetime", no_argument, NULL, 26},
+ {"read_firmware_version", no_argument, NULL, 27},
+ {"settings_hex", no_argument, NULL, 28},
+ {"dump_memory", required_argument, NULL, 29},
+ {"settings", no_argument, NULL, 'S'},
+ { NULL, 0, NULL, 0}
+};
+
+int save_buffer(pslr_handle_t camhandle, int bufno, int fd, pslr_status *status, user_file_format filefmt, int jpeg_stars) {
+ pslr_buffer_type imagetype;
+ uint8_t buf[65536];
+ uint32_t length;
+ uint32_t current;
+
+ if (filefmt == USER_FILE_FORMAT_PEF) {
+ imagetype = PSLR_BUF_PEF;
+ } else if (filefmt == USER_FILE_FORMAT_DNG) {
+ imagetype = PSLR_BUF_DNG;
+ } else {
+ imagetype = pslr_get_jpeg_buffer_type( camhandle, jpeg_stars );
+ }
+
+ DPRINT("get buffer %d type %d res %d\n", bufno, imagetype, status->jpeg_resolution);
+
+ if (pslr_buffer_open(camhandle, bufno, imagetype, status->jpeg_resolution) != PSLR_OK) {
+ return 1;
+ }
+
+ length = pslr_buffer_get_size(camhandle);
+ DPRINT("Buffer length: %d\n", length);
+ current = 0;
+
+ while (true) {
+ uint32_t bytes;
+ bytes = pslr_buffer_read(camhandle, buf, sizeof (buf));
+ if (bytes == 0) {
+ break;
+ }
+ ssize_t r = write(fd, buf, bytes);
+ if (r == 0) {
+ DPRINT("write(buf): Nothing has been written to buf.\n");
+ } else if (r == -1) {
+ perror("write(buf)");
+ } else if (r < bytes) {
+ DPRINT("write(buf): only write %zu bytes, should be %d bytes.\n", r, bytes);
+ }
+ current += bytes;
+ }
+ pslr_buffer_close(camhandle);
+ return 0;
+}
+
+void save_memory(pslr_handle_t camhandle, int fd, uint32_t length) {
+ uint8_t buf[65536];
+ uint32_t current;
+
+ DPRINT("save memory %d\n", length);
+
+ current = 0;
+
+ while (current65536 ? 65536 : length-current;
+ bytes = pslr_fullmemory_read(camhandle, buf, current, readsize);
+ if (bytes == 0) {
+ break;
+ }
+ ssize_t r = write(fd, buf, bytes);
+ if (r == 0) {
+ DPRINT("write(buf): Nothing has been written to buf.\n");
+ } else if (r == -1) {
+ perror("write(buf)");
+ } else if (r < bytes) {
+ DPRINT("write(buf): only write %zu bytes, should be %d bytes.\n", r, bytes);
+ }
+ current += bytes;
+ }
+}
+
+
+void print_status_info( pslr_handle_t h, pslr_status status ) {
+ printf("\n");
+ printf( "%s", collect_status_info( h, status ) );
+}
+
+void print_settings_info( pslr_handle_t h, pslr_settings settings ) {
+ printf("\n");
+ printf( "%s", collect_settings_info( h, settings ) );
+}
+
+void usage(char *name) {
+ printf("\nUsage: %s [OPTIONS]\n\n\
+\n\
+ --model=CAMERA_MODEL valid values are: K20d, K10d, GX10, GX20, K-x, K200D, K-7, K-r, K-5, K-2000, K-m, K-30, K100D, K110D, K-01, K-3, K-3II, K-500\n\
+ --device=DEVICE valid values for Linux: sg0, sg1, ..., for Windows: C, D, E, ...\n\
+ --timeout=SECONDS timeout for camera connection ( 0 means forever )\n\
+ -w, --warnings warning mode on\n\
+ --nowarnings warning mode off\n\
+ -m, --exposure_mode=MODE valid values are GREEN, P, SV, TV, AV, TAV, M and X\n\
+ --exposure_compensation=VALUE exposure compensation value\n\
+ --drive_mode=DRIVE_MODE valid values are: Single, Continuous-HI, SelfTimer-12, SelfTimer-2, Remote, Remote-3, Continuous-LO\n\
+ -i, --iso=ISO single value (400) or interval (200-800)\n\
+ --color_space=COLOR_SPACE valid values are: sRGB, AdobeRGB\n\
+ --af_mode=AF_MODE valid values are: AF.S, AF.C, AF.A\n\
+ --select_af_point=AF_SELECT_MODE valid values are: Auto-5, Auto-11, Spot, Select, or numerical value\n\
+ --ae_metering=AE_METERING valid values are: Multi, Center, Spot\n\
+ --flash_mode=FLASH_MODE valid values are: Manual, Manual-RedEye, Slow, Slow-RedEye, TrailingCurtain, Auto, Auto-RedEye, Wireless\n\
+ --flash_exposure_compensation=VAL flash exposure compensation value\n\
+ -a, --aperture=APERTURE\n\
+ -t, --shutter_speed=SHUTTER SPEED values can be given in rational form (eg. 1/90) or decimal form (eg. 0.8)\n\
+ -r, --resolution=RESOLUTION resolution in megapixels\n\
+ -q, --quality=QUALITY valid values are 1, 2, 3 and 4\n\
+ --jpeg_image_tone=IMAGE_TONE valid values are: Auto, Natural, Bright, Portrait, Landscape, Vibrant, Monochrome, Muted, ReversalFilm, BleachBypass, Radiant, CrossProcessing, Flat\n\
+ --white_balance_mode=WB_MODE valid values are: Auto, Daylight, Shade, Cloudy, Fluorescent_D, Fluorescent_N, Fluorescent_W, Fluorescent_L, Tungsten, Flash, Manual, Manual2, Manual3, Kelvin1, Kelvin2, Kelvin3, CTE, MultiAuto\n\
+ --white_balance_adjustment=WB_ADJ valid values like: G5B2, G3A5, B5, A3, G5, M4...\n\
+ -f, --auto_focus autofocus\n\
+ --reconnect reconnect between shots\n\
+ --servermode start in server mode and wait for commands\n\
+ --servermode_timeout=SECONDS servermode timeout\n\
+ -g, --green green button\n\
+ -s, --status print status info\n\
+ --status_hex print status hex info\n\
+ -S, --settings print settings info\n\
+ --settings_hex print settings hex info\n\
+ --read_datetime print the camera date and time\n\
+ --read_firmware_version print the firmware version of the camera\n\
+ --dump_memory SIZE dumps the internal memory of the camera to pentax_dump.dat file. Size is in bytes, but can be specified using K, M, and G modifiers.\n\
+ --dust_removal dust removal\n\
+ -F, --frames=NUMBER number of frames\n\
+ -d, --delay=SECONDS delay between the frames (seconds)\n\
+ --file_format=FORMAT valid values: PEF, DNG, JPEG\n\
+ -o, --output_file=FILE send output to FILE\n\
+ --debug turn on debug messages\n\
+ --noshutter do not send shutter command, just wait for new photo, download and delete from camera\n\
+ -v, --version display version information and exit\n\
+ -h, --help display this help and exit\n\
+ --pentax_debug_mode={0|1} enable or disable camera debug mode and exit (DANGEROUS). Valid values are: 0, 1\n\
+\n", name);
+}
+
+int open_file(char* output_file, int frameNo, user_file_format_t ufft) {
+ int ofd;
+ char fileName[256];
+
+ if (!output_file) {
+ ofd = 1;
+ } else {
+ char *dot = strrchr(output_file, '.');
+ int prefix_length;
+ if (dot && !strcmp(dot+1, ufft.extension)) {
+ prefix_length = dot - output_file;
+ } else {
+ prefix_length = strlen(output_file);
+ }
+ snprintf(fileName, 256, "%.*s-%04d.%s", prefix_length, output_file, frameNo, ufft.extension);
+ ofd = open(fileName, FILE_ACCESS, 0664);
+ if (ofd == -1) {
+ fprintf(stderr, "Could not open %s\n", output_file);
+ return -1;
+ }
+ }
+ return ofd;
+}
+
+void warning_message( const char* message, ... ) {
+ if ( warnings ) {
+ // Write to stderr
+ //
+ va_list argp;
+ va_start(argp, message);
+ vfprintf( stderr, message, argp );
+ va_end(argp);
+ }
+}
+
+void process_wbadj( const char* argv0, const char chr, uint32_t adj, uint32_t *wbadj_mg, uint32_t *wbadj_ba ) {
+ if ( chr == 'M' ) {
+ *wbadj_mg = 7 - adj;
+ } else if ( chr == 'G' ) {
+ *wbadj_mg = 7 + adj;
+ } else if ( chr == 'B' ) {
+ *wbadj_ba = 7 - adj;
+ } else if ( chr == 'A' ) {
+ *wbadj_ba = 7 + adj;
+ } else {
+ warning_message("%s: Invalid white_balance_adjustment\n", argv0);
+ }
+}
+
+char *copyright_version(char *name, char *version) {
+ char *ret = malloc(sizeof(char)*1024);
+ sprintf(ret, "%s %s\n\n\%s\
+License LGPLv3: GNU LGPL version 3 \n\
+This is free software: you are free to change and redistribute it.\n\
+There is NO WARRANTY, to the extent permitted by law.\n", name, version, copyright() );
+ return ret;
+}
+
+char *command_line(int argc, char **argv) {
+ int len = 0;
+ int i;
+ for (i=0; i 100, even for a pinhole.
+ On the other hand, the fastest lens I know of is a f:0.8 Zeiss*/
+ if (F > 100 || F < 0.8) {
+ warning_message( "%s: Invalid aperture value.\n", argv[0]);
+ }
+ if (F >= 11) {
+ aperture.nom = F;
+ aperture.denom = 1;
+ } else {
+ F = (F * 10.0);
+ aperture.nom = F;
+ aperture.denom = 10;
+ }
+ break;
+
+ case 't':
+ if (sscanf(optarg, "1/%d%c", &shutter_speed.denom, &C) == 1) {
+ shutter_speed.nom = 1;
+ } else if ((sscanf(optarg, "%f%c", &F, &C)) == 1) {
+ if (F < 2) {
+ F = F * 10;
+ shutter_speed.denom = 10;
+ shutter_speed.nom = F;
+ } else {
+ shutter_speed.denom = 1;
+ shutter_speed.nom = F;
+ }
+ } else {
+ warning_message("%s: Invalid shutter speed value.\n", argv[0]);
+ }
+ break;
+
+ case 'o':
+ if (!strcmp(optarg, "-")) {
+ output_file_stdout = true;
+ } else {
+ output_file = optarg;
+ }
+ break;
+
+ case 'f':
+ auto_focus = true;
+ break;
+
+ case 'g':
+ green = true;
+ break;
+
+ case 'F':
+ frames = atoi(optarg);
+ if (frames > 9999) {
+ warning_message("%s: Invalid frame number.\n", argv[0]);
+ frames = 9999;
+ }
+ break;
+
+ case 'd':
+ delay = atoi(optarg);
+ if (!delay) {
+ warning_message("%s: Invalid delay value\n", argv[0]);
+ }
+ break;
+
+ case 'i':
+ if (sscanf(optarg, "%d-%d%c", &auto_iso_min, &auto_iso_max, &C) != 2) {
+ auto_iso_min = 0;
+ auto_iso_max = 0;
+ iso = atoi(optarg);
+ }
+ if (iso==0 && auto_iso_min==0) {
+ warning_message("%s: Invalid iso value\n", argv[0]);
+ exit(-1);
+ }
+ break;
+
+ case 3:
+ if ( sscanf(optarg, "%f%c", &F, &C) == 1 ) {
+ ec.nom=10*F;
+ ec.denom=10;
+ }
+ break;
+
+ case 5:
+ if ( sscanf(optarg, "%f%c", &F, &C) == 1 ) {
+ fec.nom=10*F;
+ fec.denom=10;
+ }
+ break;
+
+ case 21:
+ noshutter = true;
+ break;
+
+ case 22:
+ servermode = true;
+ break;
+
+ case 23:
+ servermode_timeout = atoi(optarg);
+ break;
+
+ case 24:
+ modify_debug_mode=1;
+ debug_mode=atoi(optarg);
+ break;
+
+ case 25:
+ dangerous = true;
+ break;
+
+ case 26:
+ read_datetime=true;
+ break;
+
+ case 27:
+ read_firmware_version=true;
+ break;
+
+ case 28:
+ settings_hex=true;
+ break;
+
+ case 29:
+ if ( sscanf(optarg, "%d%c", &dump_memory_size, &multc) == 2 ) {
+ switch (multc) {
+ case 'G':
+ case 'g':
+ mult = 1024*1024*1024;
+ break;
+ case 'M':
+ case 'm':
+ mult = 1024*1024;
+ break;
+ case 'K':
+ case 'k':
+ mult = 1024;
+ break;
+ default:
+ warning_message("%s: Invalid dump memory size: %s\n", argv[0], optarg);
+
+ }
+ dump_memory_size *= mult;
+ } else {
+ dump_memory_size=atoi(optarg);
+ }
+ DPRINT("DUMP_MEMORY_SIZE: %u\n",dump_memory_size);
+ break;
+ }
+ }
+
+ if ( servermode ) {
+#ifndef WIN32
+ // ignore all the other argument and go to server mode
+ servermode_socket(servermode_timeout);
+ exit(0);
+#else
+ fprintf(stderr, "Servermode is not supported in Windows\n");
+ exit(-1);
+#endif
+ }
+
+ if (!output_file && !output_file_stdout && frames > 0) {
+ fprintf(stderr, "Should specify output filename (use '-o -' if you really want to output to stdout)\n");
+ exit(-1);
+ }
+
+ if (frames == 0 && (output_file || output_file_stdout)) {
+ frames = 1;
+ }
+
+ DPRINT("%s %s \n", argv[0], VERSION);
+ DPRINT("model %s\n", model );
+ DPRINT("device %s\n", device );
+
+ char buf[2100];
+
+ if ( !(camhandle = camera_connect( model, device, timeout, buf)) ) {
+ printf("%s", buf);
+ exit(-1);
+ }
+
+ camera_name = pslr_camera_name(camhandle);
+ printf("%s: %s Connected...\n", argv[0], camera_name);
+
+ if ( dump_memory_size > 0 ) {
+ int dfd = open(DUMP_FILE_NAME, FILE_ACCESS, 0664);
+ if (dfd == -1) {
+ fprintf(stderr, "Could not open %s\n", DUMP_FILE_NAME);
+ return -1;
+ } else {
+ printf("Dumping system memory to %s\n", DUMP_FILE_NAME);
+ save_memory(camhandle, dfd, dump_memory_size);
+ close(dfd);
+ camera_close(camhandle);
+ exit(0);
+ }
+ }
+
+ /* if debug mode switch is on, there is a possibility someone just want to alter debug mode */
+ if ( modify_debug_mode == 1) {
+ debug_onoff(camhandle,debug_mode);
+ camera_close(camhandle);
+ exit(0);
+ }
+
+ pslr_get_status(camhandle, &status);
+
+ if ( color_space != -1 ) {
+ pslr_set_color_space( camhandle, color_space );
+ }
+
+ if ( af_mode != -1 ) {
+ pslr_set_af_mode( camhandle, af_mode );
+ }
+
+ if ( af_point_sel != -1 ) {
+ pslr_set_af_point_sel( camhandle, af_point_sel );
+ if (af_point_selected != 0) {
+ pslr_select_af_point(camhandle, af_point_selected);
+ }
+ }
+
+ if ( ae_metering != -1 ) {
+ pslr_set_ae_metering_mode( camhandle, ae_metering );
+ }
+
+ if ( flash_mode != -1 ) {
+ pslr_set_flash_mode( camhandle, flash_mode );
+ }
+
+ if ( jpeg_image_tone != -1 ) {
+ if ( jpeg_image_tone > pslr_get_model_max_supported_image_tone(camhandle) ) {
+ warning_message("%s: Invalid jpeg image tone setting.\n", argv[0]);
+ }
+ pslr_set_jpeg_image_tone( camhandle, jpeg_image_tone );
+ }
+
+ if ( white_balance_mode != -1 ) {
+ pslr_set_white_balance( camhandle, white_balance_mode );
+ if ( wbadj_ss > 0 ) {
+ pslr_set_white_balance_adjustment( camhandle, white_balance_mode, white_balance_adjustment_mg, white_balance_adjustment_ba );
+ }
+ } else if ( white_balance_mode == -1 && wbadj_ss > 0 ) {
+ pslr_set_white_balance_adjustment( camhandle, status.white_balance_mode, white_balance_adjustment_mg, white_balance_adjustment_ba);
+ }
+
+ if ( drive_mode != -1 ) {
+ pslr_set_drive_mode( camhandle, drive_mode );
+ }
+
+ if ( uff == USER_FILE_FORMAT_MAX ) {
+ // not specified
+ if ( !pslr_get_model_only_limited( camhandle ) ) {
+ // use the default of the camera
+ uff = get_user_file_format( &status );
+ } else {
+ // use PEF, since all the camera supports this
+ uff = USER_FILE_FORMAT_PEF;
+ }
+ } else {
+ // set the requested format
+ pslr_set_user_file_format(camhandle, uff);
+ }
+
+ if (resolution) {
+ pslr_set_jpeg_resolution(camhandle, resolution);
+ }
+
+ if (quality>-1) {
+ if ( quality > pslr_get_model_max_jpeg_stars(camhandle) ) {
+ warning_message("%s: Invalid jpeg quality setting.\n", argv[0]);
+ }
+ pslr_set_jpeg_stars(camhandle, quality);
+ }
+
+ // We do not check iso settings
+ // The camera can handle invalid iso settings (it will use ISO 800 instead of ISO 795)
+
+ if (EM != PSLR_EXPOSURE_MODE_MAX) {
+ pslr_set_exposure_mode(camhandle, EM);
+ }
+
+ if ( ec.denom ) {
+ pslr_set_ec( camhandle, ec );
+ }
+
+ if ( fec.denom ) {
+ pslr_set_flash_exposure_compensation( camhandle, fec );
+ }
+
+ if (iso >0 || auto_iso_min >0) {
+ pslr_set_iso(camhandle, iso, auto_iso_min, auto_iso_max);
+ }
+
+ /* For some reason, resolution is not set until we read the status: */
+ pslr_get_status(camhandle, &status);
+
+ if ( quality == -1 ) {
+ // quality is not set we read it from the camera
+ quality = status.jpeg_quality;
+ }
+
+ if (EM != PSLR_EXPOSURE_MODE_MAX && status.exposure_mode != EM) {
+ warning_message( "%s: Cannot set %s mode; set the mode dial to %s or USER\n", argv[0], MODESTRING, MODESTRING);
+ }
+
+ if (shutter_speed.nom) {
+ DPRINT("shutter_speed.nom=%d\n", shutter_speed.nom);
+ DPRINT("shutter_speed.denom=%d\n", shutter_speed.denom);
+
+ if (shutter_speed.nom <= 0 || (shutter_speed.nom > 30 && status.exposure_mode != PSLR_GUI_EXPOSURE_MODE_B ) || shutter_speed.denom <= 0 || shutter_speed.denom > pslr_get_model_fastest_shutter_speed(camhandle)) {
+ warning_message("%s: Invalid shutter speed value.\n", argv[0]);
+ }
+
+ pslr_set_shutter(camhandle, shutter_speed);
+ } else if ( status.exposure_mode == PSLR_GUI_EXPOSURE_MODE_B ) {
+ warning_message("%s: Shutter speed not specified in Bulb mode. Using 30s.\n", argv[0]);
+ shutter_speed.nom = 30;
+ shutter_speed.denom = 1;
+ }
+
+ if (aperture.nom) {
+ if ((aperture.nom * status.lens_max_aperture.denom) > (aperture.denom * status.lens_max_aperture.nom)) {
+ warning_message("%s: Warning, selected aperture is smaller than this lens minimum aperture.\n", argv[0]);
+ warning_message("%s: Setting aperture to f:%d\n", argv[0], status.lens_max_aperture.nom / status.lens_max_aperture.denom);
+ }
+
+ if ((aperture.nom * status.lens_min_aperture.denom) < (aperture.denom * status.lens_min_aperture.nom)) {
+ warning_message( "%s: Warning, selected aperture is wider than this lens maximum aperture.\n", argv[0]);
+ warning_message( "%s: Setting aperture to f:%.1f\n", argv[0], (float) status.lens_min_aperture.nom / (float) status.lens_min_aperture.denom);
+ }
+
+
+ pslr_set_aperture(camhandle, aperture);
+ }
+
+ int frameNo;
+
+ if (auto_focus) {
+ pslr_focus(camhandle);
+ }
+
+ if (green) {
+ pslr_green_button( camhandle );
+ }
+
+// pslr_test( camhandle, true, 0x1e, 4, 1, 2, 3, 4);
+// pslr_button_test( camhandle, 0x0c, 1 );
+
+ if (read_datetime) {
+ int year=0, month=0, day=0, hour=0, min=0, sec=0;
+ pslr_read_datetime(camhandle, &year, &month, &day, &hour, &min, &sec);
+ printf("%04d/%02d/%02d %02d:%02d:%02d\n", year, month, day, hour, min, sec);
+ camera_close(camhandle);
+ exit(0);
+ }
+
+ if (read_firmware_version || debug) {
+ char firmware[16];
+ pslr_read_dspinfo( camhandle, firmware );
+ if (!read_firmware_version) {
+ DPRINT("Firmware version: %s\n", firmware);
+ } else {
+ printf("Firmware version: %s\n", firmware);
+ camera_close(camhandle);
+ exit(0);
+ }
+ }
+
+ // read the status and settings after setting the values
+ if (settings_hex || settings_info || pslr_get_model_has_settings_parser(camhandle)) {
+ pslr_get_settings_json(camhandle, &settings);
+ }
+ pslr_get_status(camhandle, &status);
+
+ if ( status_hex_info || status_info || settings_info || settings_hex ) {
+ if ( status_hex_info || status_info ) {
+ if ( status_hex_info ) {
+ int status_bufsize = pslr_get_model_status_buffer_size( camhandle );
+ uint8_t status_buffer[MAX_STATUS_BUF_SIZE];
+ pslr_get_status_buffer(camhandle, status_buffer);
+ hexdump( status_buffer, status_bufsize > 0 ? status_bufsize : MAX_STATUS_BUF_SIZE);
+ }
+ print_status_info( camhandle, status );
+ }
+ if ( settings_info || settings_hex ) {
+ if (settings_hex) {
+ uint8_t settings_buf[SETTINGS_BUFFER_SIZE];
+ pslr_get_settings_buffer(camhandle, settings_buf);
+ hexdump(settings_buf, SETTINGS_BUFFER_SIZE);
+ }
+ if (pslr_get_model_has_settings_parser(camhandle)) {
+ print_settings_info(camhandle, settings);
+ } else {
+ printf("--settings is not supported for this camera model\n");
+ }
+ }
+ camera_close(camhandle);
+ exit(0);
+ }
+
+ if ( dust ) {
+ pslr_dust_removal(camhandle);
+ camera_close(camhandle);
+ exit(0);
+ }
+
+ if (frames == 0) {
+ // no action specified
+ print_status_info( camhandle, status );
+ camera_close(camhandle);
+ exit(-1);
+ }
+
+ if (pslr_has_setting_by_name(camhandle, "bulb_timer")) {
+ bulb_timer_before = settings.bulb_timer.value;
+ } else if (pslr_has_setting_by_name(camhandle, "astrotracer")) {
+ astrotracer_before = settings.astrotracer.value;
+ }
+
+ double waitsec=0;
+ user_file_format_t ufft = *get_file_format_t(uff);
+ int bracket_count = status.auto_bracket_picture_count;
+ if ( bracket_count < 1 || status.auto_bracket_mode == 0 ) {
+ bracket_count = 1;
+ }
+ gettimeofday(&prev_time, NULL);
+
+ int bracket_index=0;
+
+ bool continuous = status.drive_mode == PSLR_DRIVE_MODE_CONTINUOUS_HI ||
+ status.drive_mode == PSLR_DRIVE_MODE_CONTINUOUS_LO;
+ DPRINT("cont: %d\n", continuous);
+
+ if (pslr_get_model_bufmask_single(camhandle) && bracket_count >1 && settings.one_push_bracketing.pslr_setting_status == PSLR_SETTING_STATUS_READ && settings.one_push_bracketing.value) {
+ pslr_write_setting_by_name(camhandle, "one_push_bracketing", 0);
+ settings.one_push_bracketing.value=false;
+ need_one_push_bracketing_cleanup = true;
+ }
+
+ for (frameNo = 0; frameNo < frames; ++frameNo) {
+ gettimeofday(¤t_time, NULL);
+ if ( bracket_count <= bracket_index ) {
+ if ( reconnect ) {
+ camera_close( camhandle );
+ while (!(camhandle = pslr_init( model, device ))) {
+ sleep_sec(1);
+ }
+ pslr_connect(camhandle);
+ }
+ waitsec = 1.0 * delay - timeval_diff_sec(¤t_time, &prev_time);
+ if ( waitsec > 0 ) {
+ printf("Waiting for %.2f sec\n", waitsec);
+ sleep_sec( waitsec );
+ }
+ bracket_index = 0;
+ gettimeofday(&prev_time, NULL);
+ }
+ if ( noshutter ) {
+ while (1) {
+ if ( PSLR_OK != pslr_get_status (camhandle, &status) ) {
+ break;
+ }
+
+ if ( status.bufmask != 0 ) {
+ break; //new image ?
+ }
+
+ gettimeofday (¤t_time, NULL);
+ if ( timeout != 0 && ( timeval_diff_sec(¤t_time, &prev_time) >= timeout) ) {
+ printf("Timeout %d sec passed!\n", timeout);
+ break;
+ }
+
+ usleep(100000); /* 100 ms */
+ }
+ } else {
+ if ( frames > 1 ) {
+ printf("Taking picture %d/%d\n", frameNo+1, frames);
+ fflush(stdout);
+ }
+ if ( status.exposure_mode == PSLR_GUI_EXPOSURE_MODE_B ) {
+ if (pslr_get_model_old_bulb_mode(camhandle)) {
+ bulb_old(camhandle, shutter_speed, prev_time);
+ } else {
+ need_bulb_new_cleanup = true;
+ bulb_new(camhandle, shutter_speed);
+ }
+ } else {
+ DPRINT("not bulb\n");
+ if (!settings.one_push_bracketing.value || bracket_index == 0) {
+ pslr_shutter(camhandle);
+ } else {
+ // TODO: fix waiting time
+ sleep_sec(1);
+ }
+ }
+ pslr_get_status(camhandle, &status);
+ }
+ if ( bracket_index+1 >= bracket_count || frameNo+1>=frames || pslr_get_model_bufmask_single(camhandle) ) {
+ int bracket_download = pslr_get_model_bufmask_single(camhandle) ? 1 : (bracket_index+1 < bracket_count ? bracket_index+1 : bracket_count);
+ int buffer_index;
+ for ( buffer_index = 0; buffer_index < bracket_download; ++buffer_index ) {
+ fd = open_file(output_file, frameNo-bracket_download+buffer_index+1, ufft);
+ while ( save_buffer(camhandle, buffer_index, fd, &status, uff, quality) ) {
+ usleep(10000);
+ }
+ pslr_delete_buffer(camhandle, buffer_index);
+ if (fd != 1) {
+ close(fd);
+ }
+ }
+ }
+ ++bracket_index;
+ }
+ if (need_bulb_new_cleanup) {
+ bulb_new_cleanup(camhandle);
+ }
+ if (need_one_push_bracketing_cleanup) {
+ pslr_write_setting_by_name(camhandle, "one_push_bracketing", 1);
+ }
+ camera_close(camhandle);
+
+ exit(0);
+}
diff --git a/libpktriggercord/src/pktriggercord-servermode.c b/libpktriggercord/src/pktriggercord-servermode.c
new file mode 100644
index 000000000..03b762ca0
--- /dev/null
+++ b/libpktriggercord/src/pktriggercord-servermode.c
@@ -0,0 +1,405 @@
+/*
+ pkTriggerCord
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2011-2019 Andras Salamon
+
+ based on:
+
+ pslr-shoot
+
+ Command line remote control of Pentax DSLR cameras.
+ Copyright (C) 2009 Ramiro Barreiro
+ With fragments of code from PK-Remote by Pontus Lidman.
+
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#ifndef WIN32
+#include
+#include
+#include
+#endif
+
+#include
+#include
+#include
+
+#include
+
+#include "pslr.h"
+#include "pslr_lens.h"
+
+double timeval_diff_sec(struct timeval *t2, struct timeval *t1) {
+ //DPRINT("tv2 %ld %ld t1 %ld %ld\n", t2->tv_sec, t2->tv_usec, t1->tv_sec, t1->tv_usec);
+ return (t2->tv_usec - t1->tv_usec) / 1000000.0 + (t2->tv_sec - t1->tv_sec);
+}
+
+void camera_close(pslr_handle_t camhandle) {
+ pslr_disconnect(camhandle);
+ pslr_shutdown(camhandle);
+}
+
+pslr_handle_t camera_connect( char *model, char *device, int timeout, char *error_message ) {
+ struct timeval prev_time;
+ struct timeval current_time;
+ pslr_handle_t camhandle;
+ int r;
+
+ gettimeofday(&prev_time, NULL);
+ while (!(camhandle = pslr_init( model, device ))) {
+ gettimeofday(¤t_time, NULL);
+ DPRINT("diff: %f\n", timeval_diff_sec(¤t_time, &prev_time));
+ if ( timeout == 0 || timeout > timeval_diff_sec(¤t_time, &prev_time)) {
+ DPRINT("sleep 1 sec\n");
+ sleep_sec(1);
+ } else {
+ snprintf(error_message, 1000, "%d %ds timeout exceeded\n", 1, timeout);
+ return NULL;
+ }
+ }
+
+ DPRINT("before connect\n");
+ if (camhandle) {
+ if ((r=pslr_connect(camhandle)) ) {
+ if ( r != -1 ) {
+ snprintf(error_message, 1000, "%d Cannot connect to Pentax camera. Please start the program as root.\n",1);
+ } else {
+ snprintf(error_message, 1000, "%d Unknown Pentax camera found.\n",1);
+ }
+ return NULL;
+ }
+ }
+ return camhandle;
+}
+
+#ifndef WIN32
+int client_sock;
+
+void write_socket_answer( char *answer ) {
+ ssize_t r = write(client_sock, answer, strlen(answer));
+ if (r != strlen(answer)) {
+ fprintf(stderr, "write(answer) failed");
+ }
+}
+
+void write_socket_answer_bin( uint8_t *answer, uint32_t length ) {
+ ssize_t r = write(client_sock, answer, length);
+ if (r != length) {
+ fprintf(stderr, "write(answer) failed");
+ }
+
+}
+
+char *is_string_prefix(char *str, char *prefix) {
+ if ( !strncmp(str, prefix, strlen(prefix) ) ) {
+ if ( strlen(str) <= strlen(prefix)+1 ) {
+ return str;
+ } else {
+ return str+strlen(prefix)+1;
+ }
+ } else {
+ return NULL;
+ }
+}
+
+bool check_camera(pslr_handle_t camhandle) {
+ if ( !camhandle ) {
+ write_socket_answer("1 No camera connected\n");
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void strip(char *s) {
+ char *p2 = s;
+ while (*s != '\0') {
+ if (*s != '\r' && *s != '\n') {
+ *p2++ = *s++;
+ } else {
+ ++s;
+ }
+ }
+ *p2 = '\0';
+}
+
+int servermode_socket(int servermode_timeout) {
+ int socket_desc, c, read_size;
+ struct sockaddr_in server, client;
+ char client_message[2000];
+ char *arg;
+ char buf[2100];
+ pslr_handle_t camhandle=NULL;
+ pslr_status status;
+ char C;
+ float F = 0;
+ pslr_rational_t shutter_speed = {0, 0};
+ uint32_t iso = 0;
+ uint32_t auto_iso_min = 0;
+ uint32_t auto_iso_max = 0;
+
+ //Create socket
+ socket_desc = socket(AF_INET, SOCK_STREAM, 0);
+ if (socket_desc == -1) {
+ fprintf(stderr, "Could not create socket");
+ }
+
+ int enable = 1;
+ if (setsockopt(socket_desc, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0) {
+ fprintf(stderr, "setsockopt(SO_REUSEADDR) failed");
+ }
+ DPRINT("Socket created\n");
+
+ //Prepare the sockaddr_in structure
+ server.sin_family = AF_INET;
+ server.sin_addr.s_addr = INADDR_ANY;
+ server.sin_port = htons( 8888 );
+
+ //Bind
+ if ( bind(socket_desc,(struct sockaddr *)&server, sizeof(server)) < 0) {
+ fprintf(stderr, "bind failed. Error");
+ return 1;
+ }
+ DPRINT("bind done\n");
+
+ //Listen
+ listen(socket_desc, 3);
+
+ //Accept and incoming connection
+ DPRINT("Waiting for incoming connections...\n");
+ c = sizeof(struct sockaddr_in);
+
+ while ( true ) {
+ fd_set rfds;
+ struct timeval tv;
+ int retval;
+ FD_ZERO(&rfds);
+ FD_SET(socket_desc, &rfds);
+ tv.tv_sec = servermode_timeout;
+ tv.tv_usec = 0;
+ retval = select(socket_desc+1, &rfds, NULL, NULL, &tv);
+
+ if (retval == -1) {
+ DPRINT("select error\n");
+ exit(1);
+ } else if (retval) {
+ client_sock = accept(socket_desc, (struct sockaddr *)&client, (socklen_t*)&c);
+ if (client_sock < 0) {
+ fprintf(stderr, "accept failed");
+ return 1;
+ }
+ DPRINT("Connection accepted\n");
+ } else {
+ DPRINT("Timeout\n");
+ close(socket_desc);
+ exit(0);
+ }
+
+ //Receive a message from client
+ while ( (read_size = recv(client_sock, client_message, 2000, 0)) > 0 ) {
+ client_message[read_size]='\0';
+ strip( client_message );
+ DPRINT(":%s:\n",client_message);
+ if ( !strcmp(client_message, "stopserver" ) ) {
+ if ( camhandle ) {
+ camera_close(camhandle);
+ }
+ write_socket_answer("0\n");
+ exit(0);
+ } else if ( !strcmp(client_message, "disconnect" ) ) {
+ if ( camhandle ) {
+ camera_close(camhandle);
+ }
+ write_socket_answer("0\n");
+ } else if ( (arg = is_string_prefix( client_message, "echo")) != NULL ) {
+ sprintf( buf, "0 %.100s\n", arg);
+ write_socket_answer(buf);
+ } else if ( (arg = is_string_prefix( client_message, "usleep")) != NULL ) {
+ int microseconds = atoi(arg);
+ usleep(microseconds);
+ write_socket_answer("0\n");
+ } else if ( !strcmp(client_message, "connect") ) {
+ if ( camhandle ) {
+ write_socket_answer("0\n");
+ } else if ( (camhandle = camera_connect( NULL, NULL, -1, buf )) ) {
+ write_socket_answer("0\n");
+ } else {
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "update_status") ) {
+ if ( check_camera(camhandle) ) {
+ if ( !pslr_get_status(camhandle, &status) ) {
+ sprintf( buf, "%d\n", 0);
+ } else {
+ sprintf( buf, "%d\n", 1);
+ }
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_camera_name") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %s\n", 0, pslr_camera_name(camhandle));
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_lens_name") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %s\n", 0, get_lens_name(status.lens_id1, status.lens_id2));
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_current_shutter_speed") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %d/%d\n", 0, status.current_shutter_speed.nom, status.current_shutter_speed.denom);
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_current_aperture") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %s\n", 0, format_rational( status.current_aperture, "%.1f"));
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_current_iso") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %d\n", 0, status.current_iso);
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_bufmask") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %d\n", 0, status.bufmask);
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_auto_bracket_mode") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %d\n", 0, status.auto_bracket_mode);
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "get_auto_bracket_picture_count") ) {
+ if ( check_camera(camhandle) ) {
+ sprintf(buf, "%d %d\n", 0, status.auto_bracket_picture_count);
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "focus") ) {
+ if ( check_camera(camhandle) ) {
+ pslr_focus(camhandle);
+ sprintf(buf, "%d\n", 0);
+ write_socket_answer(buf);
+ }
+ } else if ( !strcmp(client_message, "shutter") ) {
+ if ( check_camera(camhandle) ) {
+ pslr_shutter(camhandle);
+ sprintf(buf, "%d\n", 0);
+ write_socket_answer(buf);
+ }
+ } else if ( (arg = is_string_prefix( client_message, "delete_buffer")) != NULL ) {
+ int bufno = atoi(arg);
+ if ( check_camera(camhandle) ) {
+ pslr_delete_buffer(camhandle,bufno);
+ sprintf(buf, "%d\n", 0);
+ write_socket_answer(buf);
+ }
+ } else if ( (arg = is_string_prefix( client_message, "get_preview_buffer")) != NULL ) {
+ int bufno = atoi(arg);
+ if ( check_camera(camhandle) ) {
+ uint8_t *pImage;
+ uint32_t imageSize;
+ if ( pslr_get_buffer(camhandle, bufno, PSLR_BUF_PREVIEW, 4, &pImage, &imageSize) ) {
+ sprintf(buf, "%d %d\n", 1, imageSize);
+ write_socket_answer(buf);
+ } else {
+ sprintf(buf, "%d %d\n", 0, imageSize);
+ write_socket_answer(buf);
+ write_socket_answer_bin(pImage, imageSize);
+ }
+ }
+ } else if ( (arg = is_string_prefix( client_message, "get_buffer")) != NULL ) {
+ int bufno = atoi(arg);
+ if ( check_camera(camhandle) ) {
+ uint32_t imageSize;
+ if ( pslr_buffer_open(camhandle, bufno, PSLR_BUF_DNG, 0) ) {
+ sprintf(buf, "%d\n", 1);
+ write_socket_answer(buf);
+ } else {
+ imageSize = pslr_buffer_get_size(camhandle);
+ sprintf(buf, "%d %d\n", 0, imageSize);
+ write_socket_answer(buf);
+ uint32_t current = 0;
+ while (1) {
+ uint32_t bytes;
+ uint8_t buf[65536];
+ bytes = pslr_buffer_read(camhandle, buf, sizeof (buf));
+ if (bytes == 0) {
+ break;
+ }
+ write_socket_answer_bin( buf, bytes);
+ current += bytes;
+ }
+ pslr_buffer_close(camhandle);
+ }
+ }
+ } else if ( (arg = is_string_prefix( client_message, "set_shutter_speed")) != NULL ) {
+ if ( check_camera(camhandle) ) {
+ // TODO: merge with pktriggercord-cli shutter speed parse
+ if (sscanf(arg, "1/%d%c", &shutter_speed.denom, &C) == 1) {
+ shutter_speed.nom = 1;
+ sprintf(buf, "%d %d %d\n", 0, shutter_speed.nom, shutter_speed.denom);
+ } else if ((sscanf(arg, "%f%c", &F, &C)) == 1) {
+ if (F < 2) {
+ F = F * 10;
+ shutter_speed.denom = 10;
+ shutter_speed.nom = F;
+ } else {
+ shutter_speed.denom = 1;
+ shutter_speed.nom = F;
+ }
+ sprintf(buf, "%d %d %d\n", 0, shutter_speed.nom, shutter_speed.denom);
+ } else {
+ shutter_speed.nom = 0;
+ sprintf(buf,"1 Invalid shutter speed value.\n");
+ }
+ if (shutter_speed.nom) {
+ pslr_set_shutter(camhandle, shutter_speed);
+ }
+ write_socket_answer(buf);
+ }
+ } else if ( (arg = is_string_prefix( client_message, "set_iso")) != NULL ) {
+ if ( check_camera(camhandle) ) {
+ // TODO: merge with pktriggercord-cli shutter iso
+ if (sscanf(arg, "%d-%d%c", &auto_iso_min, &auto_iso_max, &C) != 2) {
+ auto_iso_min = 0;
+ auto_iso_max = 0;
+ iso = atoi(arg);
+ } else {
+ iso = 0;
+ }
+ if (iso==0 && auto_iso_min==0) {
+ sprintf(buf,"1 Invalid iso value.\n");
+ } else {
+ pslr_set_iso(camhandle, iso, auto_iso_min, auto_iso_max);
+ sprintf(buf, "%d %d %d-%d\n", 0, iso, auto_iso_min, auto_iso_max);
+ }
+ write_socket_answer(buf);
+ }
+ } else {
+ write_socket_answer("1 Invalid servermode command\n");
+ }
+ }
+
+ if (read_size == 0) {
+ DPRINT("Client disconnected\n");
+ fflush(stdout);
+ } else if (read_size == -1) {
+ fprintf(stderr, "recv failed\n");
+ }
+ }
+ return 0;
+}
+#endif
diff --git a/libpktriggercord/src/pktriggercord-servermode.h b/libpktriggercord/src/pktriggercord-servermode.h
new file mode 100644
index 000000000..952092934
--- /dev/null
+++ b/libpktriggercord/src/pktriggercord-servermode.h
@@ -0,0 +1,40 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#ifndef PKTRIGGERCORD_SERVERMODE_H
+#define PKTRIGGERCORD_SERVERMODE_H
+
+int servermode_socket(int servermode_timeout);
+
+pslr_handle_t camera_connect( char *model, char *device, int timeout, char *error_message );
+
+void camera_close(pslr_handle_t camhandle);
+
+double timeval_diff_sec(struct timeval *t2, struct timeval *t1);
+
+#endif
diff --git a/libpktriggercord/src/pslr.c b/libpktriggercord/src/pslr.c
new file mode 100644
index 000000000..8550a623f
--- /dev/null
+++ b/libpktriggercord/src/pslr.c
@@ -0,0 +1,1822 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ Support for K200D added by Jens Dreyer 04/2011
+ Support for K-r added by Vincenc Podobnik 06/2011
+ Support for K-30 added by Camilo Polymeris 09/2012
+ Support for K-01 added by Ethan Queen 01/2013
+ Support for K-3 added by Tao Wang 01/2016
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "pslr.h"
+#include "pslr_scsi.h"
+#include "pslr_lens.h"
+
+#define POLL_INTERVAL 50000 /* Number of us to wait when polling */
+#define BLKSZ 65536 /* Block size for downloads; if too big, we get
+ * memory allocation error from sg driver */
+#define BLOCK_RETRY 3 /* Number of retries, since we can occasionally
+ * get SCSI errors when downloading data */
+
+void sleep_sec(double sec) {
+ int i;
+ for (i=0; ifd, 0x02, 0x00, 0));
+ n = get_result(p->fd);
+ DPRINT("[C]\t\tipslr_get_buffer_status() bytes: %d\n",n);
+ if (n!= 8) {
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, buf, n));
+ int i;
+ for (i=0; imodel->is_little_endian) {
+ get_uint32_func_ptr = get_uint32_le;
+ } else {
+ get_uint32_func_ptr = get_uint32_be;
+ }
+ *x = (*get_uint32_func_ptr)(buf);
+ *y = (*get_uint32_func_ptr)(buf+4);
+ return PSLR_OK;
+}
+
+/* Commands in form 23 XX YY. I know it is stupid, but ipslr_cmd functions */
+/* are sooooo handy. */
+static int ipslr_cmd_23_XX(ipslr_handle_t *p, char XX, char YY, uint32_t mode) {
+ DPRINT("[C]\t\tipslr_cmd_23_XX(%x, %x, mode=%x)\n", XX, YY, mode);
+ CHECK(ipslr_write_args(p, 1, mode));
+ CHECK(command(p->fd, 0x23, XX, YY));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+/* First of two exceptions. Command 0x23 0x06 0x14 behaves differently than */
+/* generic 23 XX YY commands */
+static int ipslr_cmd_23_06(ipslr_handle_t *p, char debug_on_off) {
+ DPRINT("[C]\t\tipslr_cmd_23_06(debug=%d)\n", debug_on_off);
+ CHECK(ipslr_write_args(p, 1, 3));
+ if (debug_on_off==0) {
+ CHECK(ipslr_write_args_special(p, 4,0,0,0,0));
+ } else {
+ CHECK(ipslr_write_args_special(p, 4,1,1,0,0));
+ }
+ CHECK(command(p->fd, 0x23, 0x06, 0x14));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+/* Second exception. Command 0x23 0x04 0x08 behaves differently than generic */
+/* 23 XX YY commands */
+static int ipslr_cmd_23_04(ipslr_handle_t *p) {
+ DPRINT("[C]\t\tipslr_cmd_23_04()\n");
+ CHECK(ipslr_write_args(p, 1, 3)); // posebni ARGS-i
+ CHECK(ipslr_write_args_special(p, 1, 1)); // posebni ARGS-i
+ CHECK(command(p->fd, 0x23, 0x04, 0x08));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+/* Function called to enable/disable debug mode. If debug_mode argument is 0 */
+/* function disables debug mode, else debug mode is enabled */
+int debug_onoff(ipslr_handle_t *p, char debug_mode) {
+ DPRINT("[C]\tdebug_onoff(%d)\n", debug_mode);
+ uint8_t buf[16]; /* buffer for storing statuses and read_results */
+
+ ipslr_cmd_00_09(p,1);
+
+ ipslr_cmd_23_XX(p,0x07,0x04,3);
+ read_result(p->fd,buf,0x10);
+
+ ipslr_cmd_23_XX(p,0x05,0x04,3);
+ read_result(p->fd,buf,0x04);
+ ipslr_status(p,buf);
+
+ if (debug_mode==0) {
+ ipslr_cmd_23_06(p,DEBUG_OFF);
+ } else {
+ ipslr_cmd_23_06(p,DEBUG_ON);
+ }
+ ipslr_status(p,buf);
+
+
+ ipslr_cmd_23_04(p);
+
+ ipslr_cmd_23_XX(p,0x00,0x04, 0);
+
+ ipslr_cmd_00_09(p,2);
+ ipslr_status(p,buf);
+
+ return PSLR_OK;
+}
+
+/* ************* End enabling/disabling debug mode ************ */
+
+user_file_format_t *get_file_format_t( user_file_format uff ) {
+ unsigned int i;
+ for (i = 0; iraw_format;
+ int imgfmt = st->image_format;
+ if (imgfmt == PSLR_IMAGE_FORMAT_JPEG) {
+ return USER_FILE_FORMAT_JPEG;
+ } else {
+ if (rawfmt == PSLR_RAW_FORMAT_PEF) {
+ return USER_FILE_FORMAT_PEF;
+ } else {
+ return USER_FILE_FORMAT_DNG;
+ }
+ }
+}
+
+// most of the cameras require this exposure mode conversion step
+pslr_gui_exposure_mode_t exposure_mode_conversion( pslr_exposure_mode_t exp ) {
+ switch ( exp ) {
+
+ case PSLR_EXPOSURE_MODE_GREEN:
+ return PSLR_GUI_EXPOSURE_MODE_GREEN;
+ case PSLR_EXPOSURE_MODE_P:
+ return PSLR_GUI_EXPOSURE_MODE_P;
+ case PSLR_EXPOSURE_MODE_SV:
+ return PSLR_GUI_EXPOSURE_MODE_SV;
+ case PSLR_EXPOSURE_MODE_TV:
+ return PSLR_GUI_EXPOSURE_MODE_TV;
+ case PSLR_EXPOSURE_MODE_AV:
+ case PSLR_EXPOSURE_MODE_AV_OFFAUTO:
+ return PSLR_GUI_EXPOSURE_MODE_AV;
+ case PSLR_EXPOSURE_MODE_TAV:
+ return PSLR_GUI_EXPOSURE_MODE_TAV;
+ case PSLR_EXPOSURE_MODE_M:
+ case PSLR_EXPOSURE_MODE_M_OFFAUTO:
+ return PSLR_GUI_EXPOSURE_MODE_M;
+ case PSLR_EXPOSURE_MODE_B:
+ case PSLR_EXPOSURE_MODE_B_OFFAUTO:
+ return PSLR_GUI_EXPOSURE_MODE_B;
+ case PSLR_EXPOSURE_MODE_X:
+ return PSLR_GUI_EXPOSURE_MODE_X;
+ case PSLR_EXPOSURE_MODE_MAX:
+ return PSLR_GUI_EXPOSURE_MODE_MAX;
+ }
+ return 0;
+}
+
+pslr_handle_t pslr_init( char *model, char *device ) {
+ FDTYPE fd;
+ char vendorId[20];
+ char productId[20];
+ int driveNum;
+ char **drives;
+ const char *camera_name;
+
+ DPRINT("[C]\tplsr_init()\n");
+
+ if ( device == NULL ) {
+ drives = get_drives(&driveNum);
+ } else {
+ driveNum = 1;
+ drives = malloc( driveNum * sizeof(char*) );
+ drives[0] = malloc( strlen( device )+1 );
+ strncpy( drives[0], device, strlen( device ) );
+ drives[0][strlen(device)]='\0';
+ }
+ DPRINT("driveNum:%d\n",driveNum);
+ int i;
+ for ( i=0; imodel ) {
+ DPRINT("\nUnknown Pentax camera.\n");
+ return -1;
+ }
+ CHECK(ipslr_status_full(p, &p->status));
+ DPRINT("\tinit bufmask=0x%x\n", p->status.bufmask);
+ if ( !p->model->old_scsi_command ) {
+ CHECK(ipslr_cmd_00_09(p, 2));
+ }
+ CHECK(ipslr_status_full(p, &p->status));
+ CHECK(ipslr_cmd_10_0a(p, 1));
+ if ( p->model->old_scsi_command ) {
+ CHECK(ipslr_cmd_00_05(p));
+ }
+ CHECK(ipslr_status_full(p, &p->status));
+ return 0;
+}
+
+int pslr_disconnect(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_disconnect()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ uint8_t statusbuf[28];
+ CHECK(ipslr_cmd_10_0a(p, 0));
+ CHECK(ipslr_set_mode(p, 0));
+ CHECK(ipslr_status(p, statusbuf));
+ return PSLR_OK;
+}
+
+int pslr_shutdown(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_shutdown()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ close_drive(&p->fd);
+ return PSLR_OK;
+}
+
+int pslr_shutter(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_shutter()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_press_shutter(p, true);
+}
+
+int pslr_focus(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_focus()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_press_shutter(p, false);
+}
+
+int pslr_get_status(pslr_handle_t h, pslr_status *ps) {
+ DPRINT("[C]\tpslr_get_status()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ memset( ps, 0, sizeof( pslr_status ));
+ CHECK(ipslr_status_full(p, &p->status));
+ memcpy(ps, &p->status, sizeof (pslr_status));
+ return PSLR_OK;
+}
+
+char *format_rational( pslr_rational_t rational, char * fmt ) {
+ char *ret = malloc(32);
+ if ( rational.denom == 0 ) {
+ snprintf( ret, 32, "unknown" );
+ } else {
+ snprintf( ret, 32, fmt, 1.0 * rational.nom / rational.denom );
+ }
+ return ret;
+}
+
+static
+char *get_white_balance_single_adjust_str( uint32_t adjust, char negativeChar, char positiveChar ) {
+ char *ret = malloc(4);
+ if ( adjust < 7 ) {
+ snprintf( ret, 4, "%c%d", negativeChar, 7-adjust);
+ } else if ( adjust > 7 ) {
+ snprintf( ret, 4, "%c%d", positiveChar, adjust-7);
+ } else {
+ ret = "";
+ }
+ return ret;
+}
+
+static
+char *get_white_balance_adjust_str( uint32_t adjust_mg, uint32_t adjust_ba ) {
+ char *ret = malloc(8);
+ if ( adjust_mg != 7 || adjust_ba != 7 ) {
+ snprintf(ret, 8, "%s%s", get_white_balance_single_adjust_str(adjust_mg, 'M', 'G'),get_white_balance_single_adjust_str(adjust_ba, 'B', 'A'));
+ } else {
+ ret = "0";
+ }
+ return ret;
+}
+
+char *pslr_get_af_name(pslr_handle_t h, uint32_t af_point) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (p->model->af_point_num==11) {
+ return get_pslr_af11_point_str(af_point);
+ } else {
+ char *raw = malloc(11);
+ sprintf(raw, "%d", af_point);
+ return raw;
+ }
+}
+
+char *collect_status_info( pslr_handle_t h, pslr_status status ) {
+ char *strbuffer = malloc(8192);
+ sprintf(strbuffer,"%-32s: %d\n", "current iso", status.current_iso);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d/%d\n", "current shutter speed", status.current_shutter_speed.nom, status.current_shutter_speed.denom);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d/%d\n", "camera max shutter speed", status.max_shutter_speed.nom, status.max_shutter_speed.denom);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "current aperture", format_rational( status.current_aperture, "%.1f"));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "lens max aperture", format_rational( status.lens_max_aperture, "%.1f"));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "lens min aperture", format_rational( status.lens_min_aperture, "%.1f"));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d/%d\n", "set shutter speed", status.set_shutter_speed.nom, status.set_shutter_speed.denom);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "set aperture", format_rational( status.set_aperture, "%.1f"));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "fixed iso", status.fixed_iso);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d-%d\n", "auto iso", status.auto_iso_min,status.auto_iso_max);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg quality", status.jpeg_quality);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %dM\n", "jpeg resolution", pslr_get_jpeg_resolution( h, status.jpeg_resolution));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "jpeg image tone", get_pslr_jpeg_image_tone_str(status.jpeg_image_tone));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg saturation", status.jpeg_saturation);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg contrast", status.jpeg_contrast);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg sharpness", status.jpeg_sharpness);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg hue", status.jpeg_hue);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s mm\n", "zoom", format_rational(status.zoom, "%.2f"));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "focus", status.focus);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "color space", get_pslr_color_space_str(status.color_space));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "image format", get_pslr_image_format_str(status.image_format));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "raw format", get_pslr_raw_format_str(status.raw_format));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "light meter flags", status.light_meter_flags);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "ec", format_rational( status.ec, "%.2f" ) );
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s EV steps\n", "custom ev steps", get_pslr_custom_ev_steps_str(status.custom_ev_steps));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s EV steps\n", "custom sensitivity steps", get_pslr_custom_sensitivity_steps_str(status.custom_sensitivity_steps));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "exposure mode", status.exposure_mode);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "scene mode", get_pslr_scene_mode_str(status.scene_mode));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "user mode flag", status.user_mode_flag);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "ae metering mode", get_pslr_ae_metering_str(status.ae_metering_mode));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "af mode", get_pslr_af_mode_str(status.af_mode));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "af point select", get_pslr_af_point_sel_str(status.af_point_select));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "selected af point", pslr_get_af_name( h, status.selected_af_point));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "focused af point", pslr_get_af_name( h, status.focused_af_point));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "drive mode", get_pslr_drive_mode_str(status.drive_mode));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "auto bracket mode", status.auto_bracket_mode > 0 ? "on" : "off");
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "auto bracket picture count", status.auto_bracket_picture_count);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "auto bracket picture counter", status.auto_bracket_picture_counter);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "auto bracket ev", format_rational(status.auto_bracket_ev, "%.2f"));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "shake reduction", status.shake_reduction > 0 ? "on" : "off");
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "white balance mode", get_pslr_white_balance_mode_str(status.white_balance_mode));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "white balance adjust", get_white_balance_adjust_str(status.white_balance_adjust_mg, status.white_balance_adjust_ba));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "flash mode", get_pslr_flash_mode_str(status.flash_mode));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %.2f\n", "flash exposure compensation", (1.0 * status.flash_exposure_compensation/256));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %.2f\n", "manual mode ev", (1.0 * status.manual_mode_ev / 10));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "lens", get_lens_name(status.lens_id1, status.lens_id2));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %.2fV %.2fV %.2fV %.2fV\n", "battery", 0.01 * status.battery_1, 0.01 * status.battery_2, 0.01 * status.battery_3, 0.01 * status.battery_4);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "buffer mask", int_to_binary(status.bufmask));
+ return strbuffer;
+}
+
+static
+char *get_hardwired_setting_bool_info( pslr_bool_setting setting) {
+ char *strbuffer = malloc(32+1);
+ sprintf(strbuffer,"%-32s", setting.pslr_setting_status == PSLR_SETTING_STATUS_HARDWIRED ? "\t[hardwired]" : "");
+ return strbuffer;
+}
+
+static
+char *get_special_setting_info( pslr_setting_status_t setting_status) {
+ char *strbuffer = malloc(32);
+ switch ( setting_status ) {
+ case PSLR_SETTING_STATUS_NA:
+ sprintf(strbuffer,"N/A");
+ break;
+ case PSLR_SETTING_STATUS_UNKNOWN:
+ sprintf(strbuffer,"Unknown");
+ break;
+ default:
+ return NULL;
+ }
+ return strbuffer;
+}
+
+static
+char *get_hardwired_setting_uint16_info( pslr_uint16_setting setting) {
+ char *strbuffer = malloc(32+1);
+ sprintf(strbuffer,"%-32s", setting.pslr_setting_status == PSLR_SETTING_STATUS_HARDWIRED ? "\t[hardwired]" : "");
+ return strbuffer;
+}
+
+char *collect_settings_info( pslr_handle_t h, pslr_settings settings ) {
+ char *strbuffer = malloc(8192);
+ sprintf(strbuffer,"%-32s: %-8s%s\n", "one push bracketing", get_special_setting_info(settings.one_push_bracketing.pslr_setting_status) ?: settings.one_push_bracketing.value ? "on" : "off", get_hardwired_setting_bool_info(settings.one_push_bracketing));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "bulb mode", get_special_setting_info(settings.bulb_mode_press_press.pslr_setting_status) ?: settings.bulb_mode_press_press.value ? "press-press" : "press-hold", get_hardwired_setting_bool_info(settings.bulb_mode_press_press));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "bulb timer", get_special_setting_info(settings.bulb_timer.pslr_setting_status) ?: settings.bulb_timer.value ? "on" : "off", get_hardwired_setting_bool_info(settings.bulb_timer));
+ char *bulb_timer_sec = malloc(32);
+ sprintf(bulb_timer_sec, "%d s", settings.bulb_timer_sec.value);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "bulb timer sec", get_special_setting_info(settings.bulb_timer_sec.pslr_setting_status) ?: bulb_timer_sec, get_hardwired_setting_uint16_info(settings.bulb_timer_sec));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "remote bulb mode", get_special_setting_info(settings.remote_bulb_mode_press_press.pslr_setting_status) ?: settings.remote_bulb_mode_press_press.value ? "press-press" : "press-hold", get_hardwired_setting_bool_info(settings.remote_bulb_mode_press_press));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "using aperture ring", get_special_setting_info(settings.using_aperture_ring.pslr_setting_status) ?: settings.using_aperture_ring.value ? "on" : "off", get_hardwired_setting_bool_info(settings.using_aperture_ring));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "shake reduction", get_special_setting_info(settings.shake_reduction.pslr_setting_status) ?: settings.shake_reduction.value ? "on" : "off", get_hardwired_setting_bool_info(settings.shake_reduction));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "astrotracer", get_special_setting_info(settings.astrotracer.pslr_setting_status) ?: settings.astrotracer.value ? "on" : "off", get_hardwired_setting_bool_info(settings.astrotracer));
+ char *astrotracer_timer_sec = malloc(32);
+ sprintf(astrotracer_timer_sec, "%d s", settings.astrotracer_timer_sec.value);
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "astrotracer timer sec", get_special_setting_info(settings.astrotracer_timer_sec.pslr_setting_status) ?: astrotracer_timer_sec, get_hardwired_setting_uint16_info(settings.astrotracer_timer_sec));
+ sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "horizon correction", get_special_setting_info(settings.horizon_correction.pslr_setting_status) ?: settings.horizon_correction.value ? "on" : "off", get_hardwired_setting_bool_info(settings.horizon_correction));
+ return strbuffer;
+}
+
+
+int pslr_get_status_buffer(pslr_handle_t h, uint8_t *st_buf) {
+ DPRINT("[C]\tpslr_get_status_buffer()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ memset( st_buf, 0, MAX_STATUS_BUF_SIZE);
+// CHECK(ipslr_status_full(p, &p->status));
+// ipslr_status_full(p, &p->status);
+ memcpy(st_buf, p->status_buffer, MAX_STATUS_BUF_SIZE);
+ return PSLR_OK;
+}
+
+int pslr_get_settings_buffer(pslr_handle_t h, uint8_t *st_buf) {
+ DPRINT("[C]\tpslr_get_settings_buffer()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ memset( st_buf, 0, SETTINGS_BUFFER_SIZE);
+ memcpy(st_buf, p->settings_buffer, SETTINGS_BUFFER_SIZE);
+ return PSLR_OK;
+}
+
+int pslr_get_buffer(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution,
+ uint8_t **ppData, uint32_t *pLen) {
+ DPRINT("[C]\tpslr_get_buffer()\n");
+ uint8_t *buf = 0;
+ int ret;
+ ret = pslr_buffer_open(h, bufno, type, resolution);
+ if ( ret != PSLR_OK ) {
+ return ret;
+ }
+
+ uint32_t size = pslr_buffer_get_size(h);
+ buf = malloc(size);
+ if (!buf) {
+ return PSLR_NO_MEMORY;
+ }
+
+ uint32_t bufpos = 0;
+ while (true) {
+ uint32_t nextread = size - bufpos > 65536 ? 65536 : size - bufpos;
+ if (nextread == 0) {
+ break;
+ }
+ uint32_t bytes = pslr_buffer_read(h, buf+bufpos, nextread);
+ if (bytes == 0) {
+ break;
+ }
+ bufpos += bytes;
+ }
+ if ( bufpos != size ) {
+ return PSLR_READ_ERROR;
+ }
+ pslr_buffer_close(h);
+ if (ppData) {
+ *ppData = buf;
+ }
+ if (pLen) {
+ *pLen = size;
+ }
+
+ return PSLR_OK;
+}
+
+int pslr_set_progress_callback(pslr_handle_t h, pslr_progress_callback_t cb, uintptr_t user_data) {
+ progress_callback = cb;
+ return PSLR_OK;
+}
+
+static
+int ipslr_handle_command_x18( ipslr_handle_t *p, bool cmd9_wrap, int subcommand, int argnum, ...) {
+ DPRINT("[C]\t\tipslr_handle_command_x18(0x%x, %d)\n", subcommand, argnum);
+ if ( cmd9_wrap ) {
+ CHECK(ipslr_cmd_00_09(p, 1));
+ }
+ // max 4 args
+ va_list ap;
+ int args[4];
+ int i;
+ for ( i = 0; i < 4; ++i ) {
+ args[i] = 0;
+ }
+ va_start(ap, argnum);
+ for (i = 0; i < argnum; i++) {
+ args[i] = va_arg(ap, int);
+ }
+ va_end(ap);
+ CHECK(ipslr_write_args(p, argnum, args[0], args[1], args[2], args[3]));
+ CHECK(command(p->fd, 0x18, subcommand, 4 * argnum));
+ CHECK(get_status(p->fd));
+ if ( cmd9_wrap ) {
+ CHECK(ipslr_cmd_00_09(p, 2));
+ }
+ return PSLR_OK;
+}
+
+int pslr_test( pslr_handle_t h, bool cmd9_wrap, int subcommand, int argnum, int arg1, int arg2, int arg3, int arg4) {
+ DPRINT("[C]\tpslr_test(wrap=%d, subcommand=0x%x, %x, %x, %x, %x)\n", cmd9_wrap, subcommand, arg1, arg2, arg3, arg4);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, cmd9_wrap, subcommand, argnum, arg1, arg2, arg3, arg4);
+}
+
+int pslr_set_shutter(pslr_handle_t h, pslr_rational_t value) {
+ DPRINT("[C]\tpslr_set_shutter(%x %x)\n", value.nom, value.denom);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_SHUTTER, 2, value.nom, value.denom, 0);
+}
+
+int pslr_set_aperture(pslr_handle_t h, pslr_rational_t value) {
+ DPRINT("[C]\tpslr_set_aperture(%x %x)\n", value.nom, value.denom);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, false, X18_APERTURE, 3, value.nom, value.denom, 0);
+}
+
+int pslr_set_iso(pslr_handle_t h, uint32_t value, uint32_t auto_min_value, uint32_t auto_max_value) {
+ DPRINT("[C]\tpslr_set_iso(0x%X, auto_min=%X, auto_max=%X)\n", value, auto_min_value, auto_max_value);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_ISO, 3, value, auto_min_value, auto_max_value);
+}
+
+int pslr_set_ec(pslr_handle_t h, pslr_rational_t value) {
+ DPRINT("[C]\tpslr_set_ec(0x%X 0x%X)\n", value.nom, value.denom);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_EC, 2, value.nom, value.denom, 0);
+}
+
+int pslr_set_white_balance(pslr_handle_t h, pslr_white_balance_mode_t wb_mode) {
+ DPRINT("[C]\tpslr_set_white_balance(0x%X)\n", wb_mode);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_WHITE_BALANCE, 1, wb_mode);
+}
+
+int pslr_set_white_balance_adjustment(pslr_handle_t h, pslr_white_balance_mode_t wb_mode, uint32_t wbadj_mg, uint32_t wbadj_ba) {
+ DPRINT("[C]\tpslr_set_white_balance_adjustment(mode=0x%X, tint=0x%X, temp=0x%X)\n", wb_mode, wbadj_mg, wbadj_ba);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_WHITE_BALANCE_ADJ, 3, wb_mode, wbadj_mg, wbadj_ba);
+}
+
+
+int pslr_set_flash_mode(pslr_handle_t h, pslr_flash_mode_t value) {
+ DPRINT("[C]\tpslr_set_flash_mode(%X)\n", value);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_FLASH_MODE, 1, value, 0, 0);
+}
+
+int pslr_set_flash_exposure_compensation(pslr_handle_t h, pslr_rational_t value) {
+ DPRINT("[C]\tpslr_set_flash_exposure_compensation(%X %X)\n", value.nom, value.denom);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_FLASH_EXPOSURE_COMPENSATION, 2, value.nom, value.denom, 0);
+}
+
+int pslr_set_drive_mode(pslr_handle_t h, pslr_drive_mode_t drive_mode) {
+ DPRINT("[C]\tpslr_set_drive_mode(%X)\n", drive_mode);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_DRIVE_MODE, 1, drive_mode, 0, 0);
+}
+
+int pslr_set_ae_metering_mode(pslr_handle_t h, pslr_ae_metering_t ae_metering_mode) {
+ DPRINT("[C]\tpslr_set_ae_metering_mode(%X)\n", ae_metering_mode);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_AE_METERING_MODE, 1, ae_metering_mode, 0, 0);
+}
+
+int pslr_set_af_mode(pslr_handle_t h, pslr_af_mode_t af_mode) {
+ DPRINT("[C]\tpslr_set_af_mode(%X)\n", af_mode);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_AF_MODE, 1, af_mode, 0, 0);
+}
+
+int pslr_set_af_point_sel(pslr_handle_t h, pslr_af_point_sel_t af_point_sel) {
+ DPRINT("[C]\tpslr_set_af_point_sel(%X)\n", af_point_sel);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_AF_POINT_SEL, 1, af_point_sel, 0, 0);
+}
+
+int pslr_set_jpeg_stars(pslr_handle_t h, int jpeg_stars ) {
+ DPRINT("[C]\tpslr_set_jpeg_stars(%X)\n", jpeg_stars);
+ int hwqual;
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if ( jpeg_stars > p->model->max_jpeg_stars ) {
+ return PSLR_PARAM;
+ }
+ hwqual = get_hw_jpeg_quality( p->model, jpeg_stars );
+ return ipslr_handle_command_x18( p, true, X18_JPEG_STARS, 2, 1, hwqual, 0);
+}
+
+static
+int _get_user_jpeg_resolution( ipslr_model_info_t *model, int hwres ) {
+ return model->jpeg_resolutions[hwres];
+}
+
+int pslr_get_jpeg_resolution(pslr_handle_t h, int hwres) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return _get_user_jpeg_resolution( p->model, hwres );
+}
+
+static
+int _get_hw_jpeg_resolution( ipslr_model_info_t *model, int megapixel) {
+ int resindex = 0;
+ while ( resindex < MAX_RESOLUTION_SIZE && model->jpeg_resolutions[resindex] > megapixel ) {
+ ++resindex;
+ }
+ return resindex < MAX_RESOLUTION_SIZE ? resindex : MAX_RESOLUTION_SIZE-1;
+}
+
+int pslr_set_jpeg_resolution(pslr_handle_t h, int megapixel) {
+ DPRINT("[C]\tpslr_set_jpeg_resolution(%X)\n", megapixel);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int hwres = _get_hw_jpeg_resolution( p->model, megapixel );
+ return ipslr_handle_command_x18( p, true, X18_JPEG_RESOLUTION, 2, 1, hwres, 0);
+}
+
+int pslr_set_jpeg_image_tone(pslr_handle_t h, pslr_jpeg_image_tone_t image_tone) {
+ DPRINT("[C]\tpslr_set_jpeg_image_tone(%X)\n", image_tone);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (image_tone < 0 || image_tone > PSLR_JPEG_IMAGE_TONE_MAX) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, true, X18_JPEG_IMAGE_TONE, 1, image_tone, 0, 0);
+}
+
+int pslr_set_jpeg_sharpness(pslr_handle_t h, int32_t sharpness) {
+ DPRINT("[C]\tpslr_set_jpeg_sharpness(%X)\n", sharpness);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int hw_sharpness = sharpness + (pslr_get_model_jpeg_property_levels( h )-1) / 2;
+ if (hw_sharpness < 0 || hw_sharpness >= p->model->jpeg_property_levels) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, false, X18_JPEG_SHARPNESS, 2, 0, hw_sharpness, 0);
+}
+
+int pslr_set_jpeg_contrast(pslr_handle_t h, int32_t contrast) {
+ DPRINT("[C]\tpslr_set_jpeg_contrast(%X)\n", contrast);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int hw_contrast = contrast + (pslr_get_model_jpeg_property_levels( h )-1) / 2;
+ if (hw_contrast < 0 || hw_contrast >= p->model->jpeg_property_levels) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, false, X18_JPEG_CONTRAST, 2, 0, hw_contrast, 0);
+}
+
+int pslr_set_jpeg_hue(pslr_handle_t h, int32_t hue) {
+ DPRINT("[C]\tpslr_set_jpeg_hue(%X)\n", hue);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int hw_hue = hue + (pslr_get_model_jpeg_property_levels( h )-1) / 2;
+ DPRINT("hw_hue: %d\n", hw_hue);
+ if (hw_hue < 0 || hw_hue >= p->model->jpeg_property_levels) {
+ return PSLR_PARAM;
+ }
+ DPRINT("before return\n");
+ return ipslr_handle_command_x18( p, false, X18_JPEG_HUE, 2, 0, hw_hue, 0);
+}
+
+int pslr_set_jpeg_saturation(pslr_handle_t h, int32_t saturation) {
+ DPRINT("[C]\tpslr_set_jpeg_saturation(%X)\n", saturation);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int hw_saturation = saturation + (pslr_get_model_jpeg_property_levels( h )-1) / 2;
+ if (hw_saturation < 0 || hw_saturation >= p->model->jpeg_property_levels) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, false, X18_JPEG_SATURATION, 2, 0, hw_saturation, 0);
+}
+
+int pslr_set_image_format(pslr_handle_t h, pslr_image_format_t format) {
+ DPRINT("[C]\tpslr_set_image_format(%X)\n", format);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (format >= PSLR_IMAGE_FORMAT_MAX) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, true, X18_IMAGE_FORMAT, 2, 1, format, 0);
+}
+
+int pslr_set_raw_format(pslr_handle_t h, pslr_raw_format_t format) {
+ DPRINT("[C]\tpslr_set_raw_format(%X)\n", format);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (format >= PSLR_RAW_FORMAT_MAX) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, true, X18_RAW_FORMAT, 2, 1, format, 0);
+}
+
+int pslr_set_color_space(pslr_handle_t h, pslr_color_space_t color_space) {
+ DPRINT("[C]\tpslr_set_raw_format(%X)\n", color_space);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (color_space >= PSLR_COLOR_SPACE_MAX) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, true, X18_COLOR_SPACE, 1, color_space, 0, 0);
+}
+
+
+int pslr_delete_buffer(pslr_handle_t h, int bufno) {
+ DPRINT("[C]\tpslr_delete_buffer(%X)\n", bufno);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (bufno < 0 || bufno > 9) {
+ return PSLR_PARAM;
+ }
+ CHECK(ipslr_write_args(p, 1, bufno));
+ CHECK(command(p->fd, 0x02, 0x03, 0x04));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+int pslr_green_button(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_green_button()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ CHECK(command(p->fd, 0x10, X10_GREEN, 0x00));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+int pslr_dust_removal(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_dust_removal()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ CHECK(command(p->fd, 0x10, X10_DUST, 0x00));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+int pslr_bulb(pslr_handle_t h, bool on ) {
+ DPRINT("[C]\tpslr_bulb(%d)\n", on);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ CHECK(ipslr_write_args(p, 1, on ? 1 : 0));
+ CHECK(command(p->fd, 0x10, X10_BULB, 0x04));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+int pslr_button_test(pslr_handle_t h, int bno, int arg) {
+ DPRINT("[C]\tpslr_button_test(%X, %X)\n", bno, arg);
+ int r;
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ CHECK(ipslr_write_args(p, 1, arg));
+ CHECK(command(p->fd, 0x10, bno, 4));
+ r = get_status(p->fd);
+ DPRINT("\tbutton result code: 0x%x\n", r);
+ return PSLR_OK;
+}
+
+
+int pslr_ae_lock(pslr_handle_t h, bool lock) {
+ DPRINT("[C]\tpslr_ae_lock(%X)\n", lock);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ if (lock) {
+ CHECK(command(p->fd, 0x10, X10_AE_LOCK, 0x00));
+ } else {
+ CHECK(command(p->fd, 0x10, X10_AE_UNLOCK, 0x00));
+ }
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+int pslr_set_exposure_mode(pslr_handle_t h, pslr_exposure_mode_t mode) {
+ DPRINT("[C]\tpslr_set_exposure_mode(%X)\n", mode);
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+
+ if (mode >= PSLR_EXPOSURE_MODE_MAX) {
+ return PSLR_PARAM;
+ }
+ return ipslr_handle_command_x18( p, true, X18_EXPOSURE_MODE, 2, 1, mode, 0);
+}
+
+int pslr_buffer_open(pslr_handle_t h, int bufno, pslr_buffer_type buftype, int bufres) {
+ DPRINT("[C]\tpslr_buffer_open(#%X, type=%X, res=%X)\n", bufno, buftype, bufres);
+ pslr_buffer_segment_info info;
+ uint16_t bufs;
+ uint32_t buf_total = 0;
+ int i, j;
+ int ret;
+ int retry = 0;
+ int retry2 = 0;
+
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+
+ memset(&info, 0, sizeof (info));
+
+ CHECK(ipslr_status_full(p, &p->status));
+ bufs = p->status.bufmask;
+ DPRINT("\tp->status.bufmask = %x\n", p->status.bufmask);
+
+ if ( p->model->status_parser_function && (bufs & (1 << bufno)) == 0) {
+ // do not check this for limited support cameras
+ DPRINT("\tNo buffer data (%d)\n", bufno);
+ return PSLR_READ_ERROR;
+ }
+
+ while (retry < 3) {
+ /* If we get response 0x82 from the camera, there is a
+ * desynch. We can recover by stepping through segment infos
+ * until we get the last one (b = 2). Retry up to 3 times. */
+ ret = ipslr_select_buffer(p, bufno, buftype, bufres);
+ if (ret == PSLR_OK) {
+ break;
+ }
+
+ retry++;
+ retry2 = 0;
+ /* Try up to 9 times to reach segment info type 2 (last
+ * segment) */
+ do {
+ CHECK(ipslr_buffer_segment_info(p, &info));
+ CHECK(ipslr_next_segment(p));
+ DPRINT("\tRecover: b=%d\n", info.b);
+ } while (++retry2 < 10 && info.b != 2);
+ }
+
+ if (retry == 3) {
+ return ret;
+ }
+
+ i = 0;
+ j = 0;
+ do {
+ CHECK(ipslr_buffer_segment_info(p, &info));
+ DPRINT("\t%d: Addr: 0x%X Len: %d(0x%08X) B=%d\n", i, info.addr, info.length, info.length, info.b);
+ if (info.b == 4) {
+ p->segments[j].offset = info.length;
+ } else if (info.b == 3) {
+ if (j == MAX_SEGMENTS) {
+ DPRINT("\tToo many segments.\n");
+ return PSLR_NO_MEMORY;
+ }
+ p->segments[j].addr = info.addr;
+ p->segments[j].length = info.length;
+ j++;
+ }
+ CHECK(ipslr_next_segment(p));
+ buf_total += info.length;
+ i++;
+ } while (i < 9 && info.b != 2);
+ p->segment_count = j;
+ p->offset = 0;
+ return PSLR_OK;
+}
+
+uint32_t pslr_buffer_read(pslr_handle_t h, uint8_t *buf, uint32_t size) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int i;
+ uint32_t pos = 0;
+ uint32_t seg_offs;
+ uint32_t addr;
+ uint32_t blksz;
+ int ret;
+
+ DPRINT("[C]\tpslr_buffer_read(%d)\n", size);
+
+ /* Find current segment */
+ for (i = 0; i < p->segment_count; i++) {
+ if (p->offset < pos + p->segments[i].length) {
+ break;
+ }
+ pos += p->segments[i].length;
+ }
+
+ seg_offs = p->offset - pos;
+ addr = p->segments[i].addr + seg_offs;
+
+ /* Compute block size */
+ blksz = size;
+ if (blksz > p->segments[i].length - seg_offs) {
+ blksz = p->segments[i].length - seg_offs;
+ }
+ if (blksz > BLKSZ) {
+ blksz = BLKSZ;
+ }
+
+// DPRINT("File offset %d segment: %d offset %d address 0x%x read size %d\n", p->offset,
+// i, seg_offs, addr, blksz);
+
+ ret = ipslr_download(p, addr, blksz, buf);
+ if (ret != PSLR_OK) {
+ return 0;
+ }
+ p->offset += blksz;
+ return blksz;
+}
+
+uint32_t pslr_fullmemory_read(pslr_handle_t h, uint8_t *buf, uint32_t offset, uint32_t size) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int ret;
+
+ DPRINT("[C]\tpslr_fullmemory_read(%d)\n", size);
+
+ ret = ipslr_download(p, offset, size, buf);
+ if (ret != PSLR_OK) {
+ return 0;
+ }
+ return size;
+}
+
+uint32_t pslr_buffer_get_size(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int i;
+ uint32_t len = 0;
+ for (i = 0; i < p->segment_count; i++) {
+ len += p->segments[i].length;
+ }
+ DPRINT("\tbuffer get size:%d\n",len);
+ return len;
+}
+
+void pslr_buffer_close(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ memset(&p->segments[0], 0, sizeof (p->segments));
+ p->offset = 0;
+ p->segment_count = 0;
+}
+
+int pslr_select_af_point(pslr_handle_t h, uint32_t point) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return ipslr_handle_command_x18( p, true, X18_AF_POINT, 1, point, 0, 0);
+}
+
+int pslr_get_model_max_jpeg_stars(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->max_jpeg_stars;
+}
+
+int pslr_get_model_status_buffer_size(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->status_buffer_size;
+}
+
+int pslr_get_model_jpeg_property_levels(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->jpeg_property_levels;
+}
+
+int *pslr_get_model_jpeg_resolutions(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->jpeg_resolutions;
+}
+
+bool pslr_get_model_only_limited(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->status_buffer_size == 0 && !p->model->status_parser_function;
+}
+
+bool pslr_get_model_has_jpeg_hue(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->has_jpeg_hue;
+}
+
+bool pslr_get_model_need_exposure_conversion(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->need_exposure_mode_conversion;
+}
+
+int pslr_get_model_fastest_shutter_speed(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->fastest_shutter_speed;
+}
+
+int pslr_get_model_base_iso_min(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->base_iso_min;
+}
+
+int pslr_get_model_base_iso_max(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->base_iso_max;
+}
+
+int pslr_get_model_extended_iso_min(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->extended_iso_min;
+}
+
+int pslr_get_model_extended_iso_max(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->extended_iso_max;
+}
+
+pslr_jpeg_image_tone_t pslr_get_model_max_supported_image_tone(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->max_supported_image_tone;
+}
+
+int pslr_get_model_af_point_num(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->af_point_num;
+}
+
+bool pslr_get_model_old_bulb_mode(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->old_bulb_mode;
+}
+
+bool pslr_get_model_bufmask_single(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return p->model->bufmask_single;
+}
+
+bool pslr_get_model_has_settings_parser(pslr_handle_t h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ char cameraid[10];
+ sprintf(cameraid, "0x%0x", p->model->id);
+ int def_num;
+ setting_file_process(cameraid, &def_num);
+ return def_num>0;
+}
+
+const char *pslr_camera_name(pslr_handle_t h) {
+ DPRINT("[C]\tpslr_camera_name()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int ret;
+ if (p->id == 0) {
+ ret = ipslr_identify(p);
+ if (ret != PSLR_OK) {
+ return NULL;
+ }
+ }
+ if (p->model) {
+ return p->model->name;
+ } else {
+ static char unk_name[256];
+ snprintf(unk_name, sizeof (unk_name), "ID#%x", p->id);
+ unk_name[sizeof (unk_name) - 1] = '\0';
+ return unk_name;
+ }
+}
+
+pslr_buffer_type pslr_get_jpeg_buffer_type(pslr_handle_t h, int jpeg_stars) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ return 2 + get_hw_jpeg_quality( p->model, jpeg_stars );
+}
+
+static int ipslr_set_mode(ipslr_handle_t *p, uint32_t mode) {
+ DPRINT("[C]\t\tipslr_set_mode(0x%x)\n", mode);
+ CHECK(ipslr_write_args(p, 1, mode));
+ CHECK(command(p->fd, 0, 0, 4));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+static int ipslr_cmd_00_09(ipslr_handle_t *p, uint32_t mode) {
+ DPRINT("[C]\t\tipslr_cmd_00_09(0x%x)\n", mode);
+ CHECK(ipslr_write_args(p, 1, mode));
+ CHECK(command(p->fd, 0, 9, 4));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+static int ipslr_cmd_10_0a(ipslr_handle_t *p, uint32_t mode) {
+ DPRINT("[C]\t\tipslr_cmd_10_0a(0x%x)\n", mode);
+ CHECK(ipslr_write_args(p, 1, mode));
+ CHECK(command(p->fd, 0x10, X10_CONNECT, 4));
+ CHECK(get_status(p->fd));
+ return PSLR_OK;
+}
+
+static int ipslr_cmd_00_05(ipslr_handle_t *p) {
+ DPRINT("[C]\t\tipslr_cmd_00_05()\n");
+ int n;
+ uint8_t buf[0xb8];
+ CHECK(command(p->fd, 0x00, 0x05, 0x00));
+ n = get_result(p->fd);
+ if (n != 0xb8) {
+ DPRINT("\tonly got %d bytes\n", n);
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, buf, n));
+ return PSLR_OK;
+}
+
+static int ipslr_status(ipslr_handle_t *p, uint8_t *buf) {
+ int n;
+ DPRINT("[C]\t\tipslr_status()\n");
+ CHECK(command(p->fd, 0, 1, 0));
+ n = get_result(p->fd);
+ if (n == 16 || n == 28) {
+ return read_result(p->fd, buf, n);
+ } else {
+ return PSLR_READ_ERROR;
+ }
+}
+
+static int ipslr_status_full(ipslr_handle_t *p, pslr_status *status) {
+ int n;
+ DPRINT("[C]\t\tipslr_status_full()\n");
+ CHECK(command(p->fd, 0, 8, 0));
+ n = get_result(p->fd);
+ DPRINT("\tread %d bytes\n", n);
+ int expected_bufsize = p->model != NULL ? p->model->status_buffer_size : 0;
+ if ( p->model == NULL ) {
+ DPRINT("\tp model null\n");
+ }
+ DPRINT("\texpected_bufsize: %d\n",expected_bufsize);
+
+ CHECK(read_result(p->fd, p->status_buffer, n > MAX_STATUS_BUF_SIZE ? MAX_STATUS_BUF_SIZE: n));
+
+ if ( expected_bufsize == 0 || !p->model->status_parser_function ) {
+ // limited support only
+ return PSLR_OK;
+ } else if ( expected_bufsize > 0 && expected_bufsize != n ) {
+ DPRINT("\tWaiting for %d bytes but got %d\n", expected_bufsize, n);
+ return PSLR_READ_ERROR;
+ } else {
+ // everything OK
+ (*p->model->status_parser_function)(p, status);
+ if ( p->model->need_exposure_mode_conversion ) {
+ status->exposure_mode = exposure_mode_conversion( status->exposure_mode );
+ }
+ if ( p->model->bufmask_command ) {
+ uint32_t x, y;
+ int ret;
+
+ ret = pslr_get_buffer_status(p, &x, &y);
+ if (ret != PSLR_OK) {
+ return ret;
+ }
+ status->bufmask = x;
+ }
+ return PSLR_OK;
+ }
+}
+
+// fullpress: take picture
+// halfpress: autofocus
+static int ipslr_press_shutter(ipslr_handle_t *p, bool fullpress) {
+ DPRINT("[C]\t\tipslr_press_shutter(fullpress = %s)\n", (fullpress ? "true" : "false"));
+ int r;
+ CHECK(ipslr_status_full(p, &p->status));
+ DPRINT("\t\tbefore: mask=0x%x\n", p->status.bufmask);
+ CHECK(ipslr_write_args(p, 1, fullpress ? 2 : 1));
+ CHECK(command(p->fd, 0x10, X10_SHUTTER, 0x04));
+ r = get_status(p->fd);
+ DPRINT("\t\tshutter result code: 0x%x\n", r);
+ return PSLR_OK;
+}
+
+static int ipslr_select_buffer(ipslr_handle_t *p, int bufno, pslr_buffer_type buftype, int bufres) {
+ int r;
+ DPRINT("\t\tSelect buffer %d,%d,%d,0\n", bufno, buftype, bufres);
+ if ( !p->model->old_scsi_command ) {
+ CHECK(ipslr_write_args(p, 4, bufno, buftype, bufres, 0));
+ CHECK(command(p->fd, 0x02, 0x01, 0x10));
+ } else {
+ /* older cameras: 3-arg select buffer */
+ CHECK(ipslr_write_args(p, 4, bufno, buftype, bufres));
+ CHECK(command(p->fd, 0x02, 0x01, 0x0c));
+ }
+ r = get_status(p->fd);
+ if (r != 0) {
+ return PSLR_COMMAND_ERROR;
+ }
+ return PSLR_OK;
+}
+
+static int ipslr_next_segment(ipslr_handle_t *p) {
+ DPRINT("[C]\t\tipslr_next_segment()\n");
+ int r;
+ CHECK(ipslr_write_args(p, 1, 0));
+ CHECK(command(p->fd, 0x04, 0x01, 0x04));
+ usleep(100000); // needed !! 100 too short, 1000 not short enough for PEF
+ r = get_status(p->fd);
+ if (r == 0) {
+ return PSLR_OK;
+ }
+ return PSLR_COMMAND_ERROR;
+}
+
+static int ipslr_buffer_segment_info(ipslr_handle_t *p, pslr_buffer_segment_info *pInfo) {
+ DPRINT("[C]\t\tipslr_buffer_segment_info()\n");
+ uint8_t buf[16];
+ uint32_t n;
+ int num_try = 20;
+
+ pInfo->b = 0;
+ while ( pInfo->b == 0 && --num_try > 0 ) {
+ CHECK(command(p->fd, 0x04, 0x00, 0x00));
+ n = get_result(p->fd);
+ if (n != 16) {
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, buf, 16));
+
+ // use the right function based on the endian.
+ get_uint32_func get_uint32_func_ptr;
+ if (p->model->is_little_endian) {
+ get_uint32_func_ptr = get_uint32_le;
+ } else {
+ get_uint32_func_ptr = get_uint32_be;
+ }
+
+ pInfo->a = (*get_uint32_func_ptr)(&buf[0]);
+ pInfo->b = (*get_uint32_func_ptr)(&buf[4]);
+ pInfo->addr = (*get_uint32_func_ptr)(&buf[8]);
+ pInfo->length = (*get_uint32_func_ptr)(&buf[12]);
+ if ( pInfo-> b == 0 ) {
+ DPRINT("\tWaiting for segment info addr: 0x%x len: %d B=%d\n", pInfo->addr, pInfo->length, pInfo->b);
+ sleep_sec( 0.1 );
+ }
+ }
+ return PSLR_OK;
+}
+
+static int ipslr_download(ipslr_handle_t *p, uint32_t addr, uint32_t length, uint8_t *buf) {
+ DPRINT("[C]\t\tipslr_download(address = 0x%X, length = %d)\n", addr, length);
+ uint8_t downloadCmd[8] = {0xf0, 0x24, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00};
+ uint32_t block;
+ int n;
+ int retry;
+ uint32_t length_start = length;
+
+ retry = 0;
+ while (length > 0) {
+ if (length > BLKSZ) {
+ block = BLKSZ;
+ } else {
+ block = length;
+ }
+
+ //DPRINT("Get 0x%x bytes from 0x%x\n", block, addr);
+ CHECK(ipslr_write_args(p, 2, addr, block));
+ CHECK(command(p->fd, 0x06, 0x00, 0x08));
+ get_status(p->fd);
+
+ n = scsi_read(p->fd, downloadCmd, sizeof (downloadCmd), buf, block);
+ get_status(p->fd);
+
+ if (n < 0) {
+ if (retry < BLOCK_RETRY) {
+ retry++;
+ continue;
+ }
+ return PSLR_READ_ERROR;
+ }
+ buf += n;
+ length -= n;
+ addr += n;
+ retry = 0;
+ if (progress_callback) {
+ progress_callback(length_start - length, length_start);
+ }
+ }
+ return PSLR_OK;
+}
+
+static int ipslr_identify(ipslr_handle_t *p) {
+ DPRINT("[C]\t\tipslr_identify()\n");
+ uint8_t idbuf[8];
+ int n;
+
+ CHECK(command(p->fd, 0, 4, 0));
+ n = get_result(p->fd);
+ if (n != 8) {
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, idbuf, 8));
+ // Check the camera endian, which affect ID
+ if (idbuf[0] == 0) {
+ p->id = get_uint32_be(&idbuf[0]);
+ } else {
+ p->id = get_uint32_le(&idbuf[0]);
+ }
+ DPRINT("\tid of the camera: %x\n", p->id);
+ p->model = find_model_by_id( p->id );
+ return PSLR_OK;
+}
+
+int pslr_read_datetime(pslr_handle_t *h, int *year, int *month, int *day, int *hour, int *min, int *sec) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ DPRINT("[C]\t\tipslr_read_datetime()\n");
+ uint8_t idbuf[800];
+ int n;
+
+ CHECK(command(p->fd, 0x20, 0x06, 0));
+ n = get_result(p->fd);
+ DPRINT("[C]\t\tipslr_read_datetime() bytes: %d\n",n);
+ if (n!= 24) {
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, idbuf, n));
+ get_uint32_func get_uint32_func_ptr;
+
+ if (p->model->is_little_endian) {
+ get_uint32_func_ptr = get_uint32_le;
+ } else {
+ get_uint32_func_ptr = get_uint32_be;
+ }
+ *year = (*get_uint32_func_ptr)(idbuf);
+ *month = (*get_uint32_func_ptr)(idbuf+4);
+ *day = (*get_uint32_func_ptr)(idbuf+8);
+ *hour = (*get_uint32_func_ptr)(idbuf+12);
+ *min = (*get_uint32_func_ptr)(idbuf+16);
+ *sec = (*get_uint32_func_ptr)(idbuf+20);
+ return PSLR_OK;
+}
+
+int pslr_read_dspinfo(pslr_handle_t *h, char* firmware) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ DPRINT("[C]\t\tipslr_read_dspinfo()\n");
+ uint8_t buf[4];
+ int n;
+
+ CHECK(command(p->fd, 0x01, 0x01, 0));
+ n = get_result(p->fd);
+ DPRINT("[C]\t\tipslr_read_dspinfo() bytes: %d\n",n);
+ if (n!= 4) {
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, buf, n));
+ if (p->model->is_little_endian) {
+ snprintf( firmware, 16, "%d.%02d.%02d.%02d", buf[3], buf[2], buf[1], buf[0]);
+ } else {
+ snprintf( firmware, 16, "%d.%02d.%02d.%02d", buf[0], buf[1], buf[2], buf[3]);
+ }
+ return PSLR_OK;
+}
+
+int pslr_read_setting(pslr_handle_t *h, int offset, uint32_t *value) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ DPRINT("[C]\t\tipslr_read_setting(%d)\n", offset);
+ uint8_t buf[4];
+ int n;
+
+ CHECK(ipslr_write_args(p, 1, offset));
+ CHECK(command(p->fd, 0x20, 0x09, 4));
+ n = get_result(p->fd);
+ DPRINT("[C]\t\tipslr_read_setting() bytes: %d\n",n);
+ if (n!= 4) {
+ return PSLR_READ_ERROR;
+ }
+ CHECK(read_result(p->fd, buf, n));
+ get_uint32_func get_uint32_func_ptr;
+ if (p->model->is_little_endian) {
+ get_uint32_func_ptr = get_uint32_le;
+ } else {
+ get_uint32_func_ptr = get_uint32_be;
+ }
+ *value = (*get_uint32_func_ptr)(buf);
+ return PSLR_OK;
+}
+
+int pslr_write_setting(pslr_handle_t *h, int offset, uint32_t value) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ DPRINT("[C]\t\tipslr_write_setting(%d)=%d\n", offset, value);
+ CHECK(ipslr_cmd_00_09(p, 1));
+ CHECK(ipslr_write_args(p, 2, offset, value));
+ CHECK(command(p->fd, 0x20, 0x08, 8));
+ CHECK(ipslr_cmd_00_09(p, 2));
+ return PSLR_OK;
+}
+
+int pslr_write_setting_by_name(pslr_handle_t *h, char *name, uint32_t value) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int def_num;
+ char cameraid[10];
+ sprintf(cameraid, "0x%0x", p->model->id);
+ // printf("cameraid: %s\n", cameraid);
+ pslr_setting_def_t *defs = setting_file_process(cameraid, &def_num);
+ pslr_setting_def_t *setting_def = find_setting_by_name(defs, def_num, name);
+ if (setting_def != NULL) {
+ if (strcmp(setting_def->type,"boolean") == 0) {
+ pslr_write_setting(h, setting_def->address, value);
+ } else if (strcmp(setting_def->type, "uint16") == 0) {
+ pslr_write_setting(h, setting_def->address, value >> 8);
+ pslr_write_setting(h, setting_def->address+1, value & 0xff);
+ }
+ }
+ return PSLR_OK;
+}
+
+bool pslr_has_setting_by_name(pslr_handle_t *h, char *name) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int def_num;
+ char cameraid[10];
+ sprintf(cameraid, "0x%0x", p->model->id);
+ pslr_setting_def_t *defs = setting_file_process(cameraid, &def_num);
+ pslr_setting_def_t *setting_def = find_setting_by_name(defs, def_num, name);
+// printf("%d %d\n", def_num, (setting_def != NULL));
+ return (setting_def != NULL);
+}
+
+
+int pslr_read_settings(pslr_handle_t *h) {
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ int index=0;
+ uint32_t value;
+ int ret;
+ while (indexsettings_buffer[index] = value;
+ ++index;
+ }
+ return PSLR_OK;
+}
+
+int pslr_get_settings_json(pslr_handle_t h, pslr_settings *ps) {
+ DPRINT("[C]\tpslr_get_settings_json()\n");
+ ipslr_handle_t *p = (ipslr_handle_t *) h;
+ memset( ps, 0, sizeof( pslr_settings ));
+ CHECK(pslr_read_settings(h));
+ char cameraid[20];
+ sprintf(cameraid, "0x%05x", p->id);
+ DPRINT("cameraid:%s\n", cameraid);
+ ipslr_settings_parser_json(cameraid, p, &p->settings);
+ memcpy(ps, &p->settings, sizeof (pslr_settings));
+ return PSLR_OK;
+}
+
+
+static int _ipslr_write_args(uint8_t cmd_2, ipslr_handle_t *p, int n, ...) {
+ va_list ap;
+ uint8_t cmd[8] = {0xf0, 0x4f, cmd_2, 0x00, 0x00, 0x00, 0x00, 0x00};
+ uint8_t buf[4 * n];
+ FDTYPE fd = p->fd;
+ int res;
+ int i;
+ uint32_t data;
+
+ // print debug info
+ va_start(ap, n);
+ DPRINT("[C]\t\t\t_ipslr_write_args(cmd_2 = 0x%x, {", cmd_2);
+ for (i = 0; i < n; i++) {
+ if (i > 0) {
+ DPRINT(", ");
+ }
+ DPRINT("0x%X", va_arg(ap, uint32_t));
+ }
+ DPRINT("})\n");
+ va_end(ap);
+
+ va_start(ap, n);
+ if ( p->model && !p->model->old_scsi_command ) {
+ /* All at once */
+ for (i = 0; i < n; i++) {
+ data = va_arg(ap, uint32_t);
+
+ if (p->model == NULL || !p->model->is_little_endian) {
+ set_uint32_be(data, &buf[4*i]);
+ } else {
+ set_uint32_le(data, &buf[4*i]);
+ }
+ }
+ cmd[4] = 4 * n;
+
+
+ res = scsi_write(fd, cmd, sizeof (cmd), buf, 4 * n);
+ if (res != PSLR_OK) {
+ va_end(ap);
+ return res;
+ }
+ } else {
+ /* Arguments one by one */
+ for (i = 0; i < n; i++) {
+ data = va_arg(ap, uint32_t);
+
+ if (p->model == NULL || !p->model->is_little_endian) {
+ set_uint32_be(data, &buf[0]);
+ } else {
+ set_uint32_le(data, &buf[0]);
+ }
+
+ cmd[4] = 4;
+ cmd[2] = i * 4;
+ res = scsi_write(fd, cmd, sizeof (cmd), buf, 4);
+ if (res != PSLR_OK) {
+ va_end(ap);
+ return res;
+ }
+ }
+ }
+ va_end(ap);
+ return PSLR_OK;
+}
+
+static int command(FDTYPE fd, int a, int b, int c) {
+ DPRINT("[C]\t\t\tcommand(fd=%x, %x, %x, %x)\n", fd, a, b, c);
+ uint8_t cmd[8] = {0xf0, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ cmd[2] = a;
+ cmd[3] = b;
+ cmd[4] = c;
+
+ CHECK(scsi_write(fd, cmd, sizeof (cmd), 0, 0));
+ return PSLR_OK;
+}
+
+static int read_status(FDTYPE fd, uint8_t *buf) {
+ uint8_t cmd[8] = {0xf0, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ int n;
+
+ n = scsi_read(fd, cmd, 8, buf, 8);
+ if (n != 8) {
+ DPRINT("\tOnly got %d bytes\n", n);
+ /* The *ist DS doesn't know to return the correct number of
+ read bytes for this command, so return PSLR_OK instead of
+ PSLR_READ_ERROR */
+ return PSLR_OK;
+ }
+ return PSLR_OK;
+}
+
+static int get_status(FDTYPE fd) {
+ DPRINT("[C]\t\t\tget_status(0x%x)\n", fd);
+
+ uint8_t statusbuf[8];
+ memset(statusbuf,0,8);
+
+ while (1) {
+ CHECK(read_status(fd, statusbuf));
+ DPRINT("[R]\t\t\t\t => ERROR: 0x%02X\n", statusbuf[7]);
+ if (statusbuf[7] != 0x01) {
+ break;
+ }
+ usleep(POLL_INTERVAL);
+ }
+ if (statusbuf[7] != 0) {
+ DPRINT("\tERROR: 0x%x\n", statusbuf[7]);
+ }
+ return statusbuf[7];
+}
+
+static int get_result(FDTYPE fd) {
+ DPRINT("[C]\t\t\tget_result(0x%x)\n", fd);
+ uint8_t statusbuf[8];
+ while (1) {
+ //DPRINT("read out status\n");
+ CHECK(read_status(fd, statusbuf));
+ //hexdump_debug(statusbuf, 8);
+ if (statusbuf[6] == 0x01) {
+ break;
+ }
+ //DPRINT("Waiting for result\n");
+ //hexdump_debug(statusbuf, 8);
+ usleep(POLL_INTERVAL);
+ }
+ if ((statusbuf[7] & 0xff) != 0) {
+ DPRINT("\tERROR: 0x%x\n", statusbuf[7]);
+ return -1;
+ } else {
+ DPRINT("[R]\t\t\t\t => [%02X %02X %02X %02X]\n",
+ statusbuf[0], statusbuf[1], statusbuf[2], statusbuf[3]);
+ }
+ return statusbuf[0] | statusbuf[1] << 8 | statusbuf[2] << 16 | statusbuf[3] << 24;
+}
+
+static int read_result(FDTYPE fd, uint8_t *buf, uint32_t n) {
+ DPRINT("[C]\t\t\tread_result(0x%x, size=%d)\n", fd, n);
+ uint8_t cmd[8] = {0xf0, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ int r;
+ int i;
+ set_uint32_le(n, &cmd[4]);
+ r = scsi_read(fd, cmd, sizeof (cmd), buf, n);
+ if (r != n) {
+ return PSLR_READ_ERROR;
+ } else {
+ // Print first 32 bytes of the result.
+ DPRINT("[R]\t\t\t\t => [");
+ for (i = 0; i < n && i < 32; ++i) {
+ if (i > 0) {
+ if (i % 16 == 0) {
+ DPRINT("\n\t\t\t\t ");
+ } else if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ DPRINT(" ");
+ }
+ DPRINT("%02X", buf[i]);
+ }
+ if (n > 32) {
+ DPRINT(" ... (%d bytes more)", (n-32));
+ }
+ DPRINT("]\n");
+ }
+ return PSLR_OK;
+}
+
+char *copyright() {
+ char *ret = malloc(sizeof(char)*1024);
+ sprintf(ret, "Copyright (C) 2011-2019 Andras Salamon\n\
+\n\
+Based on:\n\
+pslr-shoot (C) 2009 Ramiro Barreiro\n\
+PK-Remote (C) 2008 Pontus Lidman \n\n");
+ return ret;
+}
+
+void write_debug( const char* message, ... ) {
+
+ // Be sure debug is really on as DPRINT doesn't know
+ //
+ if ( !debug ) {
+ return;
+ }
+
+ // Write to stderr
+ //
+ va_list argp;
+ va_start(argp, message);
+ vfprintf( stderr, message, argp );
+ va_end(argp);
+ return;
+}
diff --git a/libpktriggercord/src/pslr.h b/libpktriggercord/src/pslr.h
new file mode 100644
index 000000000..df9c196f8
--- /dev/null
+++ b/libpktriggercord/src/pslr.h
@@ -0,0 +1,237 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ Support for K200D added by Jens Dreyer 04/2011
+ Support for K-r added by Vincenc Podobnik 06/2011
+ Support for K-30 added by Camilo Polymeris 09/2012
+ Support for K-01 added by Ethan Queen 01/2013
+ Support for K-3 added by Tao Wang 01/2016
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#ifndef PSLR_H
+#define PSLR_H
+
+#include "pslr_enum.h"
+#include "pslr_scsi.h"
+#include "pslr_model.h"
+
+#define PSLR_LIGHT_METER_AE_LOCK 0x8
+
+typedef enum {
+ PSLR_BUF_PEF,
+ PSLR_BUF_DNG,
+ PSLR_BUF_JPEG_MAX,
+ PSLR_BUF_JPEG_MAX_M1,
+ PSLR_BUF_JPEG_MAX_M2,
+ PSLR_BUF_JPEG_MAX_M3,
+ PSLR_BUF_PREVIEW = 8,
+ PSLR_BUF_THUMBNAIL = 9 // 7 works also
+} pslr_buffer_type;
+
+typedef enum {
+ USER_FILE_FORMAT_PEF,
+ USER_FILE_FORMAT_DNG,
+ USER_FILE_FORMAT_JPEG,
+ USER_FILE_FORMAT_MAX
+} user_file_format;
+
+typedef struct {
+ user_file_format uff;
+ const char *file_format_name;
+ const char *extension;
+} user_file_format_t;
+
+extern user_file_format_t file_formats[3];
+
+user_file_format_t *get_file_format_t( user_file_format uff );
+
+// OFF-AUTO: Off-Auto-Aperture
+typedef enum {
+ PSLR_EXPOSURE_MODE_P = 0,
+ PSLR_EXPOSURE_MODE_GREEN = 1,
+// PSLR_EXPOSURE_MODE_HYP = 2,
+// PSLR_EXPOSURE_MODE_AUTO_PICT = 1,
+// PSLR_EXPOSURE_MODE_GREEN = 3, maybe 1 is AUTO_PICT
+ PSLR_EXPOSURE_MODE_TV = 4,
+ PSLR_EXPOSURE_MODE_AV = 5,
+// PSLR_EXPOSURE_MODE_TV_SHIFT = 6, //?
+// PSLR_EXPOSURE_MODE_AV_SHIFT = 7, //?
+ PSLR_EXPOSURE_MODE_M = 8,
+ PSLR_EXPOSURE_MODE_B = 9,
+ PSLR_EXPOSURE_MODE_AV_OFFAUTO = 10,
+ PSLR_EXPOSURE_MODE_M_OFFAUTO = 11,
+ PSLR_EXPOSURE_MODE_B_OFFAUTO = 12,
+ PSLR_EXPOSURE_MODE_TAV = 13, // ?
+ PSLR_EXPOSURE_MODE_SV = 15,
+ PSLR_EXPOSURE_MODE_X = 16, // ?
+ PSLR_EXPOSURE_MODE_MAX = 17
+} pslr_exposure_mode_t;
+
+typedef enum {
+ PSLR_GUI_EXPOSURE_MODE_GREEN,
+ PSLR_GUI_EXPOSURE_MODE_P,
+ PSLR_GUI_EXPOSURE_MODE_SV,
+ PSLR_GUI_EXPOSURE_MODE_TV,
+ PSLR_GUI_EXPOSURE_MODE_AV,
+ PSLR_GUI_EXPOSURE_MODE_TAV,
+ PSLR_GUI_EXPOSURE_MODE_M,
+ PSLR_GUI_EXPOSURE_MODE_B,
+ PSLR_GUI_EXPOSURE_MODE_X,
+ PSLR_GUI_EXPOSURE_MODE_MAX
+} pslr_gui_exposure_mode_t;
+
+typedef void *pslr_handle_t;
+
+typedef struct {
+ uint32_t a;
+ uint32_t b;
+ uint32_t addr;
+ uint32_t length;
+} pslr_buffer_segment_info;
+
+typedef void (*pslr_progress_callback_t)(uint32_t current, uint32_t total);
+
+void sleep_sec(double sec);
+
+pslr_handle_t pslr_init(char *model, char *device);
+int pslr_connect(pslr_handle_t h);
+int pslr_disconnect(pslr_handle_t h);
+int pslr_shutdown(pslr_handle_t h);
+const char *pslr_model(uint32_t id);
+
+int pslr_shutter(pslr_handle_t h);
+int pslr_focus(pslr_handle_t h);
+
+int pslr_get_status(pslr_handle_t h, pslr_status *sbuf);
+int pslr_get_status_buffer(pslr_handle_t h, uint8_t *st_buf);
+int pslr_get_settings(pslr_handle_t h, pslr_settings *ps);
+int pslr_get_settings_json(pslr_handle_t h, pslr_settings *ps);
+int pslr_get_settings_buffer(pslr_handle_t h, uint8_t *st_buf);
+
+char *collect_status_info( pslr_handle_t h, pslr_status status );
+char *collect_settings_info( pslr_handle_t h, pslr_settings settings );
+
+int pslr_get_buffer(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution,
+ uint8_t **pdata, uint32_t *pdatalen);
+
+int pslr_set_progress_callback(pslr_handle_t h, pslr_progress_callback_t cb,
+ uintptr_t user_data);
+
+int pslr_set_shutter(pslr_handle_t h, pslr_rational_t value);
+int pslr_set_aperture(pslr_handle_t h, pslr_rational_t value);
+int pslr_set_iso(pslr_handle_t h, uint32_t value, uint32_t auto_min_value, uint32_t auto_max_value);
+int pslr_set_ec(pslr_handle_t h, pslr_rational_t value);
+
+int pslr_set_white_balance(pslr_handle_t h, pslr_white_balance_mode_t wb_mode);
+int pslr_set_white_balance_adjustment(pslr_handle_t h, pslr_white_balance_mode_t wb_mode, uint32_t wbadj_mg, uint32_t wbadj_ba);
+int pslr_set_flash_mode(pslr_handle_t h, pslr_flash_mode_t value);
+int pslr_set_flash_exposure_compensation(pslr_handle_t h, pslr_rational_t value);
+int pslr_set_drive_mode(pslr_handle_t h, pslr_drive_mode_t drive_mode);
+int pslr_set_af_mode(pslr_handle_t h, pslr_af_mode_t af_mode);
+int pslr_set_af_point_sel(pslr_handle_t h, pslr_af_point_sel_t af_point_sel);
+int pslr_set_ae_metering_mode(pslr_handle_t h, pslr_ae_metering_t ae_metering_mode);
+int pslr_set_color_space(pslr_handle_t h, pslr_color_space_t color_space);
+
+int pslr_set_jpeg_stars(pslr_handle_t h, int jpeg_stars);
+int pslr_set_jpeg_resolution(pslr_handle_t h, int megapixel);
+int pslr_set_jpeg_image_tone(pslr_handle_t h, pslr_jpeg_image_tone_t image_mode);
+
+int pslr_set_jpeg_sharpness(pslr_handle_t h, int32_t sharpness);
+int pslr_set_jpeg_contrast(pslr_handle_t h, int32_t contrast);
+int pslr_set_jpeg_saturation(pslr_handle_t h, int32_t saturation);
+int pslr_set_jpeg_hue(pslr_handle_t h, int32_t hue);
+
+int pslr_set_image_format(pslr_handle_t h, pslr_image_format_t format);
+int pslr_set_raw_format(pslr_handle_t h, pslr_raw_format_t format);
+int pslr_set_user_file_format(pslr_handle_t h, user_file_format uff);
+user_file_format get_user_file_format( pslr_status *st );
+
+int pslr_delete_buffer(pslr_handle_t h, int bufno);
+
+int pslr_green_button(pslr_handle_t h);
+
+int pslr_button_test(pslr_handle_t h, int bno, int arg);
+
+int pslr_ae_lock(pslr_handle_t h, bool lock);
+
+int pslr_dust_removal(pslr_handle_t h);
+
+int pslr_bulb(pslr_handle_t h, bool on );
+
+int pslr_buffer_open(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution);
+uint32_t pslr_buffer_read(pslr_handle_t h, uint8_t *buf, uint32_t size);
+uint32_t pslr_fullmemory_read(pslr_handle_t h, uint8_t *buf, uint32_t offset, uint32_t size);
+void pslr_buffer_close(pslr_handle_t h);
+uint32_t pslr_buffer_get_size(pslr_handle_t h);
+
+int pslr_set_exposure_mode(pslr_handle_t h, pslr_exposure_mode_t mode);
+int pslr_select_af_point(pslr_handle_t h, uint32_t point);
+
+const char *pslr_camera_name(pslr_handle_t h);
+int pslr_get_model_max_jpeg_stars(pslr_handle_t h);
+int pslr_get_model_jpeg_property_levels(pslr_handle_t h);
+int pslr_get_model_status_buffer_size(pslr_handle_t h);
+int pslr_get_model_fastest_shutter_speed(pslr_handle_t h);
+int pslr_get_model_base_iso_min(pslr_handle_t h);
+int pslr_get_model_base_iso_max(pslr_handle_t h);
+int pslr_get_model_extended_iso_min(pslr_handle_t h);
+int pslr_get_model_extended_iso_max(pslr_handle_t h);
+int *pslr_get_model_jpeg_resolutions(pslr_handle_t h);
+bool pslr_get_model_only_limited(pslr_handle_t h);
+bool pslr_get_model_has_jpeg_hue(pslr_handle_t h);
+bool pslr_get_model_need_exposure_conversion(pslr_handle_t h);
+pslr_jpeg_image_tone_t pslr_get_model_max_supported_image_tone(pslr_handle_t h);
+bool pslr_get_model_has_settings_parser(pslr_handle_t h);
+int pslr_get_model_af_point_num(pslr_handle_t h);
+bool pslr_get_model_old_bulb_mode(pslr_handle_t h);
+bool pslr_get_model_bufmask_single(pslr_handle_t h);
+
+pslr_buffer_type pslr_get_jpeg_buffer_type(pslr_handle_t h, int quality);
+int pslr_get_jpeg_resolution(pslr_handle_t h, int hwres);
+
+int pslr_read_datetime(pslr_handle_t *h, int *year, int *month, int *day, int *hour, int *min, int *sec);
+
+int pslr_read_dspinfo(pslr_handle_t *h, char *firmware);
+
+int pslr_read_setting(pslr_handle_t *h, int offset, uint32_t *value);
+int pslr_write_setting(pslr_handle_t *h, int offset, uint32_t value);
+int pslr_write_setting_by_name(pslr_handle_t *h, char *name, uint32_t value);
+bool pslr_has_setting_by_name(pslr_handle_t *h, char *name);
+int pslr_read_settings(pslr_handle_t *h);
+
+pslr_gui_exposure_mode_t exposure_mode_conversion( pslr_exposure_mode_t exp );
+char *format_rational( pslr_rational_t rational, char * fmt );
+
+int pslr_test( pslr_handle_t h, bool cmd9_wrap, int subcommand, int argnum, int arg1, int arg2, int arg3, int arg4);
+
+char *copyright(void);
+
+void write_debug( const char* message, ... );
+
+int debug_onoff(ipslr_handle_t *p, char debug_mode);
+#endif
diff --git a/libpktriggercord/src/pslr_enum.c b/libpktriggercord/src/pslr_enum.c
new file mode 100644
index 000000000..7c2cf0dc0
--- /dev/null
+++ b/libpktriggercord/src/pslr_enum.c
@@ -0,0 +1,348 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ Support for K200D added by Jens Dreyer 04/2011
+ Support for K-r added by Vincenc Podobnik 06/2011
+ Support for K-30 added by Camilo Polymeris 09/2012
+ Support for K-01 added by Ethan Queen 01/2013
+ Support for K-3 added by Tao Wang 01/2016
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#include "pslr_enum.h"
+
+#include
+#include
+#include
+#include
+
+const char* pslr_color_space_str[PSLR_COLOR_SPACE_MAX] = {
+ "sRGB",
+ "AdobeRGB"
+};
+
+const char* pslr_af_mode_str[PSLR_AF_MODE_MAX] = {
+ "MF",
+ "AF.S",
+ "AF.C",
+ "AF.A"
+};
+
+const char* pslr_ae_metering_str[PSLR_AE_METERING_MAX] = {
+ "Multi",
+ "Center",
+ "Spot"
+};
+
+const char* pslr_flash_mode_str[PSLR_FLASH_MODE_MAX] = {
+ "Manual",
+ "Manual-RedEye",
+ "Slow",
+ "Slow-RedEye",
+ "TrailingCurtain",
+ "Auto",
+ "Auto-RedEye",
+ "TrailingCurtain", /* maybe in manual mode?? */
+ "Wireless"
+};
+
+const char* pslr_drive_mode_str[PSLR_DRIVE_MODE_MAX] = {
+ "Single", /* Bracketing also returns Single */
+ "Continuous-HI",
+ "SelfTimer-12",
+ "SelfTimer-2",
+ "Remote",
+ "Remote-3",
+ "Continuous-LO"
+};
+
+const char* pslr_af_point_sel_str[PSLR_AF_POINT_SEL_MAX] = {
+ "Auto-5",
+ "Select",
+ "Spot",
+ "Auto-11",
+ "Expanded"
+};
+
+const char* pslr_af11_point_str[11] = {
+ "topleft",
+ "topmiddle",
+ "topright",
+ "farleft",
+ "middleleft",
+ "middlemiddle",
+ "middleright",
+ "farright",
+ "bottomleft",
+ "bottommiddle",
+ "bottomright"
+};
+
+const char* pslr_jpeg_image_tone_str[PSLR_JPEG_IMAGE_TONE_MAX] = {
+ "Natural",
+ "Bright",
+ "Portrait",
+ "Landscape",
+ "Vibrant",
+ "Monochrome",
+ "Muted",
+ "ReversalFilm",
+ "BleachBypass",
+ "Radiant",
+ "CrossProcessing",
+ "Flat",
+ "Auto"
+};
+
+const char* pslr_white_balance_mode_str[PSLR_WHITE_BALANCE_MODE_MAX] = {
+ "Auto",
+ "Daylight",
+ "Shade",
+ "Cloudy",
+ "Fluorescent_D",
+ "Fluorescent_N",
+ "Fluorescent_W",
+ "Tungsten",
+ "Flash",
+ "Manual", /* sometimes called Manual1 */
+ "Manual2",
+ "Manual3",
+ "Kelvin1",
+ "Kelvin2",
+ "Kelvin3",
+ "Fluorescent_L",
+ "CTE",
+ "MultiAuto"
+};
+
+const char* pslr_custom_ev_steps_str[PSLR_CUSTOM_EV_STEPS_MAX] = {
+ "1/2",
+ "1/3"
+};
+
+const char* pslr_custom_sensitivity_steps_str[PSLR_CUSTOM_SENSITIVITY_STEPS_MAX] = {
+ "1",
+ "As"
+};
+
+const char* pslr_image_format_str[PSLR_IMAGE_FORMAT_MAX] = {
+ "JPEG",
+ "RAW",
+ "RAW+"
+};
+
+const char* pslr_raw_format_str[PSLR_RAW_FORMAT_MAX] = {
+ "PEF",
+ "DNG"
+};
+
+const char* pslr_scene_mode_str[PSLR_SCENE_MODE_MAX] = {
+ "NONE",
+ "HISPEED",
+ "DOF",
+ "MTF",
+ "STANDARD",
+ "PORTRAIT",
+ "LANDSCAPE",
+ "MACRO",
+ "SPORT",
+ "NIGHTSCENEPORTRAIT",
+ "NOFLASH",
+ "NIGHTSCENE",
+ "SURFANDSNOW",
+ "TEXT",
+ "SUNSET",
+ "KIDS",
+ "PET",
+ "CANDLELIGHT",
+ "MUSEUM",
+ "19",
+ "FOOD",
+ "STAGE",
+ "NIGHTSNAP",
+ "SWALLOWDOF",
+ "24",
+ "NIGHTSCENEHDR",
+ "BLUESKY",
+ "FOREST",
+ "28",
+ "BLACKLIGHTSILHOUETTE"
+};
+
+
+/* case insenstive comparison - strnicmp */
+int str_comparison_i (const char *s1, const char *s2, int n) {
+ if ( s1 == NULL ) {
+ return s2 == NULL ? 0 : -(*s2);
+ }
+ if (s2 == NULL) {
+ return *s1;
+ }
+
+ char c1='\0', c2='\0';
+ int length=0;
+ while ( length found_index_length) ) {
+ found_index_length = string_length;
+ found_index = i;
+ }
+ }
+ return found_index;
+}
+
+static
+const char *get_pslr_str( const char** array, int length, int value ) {
+ if (value >=0 && value < length) {
+ return array[value];
+ } else {
+ char *ret = malloc(128);
+ sprintf (ret, "Unknown value: %d", value);
+ return ret;
+ }
+}
+
+
+pslr_color_space_t get_pslr_color_space( char *str ) {
+ return find_in_array( pslr_color_space_str, sizeof(pslr_color_space_str)/sizeof(pslr_color_space_str[0]),str);
+}
+
+const char *get_pslr_color_space_str( pslr_color_space_t value ) {
+ return get_pslr_str( pslr_color_space_str, sizeof(pslr_color_space_str)/sizeof(pslr_color_space_str[0]),value);
+}
+
+pslr_af_mode_t get_pslr_af_mode( char *str ) {
+ return find_in_array( pslr_af_mode_str, sizeof(pslr_af_mode_str)/sizeof(pslr_af_mode_str[0]),str);
+}
+
+const char *get_pslr_af_mode_str( pslr_af_mode_t value ) {
+ return get_pslr_str( pslr_af_mode_str, sizeof(pslr_af_mode_str)/sizeof(pslr_af_mode_str[0]),value);
+}
+
+pslr_ae_metering_t get_pslr_ae_metering( char *str ) {
+ return find_in_array( pslr_ae_metering_str, sizeof(pslr_ae_metering_str)/sizeof(pslr_ae_metering_str[0]),str);
+}
+
+const char *get_pslr_ae_metering_str( pslr_ae_metering_t value ) {
+ return get_pslr_str( pslr_ae_metering_str, sizeof(pslr_ae_metering_str)/sizeof(pslr_ae_metering_str[0]),value);
+}
+
+pslr_flash_mode_t get_pslr_flash_mode( char *str ) {
+ return find_in_array( pslr_flash_mode_str, sizeof(pslr_flash_mode_str)/sizeof(pslr_flash_mode_str[0]),str);
+}
+
+const char *get_pslr_flash_mode_str( pslr_flash_mode_t value ) {
+ return get_pslr_str( pslr_flash_mode_str, sizeof(pslr_flash_mode_str)/sizeof(pslr_flash_mode_str[0]),value);
+}
+
+pslr_drive_mode_t get_pslr_drive_mode( char *str ) {
+ return find_in_array( pslr_drive_mode_str, sizeof(pslr_drive_mode_str)/sizeof(pslr_drive_mode_str[0]),str);
+}
+
+const char *get_pslr_drive_mode_str( pslr_drive_mode_t value ) {
+ return get_pslr_str( pslr_drive_mode_str, sizeof(pslr_drive_mode_str)/sizeof(pslr_drive_mode_str[0]),value);
+}
+
+pslr_af_point_sel_t get_pslr_af_point_sel( char *str ) {
+ return find_in_array( pslr_af_point_sel_str, sizeof(pslr_af_point_sel_str)/sizeof(pslr_af_point_sel_str[0]),str);
+}
+
+const char *get_pslr_af_point_sel_str( pslr_af_point_sel_t value ) {
+ return get_pslr_str( pslr_af_point_sel_str, sizeof(pslr_af_point_sel_str)/sizeof(pslr_af_point_sel_str[0]),value);
+}
+
+char *get_pslr_af11_point_str( uint32_t value ) {
+ if (value==0) {
+ return "none";
+ }
+ int bitidx=0;
+ char *ret = malloc(1024);
+ sprintf(ret, "%s", "");
+ while (value>0 && bitidx<11) {
+ if ((value & 0x01) == 1) {
+ sprintf(ret, "%s%s%s", ret, strlen(ret) == 0 ? "" : ",", pslr_af11_point_str[bitidx]);
+ }
+ value >>= 1;
+ ++bitidx;
+ }
+ if (value>0) {
+ sprintf(ret, "%s", "invalid");
+ }
+ return ret;
+}
+
+
+pslr_jpeg_image_tone_t get_pslr_jpeg_image_tone( char *str ) {
+ return find_in_array( pslr_jpeg_image_tone_str, sizeof(pslr_jpeg_image_tone_str)/sizeof(pslr_jpeg_image_tone_str[0]),str);
+}
+
+const char *get_pslr_jpeg_image_tone_str( pslr_jpeg_image_tone_t value ) {
+ return get_pslr_str( pslr_jpeg_image_tone_str, sizeof(pslr_jpeg_image_tone_str)/sizeof(pslr_jpeg_image_tone_str[0]),value);
+}
+
+pslr_white_balance_mode_t get_pslr_white_balance_mode( char *str ) {
+ return find_in_array( pslr_white_balance_mode_str, sizeof(pslr_white_balance_mode_str)/sizeof(pslr_white_balance_mode_str[0]),str);
+}
+
+const char *get_pslr_white_balance_mode_str( pslr_white_balance_mode_t value ) {
+ return get_pslr_str( pslr_white_balance_mode_str, sizeof(pslr_white_balance_mode_str)/sizeof(pslr_white_balance_mode_str[0]),value);
+}
+
+const char *get_pslr_custom_ev_steps_str( pslr_custom_ev_steps_t value ) {
+ return get_pslr_str( pslr_custom_ev_steps_str, sizeof(pslr_custom_ev_steps_str)/sizeof(pslr_custom_ev_steps_str[0]),value);
+}
+
+const char *get_pslr_custom_sensitivity_steps_str( pslr_custom_sensitivity_steps_t value ) {
+ return get_pslr_str( pslr_custom_sensitivity_steps_str, sizeof(pslr_custom_sensitivity_steps_str)/sizeof(pslr_custom_sensitivity_steps_str[0]),value);
+}
+
+const char *get_pslr_image_format_str( pslr_image_format_t value ) {
+ return get_pslr_str( pslr_image_format_str, sizeof(pslr_image_format_str)/sizeof(pslr_image_format_str[0]),value);
+}
+
+const char *get_pslr_raw_format_str( pslr_raw_format_t value ) {
+ return get_pslr_str( pslr_raw_format_str, sizeof(pslr_raw_format_str)/sizeof(pslr_raw_format_str[0]),value);
+}
+
+const char *get_pslr_scene_mode_str( pslr_scene_mode_t value ) {
+ return get_pslr_str( pslr_scene_mode_str, sizeof(pslr_scene_mode_str)/sizeof(pslr_scene_mode_str[0]),value);
+}
diff --git a/libpktriggercord/src/pslr_enum.h b/libpktriggercord/src/pslr_enum.h
new file mode 100644
index 000000000..773c1f076
--- /dev/null
+++ b/libpktriggercord/src/pslr_enum.h
@@ -0,0 +1,241 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#ifndef PSLR_ENUM_H
+#define PSLR_ENUM_H
+
+#include
+
+typedef enum {
+ PSLR_COLOR_SPACE_SRGB,
+ PSLR_COLOR_SPACE_ADOBERGB,
+ PSLR_COLOR_SPACE_MAX
+} pslr_color_space_t;
+
+typedef enum {
+ PSLR_AF_MODE_MF,
+ PSLR_AF_MODE_AF_S,
+ PSLR_AF_MODE_AF_C,
+ PSLR_AF_MODE_AF_A,
+ PSLR_AF_MODE_MAX
+} pslr_af_mode_t;
+
+typedef enum {
+ PSLR_AE_METERING_MULTI,
+ PSLR_AE_METERING_CENTER,
+ PSLR_AE_METERING_SPOT,
+ PSLR_AE_METERING_MAX
+} pslr_ae_metering_t;
+
+typedef enum {
+ PSLR_FLASH_MODE_MANUAL = 0,
+ PSLR_FLASH_MODE_MANUAL_REDEYE = 1,
+ PSLR_FLASH_MODE_SLOW = 2,
+ PSLR_FLASH_MODE_SLOW_REDEYE = 3,
+ PSLR_FLASH_MODE_TRAILING_CURTAIN = 4,
+ PSLR_FLASH_MODE_AUTO = 5,
+ PSLR_FLASH_MODE_AUTO_REDEYE = 6,
+ /* 7 not used */
+ PSLR_FLASH_MODE_WIRELESS = 8,
+ PSLR_FLASH_MODE_MAX = 9
+} pslr_flash_mode_t;
+
+typedef enum {
+ PSLR_DRIVE_MODE_SINGLE,
+ PSLR_DRIVE_MODE_CONTINUOUS_HI,
+ PSLR_DRIVE_MODE_SELF_TIMER_12,
+ PSLR_DRIVE_MODE_SELF_TIMER_2,
+ PSLR_DRIVE_MODE_REMOTE,
+ PSLR_DRIVE_MODE_REMOTE_3,
+ PSLR_DRIVE_MODE_CONTINUOUS_LO,
+ PSLR_DRIVE_MODE_MAX
+} pslr_drive_mode_t;
+
+typedef enum {
+ PSLR_AF_POINT_SEL_AUTO_5,
+ PSLR_AF_POINT_SEL_SELECT,
+ PSLR_AF_POINT_SEL_SPOT,
+ PSLR_AF_POINT_SEL_AUTO_11, /* maybe not for all cameras */
+ PSLR_AF_POINT_SEL_EXPANDED, /* only for newer */
+ PSLR_AF_POINT_SEL_MAX
+} pslr_af_point_sel_t;
+
+typedef enum {
+ PSLR_AF11_POINT_TOP_LEFT = 0x01,
+ PSLR_AF11_POINT_TOP_MID = 0x2,
+ PSLR_AF11_POINT_TOP_RIGHT = 0x4,
+ PSLR_AF11_POINT_FAR_LEFT = 0x8,
+ PSLR_AF11_POINT_MID_LEFT = 0x10,
+ PSLR_AF11_POINT_MID_MID = 0x20,
+ PSLR_AF11_POINT_MID_RIGHT = 0x40,
+ PSLR_AF11_POINT_FAR_RIGHT = 0x80,
+ PSLR_AF11_POINT_BOT_LEFT = 0x100,
+ PSLR_AF11_POINT_BOT_MID = 0x200,
+ PSLR_AF11_POINT_BOT_RIGHT = 0x400
+} pslr_af11_point_t;
+
+typedef enum {
+ PSLR_JPEG_IMAGE_TONE_NONE = -1,
+ PSLR_JPEG_IMAGE_TONE_NATURAL,
+ PSLR_JPEG_IMAGE_TONE_BRIGHT,
+ PSLR_JPEG_IMAGE_TONE_PORTRAIT,
+ PSLR_JPEG_IMAGE_TONE_LANDSCAPE,
+ PSLR_JPEG_IMAGE_TONE_VIBRANT,
+ PSLR_JPEG_IMAGE_TONE_MONOCHROME,
+ PSLR_JPEG_IMAGE_TONE_MUTED,
+ PSLR_JPEG_IMAGE_TONE_REVERSAL_FILM,
+ PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS,
+ PSLR_JPEG_IMAGE_TONE_RADIANT,
+ PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING,
+ PSLR_JPEG_IMAGE_TONE_FLAT,
+ PSLR_JPEG_IMAGE_TONE_AUTO,
+ PSLR_JPEG_IMAGE_TONE_MAX
+} pslr_jpeg_image_tone_t;
+
+typedef enum {
+ PSLR_WHITE_BALANCE_MODE_AUTO,
+ PSLR_WHITE_BALANCE_MODE_DAYLIGHT,
+ PSLR_WHITE_BALANCE_MODE_SHADE,
+ PSLR_WHITE_BALANCE_MODE_CLOUDY,
+ PSLR_WHITE_BALANCE_MODE_FLUORESCENT_DAYLIGHT_COLOR,
+ PSLR_WHITE_BALANCE_MODE_FLUORESCENT_DAYLIGHT_WHITE,
+ PSLR_WHITE_BALANCE_MODE_FLUORESCENT_COOL_WHITE,
+ PSLR_WHITE_BALANCE_MODE_TUNGSTEN,
+ PSLR_WHITE_BALANCE_MODE_FLASH,
+ PSLR_WHITE_BALANCE_MODE_MANUAL,
+ PSLR_WHITE_BALANCE_MODE_MANUAL_2,
+ PSLR_WHITE_BALANCE_MODE_MANUAL_3,
+ PSLR_WHITE_BALANCE_MODE_KELVIN_1,
+ PSLR_WHITE_BALANCE_MODE_KELVIN_2,
+ PSLR_WHITE_BALANCE_MODE_KELVIN_3,
+ PSLR_WHITE_BALANCE_MODE_FLUORESCENT_WARM_WHITE,
+ PSLR_WHITE_BALANCE_MODE_CTE,
+ PSLR_WHITE_BALANCE_MODE_MULTI_AUTO,
+ PSLR_WHITE_BALANCE_MODE_MAX
+} pslr_white_balance_mode_t;
+
+typedef enum {
+ PSLR_CUSTOM_EV_STEPS_1_2,
+ PSLR_CUSTOM_EV_STEPS_1_3,
+ PSLR_CUSTOM_EV_STEPS_MAX
+} pslr_custom_ev_steps_t;
+
+typedef enum {
+ PSLR_CUSTOM_SENSITIVITY_STEPS_1EV,
+ PSLR_CUSTOM_SENSITIVITY_STEPS_AS_EV,
+ PSLR_CUSTOM_SENSITIVITY_STEPS_MAX
+} pslr_custom_sensitivity_steps_t;
+
+typedef enum {
+ PSLR_IMAGE_FORMAT_JPEG,
+ PSLR_IMAGE_FORMAT_RAW,
+ PSLR_IMAGE_FORMAT_RAW_PLUS,
+ PSLR_IMAGE_FORMAT_MAX
+} pslr_image_format_t;
+
+typedef enum {
+ PSLR_RAW_FORMAT_PEF,
+ PSLR_RAW_FORMAT_DNG,
+ PSLR_RAW_FORMAT_MAX
+} pslr_raw_format_t;
+
+typedef enum {
+ PSLR_SCENE_MODE_NONE,
+ PSLR_SCENE_MODE_HISPEED,
+ PSLR_SCENE_MODE_DOF,
+ PSLR_SCENE_MODE_MTF,
+ PSLR_SCENE_MODE_STANDARD,
+ PSLR_SCENE_MODE_PORTRAIT,
+ PSLR_SCENE_MODE_LANDSCAPE,
+ PSLR_SCENE_MODE_MACRO,
+ PSLR_SCENE_MODE_SPORT,
+ PSLR_SCENE_MODE_NIGHTSCENEPORTRAIT,
+ PSLR_SCENE_MODE_NOFLASH,
+ PSLR_SCENE_MODE_NIGHTSCENE,
+ PSLR_SCENE_MODE_SURFANDSNOW,
+ PSLR_SCENE_MODE_TEXT,
+ PSLR_SCENE_MODE_SUNSET,
+ PSLR_SCENE_MODE_KIDS,
+ PSLR_SCENE_MODE_PET,
+ PSLR_SCENE_MODE_CANDLELIGHT,
+ PSLR_SCENE_MODE_MUSEUM,
+ PSLR_SCENE_MODE_19,
+ PSLR_SCENE_MODE_FOOD,
+ PSLR_SCENE_MODE_STAGE,
+ PSLR_SCENE_MODE_NIGHTSNAP,
+ PSLR_SCENE_MODE_SWALLOWDOF,
+ PSLR_SCENE_MODE_24,
+ PSLR_SCENE_MODE_NIGHTSCENEHDR,
+ PSLR_SCENE_MODE_BLUESKY,
+ PSLR_SCENE_MODE_FOREST,
+ PSLR_SCENE_MODE_28,
+ PSLR_SCENE_MODE_BLACKLIGHTSILHOUETTE,
+ PSLR_SCENE_MODE_MAX
+} pslr_scene_mode_t;
+
+int str_comparison_i (const char *s1, const char *s2, int n);
+int find_in_array( const char** array, int length, char* str );
+
+pslr_color_space_t get_pslr_color_space( char *str );
+const char *get_pslr_color_space_str( pslr_color_space_t value );
+
+pslr_af_mode_t get_pslr_af_mode( char *str );
+const char *get_pslr_af_mode_str( pslr_af_mode_t value );
+
+pslr_ae_metering_t get_pslr_ae_metering( char *str );
+const char *get_pslr_ae_metering_str( pslr_ae_metering_t value );
+
+pslr_flash_mode_t get_pslr_flash_mode( char *str );
+const char *get_pslr_flash_mode_str( pslr_flash_mode_t value );
+
+pslr_drive_mode_t get_pslr_drive_mode( char *str );
+const char *get_pslr_drive_mode_str( pslr_drive_mode_t value );
+
+pslr_af_point_sel_t get_pslr_af_point_sel( char *str );
+const char *get_pslr_af_point_sel_str( pslr_af_point_sel_t value );
+
+char *get_pslr_af11_point_str( uint32_t value );
+
+pslr_jpeg_image_tone_t get_pslr_jpeg_image_tone( char *str );
+const char *get_pslr_jpeg_image_tone_str( pslr_jpeg_image_tone_t value );
+
+pslr_white_balance_mode_t get_pslr_white_balance_mode( char *str );
+const char *get_pslr_white_balance_mode_str( pslr_white_balance_mode_t value );
+
+/* pslr_custom_ev_steps_t get_pslr_custom_ev_steps( char *str ); */
+const char *get_pslr_custom_ev_steps_str( pslr_custom_ev_steps_t value );
+
+const char *get_pslr_custom_sensitivity_steps_str( pslr_custom_sensitivity_steps_t value );
+
+const char *get_pslr_image_format_str( pslr_image_format_t value );
+
+const char *get_pslr_raw_format_str( pslr_raw_format_t value );
+
+const char *get_pslr_scene_mode_str( pslr_scene_mode_t value );
+
+#endif
diff --git a/libpktriggercord/src/pslr_lens.c b/libpktriggercord/src/pslr_lens.c
new file mode 100644
index 000000000..83c334f7c
--- /dev/null
+++ b/libpktriggercord/src/pslr_lens.c
@@ -0,0 +1,51 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ Pentax lens database comes from ExifTool ( http://www.sno.phy.queensu.ca/~phil/exiftool/ )
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#include "pslr_lens.h"
+
+#include
+
+static const struct {
+ uint32_t id1;
+ uint32_t id2;
+ const char *name;
+} lens_id[] = {
+#include "exiftool_pentax_lens.txt"
+};
+
+const char *get_lens_name( uint32_t id1, uint32_t id2) {
+ int lens_num = sizeof(lens_id)/sizeof(lens_id[0]);
+ int i;
+ for ( i=0; i
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ Pentax lens database comes from ExifTool ( http://www.sno.phy.queensu.ca/~phil/exiftool/ )
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#ifndef PSLR_LENS_H
+#define PSLR_LENS_H
+
+#include
+
+const char *get_lens_name( uint32_t id1, uint32_t id2);
+#endif
diff --git a/libpktriggercord/src/pslr_model.c b/libpktriggercord/src/pslr_model.c
new file mode 100644
index 000000000..f0bad01f3
--- /dev/null
+++ b/libpktriggercord/src/pslr_model.c
@@ -0,0 +1,996 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ Support for K200D added by Jens Dreyer 04/2011
+ Support for K-r added by Vincenc Podobnik 06/2011
+ Support for K-30 added by Camilo Polymeris 09/2012
+ Support for K-01 added by Ethan Queen 01/2013
+ Support for K-3 added by Tao Wang 01/2016
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "js0n.h"
+
+#include "pslr_model.h"
+#include "pslr.h"
+
+static uint8_t lastbuf[MAX_STATUS_BUF_SIZE];
+static int first = 1;
+static char *jsontext=NULL;
+static int jsonsize;
+
+static void ipslr_status_diff(uint8_t *buf) {
+ int n;
+ int diffs;
+ if (first) {
+ hexdump(buf, MAX_STATUS_BUF_SIZE);
+ memcpy(lastbuf, buf, MAX_STATUS_BUF_SIZE);
+ first = 0;
+ }
+
+ diffs = 0;
+ for (n = 0; n < MAX_STATUS_BUF_SIZE; n++) {
+ if (lastbuf[n] != buf[n]) {
+ DPRINT("\t\tbuf[%03X] last %02Xh %3d new %02Xh %3d\n", n, lastbuf[n], lastbuf[n], buf[n], buf[n]);
+ diffs++;
+ }
+ }
+ if (diffs) {
+ DPRINT("---------------------------\n");
+ memcpy(lastbuf, buf, MAX_STATUS_BUF_SIZE);
+ }
+}
+
+static
+uint16_t get_uint16_be(const uint8_t *buf) {
+ uint16_t res;
+ res = buf[0] << 8 | buf[1];
+ return res;
+}
+
+uint32_t get_uint32_be(uint8_t *buf) {
+ uint32_t res;
+ res = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
+ return res;
+}
+
+static
+int32_t get_int32_be(uint8_t *buf) {
+ int32_t res;
+ res = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
+ return res;
+}
+
+static
+uint16_t get_uint16_le(const uint8_t *buf) {
+ uint16_t res;
+ res = buf[1] << 8 | buf[0];
+ return res;
+}
+
+uint32_t get_uint32_le(uint8_t *buf) {
+ uint32_t res;
+ res = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0];
+ return res;
+}
+
+static
+int32_t get_int32_le(uint8_t *buf) {
+ int32_t res;
+ res = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0];
+ return res;
+}
+
+void set_uint32_le(uint32_t v, uint8_t *buf) {
+ buf[0] = v;
+ buf[1] = v >> 8;
+ buf[2] = v >> 16;
+ buf[3] = v >> 24;
+}
+
+void set_uint32_be(uint32_t v, uint8_t *buf) {
+ buf[0] = v >> 24;
+ buf[1] = v >> 16;
+ buf[2] = v >> 8;
+ buf[3] = v;
+}
+
+char *shexdump(uint8_t *buf, uint32_t bufLen) {
+ char *ret = malloc(4*bufLen);
+ uint32_t i;
+ sprintf(ret,"%s","");
+ for (i = 0; i < bufLen; i++) {
+ if (i % 16 == 0) {
+ sprintf(ret+strlen(ret),"0x%04x | ", i);
+ }
+ sprintf(ret+strlen(ret), "%02x ", buf[i]);
+ if (i % 8 == 7) {
+ sprintf(ret+strlen(ret), " ");
+ }
+ if (i % 16 == 15) {
+ sprintf(ret+strlen(ret), "\n");
+ }
+ }
+ if (i % 16 != 15) {
+ sprintf(ret+strlen(ret), "\n");
+ }
+ return ret;
+}
+
+void hexdump(uint8_t *buf, uint32_t bufLen) {
+ char *dmp = shexdump(buf, bufLen);
+ printf("%s",dmp);
+ free(dmp);
+}
+
+void hexdump_debug(uint8_t *buf, uint32_t bufLen) {
+ char *dmp = shexdump(buf, bufLen);
+ DPRINT("%s",dmp);
+ free(dmp);
+}
+
+
+// based on http://stackoverflow.com/a/657202/21348
+
+const char* int_to_binary( uint16_t x ) {
+ static char b[sizeof(uint16_t)*8+1] = {0};
+ int y;
+ long long z;
+ for (z=(1LL<0; z>>=1,y++) {
+ b[y] = ( ((x & z) == z) ? '1' : '0');
+ }
+ b[y] = 0;
+ return b;
+}
+
+
+static
+int _get_user_jpeg_stars( ipslr_model_info_t *model, int hwqual ) {
+ if ( model->id == 0x12f71 ) {
+ // K5IIs hack
+ // TODO: test it
+ if ( hwqual == model->max_jpeg_stars -1 ) {
+ return model->max_jpeg_stars;
+ } else {
+ return model->max_jpeg_stars - 1 - hwqual;
+ }
+ } else {
+ return model->max_jpeg_stars - hwqual;
+ }
+}
+
+int get_hw_jpeg_quality( ipslr_model_info_t *model, int user_jpeg_stars) {
+ if ( model->id == 0x12f71 ) {
+ // K5IIs hack
+ // TODO: test it
+ if ( user_jpeg_stars == model->max_jpeg_stars ) {
+ return model->max_jpeg_stars-1;
+ } else {
+ return model->max_jpeg_stars - 1 - user_jpeg_stars;
+ }
+ } else {
+ return model->max_jpeg_stars - user_jpeg_stars;
+ }
+}
+
+
+static
+void ipslr_status_parse_k10d(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+ memset(status, 0, sizeof (*status));
+ status->bufmask = get_uint16_be(&buf[0x16]);
+ status->user_mode_flag = get_uint32_be(&buf[0x1c]);
+ status->set_shutter_speed.nom = get_uint32_be(&buf[0x2c]);
+ status->set_shutter_speed.denom = get_uint32_be(&buf[0x30]);
+ status->set_aperture.nom = get_uint32_be(&buf[0x34]);
+ status->set_aperture.denom = get_uint32_be(&buf[0x38]);
+ status->ec.nom = get_uint32_be(&buf[0x3c]);
+ status->ec.denom = get_uint32_be(&buf[0x40]);
+ status->fixed_iso = get_uint32_be(&buf[0x60]);
+ status->image_format = get_uint32_be(&buf[0x78]);
+ status->jpeg_resolution = get_uint32_be(&buf[0x7c]);
+ status->jpeg_quality = _get_user_jpeg_stars( p->model, get_uint32_be(&buf[0x80]));
+ status->raw_format = get_uint32_be(&buf[0x84]);
+ status->jpeg_image_tone = get_uint32_be(&buf[0x88]);
+ status->jpeg_saturation = get_uint32_be(&buf[0x8c]);
+ status->jpeg_sharpness = get_uint32_be(&buf[0x90]);
+ status->jpeg_contrast = get_uint32_be(&buf[0x94]);
+ status->custom_ev_steps = get_uint32_be(&buf[0x9c]);
+ status->custom_sensitivity_steps = get_uint32_be(&buf[0xa0]);
+ status->af_point_select = get_uint32_be(&buf[0xbc]);
+ status->selected_af_point = get_uint32_be(&buf[0xc0]);
+ status->exposure_mode = get_uint32_be(&buf[0xac]);
+ status->current_shutter_speed.nom = get_uint32_be(&buf[0xf4]);
+ status->current_shutter_speed.denom = get_uint32_be(&buf[0xf8]);
+ status->current_aperture.nom = get_uint32_be(&buf[0xfc]);
+ status->current_aperture.denom = get_uint32_be(&buf[0x100]);
+ status->current_iso = get_uint32_be(&buf[0x11c]);
+ status->light_meter_flags = get_uint32_be(&buf[0x124]);
+ status->lens_min_aperture.nom = get_uint32_be(&buf[0x12c]);
+ status->lens_min_aperture.denom = get_uint32_be(&buf[0x130]);
+ status->lens_max_aperture.nom = get_uint32_be(&buf[0x134]);
+ status->lens_max_aperture.denom = get_uint32_be(&buf[0x138]);
+ status->focused_af_point = get_uint32_be(&buf[0x150]);
+ status->zoom.nom = get_uint32_be(&buf[0x16c]);
+ status->zoom.denom = get_uint32_be(&buf[0x170]);
+ status->focus = get_int32_be(&buf[0x174]);
+}
+
+static
+void ipslr_status_parse_k20d(ipslr_handle_t *p, pslr_status *status) {
+
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+ memset(status, 0, sizeof (*status));
+ status->bufmask = get_uint16_be( &buf[0x16]);
+ status->user_mode_flag = get_uint32_be(&buf[0x1c]);
+ status->set_shutter_speed.nom = get_uint32_be(&buf[0x2c]);
+ status->set_shutter_speed.denom = get_uint32_be(&buf[0x30]);
+ status->set_aperture.nom = get_uint32_be(&buf[0x34]);
+ status->set_aperture.denom = get_uint32_be(&buf[0x38]);
+ status->ec.nom = get_uint32_be(&buf[0x3c]);
+ status->ec.denom = get_uint32_be(&buf[0x40]);
+ status->fixed_iso = get_uint32_be(&buf[0x60]);
+ status->image_format = get_uint32_be(&buf[0x78]);
+ status->jpeg_resolution = get_uint32_be(&buf[0x7c]);
+ status->jpeg_quality = _get_user_jpeg_stars( p->model, get_uint32_be(&buf[0x80]));
+ status->raw_format = get_uint32_be(&buf[0x84]);
+ status->jpeg_image_tone = get_uint32_be(&buf[0x88]);
+ status->jpeg_saturation = get_uint32_be(&buf[0x8c]); // commands do now work for it?
+ status->jpeg_sharpness = get_uint32_be(&buf[0x90]); // commands do now work for it?
+ status->jpeg_contrast = get_uint32_be(&buf[0x94]); // commands do now work for it?
+ status->custom_ev_steps = get_uint32_be(&buf[0x9c]);
+ status->custom_sensitivity_steps = get_uint32_be(&buf[0xa0]);
+ status->ae_metering_mode = get_uint32_be(&buf[0xb4]); // same as c4
+ status->af_mode = get_uint32_be(&buf[0xb8]);
+ status->af_point_select = get_uint32_be(&buf[0xbc]); // not sure
+ status->selected_af_point = get_uint32_be(&buf[0xc0]);
+ status->exposure_mode = get_uint32_be(&buf[0xac]);
+ status->current_shutter_speed.nom = get_uint32_be(&buf[0x108]);
+ status->current_shutter_speed.denom = get_uint32_be(&buf[0x10C]);
+ status->current_aperture.nom = get_uint32_be(&buf[0x110]);
+ status->current_aperture.denom = get_uint32_be(&buf[0x114]);
+ status->current_iso = get_uint32_be(&buf[0x130]);
+ status->light_meter_flags = get_uint32_be(&buf[0x138]);
+ status->lens_min_aperture.nom = get_uint32_be(&buf[0x140]);
+ status->lens_min_aperture.denom = get_uint32_be(&buf[0x144]);
+ status->lens_max_aperture.nom = get_uint32_be(&buf[0x148]);
+ status->lens_max_aperture.denom = get_uint32_be(&buf[0x14B]);
+ status->focused_af_point = get_uint32_be(&buf[0x160]); // unsure about it, a lot is changing when the camera focuses
+ status->zoom.nom = get_uint32_be(&buf[0x180]);
+ status->zoom.denom = get_uint32_be(&buf[0x184]);
+ status->focus = get_int32_be(&buf[0x188]); // current focus ring position?
+ // 0x158 current ev?
+ // 0x160 and 0x164 change when AF
+}
+
+static
+void ipslr_status_parse_istds(ipslr_handle_t *p, pslr_status *status) {
+
+ uint8_t *buf = p->status_buffer;
+ /* *ist DS status block */
+ memset(status, 0, sizeof (*status));
+ status->bufmask = get_uint16_be(&buf[0x12]);
+ status->set_shutter_speed.nom = get_uint32_be(&buf[0x80]);
+ status->set_shutter_speed.denom = get_uint32_be(&buf[0x84]);
+ status->set_aperture.nom = get_uint32_be(&buf[0x88]);
+ status->set_aperture.denom = get_uint32_be(&buf[0x8c]);
+ status->lens_min_aperture.nom = get_uint32_be(&buf[0xb8]);
+ status->lens_min_aperture.denom = get_uint32_be(&buf[0xbc]);
+ status->lens_max_aperture.nom = get_uint32_be(&buf[0xc0]);
+ status->lens_max_aperture.denom = get_uint32_be(&buf[0xc4]);
+
+ // no DNG support so raw format is PEF
+ status->raw_format = PSLR_RAW_FORMAT_PEF;
+}
+
+// some of the cameras share most of the status fields
+// this method is used for K-x, K-7, K-5, K-r
+//
+// some cameras also have this data block, but it's shifted a bit
+static
+void ipslr_status_parse_common(ipslr_handle_t *p, pslr_status *status, int shift) {
+
+ uint8_t *buf = p->status_buffer;
+ get_uint32_func get_uint32_func_ptr;
+ get_int32_func get_int32_func_ptr;
+ get_uint16_func get_uint16_func_ptr;
+
+ if (p->model->is_little_endian) {
+ get_uint32_func_ptr = get_uint32_le;
+ get_int32_func_ptr = get_int32_le;
+ get_uint16_func_ptr = get_uint16_le;
+ } else {
+ get_uint32_func_ptr = get_uint32_be;
+ get_int32_func_ptr = get_int32_be;
+ get_uint16_func_ptr = get_uint16_be;
+ }
+
+ // 0x0C: 0x85 0xA5
+ // 0x0F: beginning 0 sometime changes to 1
+ // 0x14: LCD panel 2: turned off 3: on?
+ status->bufmask = (*get_uint16_func_ptr)( &buf[0x1E + shift]);
+ status->user_mode_flag = (*get_uint32_func_ptr)(&buf[0x24 + shift]);
+ status->flash_mode = (*get_uint32_func_ptr)(&buf[0x28 + shift]);
+ status->flash_exposure_compensation = (*get_int32_func_ptr)(&buf[0x2C + shift]);
+ status->set_shutter_speed.nom = (*get_uint32_func_ptr)(&buf[0x34 + shift]);
+ status->set_shutter_speed.denom = (*get_uint32_func_ptr)(&buf[0x38 + shift]);
+ status->set_aperture.nom = (*get_uint32_func_ptr)(&buf[0x3C + shift]);
+ status->set_aperture.denom = (*get_uint32_func_ptr)(&buf[0x40 + shift]);
+ status->ec.nom = (*get_uint32_func_ptr)(&buf[0x44 + shift]);
+ status->ec.denom = (*get_uint32_func_ptr)(&buf[0x48 + shift]);
+ status->auto_bracket_mode = (*get_uint32_func_ptr)(&buf[0x4C + shift]);
+ status->auto_bracket_ev.nom = (*get_uint32_func_ptr)(&buf[0x50 + shift]);
+ status->auto_bracket_ev.denom = (*get_uint32_func_ptr)(&buf[0x54 + shift]);
+ status->auto_bracket_picture_count = (*get_uint32_func_ptr)(&buf[0x58 + shift]);
+ status->drive_mode = (*get_uint32_func_ptr)(&buf[0x5C + shift]);
+ status->fixed_iso = (*get_uint32_func_ptr)(&buf[0x68 + shift]);
+ status->auto_iso_min = (*get_uint32_func_ptr)(&buf[0x6C + shift]);
+ status->auto_iso_max = (*get_uint32_func_ptr)(&buf[0x70 + shift]);
+ status->white_balance_mode = (*get_uint32_func_ptr)(&buf[0x74 + shift]);
+ status->white_balance_adjust_mg = (*get_uint32_func_ptr)(&buf[0x78 + shift]); // 0: M7 7: 0 14: G7
+ status->white_balance_adjust_ba = (*get_uint32_func_ptr)(&buf[0x7C + shift]); // 0: B7 7: 0 14: A7
+ status->image_format = (*get_uint32_func_ptr)(&buf[0x80 + shift]);
+ status->jpeg_resolution = (*get_uint32_func_ptr)(&buf[0x84 + shift]);
+ status->jpeg_quality = _get_user_jpeg_stars( p->model, (*get_uint32_func_ptr)(&buf[0x88 + shift]));
+ status->raw_format = (*get_uint32_func_ptr)(&buf[0x8C + shift]);
+ status->jpeg_image_tone = (*get_uint32_func_ptr)(&buf[0x90 + shift]);
+ status->jpeg_saturation = (*get_uint32_func_ptr)(&buf[0x94 + shift]);
+ status->jpeg_sharpness = (*get_uint32_func_ptr)(&buf[0x98 + shift]);
+ status->jpeg_contrast = (*get_uint32_func_ptr)(&buf[0x9C + shift]);
+ status->color_space = (*get_uint32_func_ptr)(&buf[0xA0 + shift]);
+ status->custom_ev_steps = (*get_uint32_func_ptr)(&buf[0xA4 + shift]);
+ status->custom_sensitivity_steps = (*get_uint32_func_ptr)(&buf[0xa8 + shift]);
+ status->exposure_mode = (*get_uint32_func_ptr)(&buf[0xb4 + shift]);
+ status->scene_mode = (*get_uint32_func_ptr)(&buf[0xb8 + shift]);
+ status->ae_metering_mode = (*get_uint32_func_ptr)(&buf[0xbc + shift]); // same as cc
+ status->af_mode = (*get_uint32_func_ptr)(&buf[0xC0 + shift]);
+ status->af_point_select = (*get_uint32_func_ptr)(&buf[0xc4 + shift]);
+ status->selected_af_point = (*get_uint32_func_ptr)(&buf[0xc8 + shift]);
+ status->shake_reduction = (*get_uint32_func_ptr)(&buf[0xE0 + shift]);
+ status->auto_bracket_picture_counter = (*get_uint32_func_ptr)(&buf[0xE4 + shift]);
+ status->jpeg_hue = (*get_uint32_func_ptr)(&buf[0xFC + shift]);
+ status->current_shutter_speed.nom = (*get_uint32_func_ptr)(&buf[0x10C + shift]);
+ status->current_shutter_speed.denom = (*get_uint32_func_ptr)(&buf[0x110 + shift]);
+ status->current_aperture.nom = (*get_uint32_func_ptr)(&buf[0x114 + shift]);
+ status->current_aperture.denom = (*get_uint32_func_ptr)(&buf[0x118 + shift]);
+ status->max_shutter_speed.nom = (*get_uint32_func_ptr)(&buf[0x12C + shift]);
+ status->max_shutter_speed.denom = (*get_uint32_func_ptr)(&buf[0x130 + shift]);
+ status->current_iso = (*get_uint32_func_ptr)(&buf[0x134 + shift]);
+ status->light_meter_flags = (*get_uint32_func_ptr)(&buf[0x13C + shift]);
+ status->lens_min_aperture.nom = (*get_uint32_func_ptr)(&buf[0x144 + shift]);
+ status->lens_min_aperture.denom = (*get_uint32_func_ptr)(&buf[0x148 + shift]);
+ status->lens_max_aperture.nom = (*get_uint32_func_ptr)(&buf[0x14C + shift]);
+ status->lens_max_aperture.denom = (*get_uint32_func_ptr)(&buf[0x150 + shift]);
+ status->manual_mode_ev = (*get_int32_func_ptr)(&buf[0x15C + shift]);
+ status->focused_af_point = (*get_uint32_func_ptr)(&buf[0x168 + shift]); //d, unsure about it, a lot is changing when the camera focuses
+ // probably voltage*100
+ // battery_1 > battery2 ( noload vs load voltage?)
+ status->battery_1 = (*get_uint32_func_ptr)( &buf[0x170 + shift] );
+ status->battery_2 = (*get_uint32_func_ptr)( &buf[0x174 + shift] );
+ status->battery_3 = (*get_uint32_func_ptr)( &buf[0x180 + shift] );
+ status->battery_4 = (*get_uint32_func_ptr)( &buf[0x184 + shift] );
+
+}
+
+static
+void ipslr_status_parse_kx(ipslr_handle_t *p, pslr_status *status) {
+
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0);
+ status->zoom.nom = get_uint32_be(&buf[0x198]);
+ status->zoom.denom = get_uint32_be(&buf[0x19C]);
+ status->focus = get_int32_be(&buf[0x1A0]);
+ status->lens_id1 = get_uint32_be(&buf[0x188]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x194]);
+ // selected_af_point: cannot find the field, 0xc8 is always zero
+}
+
+// Vince: K-r support 2011-06-22
+//
+static
+void ipslr_status_parse_kr(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ status->zoom.nom = get_uint32_be(&buf[0x19C]);
+ status->zoom.denom = get_uint32_be(&buf[0x1A0]);
+ status->focus = get_int32_be(&buf[0x1A4]);
+ status->lens_id1 = get_uint32_be(&buf[0x18C]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x198]);
+}
+
+static
+void ipslr_status_parse_k5(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ status->zoom.nom = get_uint32_be(&buf[0x1A0]);
+ status->zoom.denom = get_uint32_be(&buf[0x1A4]);
+ status->focus = get_int32_be(&buf[0x1A8]); // ?
+ status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x19C]);
+
+// TODO: check these fields
+//status.focused = getInt32(statusBuf, 0x164);
+}
+
+static
+void ipslr_status_parse_k30(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ //~ status->jpeg_contrast -= 4;
+ //~ status->jpeg_hue -= 4;
+ //~ status->jpeg_sharpness -= 4;
+ //~ status->jpeg_saturation -= 4;
+ status->zoom.nom = get_uint32_be(&buf[0x1A0]);
+ status->zoom.denom = 100;
+ status->focus = get_int32_be(&buf[0x1A8]); // ?
+ status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x19C]);
+}
+
+// status check seems to be the same as K30
+static
+void ipslr_status_parse_k01(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ //~ status->jpeg_contrast -= 4;
+ //~ status->jpeg_hue -= 4;
+ //~ status->jpeg_sharpness -= 4;
+ //~ status->jpeg_saturation -= 4;
+ status->zoom.nom = get_uint32_be(&buf[0x1A0]); // - good for K01
+ status->zoom.denom = 100; // good for K-01
+ status->focus = get_int32_be(&buf[0x1A8]); // ? - good for K01
+ status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F; // - good for K01
+ status->lens_id2 = get_uint32_be( &buf[0x19C]); // - good for K01
+}
+
+static
+void ipslr_status_parse_k50(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ status->zoom.nom = get_uint32_be(&buf[0x1A0]);
+ status->zoom.denom = get_uint32_be(&buf[0x1A4]);
+ // status->focus = get_int32_be(&buf[0x1A8]); // ?
+ status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x19C]);
+}
+
+static
+void ipslr_status_parse_k500(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ status->zoom.nom = get_uint32_be(&buf[0x1A0]);
+ status->zoom.denom = get_uint32_be(&buf[0x1A4]);
+ // status->focus = get_int32_be(&buf[0x1A8]); // ?
+ status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x19C]);
+ // cannot read max_shutter_speed from status buffer, hardwire the values here
+ status->max_shutter_speed.nom = 1;
+ status->max_shutter_speed.denom = 6000;
+}
+
+static
+void ipslr_status_parse_km(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, -4);
+ status->zoom.nom = get_uint32_be(&buf[0x180]);
+ status->zoom.denom = get_uint32_be(&buf[0x184]);
+ status->lens_id1 = get_uint32_be(&buf[0x170]) & 0x0F;
+ status->lens_id2 = get_uint32_be( &buf[0x17c]);
+// TODO
+// status.focused = getInt32(statusBuf, 0x164);
+}
+
+// K-3 returns data in little-endian
+static
+void ipslr_status_parse_k3(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ status->bufmask = get_uint16_le( &buf[0x1C]);
+ status->zoom.nom = get_uint32_le(&buf[0x1A0]);
+ status->zoom.denom = get_uint32_le(&buf[0x1A4]);
+ status->focus = get_int32_le(&buf[0x1A8]);
+ status->lens_id1 = get_uint32_le(&buf[0x190]) & 0x0F;
+ status->lens_id2 = get_uint32_le( &buf[0x19C]);
+}
+
+static
+void ipslr_status_parse_ks1(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+ status->bufmask = get_uint16_le( &buf[0x0C]);
+ status->zoom.nom = get_uint32_le(&buf[0x1A0]);
+ status->zoom.denom = get_uint32_le(&buf[0x1A4]);
+ status->focus = get_int32_le(&buf[0x1A8]);
+ status->lens_id1 = get_uint32_le(&buf[0x190]) & 0x0F;
+ status->lens_id2 = get_uint32_le( &buf[0x19C]);
+}
+
+
+static
+void ipslr_status_parse_k1(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+// parse_common returns invalid values for the following fields. Fixing the fields:
+
+ status->jpeg_hue = get_uint32_le(&buf[0x100]);
+ status->current_shutter_speed.nom = get_uint32_le(&buf[0x110]);
+ status->current_shutter_speed.denom = get_uint32_le(&buf[0x114]);
+ status->current_aperture.nom = get_uint32_le(&buf[0x118]);
+ status->current_aperture.denom = get_uint32_le(&buf[0x11c]);
+ status->max_shutter_speed.nom = get_uint32_le(&buf[0x130]);
+ status->max_shutter_speed.denom = get_uint32_le(&buf[0x134]);
+ status->current_iso = get_uint32_le(&buf[0x138]);
+ status->light_meter_flags = get_uint32_le(&buf[0x140]); // ?
+ status->lens_min_aperture.nom = get_uint32_le(&buf[0x148]);
+ status->lens_min_aperture.denom = get_uint32_le(&buf[0x14c]);
+ status->lens_max_aperture.nom = get_uint32_le(&buf[0x150]);
+ status->lens_max_aperture.denom = get_uint32_le(&buf[0x154]);
+ status->manual_mode_ev = get_uint32_le(&buf[0x160]); // ?
+ status->focused_af_point = get_uint32_le(&buf[0x16c]); // ?
+ status->battery_1 = get_uint32_le(&buf[0x174]);
+ status->battery_2 = get_uint32_le(&buf[0x178]);
+
+ // selected_af_point
+ // toprow left: 0x04000000
+ // toprow leftmiddle: 0x02000000
+ // toprow middle: 0x01000000
+ // toprow rightmiddle: 0x00800000
+ // bottomright: 0x00000004
+
+ status->bufmask = get_uint16_le( &buf[0x0C]);
+ status->zoom.nom = get_uint32_le(&buf[0x1A4]);
+ status->zoom.denom = get_uint32_le(&buf[0x1A8]);
+// status->focus = get_int32_le(&buf[0x1A8]);
+ status->lens_id1 = get_uint32_le(&buf[0x194]) & 0x0F;
+ status->lens_id2 = get_uint32_le( &buf[0x1A0]);
+}
+
+static
+void ipslr_status_parse_k70(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ ipslr_status_parse_common( p, status, 0 );
+// parse_common returns invalid values for the following fields. Fixing the fields:
+
+ status->auto_bracket_picture_counter = get_uint32_le(&buf[0xE8]);
+ status->jpeg_hue = get_uint32_le(&buf[0x100]);
+ status->current_shutter_speed.nom = get_uint32_le(&buf[0x110]);
+ status->current_shutter_speed.denom = get_uint32_le(&buf[0x114]);
+ status->current_aperture.nom = get_uint32_le(&buf[0x118]);
+ status->current_aperture.denom = get_uint32_le(&buf[0x11c]);
+ status->max_shutter_speed.nom = get_uint32_le(&buf[0x130]);
+ status->max_shutter_speed.denom = get_uint32_le(&buf[0x134]);
+ status->current_iso = get_uint32_le(&buf[0x138]);
+ status->light_meter_flags = get_uint32_le(&buf[0x140]); // ?
+ status->lens_min_aperture.nom = get_uint32_le(&buf[0x148]);
+ status->lens_min_aperture.denom = get_uint32_le(&buf[0x14c]);
+ status->lens_max_aperture.nom = get_uint32_le(&buf[0x150]);
+ status->lens_max_aperture.denom = get_uint32_le(&buf[0x154]);
+ status->manual_mode_ev = get_uint32_le(&buf[0x160]); // ?
+ status->focused_af_point = get_uint32_le(&buf[0x16c]); // ?
+
+ switch ( status->af_point_select) {
+ case 0:
+ status->af_point_select=PSLR_AF_POINT_SEL_SPOT;
+ break;
+ case 1:
+ status->af_point_select=PSLR_AF_POINT_SEL_SELECT;
+ break;
+ case 2:
+ status->af_point_select=PSLR_AF_POINT_SEL_EXPANDED;
+ break;
+ case 5:
+ status->af_point_select=PSLR_AF_POINT_SEL_AUTO_5;
+ break;
+ case 6:
+ status->af_point_select=PSLR_AF_POINT_SEL_AUTO_11;
+ break;
+ }
+
+ status->battery_1 = get_uint32_le(&buf[0x174]);
+ status->battery_2 = get_uint32_le(&buf[0x178]);
+ status->battery_3 = 0;
+ status->battery_4 = 0;
+
+ uint32_t converted_selected_af_point=0;
+ int convert_bit_index[11] = { 26, 24, 22, 1, 16, 14, 12, 0, 6, 4, 2};
+ int bitidx=0;
+ for (bitidx=0; bitidx<11; ++bitidx) {
+ if (status->selected_af_point & 1<selected_af_point = converted_selected_af_point;
+
+ status->bufmask = get_uint16_le( &buf[0x0C]);
+ status->zoom.nom = get_uint32_le(&buf[0x1A4]);
+ status->zoom.denom = get_uint32_le(&buf[0x1A8]);
+// status->focus = get_int32_le(&buf[0x1A8]);
+ status->lens_id1 = get_uint32_le(&buf[0x194]) & 0x0F;
+ status->lens_id2 = get_uint32_le( &buf[0x1A0]);
+ status->shake_reduction = get_uint32_le(&buf[0xe4]);
+}
+
+static
+void ipslr_status_parse_k200d(ipslr_handle_t *p, pslr_status *status) {
+ uint8_t *buf = p->status_buffer;
+ if ( debug ) {
+ ipslr_status_diff(buf);
+ }
+
+ memset(status, 0, sizeof (*status));
+ status->bufmask = get_uint16_be(&buf[0x16]);
+ status->user_mode_flag = get_uint32_be(&buf[0x1c]);
+ status->set_shutter_speed.nom = get_uint32_be(&buf[0x2c]);
+ status->set_shutter_speed.denom = get_uint32_be(&buf[0x30]);
+ status->current_aperture.nom = get_uint32_be(&buf[0x034]);
+ status->current_aperture.denom = get_uint32_be(&buf[0x038]);
+ status->set_aperture.nom = get_uint32_be(&buf[0x34]);
+ status->set_aperture.denom = get_uint32_be(&buf[0x38]);
+ status->ec.nom = get_uint32_be(&buf[0x3c]);
+ status->ec.denom = get_uint32_be(&buf[0x40]);
+ status->current_iso = get_uint32_be(&buf[0x060]);
+ status->fixed_iso = get_uint32_be(&buf[0x60]);
+ status->auto_iso_min = get_uint32_be(&buf[0x64]);
+ status->auto_iso_max = get_uint32_be(&buf[0x68]);
+ status->image_format = get_uint32_be(&buf[0x78]);
+ status->jpeg_resolution = get_uint32_be(&buf[0x7c]);
+ status->jpeg_quality = _get_user_jpeg_stars( p->model, get_uint32_be(&buf[0x80]));
+ status->raw_format = get_uint32_be(&buf[0x84]);
+ status->jpeg_image_tone = get_uint32_be(&buf[0x88]);
+ status->jpeg_saturation = get_uint32_be(&buf[0x8c]);
+ status->jpeg_sharpness = get_uint32_be(&buf[0x90]);
+ status->jpeg_contrast = get_uint32_be(&buf[0x94]);
+ //status->custom_ev_steps = get_uint32_be(&buf[0x9c]);
+ //status->custom_sensitivity_steps = get_uint32_be(&buf[0xa0]);
+ status->exposure_mode = get_uint32_be(&buf[0xac]);
+ status->af_mode = get_uint32_be(&buf[0xb8]);
+ status->af_point_select = get_uint32_be(&buf[0xbc]);
+ status->selected_af_point = get_uint32_be(&buf[0xc0]);
+ status->drive_mode = get_uint32_be(&buf[0xcc]);
+ status->shake_reduction = get_uint32_be(&buf[0xda]);
+ status->jpeg_hue = get_uint32_be(&buf[0xf4]);
+ status->current_shutter_speed.nom = get_uint32_be(&buf[0x0104]);
+ status->current_shutter_speed.denom = get_uint32_be(&buf[0x108]);
+ status->light_meter_flags = get_uint32_be(&buf[0x124]);
+ status->lens_min_aperture.nom = get_uint32_be(&buf[0x13c]);
+ status->lens_min_aperture.denom = get_uint32_be(&buf[0x140]);
+ status->lens_max_aperture.nom = get_uint32_be(&buf[0x144]);
+ status->lens_max_aperture.denom = get_uint32_be(&buf[0x148]);
+ status->focused_af_point = get_uint32_be(&buf[0x150]);
+ status->zoom.nom = get_uint32_be(&buf[0x17c]);
+ status->zoom.denom = get_uint32_be(&buf[0x180]);
+ status->focus = get_int32_be(&buf[0x184]);
+ // Drive mode: 0=Single shot, 1= Continous Hi, 2= Continous Low or Self timer 12s, 3=Self timer 2s
+ // 4= remote, 5= remote 3s delay
+}
+
+pslr_setting_def_t *find_setting_by_name (pslr_setting_def_t *array, int array_length, char *name) {
+ if (array == NULL || array_length == 0) {
+ return NULL;
+ }
+ int i;
+ for ( i = 0; ivalue != NULL) {
+ bool_setting = (pslr_bool_setting) {
+ PSLR_SETTING_STATUS_HARDWIRED, strcmp("false", def->value) == 0 ? false : true
+ };
+ } else if (def->address != 0) {
+ uint8_t target = strcmp(def->type, "boolean!") == 0 ? 0 : 1;
+ bool_setting = (pslr_bool_setting) {
+ PSLR_SETTING_STATUS_READ, buf[def->address] == target
+ };
+ } else {
+ bool_setting = (pslr_bool_setting) {
+ PSLR_SETTING_STATUS_NA, false
+ };
+ }
+ return bool_setting;
+}
+
+pslr_uint16_setting ipslr_settings_parse_uint16(const uint8_t *buf, const pslr_setting_def_t *def) {
+ pslr_uint16_setting uint16_setting;
+ if (def->value != NULL) {
+ uint16_setting = (pslr_uint16_setting) {
+ PSLR_SETTING_STATUS_HARDWIRED, atoi(def->value)
+ };
+ } else if (def->address != 0) {
+ uint16_setting = (pslr_uint16_setting) {
+ PSLR_SETTING_STATUS_READ, get_uint16_be(&buf[def->address])
+ };
+ } else {
+ uint16_setting = (pslr_uint16_setting) {
+ PSLR_SETTING_STATUS_NA, 0
+ };
+ }
+ return uint16_setting;
+}
+
+void ipslr_settings_parser_json(const char *cameraid, ipslr_handle_t *p, pslr_settings *settings) {
+ uint8_t *buf = p->settings_buffer;
+ memset(settings, 0, sizeof (*settings));
+ int def_num;
+
+ pslr_setting_def_t *defs = setting_file_process(cameraid,&def_num);
+ int def_index=0;
+ while (def_index < def_num) {
+ pslr_bool_setting bool_setting;
+ pslr_uint16_setting uint16_setting;
+ pslr_setting_def_t def = defs[def_index];
+ if (strncmp(def.type, "boolean", 7) == 0) {
+ bool_setting = ipslr_settings_parse_bool(buf, &def);
+ } else if (strcmp(def.type, "uint16") == 0) {
+ uint16_setting = ipslr_settings_parse_uint16(buf, &def);
+ } else {
+ fprintf(stderr, "Invalid json type: %s\n", def.type);
+ }
+ if (strcmp(def.name, "bulb_mode_press_press") == 0) {
+ settings->bulb_mode_press_press = bool_setting;
+ } else if (strcmp(def.name, "remote_bulb_mode_press_press") == 0) {
+ settings->remote_bulb_mode_press_press = bool_setting;
+ } else if (strcmp(def.name, "one_push_bracketing") == 0) {
+ settings->one_push_bracketing = bool_setting;
+ } else if (strcmp(def.name, "bulb_timer") == 0) {
+ settings->bulb_timer = bool_setting;
+ } else if (strcmp(def.name, "bulb_timer_sec") == 0) {
+ settings->bulb_timer_sec = uint16_setting;
+ } else if (strcmp(def.name, "using_aperture_ring") == 0) {
+ settings->using_aperture_ring = bool_setting;
+ } else if (strcmp(def.name, "shake_reduction") == 0) {
+ settings->shake_reduction = bool_setting;
+ } else if (strcmp(def.name, "astrotracer") == 0) {
+ settings->astrotracer = bool_setting;
+ } else if (strcmp(def.name, "astrotracer_timer_sec") == 0) {
+ settings->astrotracer_timer_sec = uint16_setting;
+ } else if (strcmp(def.name, "horizon_correction") == 0) {
+ settings->horizon_correction = bool_setting;
+ }
+ ++def_index;
+ }
+}
+
+
+ipslr_model_info_t camera_models[] = {
+ { 0x12aa2, "*ist DS", true, true, true, false, false, false, 264, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, ipslr_status_parse_istds},
+ { 0x12cd2, "K20D", false, true, true, false, false, false, 412, 4, {14, 10, 6, 2}, 7, 4000, 100, 3200, 100, 6400, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_k20d},
+ { 0x12c1e, "K10D", false, true, true, false, false, false, 392, 3, {10, 6, 2}, 7, 4000, 100, 1600, 100, 1600, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, ipslr_status_parse_k10d},
+ { 0x12c20, "GX10", false, true, true, false, false, false, 392, 3, {10, 6, 2}, 7, 4000, 100, 1600, 100, 1600, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, ipslr_status_parse_k10d},
+ { 0x12cd4, "GX20", false, true, true, false, false, false, 412, 4, {14, 10, 6, 2}, 7, 4000, 100, 3200, 100, 6400, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_k20d},
+ { 0x12dfe, "K-x", false, true, true, false, false, false, 436, 3, {12, 10, 6, 2}, 9, 6000, 200, 6400, 100, 12800, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_kx}, //muted: bug
+ { 0x12cfa, "K200D", false, true, true, false, false, false, 408, 3, {10, 6, 2}, 9, 4000, 100, 1600, 100, 1600, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_k200d},
+ { 0x12db8, "K-7", false, true, true, false, false, false, 436, 4, {14, 10, 6, 2}, 9, 8000, 100, 3200, 100, 6400, PSLR_JPEG_IMAGE_TONE_MUTED, true, 11, ipslr_status_parse_kx},
+ { 0x12e6c, "K-r", false, true, true, false, false, false, 440, 3, {12, 10, 6, 2}, 9, 6000, 200,12800, 100, 25600, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_kr},
+ { 0x12e76, "K-5", false, true, true, false, false, false, 444, 4, {16, 10, 6, 2}, 9, 8000, 100,12800, 80, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k5},
+ { 0x12d72, "K-2000", false, true, true, false, false, false, 412, 3, {10, 6, 2}, 9, 4000, 100, 3200, 100, 3200, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_km},
+ { 0x12d73, "K-m", false, true, true, false, false, false, 412, 3, {10, 6, 2}, 9, 4000, 100, 3200, 100, 3200, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_km},
+ { 0x12f52, "K-30", false, true, false, false, false, false, 452, 3, {16, 12, 8, 5}, 9, 6000, 100,12800, 100, 25600, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k30},
+ { 0x12ef8, "K-01", false, true, true, false, false, false, 452, 3, {16, 12, 8, 5}, 9, 4000, 100,12800, 100, 25600, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k01},
+ { 0x12f70, "K-5II", false, true, true, false, false, false, 444, 4, {16, 10, 6, 2}, 9, 8000, 100, 12800, 80, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k5},
+ { 0x12f71, "K-5IIs", false, true, true, false, false, false, 444, 4, {16, 10, 6, 2}, 9, 8000, 100, 12800, 80, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k5},
+ { 0x12fb6, "K-50", false, true, true, false, false, false, 452, 4, {16, 12, 8, 5}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k50},
+ { 0x12fc0, "K-3", false, true, true, false, false, true, 452, 4, {24, 14, 6, 2}, 9, 8000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 27, ipslr_status_parse_k3},
+ { 0x1309c, "K-3II", false, false, true, true, false, true, 452, 4, {24, 14, 6, 2}, 9, 8000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 27, ipslr_status_parse_k3},
+ { 0x12fca, "K-500", false, true, true, false, false, false, 452, 3, {16, 12, 8, 5}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 11, ipslr_status_parse_k500},
+ // only limited support from here
+ { 0x12994, "*ist D", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 3, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_NONE, false, 11, NULL}, // buffersize: 264
+ { 0x12b60, "*ist DS2", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL},
+ { 0x12b1a, "*ist DL", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL},
+ { 0x12b80, "GX-1L", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL},
+ { 0x12b9d, "K110D", false, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL},
+ { 0x12b9c, "K100D", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL},
+ { 0x12ba2, "K100D Super", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL},
+ { 0x1301a, "K-S1", false, true, true, false, false, true, 452, 3, {20, 12, 6, 2}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 11, ipslr_status_parse_ks1},
+ { 0x13024, "K-S2", false, true, true, false, false, true, 452, 3, {20, 12, 6, 2}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 11, ipslr_status_parse_k3},
+ { 0x13092, "K-1", false, false, true, true, false, true, 456, 3, {36, 22, 12, 2}, 9, 8000, 100, 204800, 100, 204800, PSLR_JPEG_IMAGE_TONE_FLAT, true, 33, ipslr_status_parse_k1 },
+ { 0x13240, "K-1 II", false, false, true, true, false, true, 456, 3, {36, 22, 12, 2}, 9, 8000, 100, 819200, 100, 819200, PSLR_JPEG_IMAGE_TONE_FLAT, true, 33, ipslr_status_parse_k1 },
+ { 0x13222, "K-70", false, false, true, true, true, true, 456, 3, {24, 14, 6, 2}, 9, 6000, 100, 102400, 100, 102400, PSLR_JPEG_IMAGE_TONE_AUTO, true, 11, ipslr_status_parse_k70},
+ { 0x1322c, "KP", false, false, true, true, false, true, 456, 3, {24, 14, 6, 2}, 9, 6000, 100, 819200, 100, 819200, PSLR_JPEG_IMAGE_TONE_AUTO, true, 27, ipslr_status_parse_k70}
+};
+
+ipslr_model_info_t *find_model_by_id( uint32_t id ) {
+ int i;
+ for ( i = 0; i
+ Remote control of Pentax DSLR cameras.
+
+ Support for K200D added by Jens Dreyer 04/2011
+ Support for K-r added by Vincenc Podobnik 06/2011
+ Support for K-30 added by Camilo Polymeris 09/2012
+ Support for K-01 added by Ethan Queen 01/2013
+ Support for K-3 added by Tao Wang 01/2016
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ PK-Remote for Windows
+ Copyright (C) 2010 Tomasz Kos
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#ifndef PSLR_MODEL_H
+#define PSLR_MODEL_H
+
+#include "pslr_enum.h"
+#include "pslr_scsi.h"
+
+#define MAX_RESOLUTION_SIZE 4
+#define MAX_STATUS_BUF_SIZE 456
+#define SETTINGS_BUFFER_SIZE 1024
+#define MAX_SEGMENTS 4
+
+typedef struct ipslr_handle ipslr_handle_t;
+
+typedef struct {
+ int32_t nom;
+ int32_t denom;
+} pslr_rational_t;
+
+typedef struct {
+ uint16_t bufmask;
+ uint32_t current_iso;
+ pslr_rational_t current_shutter_speed;
+ pslr_rational_t current_aperture;
+ pslr_rational_t lens_max_aperture;
+ pslr_rational_t lens_min_aperture;
+ pslr_rational_t set_shutter_speed;
+ pslr_rational_t set_aperture;
+ pslr_rational_t max_shutter_speed;
+ uint32_t auto_bracket_mode;
+ pslr_rational_t auto_bracket_ev;
+ uint32_t auto_bracket_picture_count;
+ uint32_t auto_bracket_picture_counter;
+ uint32_t fixed_iso;
+ uint32_t jpeg_resolution;
+ uint32_t jpeg_saturation;
+ uint32_t jpeg_quality;
+ uint32_t jpeg_contrast;
+ uint32_t jpeg_sharpness;
+ uint32_t jpeg_image_tone;
+ uint32_t jpeg_hue;
+ pslr_rational_t zoom;
+ int32_t focus;
+ uint32_t image_format;
+ uint32_t raw_format;
+ uint32_t light_meter_flags;
+ pslr_rational_t ec;
+ uint32_t custom_ev_steps;
+ uint32_t custom_sensitivity_steps;
+ uint32_t exposure_mode;
+ uint32_t scene_mode;
+ uint32_t user_mode_flag;
+ uint32_t ae_metering_mode;
+ uint32_t af_mode;
+ uint32_t af_point_select;
+ uint32_t selected_af_point;
+ uint32_t focused_af_point;
+ uint32_t auto_iso_min;
+ uint32_t auto_iso_max;
+ uint32_t drive_mode;
+ uint32_t shake_reduction;
+ uint32_t white_balance_mode;
+ uint32_t white_balance_adjust_mg;
+ uint32_t white_balance_adjust_ba;
+ uint32_t flash_mode;
+ int32_t flash_exposure_compensation; /* 1/256 */
+ int32_t manual_mode_ev; /* 1/10 */
+ uint32_t color_space;
+ uint32_t lens_id1;
+ uint32_t lens_id2;
+ uint32_t battery_1;
+ uint32_t battery_2;
+ uint32_t battery_3;
+ uint32_t battery_4;
+} pslr_status;
+
+typedef enum {
+ PSLR_SETTING_STATUS_UNKNOWN,
+ PSLR_SETTING_STATUS_READ,
+ PSLR_SETTING_STATUS_HARDWIRED,
+ PSLR_SETTING_STATUS_NA
+} pslr_setting_status_t;
+
+typedef struct {
+ pslr_setting_status_t pslr_setting_status;
+ bool value;
+} pslr_bool_setting;
+
+typedef struct {
+ pslr_setting_status_t pslr_setting_status;
+ uint16_t value;
+} pslr_uint16_setting;
+
+typedef struct {
+ pslr_bool_setting one_push_bracketing;
+ pslr_bool_setting bulb_mode_press_press;
+ pslr_bool_setting bulb_timer;
+ pslr_uint16_setting bulb_timer_sec;
+ pslr_bool_setting using_aperture_ring;
+ pslr_bool_setting shake_reduction;
+ pslr_bool_setting astrotracer;
+ pslr_uint16_setting astrotracer_timer_sec;
+ pslr_bool_setting horizon_correction;
+ pslr_bool_setting remote_bulb_mode_press_press;
+} pslr_settings;
+
+typedef struct {
+ const char *name;
+ unsigned long address;
+ const char *value;
+ const char *type;
+} pslr_setting_def_t;
+
+typedef void (*ipslr_status_parse_t)(ipslr_handle_t *p, pslr_status *status);
+pslr_setting_def_t *find_setting_by_name (pslr_setting_def_t *array, int array_length, char *name);
+void ipslr_settings_parser_json(const char *cameraid, ipslr_handle_t *p, pslr_settings *settings);
+pslr_setting_def_t *setting_file_process(const char *cameraid, int *def_num);
+
+typedef struct {
+ uint32_t id; // Pentax model ID
+ const char *name; // name
+ bool old_scsi_command; // true for *ist cameras, false for the newer cameras
+ bool old_bulb_mode; // true for older cameras
+ bool need_exposure_mode_conversion; // is exposure_mode_conversion required
+ bool bufmask_command; // true if bufmask determined by calling command 0x02 0x00
+ bool bufmask_single; // true if buffer cannot handle multiple images
+ bool is_little_endian; // whether the return value should be parsed as little-endian
+ int status_buffer_size; // status buffer size in bytes
+ int max_jpeg_stars; // maximum jpeg stars
+ int jpeg_resolutions[MAX_RESOLUTION_SIZE]; // jpeg resolution table
+ int jpeg_property_levels; // 5 [-2, 2] or 7 [-3,3] or 9 [-4,4]
+ int fastest_shutter_speed; // fastest shutter speed denominator
+ int base_iso_min; // base iso minimum
+ int base_iso_max; // base iso maximum
+ int extended_iso_min; // extended iso minimum
+ int extended_iso_max; // extended iso maximum
+ pslr_jpeg_image_tone_t max_supported_image_tone; // last supported jpeg image tone
+ bool has_jpeg_hue; // camera has jpeg hue setting
+ int af_point_num; // number of AF points
+ ipslr_status_parse_t status_parser_function; // parse function for status buffer
+} ipslr_model_info_t;
+
+typedef struct {
+ uint32_t offset;
+ uint32_t addr;
+ uint32_t length;
+} ipslr_segment_t;
+
+struct ipslr_handle {
+ FDTYPE fd;
+ pslr_status status;
+ pslr_settings settings;
+ uint32_t id;
+ ipslr_model_info_t *model;
+ ipslr_segment_t segments[MAX_SEGMENTS];
+ uint32_t segment_count;
+ uint32_t offset;
+ uint8_t status_buffer[MAX_STATUS_BUF_SIZE];
+ uint8_t settings_buffer[SETTINGS_BUFFER_SIZE];
+};
+
+ipslr_model_info_t *find_model_by_id( uint32_t id );
+
+int get_hw_jpeg_quality( ipslr_model_info_t *model, int user_jpeg_stars);
+
+uint32_t get_uint32_be(uint8_t *buf);
+uint32_t get_uint32_le(uint8_t *buf);
+void set_uint32_be(uint32_t v, uint8_t *buf);
+void set_uint32_le(uint32_t v, uint8_t *buf);
+
+typedef uint32_t (*get_uint32_func)(uint8_t *buf);
+typedef uint16_t (*get_uint16_func)(const uint8_t *buf);
+typedef int32_t (*get_int32_func)(uint8_t *buf);
+
+char *shexdump(uint8_t *buf, uint32_t bufLen);
+void hexdump(uint8_t *buf, uint32_t bufLen);
+void hexdump_debug(uint8_t *buf, uint32_t bufLen);
+const char* int_to_binary( uint16_t x );
+
+#endif
diff --git a/libpktriggercord/src/pslr_scsi.c b/libpktriggercord/src/pslr_scsi.c
new file mode 100644
index 000000000..25b48e713
--- /dev/null
+++ b/libpktriggercord/src/pslr_scsi.c
@@ -0,0 +1,36 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#ifdef WIN32
+#include "pslr_scsi_win.c"
+#else
+/* Ugly hack. More generic ifs required */
+#ifdef __OpenBSD__
+#include "pslr_scsi_openbsd.c"
+#else
+#include "pslr_scsi_linux.c"
+#endif
+#endif
diff --git a/libpktriggercord/src/pslr_scsi.h b/libpktriggercord/src/pslr_scsi.h
new file mode 100644
index 000000000..3174ed4c5
--- /dev/null
+++ b/libpktriggercord/src/pslr_scsi.h
@@ -0,0 +1,92 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+
+#ifndef PSLR_SCSI_H
+#define PSLR_SCSI_H
+
+#include
+#include
+#include
+#include
+
+extern bool debug;
+extern void write_debug( const char* message, ... );
+
+#ifdef ANDROID
+#include
+#define DPRINT(...) __android_log_print(ANDROID_LOG_DEBUG, "PkTriggerCord", __VA_ARGS__)
+#else
+#ifdef LIBGPHOTO
+#include
+#define DPRINT(x...) gp_log (GP_LOG_DEBUG, "pentax", x)
+#else
+#define DPRINT(x...) write_debug(x)
+#endif
+#endif
+
+#define CHECK(x) do { \
+ int __r; \
+ __r = (x); \
+ if (__r != PSLR_OK) { \
+ fprintf(stderr, "%s:%d:%s failed: %d\n", __FILE__, __LINE__, #x, __r); \
+ return __r; \
+ } \
+ } while (0)
+
+typedef enum {
+ PSLR_OK = 0,
+ PSLR_DEVICE_ERROR,
+ PSLR_SCSI_ERROR,
+ PSLR_COMMAND_ERROR,
+ PSLR_READ_ERROR,
+ PSLR_NO_MEMORY,
+ PSLR_PARAM, /* Invalid parameters to API */
+ PSLR_ERROR_MAX
+} pslr_result;
+
+/* This also could be used to specify FDTYPE HANDLE for Win32, but this seems tricky with includes */
+#ifdef LIBGPHOTO2
+typedef struct _GPPort GPPort;
+#define FDTYPE GPPort*
+#else
+/* classic UNIX style handle */
+#define FDTYPE int
+#endif
+
+int scsi_read(FDTYPE sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen);
+
+int scsi_write(FDTYPE sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen);
+
+char **get_drives(int *drive_num);
+
+pslr_result get_drive_info(char* drive_name, FDTYPE* device,
+ char* vendor_id, int vendor_id_size_max,
+ char* product_id, int product_id_size_max);
+
+void close_drive(FDTYPE *device);
+#endif
diff --git a/libpktriggercord/src/pslr_scsi_linux.c b/libpktriggercord/src/pslr_scsi_linux.c
new file mode 100644
index 000000000..9c3e12c89
--- /dev/null
+++ b/libpktriggercord/src/pslr_scsi_linux.c
@@ -0,0 +1,314 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#ifdef ANDROID
+#include "android_scsi_sg.h"
+#else
+#include
+#endif
+#include
+#include
+#include "pslr_model.h"
+
+#include "pslr_scsi.h"
+
+static const int MAX_DEVICE_NUM = 256;
+
+void print_scsi_error(sg_io_hdr_t *pIo, uint8_t *sense_buffer) {
+ int k;
+
+ if (pIo->sb_len_wr > 0) {
+ DPRINT("SCSI error: sense data: ");
+ for (k = 0; k < pIo->sb_len_wr; ++k) {
+ if ((k > 0) && (0 == (k % 10))) {
+ DPRINT("\n ");
+ }
+ DPRINT("0x%02x ", sense_buffer[k]);
+ }
+ DPRINT("\n");
+ }
+ if (pIo->masked_status) {
+ DPRINT("SCSI status=0x%x\n", pIo->status);
+ }
+ if (pIo->host_status) {
+ DPRINT("host_status=0x%x\n", pIo->host_status);
+ }
+ if (pIo->driver_status) {
+ DPRINT("driver_status=0x%x\n", pIo->driver_status);
+ }
+}
+
+const char* device_dirs[2] = {"/sys/class/scsi_generic", "/sys/block"};
+const int device_dir_num = sizeof(device_dirs)/sizeof(device_dirs[0]);
+
+char **get_drives(int *drive_num) {
+ DIR *d;
+ struct dirent *ent;
+ char *tmp[MAX_DEVICE_NUM];
+ char **ret=NULL;
+ int j=0,jj;
+ int di;
+
+ for (di=0; did_name, ".") != 0 && strcmp(ent->d_name, "..") != 0 && strncmp(ent->d_name, "loop",4) != 0) {
+ tmp[j] = malloc( strlen(ent->d_name)+1 );
+ strncpy(tmp[j], ent->d_name, strlen(ent->d_name)+1);
+ ++j;
+ }
+ }
+ closedir(d);
+ } else {
+ DPRINT("Cannot open %s\n", device_dirs[di]);
+ }
+ }
+ *drive_num = j;
+ if (j>0) {
+ ret = malloc( j * sizeof(char*) );
+ for ( jj=0; jj>> [");
+ for (i = 0; i < cmdLen; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", cmd[i]);
+ }
+ DPRINT("]\n");
+
+ r = ioctl(sg_fd, SG_IO, &io);
+ if (r == -1) {
+ perror("ioctl");
+ return -PSLR_DEVICE_ERROR;
+ }
+
+ if ((io.info & SG_INFO_OK_MASK) != SG_INFO_OK) {
+ print_scsi_error(&io, sense);
+ return -PSLR_SCSI_ERROR;
+ } else {
+ DPRINT("[S]\t\t\t\t\t <<< [");
+ for (i = 0; i < 32 && i < (bufLen - io.resid); ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if (i % 16 == 0) {
+ DPRINT("\n\t\t\t\t\t ");
+ } else if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", buf[i]);
+ }
+ DPRINT("]\n");
+
+ /* Older Pentax DSLR will report all bytes remaining, so make
+ * a special case for this (treat it as all bytes read). */
+ if (io.resid == bufLen) {
+ return bufLen;
+ } else {
+ return bufLen - io.resid;
+ }
+ }
+}
+
+int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen) {
+
+ sg_io_hdr_t io;
+ uint8_t sense[32];
+ int r;
+ uint32_t i;
+
+ memset(&io, 0, sizeof (io));
+
+ io.interface_id = 'S';
+ io.cmd_len = cmdLen;
+ /* io.iovec_count = 0; */ /* memset takes care of this */
+ io.mx_sb_len = sizeof (sense);
+ io.dxfer_direction = SG_DXFER_TO_DEV;
+ io.dxfer_len = bufLen;
+ io.dxferp = buf;
+ io.cmdp = cmd;
+ io.sbp = sense;
+ io.timeout = 20000; /* 20000 millisecs == 20 seconds */
+ /* io.flags = 0; */ /* take defaults: indirect IO, etc */
+ /* io.pack_id = 0; */
+ /* io.usr_ptr = NULL; */
+
+ /* print debug scsi cmd */
+ DPRINT("[S]\t\t\t\t\t >>> [");
+ for (i = 0; i < cmdLen; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", cmd[i]);
+ }
+ DPRINT("]\n");
+ if (bufLen > 0) {
+ /* print debug write buffer */
+ DPRINT("[S]\t\t\t\t\t >>> [");
+ for (i = 0; i < 32 && i < bufLen; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if (i % 16 == 0) {
+ DPRINT("\n\t\t\t\t\t ");
+ } else if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", buf[i]);
+ }
+ DPRINT("]\n");
+ }
+
+ r = ioctl(sg_fd, SG_IO, &io);
+
+ if (r == -1) {
+ perror("ioctl");
+ return PSLR_DEVICE_ERROR;
+ }
+
+ if ((io.info & SG_INFO_OK_MASK) != SG_INFO_OK) {
+ print_scsi_error(&io, sense);
+ return PSLR_SCSI_ERROR;
+ } else {
+ return PSLR_OK;
+ }
+}
diff --git a/libpktriggercord/src/pslr_scsi_openbsd.c b/libpktriggercord/src/pslr_scsi_openbsd.c
new file mode 100644
index 000000000..71d969443
--- /dev/null
+++ b/libpktriggercord/src/pslr_scsi_openbsd.c
@@ -0,0 +1,300 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "pslr_model.h"
+
+#include "pslr_scsi.h"
+
+#include
+#define SCSI_INQUIRY 0x12
+
+void print_scsi_error(scsireq_t *req) {
+ int k;
+
+ if (req->senselen_used > 0) {
+ DPRINT("SCSI error: sense data: ");
+ for (k = 0; k < req->senselen_used; ++k) {
+ if ((k > 0) && (0 == (k % 10))) {
+ DPRINT("\n ");
+ }
+ DPRINT("0x%02x ", req->sense[k]);
+ }
+ DPRINT("\n");
+ }
+
+ DPRINT("SCSI status=0x%x\n", req->status);
+}
+
+char **get_drives(int *drive_num) {
+ DIR *d;
+ struct dirent *ent;
+ char *tmp[256];
+ char **ret;
+ int j,jj;
+ d = opendir("/dev");
+
+
+ if ( !d ) {
+ DPRINT("Cannot open /dev\n");
+ *drive_num = 0;
+ return NULL;
+ }
+ j=0;
+ while ( (ent = readdir(d)) ) {
+ if (strncmp(ent->d_name, "rsd", 3) == 0 &&
+ strnlen(ent->d_name, 6) > 4 && ent->d_name[4] == 'c') {
+ tmp[j] = malloc( strlen(ent->d_name)+1 );
+ strncpy(tmp[j], ent->d_name, strlen(ent->d_name)+1);
+ ++j;
+ }
+ }
+ closedir(d);
+ ret = malloc( j * sizeof(char*) );
+ for ( jj=0; jj p && q[-1] == ' ') {
+ q--;
+ }
+ memcpy(vendor_id, p, q - p);
+ vendor_id[q - p] = '\0';
+ /* Product */
+ p = buf + 16;
+ q = p + ((16 < product_id_size_max)?16:product_id_size_max);
+ while (q > p && q[-1] == ' ') {
+ q--;
+ }
+ memcpy(product_id, p, q - p);
+ product_id[q - p] = '\0';
+
+ close(fd);
+
+ *device = open(deviceName, O_RDWR);
+ if ( *device == -1) {
+ return PSLR_DEVICE_ERROR;
+ }
+ return PSLR_OK;
+}
+
+void close_drive(int *device) {
+ close( *device );
+}
+
+int scsi_read(int sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen) {
+
+ int r;
+ unsigned int i;
+ scsireq_t screq;
+
+ memset(&screq, 0, sizeof(screq));
+ screq.flags = SCCMD_READ;
+ screq.timeout = 20000;
+
+ assert(cmdLen < CMDBUFLEN);
+
+ memcpy(screq.cmd, cmd, cmdLen);
+ screq.cmdlen = cmdLen;
+ screq.senselen = SENSEBUFLEN;
+
+ screq.databuf = buf;
+ screq.datalen = bufLen;
+
+ DPRINT("[S]\t\t\t\t\t >>> [");
+ for (i = 0; i < cmdLen; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", cmd[i]);
+ }
+ DPRINT("]\n");
+
+ r = ioctl(sg_fd, SCIOCCOMMAND, &screq);
+ if (r == -1) {
+ perror("ioctl");
+ return -PSLR_DEVICE_ERROR;
+ }
+
+ if (screq.retsts != SCCMD_OK) {
+ print_scsi_error(&screq);
+ return -PSLR_SCSI_ERROR;
+ } else {
+ DPRINT("[S]\t\t\t\t\t <<< [");
+ for (i = 0; i < 32 && i < screq.datalen_used; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if (i % 16 == 0) {
+ DPRINT("\n\t\t\t\t\t ");
+ } else if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", buf[i]);
+ }
+ DPRINT("]\n");
+
+ /* Older Pentax DSLR will report all bytes remaining, so make
+ * a special case for this (treat it as all bytes read). */
+ /* Linux solution:
+ if (io.resid == bufLen)
+ return bufLen;
+ else
+ return bufLen - io.resid;
+ */
+ /* In BSD this could be something like:
+ if (screq.datalen_used == 0)
+ return bufLen;
+ */
+ return screq.datalen_used;
+
+ }
+}
+
+int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen) {
+
+
+ int r;
+ unsigned int i;
+ scsireq_t screq;
+
+ memset(&screq, 0, sizeof(screq));
+ screq.flags = SCCMD_WRITE;
+ screq.timeout = 20000;
+
+ assert(cmdLen < CMDBUFLEN);
+
+ memcpy(screq.cmd, cmd, cmdLen);
+ screq.cmdlen = cmdLen;
+ screq.senselen = SENSEBUFLEN;
+
+ screq.databuf = buf;
+ screq.datalen = bufLen;
+
+
+ // print debug scsi cmd
+ DPRINT("[S]\t\t\t\t\t >>> [");
+ for (i = 0; i < cmdLen; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", cmd[i]);
+ }
+ DPRINT("]\n");
+ if (bufLen > 0) {
+ // print debug write buffer
+ DPRINT("[S]\t\t\t\t\t >>> [");
+ for (i = 0; i < 32 && i < bufLen; ++i) {
+ if (i > 0) {
+ DPRINT(" ");
+ if (i % 16 == 0) {
+ DPRINT("\n\t\t\t\t\t ");
+ } else if ((i%4) == 0 ) {
+ DPRINT(" ");
+ }
+ }
+ DPRINT("%02X", buf[i]);
+ }
+ DPRINT("]\n");
+ }
+
+ r = ioctl(sg_fd, SCIOCCOMMAND, &screq);
+
+ if (r == -1) {
+ perror("ioctl");
+ return PSLR_DEVICE_ERROR;
+ }
+
+ if (screq.retsts != SCCMD_OK) {
+ print_scsi_error(&screq);
+ return PSLR_SCSI_ERROR;
+ } else {
+ return PSLR_OK;
+ }
+}
diff --git a/libpktriggercord/src/pslr_scsi_win.c b/libpktriggercord/src/pslr_scsi_win.c
new file mode 100644
index 000000000..3138631d7
--- /dev/null
+++ b/libpktriggercord/src/pslr_scsi_win.c
@@ -0,0 +1,250 @@
+/*
+ pkTriggerCord
+ Copyright (C) 2011-2019 Andras Salamon
+ Remote control of Pentax DSLR cameras.
+
+ based on:
+
+ PK-Remote
+ Remote control of Pentax DSLR cameras.
+ Copyright (C) 2008 Pontus Lidman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ and GNU Lesser General Public License
+ along with this program. If not, see .
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "pslr_scsi.h"
+
+#define IOCTL_SCSI_PASS_THROUGH_DIRECT 0x4D014
+#define SCSI_IOCTL_DATA_IN 1
+#define SCSI_IOCTL_DATA_OUT 0
+
+typedef struct _SCSI_PASS_THROUGH_DIRECT {
+ USHORT Length;
+ UCHAR ScsiStatus;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR CdbLength;
+ UCHAR SenseInfoLength;
+ UCHAR DataIn;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ PVOID DataBuffer;
+ ULONG SenseInfoOffset;
+ UCHAR Cdb[16];
+} SCSI_PASS_THROUGH_DIRECT;
+
+
+typedef struct _SCSI_PASS_THROUGH_WITH_BUFFER {
+ SCSI_PASS_THROUGH_DIRECT sptd;
+ ULONG Filler; // realign buffers to double word boundary
+ UCHAR ucSenseBuf[32];
+} SCSI_PASS_THROUGH_WITH_BUFFER;
+
+char **get_drives(int *driveNum) {
+ char **ret;
+ ret = malloc( ('Z'-'C'+1) * sizeof(char *));
+ int driveLetter;
+ int j=0;
+ for ( driveLetter = 'C'; driveLetter<='Z'; ++driveLetter ) {
+ ret[j] = malloc( 2 * sizeof (char) );
+ snprintf(ret[j], 2, "%c", driveLetter);
+ ++j;
+ }
+ *driveNum = j;
+ return ret;
+}
+
+pslr_result get_drive_info(char* drive_name, int* device,
+ char* vendor_id, int vendor_id_size_max,
+ char* product_id, int product_id_size_max
+ ) {
+ bool Status;
+ STORAGE_PROPERTY_QUERY query;
+ STORAGE_DEVICE_DESCRIPTOR* pdescriptor;
+ byte descriptorBuf[256];
+ DWORD bytesRead;
+ pslr_result drive_status = PSLR_DEVICE_ERROR;
+ HANDLE hDrive;
+ char fullDriveName[7];
+
+ vendor_id[0] = '\0';
+ product_id[0] = '\0';
+ query.PropertyId = StorageDeviceProperty;
+ query.QueryType = PropertyStandardQuery;
+
+ snprintf( fullDriveName, 7, "\\\\.\\%s:", drive_name);
+
+ hDrive = CreateFile(fullDriveName,
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ 0,
+ NULL);
+
+ if (hDrive != INVALID_HANDLE_VALUE) {
+ Status = DeviceIoControl(hDrive,
+ IOCTL_STORAGE_QUERY_PROPERTY,
+ &query,
+ sizeof(query),
+ &descriptorBuf,
+ sizeof(descriptorBuf),
+ &bytesRead,
+ (LPOVERLAPPED)0);
+ if (Status==FALSE) {
+ int LastError = GetLastError(); //lastError alwasy return 1450
+ if (LastError != 0) {
+ CancelIo(hDrive);
+ }
+ } else {
+ *device = (int)hDrive;
+ drive_status = PSLR_OK;
+
+ pdescriptor = (STORAGE_DEVICE_DESCRIPTOR *)descriptorBuf;
+
+ if (pdescriptor->VendorIdOffset != 0) {
+ int i = 0;
+ while ((descriptorBuf[pdescriptor->VendorIdOffset + i] != 0)
+ &&(i < vendor_id_size_max)
+ ) {
+ vendor_id[i] = descriptorBuf[pdescriptor->VendorIdOffset + i];
+ i++;
+ }
+ vendor_id[i]='\0';
+ }
+ if (pdescriptor->ProductIdOffset != 0) {
+ int i = 0;
+ while ((descriptorBuf[pdescriptor->ProductIdOffset + i] != 0)
+ &&(i < product_id_size_max)
+ ) {
+ product_id[i] = descriptorBuf[pdescriptor->ProductIdOffset + i];
+ i++;
+ }
+ product_id[i]='\0';
+ }
+ }
+ }
+ return drive_status;
+}
+
+void close_drive(int *device) {
+ CloseHandle((HANDLE)*device);
+}
+
+int scsi_read(int sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen) {
+ SCSI_PASS_THROUGH_WITH_BUFFER sptdwb;
+ DWORD outByte=0;
+ int Status;
+ int LastError=0;
+ uint8_t dataIn[64*1024];
+
+ sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
+ sptdwb.sptd.ScsiStatus = 0;
+ sptdwb.sptd.PathId = 0;
+ sptdwb.sptd.TargetId = 0;
+ sptdwb.sptd.Lun = 0;
+ sptdwb.sptd.CdbLength = cmdLen;
+ sptdwb.sptd.SenseInfoLength = sizeof(sptdwb.ucSenseBuf);
+ sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_IN;
+ sptdwb.sptd.DataTransferLength = bufLen;
+ sptdwb.sptd.TimeOutValue = 10;
+ sptdwb.sptd.DataBuffer = dataIn;
+ sptdwb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFER,ucSenseBuf);
+
+ memset(sptdwb.sptd.Cdb, 0, sizeof(sptdwb.sptd.Cdb));
+ memcpy(sptdwb.sptd.Cdb, cmd, cmdLen);
+
+ Status=DeviceIoControl((HANDLE)sg_fd,
+ IOCTL_SCSI_PASS_THROUGH_DIRECT,
+ &sptdwb,
+ sizeof(sptdwb),
+ &sptdwb,
+ sizeof(sptdwb),
+ &outByte,
+ NULL);
+ if (Status==0) {
+ LastError = GetLastError();
+ if (LastError != 0) {
+ CancelIo((HANDLE)sg_fd);
+ }
+ }
+
+ memcpy(buf,sptdwb.sptd.DataBuffer,bufLen);
+
+ if (LastError != 0) {
+ return -PSLR_SCSI_ERROR;
+ } else {
+ if (sptdwb.sptd.DataTransferLength == bufLen) {
+ return bufLen;
+ } else {
+ return bufLen - sptdwb.sptd.DataTransferLength;
+ }
+ }
+}
+
+int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdLen,
+ uint8_t *buf, uint32_t bufLen) {
+ SCSI_PASS_THROUGH_WITH_BUFFER sptdwb;
+ DWORD outByte=0;
+ int Status;
+ int LastError=0;
+
+ sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
+ sptdwb.sptd.ScsiStatus = 0;
+ sptdwb.sptd.PathId = 0;
+ sptdwb.sptd.TargetId = 0;
+ sptdwb.sptd.Lun = 0;
+ sptdwb.sptd.CdbLength = cmdLen;
+ sptdwb.sptd.SenseInfoLength = sizeof(sptdwb.ucSenseBuf);
+ sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_OUT;
+ sptdwb.sptd.DataTransferLength = bufLen;
+ sptdwb.sptd.TimeOutValue = 10;
+ sptdwb.sptd.DataBuffer = buf;
+ sptdwb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFER,ucSenseBuf);
+
+ memset(sptdwb.sptd.Cdb, 0, sizeof(sptdwb.sptd.Cdb));
+ memcpy(sptdwb.sptd.Cdb, cmd, cmdLen);
+
+ Status=DeviceIoControl((HANDLE)sg_fd,
+ IOCTL_SCSI_PASS_THROUGH_DIRECT,
+ &sptdwb,
+ sizeof(sptdwb),
+ &sptdwb,
+ sizeof(sptdwb),
+ &outByte,
+ NULL);
+ if (Status==0) {
+ LastError = GetLastError();
+ if (LastError != 0) {
+ CancelIo((HANDLE)sg_fd);
+ }
+ }
+ if (LastError != 0) {
+ return PSLR_SCSI_ERROR;
+ } else {
+ return PSLR_OK;
+ }
+}
diff --git a/libpktriggercord/src/samsung.rules b/libpktriggercord/src/samsung.rules
new file mode 100644
index 000000000..e643a627c
--- /dev/null
+++ b/libpktriggercord/src/samsung.rules
@@ -0,0 +1,13 @@
+ACTION!="add", GOTO="samsung_rules_end"
+
+SUBSYSTEM=="scsi_generic", GOTO="samsung_rules_start"
+
+SUBSYSTEM!="scsi_generic", GOTO="samsung_rules_end"
+
+LABEL="samsung_rules_start"
+# WAIT_FOR_SYSFS="device/vendor"
+ATTRS{vendor}=="SAMSUNG", ATTRS{model}=="DIGITAL_CAMERA", MODE="0666", GROUP="users"
+ATTRS{vendor}=="SAMSUNG", ATTRS{model}=="DSC*", MODE="0666", GROUP="users"
+ATTRS{vendor}=="SAMSUNG", ATTRS{model}=="K*", MODE="0666", GROUP="users"
+
+LABEL="samsung_rules_end"
diff --git a/libpktriggercord/src/src/external/js0n/js0n.c b/libpktriggercord/src/src/external/js0n/js0n.c
new file mode 100644
index 000000000..062859b33
--- /dev/null
+++ b/libpktriggercord/src/src/external/js0n/js0n.c
@@ -0,0 +1,162 @@
+// by jeremie miller - 2014
+// public domain or MIT license, contributions/improvements welcome via github at https://github.com/quartzjer/js0n
+
+#include // one strncmp() is used to do key comparison, and a strlen(key) if no len passed in
+
+// gcc started warning for the init syntax used here, is not helpful so don't generate the spam, supressing the warning is really inconsistently supported across versions
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#pragma GCC diagnostic push
+#endif
+#pragma GCC diagnostic ignored "-Wunknown-pragmas"
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Winitializer-overrides"
+#pragma GCC diagnostic ignored "-Woverride-init"
+
+// only at depth 1, track start pointers to match key/value
+#define PUSH(i) if(depth == 1) { if(!index) { val = cur+i; }else{ if(klen && index == 1) start = cur+i; else index--; } }
+
+// determine if key matches or value is complete
+#define CAP(i) if(depth == 1) { if(val && !index) {*vlen = (size_t)((cur+i+1) - val); return val;}; if(klen && start) {index = (klen == (size_t)(cur-start) && strncmp(key,start,klen)==0) ? 0 : 2; start = 0;} }
+
+// this makes a single pass across the json bytes, using each byte as an index into a jump table to build an index and transition state
+const char *js0n(const char *key, size_t klen,
+ const char *json, size_t jlen, size_t *vlen)
+{
+ const char *val = 0;
+ const char *cur, *end, *start;
+ size_t index = 1;
+ int depth = 0;
+ int utf8_remain = 0;
+ static void *gostruct[] =
+ {
+ [0 ... 255] = &&l_bad,
+ ['\t'] = &&l_loop, [' '] = &&l_loop, ['\r'] = &&l_loop, ['\n'] = &&l_loop,
+ ['"'] = &&l_qup,
+ [':'] = &&l_loop,[','] = &&l_loop,
+ ['['] = &&l_up, [']'] = &&l_down, // tracking [] and {} individually would allow fuller validation but is really messy
+ ['{'] = &&l_up, ['}'] = &&l_down,
+ ['-'] = &&l_bare, [48 ... 57] = &&l_bare, // 0-9
+ [65 ... 90] = &&l_bare, // A-Z
+ [97 ... 122] = &&l_bare // a-z
+ };
+ static void *gobare[] =
+ {
+ [0 ... 31] = &&l_bad,
+ [32 ... 126] = &&l_loop, // could be more pedantic/validation-checking
+ ['\t'] = &&l_unbare, [' '] = &&l_unbare, ['\r'] = &&l_unbare, ['\n'] = &&l_unbare,
+ [','] = &&l_unbare, [']'] = &&l_unbare, ['}'] = &&l_unbare, [':'] = &&l_unbare,
+ [127 ... 255] = &&l_bad
+ };
+ static void *gostring[] =
+ {
+ [0 ... 31] = &&l_bad, [127] = &&l_bad,
+ [32 ... 126] = &&l_loop,
+ ['\\'] = &&l_esc, ['"'] = &&l_qdown,
+ [128 ... 191] = &&l_bad,
+ [192 ... 223] = &&l_utf8_2,
+ [224 ... 239] = &&l_utf8_3,
+ [240 ... 247] = &&l_utf8_4,
+ [248 ... 255] = &&l_bad
+ };
+ static void *goutf8_continue[] =
+ {
+ [0 ... 127] = &&l_bad,
+ [128 ... 191] = &&l_utf_continue,
+ [192 ... 255] = &&l_bad
+ };
+ static void *goesc[] =
+ {
+ [0 ... 255] = &&l_bad,
+ ['"'] = &&l_unesc, ['\\'] = &&l_unesc, ['/'] = &&l_unesc, ['b'] = &&l_unesc,
+ ['f'] = &&l_unesc, ['n'] = &&l_unesc, ['r'] = &&l_unesc, ['t'] = &&l_unesc, ['u'] = &&l_unesc
+ };
+ void **go = gostruct;
+
+ if(!json || jlen <= 0 || !vlen) return 0;
+ *vlen = 0;
+
+ // no key is array mode, klen provides requested index
+ if(!key)
+ {
+ index = klen;
+ klen = 0;
+ }else{
+ if(klen <= 0) klen = strlen(key); // convenience
+ }
+
+ for(start=cur=json,end=cur+jlen; cur 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#pragma GCC diagnostic pop
+#endif
diff --git a/libpktriggercord/src/src/external/js0n/js0n.h b/libpktriggercord/src/src/external/js0n/js0n.h
new file mode 100644
index 000000000..1656113e0
--- /dev/null
+++ b/libpktriggercord/src/src/external/js0n/js0n.h
@@ -0,0 +1,16 @@
+// key = string to match or null
+// klen = key length (or 0), or if null key then len is the array offset value
+// json = json object or array
+// jlen = length of json
+// vlen = where to store return value length
+// returns pointer to value and sets len to value length, or 0 if not found
+// any parse error will set vlen to the position of the error
+#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+const char *js0n(const char *key, size_t klen,
+ const char *json, size_t jlen, size_t *vlen);
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
diff --git a/libpktriggercord/src/src/external/readme.txt b/libpktriggercord/src/src/external/readme.txt
new file mode 100644
index 000000000..a932efaff
--- /dev/null
+++ b/libpktriggercord/src/src/external/readme.txt
@@ -0,0 +1,3 @@
+This directory contains external source files:
+
+js0n - https://github.com/quartzjer/js0n by Jeremie Miller
diff --git a/libricohcamerasdk/3rdparty/libmtp.patch b/libricohcamerasdk/3rdparty/libmtp.patch
new file mode 100644
index 000000000..2b486f1f2
--- /dev/null
+++ b/libricohcamerasdk/3rdparty/libmtp.patch
@@ -0,0 +1,43932 @@
+diff --git a/3rdparty/libmtp/CMakeLists.txt b/3rdparty/libmtp/CMakeLists.txt
+new file mode 100644
+index 0000000..94a6b10
+--- /dev/null
++++ b/3rdparty/libmtp/CMakeLists.txt
+@@ -0,0 +1,12 @@
++include(ExternalProject)
++
++ExternalProject_Add(
++ libmtp
++ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
++ CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/libmtp --disable-static
++ BUILD_COMMAND $(MAKE)
++ INSTALL_COMMAND $(MAKE) install-exec)
++
++add_library(mtp SHARED IMPORTED GLOBAL)
++set_target_properties(mtp
++ PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/libmtp/lib/libmtp.so)
+diff --git a/3rdparty/libmtp/Makefile.in b/3rdparty/libmtp/Makefile.in
+index d7683a2..da9cc08 100644
+--- a/3rdparty/libmtp/Makefile.in
++++ b/3rdparty/libmtp/Makefile.in
+@@ -363,6 +363,7 @@ pdfdir = @pdfdir@
+ prefix = @prefix@
+ program_transform_name = @program_transform_name@
+ psdir = @psdir@
++runstatedir = @runstatedir@
+ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+ srcdir = @srcdir@
+@@ -687,7 +688,7 @@ distdir: $(DISTFILES)
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+ dist-gzip: distdir
+- tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
++ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+ dist-bzip2: distdir
+@@ -713,7 +714,7 @@ dist-shar: distdir
+ @echo WARNING: "Support for shar distribution archives is" \
+ "deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+- shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
++ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__post_remove_distdir)
+
+ dist-zip: distdir
+@@ -731,7 +732,7 @@ dist dist-all:
+ distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+- eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
++ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+@@ -741,7 +742,7 @@ distcheck: dist
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+- eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
++ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+diff --git a/3rdparty/libmtp/aclocal.m4 b/3rdparty/libmtp/aclocal.m4
+index 857847a..2bf2ed8 100644
+--- a/3rdparty/libmtp/aclocal.m4
++++ b/3rdparty/libmtp/aclocal.m4
+@@ -21,7 +21,7 @@ If you have problems, you may need to regenerate the build system entirely.
+ To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+ # lib-ld.m4 serial 6
+-dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc.
++dnl Copyright (C) 1996-2003, 2009-2015 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+@@ -141,7 +141,7 @@ AC_LIB_PROG_LD_GNU
+ ])
+
+ # lib-link.m4 serial 26 (gettext-0.18.2)
+-dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
++dnl Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+@@ -919,7 +919,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+ ])
+
+ # lib-prefix.m4 serial 7 (gettext-0.18)
+-dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc.
++dnl Copyright (C) 2001-2005, 2008-2015 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+diff --git a/3rdparty/libmtp/autom4te.cache/output.0 b/3rdparty/libmtp/autom4te.cache/output.0
+new file mode 100644
+index 0000000..453fbbb
+--- /dev/null
++++ b/3rdparty/libmtp/autom4te.cache/output.0
+@@ -0,0 +1,18412 @@
++@%:@! /bin/sh
++@%:@ Guess values for system-dependent variables and create Makefiles.
++@%:@ Generated by GNU Autoconf 2.69 for libmtp 1.1.13.
++@%:@
++@%:@ Report bugs to .
++@%:@
++@%:@
++@%:@ Copyright (C) 1992-1996, 1998-2012 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
++if test -n "${ZSH_VERSION+set}" && (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
++ case `(set -o) 2>/dev/null` in @%:@(
++ *posix*) :
++ set -o posix ;; @%:@(
++ *) :
++ ;;
++esac
++fi
++
++
++as_nl='
++'
++export as_nl
++# Printing a long string crashes Solaris 7 /usr/bin/printf.
++as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
++# Prefer a ksh shell builtin over an external printf program on Solaris,
++# but without wasting forks for bash or zsh.
++if test -z "$BASH_VERSION$ZSH_VERSION" \
++ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
++ as_echo='print -r --'
++ as_echo_n='print -rn --'
++elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
++ as_echo='printf %s\n'
++ as_echo_n='printf %s'
++else
++ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
++ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
++ as_echo_n='/usr/ucb/echo -n'
++ else
++ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
++ as_echo_n_body='eval
++ arg=$1;
++ case $arg in @%:@(
++ *"$as_nl"*)
++ expr "X$arg" : "X\\(.*\\)$as_nl";
++ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
++ esac;
++ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
++ '
++ export as_echo_n_body
++ as_echo_n='sh -c $as_echo_n_body as_echo'
++ fi
++ export as_echo_body
++ as_echo='sh -c $as_echo_body as_echo'
++fi
++
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; 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
++
++
++# IFS
++# We need space, tab and new line, in precisely that order. Quoting is
++# there to prevent editors from complaining about space-tab.
++# (If _AS_PATH_WALK were called with IFS unset, it would disable word
++# splitting by setting IFS to empty value.)
++IFS=" "" $as_nl"
++
++# 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
++ test -z "$as_dir" && as_dir=.
++ 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
++ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
++ exit 1
++fi
++
++# Unset variables that we do not need and which cause bugs (e.g. in
++# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
++# suppresses any "Segmentation fault" message there. '((' could
++# trigger a bug in pdksh 5.2.14.
++for as_var in BASH_ENV ENV MAIL MAILPATH
++do eval test x\${$as_var+set} = xset \
++ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
++done
++PS1='$ '
++PS2='> '
++PS4='+ '
++
++# NLS nuisances.
++LC_ALL=C
++export LC_ALL
++LANGUAGE=C
++export LANGUAGE
++
++# CDPATH.
++(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
++
++# 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'.
++$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
++as_fn_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="if test -n \"\${ZSH_VERSION+set}\" && (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
++ 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
++ exitcode=1; echo positional parameters were not saved.
++fi
++test x\$exitcode = x0 || 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
++
++ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
++ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
++ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
++ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
++ PATH=/empty FPATH=/empty; export PATH FPATH
++ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
++ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
++test \$(( 1 + 1 )) = 2 || exit 1"
++ if (eval "$as_required") 2>/dev/null; then :
++ as_have_required=yes
++else
++ as_have_required=no
++fi
++ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
++
++else
++ 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
++ test -z "$as_dir" && as_dir=.
++ 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_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
++ CONFIG_SHELL=$as_shell as_have_required=yes
++ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
++ break 2
++fi
++fi
++ done;;
++ esac
++ as_found=false
++done
++$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
++ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
++ CONFIG_SHELL=$SHELL as_have_required=yes
++fi; }
++IFS=$as_save_IFS
++
++
++ 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'.
++$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
++exit 255
++fi
++
++ if test x$as_have_required = xno; then :
++ $as_echo "$0: This script requires a shell more modern than all"
++ $as_echo "$0: the shells that I found on your system."
++ if test x${ZSH_VERSION+set} = xset ; then
++ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
++ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
++ else
++ $as_echo "$0: Please tell bug-autoconf@gnu.org and
++$0: libmtp-discuss@lists.sourceforge.net about your system,
++$0: including any error possibly output before this
++$0: message. Then install a modern shell, or manually run
++$0: the script 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 @S|@? 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_mkdir_p
++@%:@ -------------
++@%:@ Create "@S|@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=`$as_echo "$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 ||
++$as_echo 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_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 @S|@as_val. Take advantage of shells that can avoid forks. The arguments
++@%:@ must be portable across @S|@(()) and expr.
++if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
++ eval 'as_fn_arith ()
++ {
++ as_val=$(( $* ))
++ }'
++else
++ as_fn_arith ()
++ {
++ as_val=`expr "$@" || test $? -eq 1`
++ }
++fi # as_fn_arith
++
++
++@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD]
++@%:@ ----------------------------------------
++@%:@ Output "`basename @S|@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
++ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
++ fi
++ $as_echo "$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 ||
++$as_echo 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" ||
++ { $as_echo "$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
++}
++
++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
++
++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'"
++
++SHELL=${CONFIG_SHELL-/bin/sh}
++
++
++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=.
++LIB@&t@OBJS=
++cross_compiling=no
++subdirs=
++MFLAGS=
++MAKEFLAGS=
++
++# Identity of this package.
++PACKAGE_NAME='libmtp'
++PACKAGE_TARNAME='libmtp'
++PACKAGE_VERSION='1.1.13'
++PACKAGE_STRING='libmtp 1.1.13'
++PACKAGE_BUGREPORT='libmtp-discuss@lists.sourceforge.net'
++PACKAGE_URL=''
++
++ac_unique_file="src/libmtp.c"
++# Factoring default headers for most tests.
++ac_includes_default="\
++#include
++#ifdef HAVE_SYS_TYPES_H
++# include
++#endif
++#ifdef HAVE_SYS_STAT_H
++# include
++#endif
++#ifdef STDC_HEADERS
++# include
++# include
++#else
++# ifdef HAVE_STDLIB_H
++# include
++# endif
++#endif
++#ifdef HAVE_STRING_H
++# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
++# include
++# endif
++# include
++#endif
++#ifdef HAVE_STRINGS_H
++# include
++#endif
++#ifdef HAVE_INTTYPES_H
++# include
++#endif
++#ifdef HAVE_STDINT_H
++# include
++#endif
++#ifdef HAVE_UNISTD_H
++# include
++#endif"
++
++ac_subst_vars='am__EXEEXT_FALSE
++am__EXEEXT_TRUE
++LTLIBOBJS
++effective_target
++LIB@&t@OBJS
++LIBOPENUSB_COMPILE_FALSE
++LIBOPENUSB_COMPILE_TRUE
++LIBUSB0_COMPILE_FALSE
++LIBUSB0_COMPILE_TRUE
++LIBUSB1_COMPILE_FALSE
++LIBUSB1_COMPILE_TRUE
++MTPZ_COMPILE_FALSE
++MTPZ_COMPILE_TRUE
++LIBUSB_REQUIRES
++LIBUSB_LIBS
++LIBUSB_CFLAGS
++PKG_CONFIG_LIBDIR
++PKG_CONFIG_PATH
++PKG_CONFIG
++MS_LIB_EXE_FALSE
++MS_LIB_EXE_TRUE
++ms_lib_exe
++COMPILE_MINGW32_FALSE
++COMPILE_MINGW32_TRUE
++USE_LINUX_FALSE
++USE_LINUX_TRUE
++OSFLAGS
++HAVE_DOXYGEN_FALSE
++HAVE_DOXYGEN_TRUE
++HAVE_DOXYGEN
++UDEV_MODE
++UDEV_GROUP
++UDEV_RULES
++UDEV
++LTLIBICONV
++LIBICONV
++CPP
++LT_SYS_LIBRARY_PATH
++OTOOL64
++OTOOL
++LIPO
++NMEDIT
++DSYMUTIL
++MANIFEST_TOOL
++RANLIB
++ac_ct_AR
++AR
++NM
++ac_ct_DUMPBIN
++DUMPBIN
++LD
++FGREP
++EGREP
++GREP
++SED
++LIBTOOL
++OBJDUMP
++DLLTOOL
++AS
++host_os
++host_vendor
++host_cpu
++host
++build_os
++build_vendor
++build_cpu
++build
++LN_S
++am__fastdepCC_FALSE
++am__fastdepCC_TRUE
++CCDEPMODE
++am__nodep
++AMDEPBACKSLASH
++AMDEP_FALSE
++AMDEP_TRUE
++am__quote
++am__include
++DEPDIR
++OBJEXT
++EXEEXT
++ac_ct_CC
++CPPFLAGS
++LDFLAGS
++CFLAGS
++CC
++AM_BACKSLASH
++AM_DEFAULT_VERBOSITY
++AM_DEFAULT_V
++AM_V
++am__untar
++am__tar
++AMTAR
++am__leading_dot
++SET_MAKE
++AWK
++mkdir_p
++MKDIR_P
++INSTALL_STRIP_PROGRAM
++STRIP
++install_sh
++MAKEINFO
++AUTOHEADER
++AUTOMAKE
++AUTOCONF
++ACLOCAL
++VERSION
++PACKAGE
++CYGPATH_W
++am__isrc
++INSTALL_DATA
++INSTALL_SCRIPT
++INSTALL_PROGRAM
++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
++enable_silent_rules
++enable_dependency_tracking
++enable_shared
++enable_static
++with_pic
++enable_fast_install
++with_aix_soname
++with_gnu_ld
++with_sysroot
++enable_libtool_lock
++enable_rpath
++with_libiconv_prefix
++with_udev
++with_udev_rules
++with_udev_group
++with_udev_mode
++enable_doxygen
++enable_mtpz
++enable_largefile
++'
++ ac_precious_vars='build_alias
++host_alias
++target_alias
++CC
++CFLAGS
++LDFLAGS
++LIBS
++CPPFLAGS
++LT_SYS_LIBRARY_PATH
++CPP
++PKG_CONFIG
++PKG_CONFIG_PATH
++PKG_CONFIG_LIBDIR
++LIBUSB_CFLAGS
++LIBUSB_LIBS'
++
++
++# 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
++
++ # Accept the important Cygnus configure options, so we can diagnose typos.
++
++ 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=`$as_echo "$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=`$as_echo "$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=`$as_echo "$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=`$as_echo "$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.
++ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
++ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
++ $as_echo "$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" ;;
++ *) $as_echo "$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 ||
++$as_echo 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 libmtp 1.1.13 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
++ @<:@@S|@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/libmtp@:>@
++ --htmldir=DIR html documentation [DOCDIR]
++ --dvidir=DIR dvi documentation [DOCDIR]
++ --pdfdir=DIR pdf documentation [DOCDIR]
++ --psdir=DIR ps documentation [DOCDIR]
++_ACEOF
++
++ cat <<\_ACEOF
++
++Program names:
++ --program-prefix=PREFIX prepend PREFIX to installed program names
++ --program-suffix=SUFFIX append SUFFIX to installed program names
++ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
++
++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 libmtp 1.1.13:";;
++ esac
++ cat <<\_ACEOF
++
++Optional Features:
++ --disable-option-checking ignore unrecognized --enable/--with options
++ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
++ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
++ --enable-silent-rules less verbose build output (undo: "make V=1")
++ --disable-silent-rules verbose build output (undo: "make V=0")
++ --enable-dependency-tracking
++ do not reject slow dependency extractors
++ --disable-dependency-tracking
++ speeds up one-time build
++ --enable-shared@<:@=PKGS@:>@ build shared libraries @<:@default=yes@:>@
++ --enable-static@<:@=PKGS@:>@ build static libraries @<:@default=yes@:>@
++ --enable-fast-install@<:@=PKGS@:>@
++ optimize for fast installation @<:@default=yes@:>@
++ --disable-libtool-lock avoid locking (might break parallel builds)
++ --disable-rpath do not hardcode runtime library paths
++ --enable-doxygen Build API documentation using Doxygen @<:@default=auto@:>@
++ --disable-mtpz Disable functionality to connect to MTPZ devices
++ (e.g. Zune)
++ --disable-largefile omit support for large files
++
++Optional Packages:
++ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
++ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-pic@<:@=PKGS@:>@ try to use only PIC/non-PIC objects @<:@default=use
++ both@:>@
++ --with-aix-soname=aix|svr4|both
++ shared library versioning (aka "SONAME") variant to
++ provide on AIX, @<:@default=aix@:>@.
++ --with-gnu-ld assume the C compiler uses GNU ld @<:@default=no@:>@
++ --with-sysroot@<:@=DIR@:>@ Search for dependent libraries within DIR (or the
++ compiler's sysroot if not specified).
++ --with-gnu-ld assume the C compiler uses GNU ld @<:@default=no@:>@
++ --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
++ --without-libiconv-prefix don't search for libiconv in includedir and libdir
++ --with-udev=DIR directory where udev is installed
++ @<:@default=/usr/lib/udev@:>@
++ --with-udev-rules=NAME file name for udev rules @<:@default=69-libmtp.rules@:>@
++ --with-udev-group=GROUP file group for device nodes @<:@default: none
++ specified@:>@
++ --with-udev-mode=GROUP file mode for device nodes @<:@default: none specified@:>@
++
++Some influential environment variables:
++ CC C compiler command
++ CFLAGS 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
++ LT_SYS_LIBRARY_PATH
++ User-defined run-time library search path.
++ CPP C preprocessor
++ PKG_CONFIG path to pkg-config utility
++ PKG_CONFIG_PATH
++ directories to add to pkg-config's search path
++ PKG_CONFIG_LIBDIR
++ path overriding pkg-config's built-in search path
++ LIBUSB_CFLAGS
++ C compiler flags for LIBUSB, overriding pkg-config
++ LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config
++
++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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
++ # A ".." for each directory in $ac_dir_suffix.
++ ac_top_builddir_sub=`$as_echo "$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 guested configure.
++ 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
++ $as_echo "$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
++libmtp configure 1.1.13
++generated by GNU Autoconf 2.69
++
++Copyright (C) 2012 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_c_try_compile LINENO
++@%:@ --------------------------
++@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded.
++ac_fn_c_try_compile ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ rm -f conftest.$ac_objext
++ 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\""
++$as_echo "$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
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; } && {
++ test -z "$ac_c_werror_flag" ||
++ test ! -s conftest.err
++ } && test -s conftest.$ac_objext; then :
++ ac_retval=0
++else
++ $as_echo "$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_c_try_compile
++
++@%:@ ac_fn_c_try_link LINENO
++@%:@ -----------------------
++@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded.
++ac_fn_c_try_link ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ rm -f conftest.$ac_objext 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\""
++$as_echo "$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
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; } && {
++ test -z "$ac_c_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_echo "$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_c_try_link
++
++@%:@ ac_fn_c_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_c_check_header_compile ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if eval \${$3+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$4
++@%:@include <$2>
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ eval "$3=yes"
++else
++ eval "$3=no"
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++eval ac_res=\$$3
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
++
++} @%:@ ac_fn_c_check_header_compile
++
++@%:@ ac_fn_c_try_cpp LINENO
++@%:@ ----------------------
++@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded.
++ac_fn_c_try_cpp ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ if { { ac_try="$ac_cpp conftest.$ac_ext"
++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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_cpp conftest.$ac_ext") 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
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; } > conftest.i && {
++ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
++ test ! -s conftest.err
++ }; then :
++ ac_retval=0
++else
++ $as_echo "$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_c_try_cpp
++
++@%:@ ac_fn_c_try_run LINENO
++@%:@ ----------------------
++@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes
++@%:@ that executables *can* be run.
++ac_fn_c_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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_link") 2>&5
++ ac_status=$?
++ $as_echo "$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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_try") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; }; then :
++ ac_retval=0
++else
++ $as_echo "$as_me: program exited with status $ac_status" >&5
++ $as_echo "$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_c_try_run
++
++@%:@ ac_fn_c_check_func LINENO FUNC VAR
++@%:@ ----------------------------------
++@%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly
++ac_fn_c_check_func ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if eval \${$3+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ 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.
++ Prefer to if __STDC__ is defined, since
++ exists even on freestanding compilers. */
++
++#ifdef __STDC__
++# include
++#else
++# include
++#endif
++
++#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 ()
++{
++return $2 ();
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ eval "$3=yes"
++else
++ eval "$3=no"
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++fi
++eval ac_res=\$$3
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
++
++} @%:@ ac_fn_c_check_func
++
++@%:@ ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
++@%:@ -------------------------------------------------------
++@%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using
++@%:@ the include files in INCLUDES and setting the cache variable VAR
++@%:@ accordingly.
++ac_fn_c_check_header_mongrel ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ if eval \${$3+:} false; then :
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if eval \${$3+:} false; then :
++ $as_echo_n "(cached) " >&6
++fi
++eval ac_res=\$$3
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++else
++ # Is the header compilable?
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
++$as_echo_n "checking $2 usability... " >&6; }
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$4
++@%:@include <$2>
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ ac_header_compiler=yes
++else
++ ac_header_compiler=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
++$as_echo "$ac_header_compiler" >&6; }
++
++# Is the header present?
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
++$as_echo_n "checking $2 presence... " >&6; }
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++@%:@include <$2>
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++ ac_header_preproc=yes
++else
++ ac_header_preproc=no
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
++$as_echo "$ac_header_preproc" >&6; }
++
++# So? What about this header?
++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
++ yes:no: )
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
++$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
++$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
++ ;;
++ no:yes:* )
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
++$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
++$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
++$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
++$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
++$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
++( $as_echo "## --------------------------------------------------- ##
++## Report this to libmtp-discuss@lists.sourceforge.net ##
++## --------------------------------------------------- ##"
++ ) | sed "s/^/$as_me: WARNING: /" >&2
++ ;;
++esac
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if eval \${$3+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ eval "$3=\$ac_header_compiler"
++fi
++eval ac_res=\$$3
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++fi
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
++
++} @%:@ ac_fn_c_check_header_mongrel
++
++@%:@ ac_fn_c_check_type LINENO TYPE VAR INCLUDES
++@%:@ -------------------------------------------
++@%:@ Tests whether TYPE exists after having included INCLUDES, setting cache
++@%:@ variable VAR accordingly.
++ac_fn_c_check_type ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if eval \${$3+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ eval "$3=no"
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$4
++int
++main ()
++{
++if (sizeof ($2))
++ return 0;
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$4
++int
++main ()
++{
++if (sizeof (($2)))
++ return 0;
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++else
++ eval "$3=yes"
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++eval ac_res=\$$3
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
++
++} @%:@ ac_fn_c_check_type
++
++@%:@ ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
++@%:@ ----------------------------------------------------
++@%:@ Tries to find if the field MEMBER exists in type AGGR, after including
++@%:@ INCLUDES, setting cache variable VAR accordingly.
++ac_fn_c_check_member ()
++{
++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
++$as_echo_n "checking for $2.$3... " >&6; }
++if eval \${$4+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$5
++int
++main ()
++{
++static $2 ac_aggr;
++if (ac_aggr.$3)
++return 0;
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ eval "$4=yes"
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$5
++int
++main ()
++{
++static $2 ac_aggr;
++if (sizeof ac_aggr.$3)
++return 0;
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ eval "$4=yes"
++else
++ eval "$4=no"
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++eval ac_res=\$$4
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
++
++} @%:@ ac_fn_c_check_member
++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 libmtp $as_me 1.1.13, which was
++generated by GNU Autoconf 2.69. Invocation command line was
++
++ $ $0 $@
++
++_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
++ test -z "$as_dir" && as_dir=.
++ $as_echo "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=`$as_echo "$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=$?
++ # Save into config.log some information that might help in debugging.
++ {
++ echo
++
++ $as_echo "## ---------------- ##
++## 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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
++$as_echo "$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
++
++ $as_echo "## ----------------- ##
++## Output variables. ##
++## ----------------- ##"
++ echo
++ for ac_var in $ac_subst_vars
++ do
++ eval ac_val=\$$ac_var
++ case $ac_val in
++ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
++ esac
++ $as_echo "$ac_var='\''$ac_val'\''"
++ done | sort
++ echo
++
++ if test -n "$ac_subst_files"; then
++ $as_echo "## ------------------- ##
++## File substitutions. ##
++## ------------------- ##"
++ echo
++ for ac_var in $ac_subst_files
++ do
++ eval ac_val=\$$ac_var
++ case $ac_val in
++ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
++ esac
++ $as_echo "$ac_var='\''$ac_val'\''"
++ done | sort
++ echo
++ fi
++
++ if test -s confdefs.h; then
++ $as_echo "## ----------- ##
++## confdefs.h. ##
++## ----------- ##"
++ echo
++ cat confdefs.h
++ echo
++ fi
++ test "$ac_signal" != 0 &&
++ $as_echo "$as_me: caught signal $ac_signal"
++ $as_echo "$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
++
++$as_echo "/* confdefs.h */" > confdefs.h
++
++# Predefined preprocessor variables.
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE_NAME "$PACKAGE_NAME"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE_VERSION "$PACKAGE_VERSION"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE_STRING "$PACKAGE_STRING"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE_URL "$PACKAGE_URL"
++_ACEOF
++
++
++# Let the site file select an alternate cache file if it wants to.
++# Prefer an explicitly selected file to automatically selected ones.
++ac_site_file1=NONE
++ac_site_file2=NONE
++if test -n "$CONFIG_SITE"; then
++ # We do not want a PATH search for config.site.
++ case $CONFIG_SITE in @%:@((
++ -*) ac_site_file1=./$CONFIG_SITE;;
++ */*) ac_site_file1=$CONFIG_SITE;;
++ *) ac_site_file1=./$CONFIG_SITE;;
++ esac
++elif test "x$prefix" != xNONE; then
++ ac_site_file1=$prefix/share/config.site
++ ac_site_file2=$prefix/etc/config.site
++else
++ ac_site_file1=$ac_default_prefix/share/config.site
++ ac_site_file2=$ac_default_prefix/etc/config.site
++fi
++for ac_site_file in "$ac_site_file1" "$ac_site_file2"
++do
++ test "x$ac_site_file" = xNONE && continue
++ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
++$as_echo "$as_me: loading site script $ac_site_file" >&6;}
++ sed 's/^/| /' "$ac_site_file" >&5
++ . "$ac_site_file" \
++ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$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
++ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
++$as_echo "$as_me: loading cache $cache_file" >&6;}
++ case $cache_file in
++ [\\/]* | ?:[\\/]* ) . "$cache_file";;
++ *) . "./$cache_file";;
++ esac
++ fi
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
++$as_echo "$as_me: creating cache $cache_file" >&6;}
++ >$cache_file
++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,)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
++$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
++ ac_cache_corrupted=: ;;
++ ,set)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
++$as_echo "$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
++ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
++$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
++ ac_cache_corrupted=:
++ else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
++$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
++ eval $ac_var=\$ac_old_val
++ fi
++ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
++$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
++$as_echo "$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=`$as_echo "$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
++ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
++$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
++ as_fn_error $? "run \`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
++
++
++
++am__api_version='1.15'
++
++ac_aux_dir=
++for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
++ if test -f "$ac_dir/install-sh"; then
++ ac_aux_dir=$ac_dir
++ ac_install_sh="$ac_aux_dir/install-sh -c"
++ break
++ elif test -f "$ac_dir/install.sh"; then
++ ac_aux_dir=$ac_dir
++ ac_install_sh="$ac_aux_dir/install.sh -c"
++ break
++ elif test -f "$ac_dir/shtool"; then
++ ac_aux_dir=$ac_dir
++ ac_install_sh="$ac_aux_dir/shtool install -c"
++ break
++ fi
++done
++if test -z "$ac_aux_dir"; then
++ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$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.
++ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
++ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
++ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
++
++
++# Find a good install program. We prefer a C program (faster),
++# so one script is as good as another. But avoid the broken or
++# incompatible versions:
++# SysV /etc/install, /usr/sbin/install
++# SunOS /usr/etc/install
++# IRIX /sbin/install
++# AIX /bin/install
++# AmigaOS /C/install, which installs bootblocks on floppy discs
++# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
++# AFS /usr/afsws/bin/install, which mishandles nonexistent args
++# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
++# OS/2's system install, which has a completely different semantic
++# ./install, which can be erroneously created by make from ./install.sh.
++# Reject install programs that cannot install multiple files.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
++$as_echo_n "checking for a BSD-compatible install... " >&6; }
++if test -z "$INSTALL"; then
++if ${ac_cv_path_install+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ # Account for people who put trailing slashes in PATH elements.
++case $as_dir/ in @%:@((
++ ./ | .// | /[cC]/* | \
++ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
++ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
++ /usr/ucb/* ) ;;
++ *)
++ # OSF1 and SCO ODT 3.0 have their own names for install.
++ # Don't use installbsd from OSF since it installs stuff as root
++ # by default.
++ for ac_prog in ginstall scoinst install; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
++ if test $ac_prog = install &&
++ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
++ # AIX install. It has an incompatible calling convention.
++ :
++ elif test $ac_prog = install &&
++ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
++ # program-specific install script used by HP pwplus--don't use.
++ :
++ else
++ rm -rf conftest.one conftest.two conftest.dir
++ echo one > conftest.one
++ echo two > conftest.two
++ mkdir conftest.dir
++ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
++ test -s conftest.one && test -s conftest.two &&
++ test -s conftest.dir/conftest.one &&
++ test -s conftest.dir/conftest.two
++ then
++ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
++ break 3
++ fi
++ fi
++ fi
++ done
++ done
++ ;;
++esac
++
++ done
++IFS=$as_save_IFS
++
++rm -rf conftest.one conftest.two conftest.dir
++
++fi
++ if test "${ac_cv_path_install+set}" = set; then
++ INSTALL=$ac_cv_path_install
++ else
++ # As a last resort, use the slow shell script. Don't cache a
++ # value for INSTALL within a source directory, because that will
++ # break other packages using the cache if that directory is
++ # removed, or if the value is a relative name.
++ INSTALL=$ac_install_sh
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
++$as_echo "$INSTALL" >&6; }
++
++# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
++# It thinks the first close brace ends the variable substitution.
++test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
++
++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
++
++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
++$as_echo_n "checking whether build environment is sane... " >&6; }
++# Reject unsafe characters in $srcdir or the absolute working directory
++# name. Accept space and tab only in the latter.
++am_lf='
++'
++case `pwd` in
++ *[\\\"\#\$\&\'\`$am_lf]*)
++ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
++esac
++case $srcdir in
++ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
++ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
++esac
++
++# Do 'set' in a subshell so we don't clobber the current shell's
++# arguments. Must try -L first in case configure is actually a
++# symlink; some systems play weird games with the mod time of symlinks
++# (eg FreeBSD returns the mod time of the symlink's containing
++# directory).
++if (
++ am_has_slept=no
++ for am_try in 1 2; do
++ echo "timestamp, slept: $am_has_slept" > conftest.file
++ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
++ if test "$*" = "X"; then
++ # -L didn't work.
++ set X `ls -t "$srcdir/configure" conftest.file`
++ fi
++ if test "$*" != "X $srcdir/configure conftest.file" \
++ && test "$*" != "X conftest.file $srcdir/configure"; then
++
++ # If neither matched, then we have a broken ls. This can happen
++ # if, for instance, CONFIG_SHELL is bash and it inherits a
++ # broken ls alias from the environment. This has actually
++ # happened. Such a system could not be considered "sane".
++ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
++ alias in your environment" "$LINENO" 5
++ fi
++ if test "$2" = conftest.file || test $am_try -eq 2; then
++ break
++ fi
++ # Just in case.
++ sleep 1
++ am_has_slept=yes
++ done
++ test "$2" = conftest.file
++ )
++then
++ # Ok.
++ :
++else
++ as_fn_error $? "newly created file is older than distributed files!
++Check your system clock" "$LINENO" 5
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++# If we didn't sleep, we still need to ensure time stamps of config.status and
++# generated files are strictly newer.
++am_sleep_pid=
++if grep 'slept: no' conftest.file >/dev/null 2>&1; then
++ ( sleep 1 ) &
++ am_sleep_pid=$!
++fi
++
++rm -f conftest.file
++
++test "$program_prefix" != NONE &&
++ program_transform_name="s&^&$program_prefix&;$program_transform_name"
++# Use a double $ so make ignores it.
++test "$program_suffix" != NONE &&
++ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
++# Double any \ or $.
++# By default was `s,x,x', remove it if useless.
++ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
++program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
++
++# Expand $ac_aux_dir to an absolute path.
++am_aux_dir=`cd "$ac_aux_dir" && pwd`
++
++if test x"${MISSING+set}" != xset; then
++ case $am_aux_dir in
++ *\ * | *\ *)
++ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
++ *)
++ MISSING="\${SHELL} $am_aux_dir/missing" ;;
++ esac
++fi
++# Use eval to expand $SHELL
++if eval "$MISSING --is-lightweight"; then
++ am_missing_run="$MISSING "
++else
++ am_missing_run=
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
++$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
++fi
++
++if test x"${install_sh+set}" != xset; then
++ case $am_aux_dir in
++ *\ * | *\ *)
++ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
++ *)
++ install_sh="\${SHELL} $am_aux_dir/install-sh"
++ esac
++fi
++
++# Installed binaries are usually stripped using 'strip' when the user
++# run "make install-strip". However 'strip' might not be the right
++# tool to use in cross-compilation environments, therefore Automake
++# will honor the 'STRIP' environment variable to overrule this program.
++if test "$cross_compiling" != no; then
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
++set dummy ${ac_tool_prefix}strip; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_STRIP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$STRIP"; then
++ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_STRIP="${ac_tool_prefix}strip"
++ $as_echo "$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
++STRIP=$ac_cv_prog_STRIP
++if test -n "$STRIP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
++$as_echo "$STRIP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_STRIP"; then
++ ac_ct_STRIP=$STRIP
++ # Extract the first word of "strip", so it can be a program name with args.
++set dummy strip; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_STRIP"; then
++ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_STRIP="strip"
++ $as_echo "$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_STRIP=$ac_cv_prog_ac_ct_STRIP
++if test -n "$ac_ct_STRIP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
++$as_echo "$ac_ct_STRIP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_STRIP" = x; then
++ STRIP=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ STRIP=$ac_ct_STRIP
++ fi
++else
++ STRIP="$ac_cv_prog_STRIP"
++fi
++
++fi
++INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
++$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
++if test -z "$MKDIR_P"; then
++ if ${ac_cv_path_mkdir+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_prog in mkdir gmkdir; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
++ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
++ 'mkdir (GNU coreutils) '* | \
++ 'mkdir (coreutils) '* | \
++ 'mkdir (fileutils) '4.1*)
++ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
++ break 3;;
++ esac
++ done
++ done
++ done
++IFS=$as_save_IFS
++
++fi
++
++ test -d ./--version && rmdir ./--version
++ if test "${ac_cv_path_mkdir+set}" = set; then
++ MKDIR_P="$ac_cv_path_mkdir -p"
++ else
++ # As a last resort, use the slow shell script. Don't cache a
++ # value for MKDIR_P within a source directory, because that will
++ # break other packages using the cache if that directory is
++ # removed, or if the value is a relative name.
++ MKDIR_P="$ac_install_sh -d"
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
++$as_echo "$MKDIR_P" >&6; }
++
++for ac_prog in gawk mawk nawk awk
++do
++ # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_AWK+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$AWK"; then
++ ac_cv_prog_AWK="$AWK" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_AWK="$ac_prog"
++ $as_echo "$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
++AWK=$ac_cv_prog_AWK
++if test -n "$AWK"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
++$as_echo "$AWK" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$AWK" && break
++done
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
++$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
++set x ${MAKE-make}
++ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
++if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat >conftest.make <<\_ACEOF
++SHELL = /bin/sh
++all:
++ @echo '@@@%%%=$(MAKE)=@@@%%%'
++_ACEOF
++# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
++case `${MAKE-make} -f conftest.make 2>/dev/null` in
++ *@@@%%%=?*=@@@%%%*)
++ eval ac_cv_prog_make_${ac_make}_set=yes;;
++ *)
++ eval ac_cv_prog_make_${ac_make}_set=no;;
++esac
++rm -f conftest.make
++fi
++if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++ SET_MAKE=
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ SET_MAKE="MAKE=${MAKE-make}"
++fi
++
++rm -rf .tst 2>/dev/null
++mkdir .tst 2>/dev/null
++if test -d .tst; then
++ am__leading_dot=.
++else
++ am__leading_dot=_
++fi
++rmdir .tst 2>/dev/null
++
++@%:@ Check whether --enable-silent-rules was given.
++if test "${enable_silent_rules+set}" = set; then :
++ enableval=$enable_silent_rules;
++fi
++
++case $enable_silent_rules in @%:@ (((
++ yes) AM_DEFAULT_VERBOSITY=0;;
++ no) AM_DEFAULT_VERBOSITY=1;;
++ *) AM_DEFAULT_VERBOSITY=1;;
++esac
++am_make=${MAKE-make}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
++$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
++if ${am_cv_make_support_nested_variables+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if $as_echo 'TRUE=$(BAR$(V))
++BAR0=false
++BAR1=true
++V=1
++am__doit:
++ @$(TRUE)
++.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
++ am_cv_make_support_nested_variables=yes
++else
++ am_cv_make_support_nested_variables=no
++fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
++$as_echo "$am_cv_make_support_nested_variables" >&6; }
++if test $am_cv_make_support_nested_variables = yes; then
++ AM_V='$(V)'
++ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
++else
++ AM_V=$AM_DEFAULT_VERBOSITY
++ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
++fi
++AM_BACKSLASH='\'
++
++if test "`cd $srcdir && pwd`" != "`pwd`"; then
++ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
++ # is not polluted with repeated "-I."
++ am__isrc=' -I$(srcdir)'
++ # test to see if srcdir already configured
++ if test -f $srcdir/config.status; then
++ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
++ fi
++fi
++
++# test whether we have cygpath
++if test -z "$CYGPATH_W"; then
++ if (cygpath --version) >/dev/null 2>/dev/null; then
++ CYGPATH_W='cygpath -w'
++ else
++ CYGPATH_W=echo
++ fi
++fi
++
++
++# Define the identity of the package.
++ PACKAGE='libmtp'
++ VERSION='1.1.13'
++
++
++cat >>confdefs.h <<_ACEOF
++@%:@define PACKAGE "$PACKAGE"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++@%:@define VERSION "$VERSION"
++_ACEOF
++
++# Some tools Automake needs.
++
++ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
++
++
++AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
++
++
++AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
++
++
++AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
++
++
++MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
++
++# For better backward compatibility. To be removed once Automake 1.9.x
++# dies out for good. For more background, see:
++#
++#
++mkdir_p='$(MKDIR_P)'
++
++# We need awk for the "check" target (and possibly the TAP driver). The
++# system "awk" is bad on some platforms.
++# Always define AMTAR for backward compatibility. Yes, it's still used
++# in the wild :-( We should find a proper way to deprecate it ...
++AMTAR='$${TAR-tar}'
++
++
++# We'll loop over all known methods to create a tar archive until one works.
++_am_tools='gnutar pax cpio none'
++
++am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
++
++
++
++
++
++
++# POSIX will say in a future version that running "rm -f" with no argument
++# is OK; and we want to be able to make that assumption in our Makefile
++# recipes. So use an aggressive probe to check that the usage we want is
++# actually supported "in the wild" to an acceptable degree.
++# See automake bug#10828.
++# To make any issue more visible, cause the running configure to be aborted
++# by default if the 'rm' program in use doesn't match our expectations; the
++# user can still override this though.
++if rm -f && rm -fr && rm -rf; then : OK; else
++ cat >&2 <<'END'
++Oops!
++
++Your 'rm' program seems unable to run without file operands specified
++on the command line, even when the '-f' option is present. This is contrary
++to the behaviour of most rm programs out there, and not conforming with
++the upcoming POSIX standard:
++
++Please tell bug-automake@gnu.org about your system, including the value
++of your $PATH and any error possibly output before this message. This
++can help us improve future automake versions.
++
++END
++ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
++ echo 'Configuration will proceed anyway, since you have set the' >&2
++ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
++ echo >&2
++ else
++ cat >&2 <<'END'
++Aborting the configuration process, to ensure you take notice of the issue.
++
++You can download and install GNU coreutils to get an 'rm' implementation
++that behaves properly: .
++
++If you want to complete the configuration process using your problematic
++'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
++to "yes", and re-run configure.
++
++END
++ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
++ fi
++fi
++
++
++ac_config_headers="$ac_config_headers config.h"
++
++
++# Checks for programs.
++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
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
++set dummy ${ac_tool_prefix}gcc; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_CC+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$CC"; then
++ ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_CC="${ac_tool_prefix}gcc"
++ $as_echo "$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
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_CC"; then
++ ac_ct_CC=$CC
++ # Extract the first word of "gcc", so it can be a program name with args.
++set dummy gcc; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_CC+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_CC"; then
++ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_CC="gcc"
++ $as_echo "$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_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
++$as_echo "$ac_ct_CC" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_CC" = x; then
++ CC=""
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ CC=$ac_ct_CC
++ fi
++else
++ CC="$ac_cv_prog_CC"
++fi
++
++if test -z "$CC"; then
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
++set dummy ${ac_tool_prefix}cc; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_CC+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$CC"; then
++ ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_CC="${ac_tool_prefix}cc"
++ $as_echo "$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
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ fi
++fi
++if test -z "$CC"; then
++ # Extract the first word of "cc", so it can be a program name with args.
++set dummy cc; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_CC+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$CC"; then
++ ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++ ac_prog_rejected=no
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
++ ac_prog_rejected=yes
++ continue
++ fi
++ ac_cv_prog_CC="cc"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++if test $ac_prog_rejected = yes; then
++ # We found a bogon in the path, so make sure we never use it.
++ set dummy $ac_cv_prog_CC
++ shift
++ if test $@%:@ != 0; then
++ # We chose a different compiler from the bogus one.
++ # However, it has the same basename, so the bogon will be chosen
++ # first if we set CC to just the basename; use the full file name.
++ shift
++ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
++ fi
++fi
++fi
++fi
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$CC"; then
++ if test -n "$ac_tool_prefix"; then
++ for ac_prog in cl.exe
++ 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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_CC+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$CC"; then
++ ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_CC="$ac_tool_prefix$ac_prog"
++ $as_echo "$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
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$CC" && break
++ done
++fi
++if test -z "$CC"; then
++ ac_ct_CC=$CC
++ for ac_prog in cl.exe
++do
++ # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_CC+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_CC"; then
++ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_CC="$ac_prog"
++ $as_echo "$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_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
++$as_echo "$ac_ct_CC" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$ac_ct_CC" && break
++done
++
++ if test "x$ac_ct_CC" = x; then
++ CC=""
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ CC=$ac_ct_CC
++ fi
++fi
++
++fi
++
++
++test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error $? "no acceptable C compiler found in \$PATH
++See \`config.log' for more details" "$LINENO" 5; }
++
++# Provide some information about the compiler.
++$as_echo "$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\""
++$as_echo "$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
++ $as_echo "$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 ()
++{
++
++ ;
++ 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.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
++$as_echo_n "checking whether the C compiler works... " >&6; }
++ac_link_default=`$as_echo "$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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_link_default") 2>&5
++ ac_status=$?
++ $as_echo "$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+set}" = set && 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
++ ac_file=''
++fi
++if test -z "$ac_file"; then :
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++$as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$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_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
++$as_echo_n "checking for C compiler default output file name... " >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
++$as_echo "$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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
++$as_echo_n "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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_link") 2>&5
++ ac_status=$?
++ $as_echo "$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_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
++$as_echo "$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 ()
++{
++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.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
++$as_echo_n "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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_link") 2>&5
++ ac_status=$?
++ $as_echo "$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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_try") 2>&5
++ ac_status=$?
++ $as_echo "$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
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error $? "cannot run C compiled programs.
++If you meant to cross compile, use \`--host'.
++See \`config.log' for more details" "$LINENO" 5; }
++ fi
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
++$as_echo "$cross_compiling" >&6; }
++
++rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
++ac_clean_files=$ac_clean_files_save
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
++$as_echo_n "checking for suffix of object files... " >&6; }
++if ${ac_cv_objext+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ 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\""
++$as_echo "$ac_try_echo"; } >&5
++ (eval "$ac_compile") 2>&5
++ ac_status=$?
++ $as_echo "$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_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
++$as_echo "$ac_cv_objext" >&6; }
++OBJEXT=$ac_cv_objext
++ac_objext=$OBJEXT
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
++$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
++if ${ac_cv_c_compiler_gnu+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++#ifndef __GNUC__
++ choke me
++#endif
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ ac_compiler_gnu=yes
++else
++ ac_compiler_gnu=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ac_cv_c_compiler_gnu=$ac_compiler_gnu
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
++$as_echo "$ac_cv_c_compiler_gnu" >&6; }
++if test $ac_compiler_gnu = yes; then
++ GCC=yes
++else
++ GCC=
++fi
++ac_test_CFLAGS=${CFLAGS+set}
++ac_save_CFLAGS=$CFLAGS
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
++$as_echo_n "checking whether $CC accepts -g... " >&6; }
++if ${ac_cv_prog_cc_g+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_save_c_werror_flag=$ac_c_werror_flag
++ ac_c_werror_flag=yes
++ ac_cv_prog_cc_g=no
++ CFLAGS="-g"
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ ac_cv_prog_cc_g=yes
++else
++ CFLAGS=""
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++else
++ ac_c_werror_flag=$ac_save_c_werror_flag
++ CFLAGS="-g"
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ ac_cv_prog_cc_g=yes
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ ac_c_werror_flag=$ac_save_c_werror_flag
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
++$as_echo "$ac_cv_prog_cc_g" >&6; }
++if test "$ac_test_CFLAGS" = set; then
++ CFLAGS=$ac_save_CFLAGS
++elif test $ac_cv_prog_cc_g = yes; then
++ if test "$GCC" = yes; then
++ CFLAGS="-g -O2"
++ else
++ CFLAGS="-g"
++ fi
++else
++ if test "$GCC" = yes; then
++ CFLAGS="-O2"
++ else
++ CFLAGS=
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
++$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
++if ${ac_cv_prog_cc_c89+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_cv_prog_cc_c89=no
++ac_save_CC=$CC
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include
++#include
++struct stat;
++/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
++struct buf { int x; };
++FILE * (*rcsopen) (struct buf *, struct stat *, int);
++static char *e (p, i)
++ char **p;
++ int i;
++{
++ return p[i];
++}
++static char *f (char * (*g) (char **, int), char **p, ...)
++{
++ char *s;
++ va_list v;
++ va_start (v,p);
++ s = g (p, va_arg (v,int));
++ va_end (v);
++ return s;
++}
++
++/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
++ function prototypes and stuff, but not '\xHH' hex character constants.
++ These don't provoke an error unfortunately, instead are silently treated
++ as 'x'. The following induces an error, until -std is added to get
++ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
++ array size at least. It's necessary to write '\x00'==0 to get something
++ that's true only with -std. */
++int osf4_cc_array ['\x00' == 0 ? 1 : -1];
++
++/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
++ inside strings and character constants. */
++#define FOO(x) 'x'
++int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
++
++int test (int i, double x);
++struct s1 {int (*f) (int a);};
++struct s2 {int (*f) (double a);};
++int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
++int argc;
++char **argv;
++int
++main ()
++{
++return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
++ ;
++ return 0;
++}
++_ACEOF
++for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
++ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
++do
++ CC="$ac_save_CC $ac_arg"
++ if ac_fn_c_try_compile "$LINENO"; then :
++ ac_cv_prog_cc_c89=$ac_arg
++fi
++rm -f core conftest.err conftest.$ac_objext
++ test "x$ac_cv_prog_cc_c89" != "xno" && break
++done
++rm -f conftest.$ac_ext
++CC=$ac_save_CC
++
++fi
++# AC_CACHE_VAL
++case "x$ac_cv_prog_cc_c89" in
++ x)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
++$as_echo "none needed" >&6; } ;;
++ xno)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
++$as_echo "unsupported" >&6; } ;;
++ *)
++ CC="$CC $ac_cv_prog_cc_c89"
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
++$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
++esac
++if test "x$ac_cv_prog_cc_c89" != xno; then :
++
++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=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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
++$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
++if ${am_cv_prog_cc_c_o+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++ # Make sure it works both with $CC and with simple cc.
++ # Following AC_PROG_CC_C_O, we do the test twice because some
++ # compilers refuse to overwrite an existing .o file with -o,
++ # though they will create one.
++ am_cv_prog_cc_c_o=yes
++ for am_i in 1 2; do
++ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
++ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } \
++ && test -f conftest2.$ac_objext; then
++ : OK
++ else
++ am_cv_prog_cc_c_o=no
++ break
++ fi
++ done
++ rm -f core conftest*
++ unset am_i
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
++$as_echo "$am_cv_prog_cc_c_o" >&6; }
++if test "$am_cv_prog_cc_c_o" != yes; then
++ # Losing compiler, so override with the script.
++ # FIXME: It is wrong to rewrite CC.
++ # But if we don't then we get into trouble of one sort or another.
++ # A longer-term fix would be to have automake use am__CC in this case,
++ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
++ CC="$am_aux_dir/compile $CC"
++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
++
++DEPDIR="${am__leading_dot}deps"
++
++ac_config_commands="$ac_config_commands depfiles"
++
++
++am_make=${MAKE-make}
++cat > confinc << 'END'
++am__doit:
++ @echo this is the am__doit target
++.PHONY: am__doit
++END
++# If we don't find an include directive, just comment out the code.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
++$as_echo_n "checking for style of include used by $am_make... " >&6; }
++am__include="#"
++am__quote=
++_am_result=none
++# First try GNU make style include.
++echo "include confinc" > confmf
++# Ignore all kinds of additional output from 'make'.
++case `$am_make -s -f confmf 2> /dev/null` in #(
++*the\ am__doit\ target*)
++ am__include=include
++ am__quote=
++ _am_result=GNU
++ ;;
++esac
++# Now try BSD make style include.
++if test "$am__include" = "#"; then
++ echo '.include "confinc"' > confmf
++ case `$am_make -s -f confmf 2> /dev/null` in #(
++ *the\ am__doit\ target*)
++ am__include=.include
++ am__quote="\""
++ _am_result=BSD
++ ;;
++ esac
++fi
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
++$as_echo "$_am_result" >&6; }
++rm -f confinc confmf
++
++@%:@ Check whether --enable-dependency-tracking was given.
++if test "${enable_dependency_tracking+set}" = set; then :
++ enableval=$enable_dependency_tracking;
++fi
++
++if test "x$enable_dependency_tracking" != xno; then
++ am_depcomp="$ac_aux_dir/depcomp"
++ AMDEPBACKSLASH='\'
++ am__nodep='_no'
++fi
++ if test "x$enable_dependency_tracking" != xno; then
++ AMDEP_TRUE=
++ AMDEP_FALSE='#'
++else
++ AMDEP_TRUE='#'
++ AMDEP_FALSE=
++fi
++
++
++
++depcc="$CC" am_compiler_list=
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
++$as_echo_n "checking dependency style of $depcc... " >&6; }
++if ${am_cv_CC_dependencies_compiler_type+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
++ # We make a subdir and do the tests there. Otherwise we can end up
++ # making bogus files that we don't know about and never remove. For
++ # instance it was reported that on HP-UX the gcc test will end up
++ # making a dummy file named 'D' -- because '-MD' means "put the output
++ # in D".
++ rm -rf conftest.dir
++ mkdir conftest.dir
++ # Copy depcomp to subdir because otherwise we won't find it if we're
++ # using a relative directory.
++ cp "$am_depcomp" conftest.dir
++ cd conftest.dir
++ # We will build objects and dependencies in a subdirectory because
++ # it helps to detect inapplicable dependency modes. For instance
++ # both Tru64's cc and ICC support -MD to output dependencies as a
++ # side effect of compilation, but ICC will put the dependencies in
++ # the current directory while Tru64 will put them in the object
++ # directory.
++ mkdir sub
++
++ am_cv_CC_dependencies_compiler_type=none
++ if test "$am_compiler_list" = ""; then
++ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
++ fi
++ am__universal=false
++ case " $depcc " in #(
++ *\ -arch\ *\ -arch\ *) am__universal=true ;;
++ esac
++
++ for depmode in $am_compiler_list; do
++ # Setup a source with many dependencies, because some compilers
++ # like to wrap large dependency lists on column 80 (with \), and
++ # we should not choose a depcomp mode which is confused by this.
++ #
++ # We need to recreate these files for each test, as the compiler may
++ # overwrite some of them when testing with obscure command lines.
++ # This happens at least with the AIX C compiler.
++ : > sub/conftest.c
++ for i in 1 2 3 4 5 6; do
++ echo '#include "conftst'$i'.h"' >> sub/conftest.c
++ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
++ # Solaris 10 /bin/sh.
++ echo '/* dummy */' > sub/conftst$i.h
++ done
++ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
++
++ # We check with '-c' and '-o' for the sake of the "dashmstdout"
++ # mode. It turns out that the SunPro C++ compiler does not properly
++ # handle '-M -o', and we need to detect this. Also, some Intel
++ # versions had trouble with output in subdirs.
++ am__obj=sub/conftest.${OBJEXT-o}
++ am__minus_obj="-o $am__obj"
++ case $depmode in
++ gcc)
++ # This depmode causes a compiler race in universal mode.
++ test "$am__universal" = false || continue
++ ;;
++ nosideeffect)
++ # After this tag, mechanisms are not by side-effect, so they'll
++ # only be used when explicitly requested.
++ if test "x$enable_dependency_tracking" = xyes; then
++ continue
++ else
++ break
++ fi
++ ;;
++ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
++ # This compiler won't grok '-c -o', but also, the minuso test has
++ # not run yet. These depmodes are late enough in the game, and
++ # so weak that their functioning should not be impacted.
++ am__obj=conftest.${OBJEXT-o}
++ am__minus_obj=
++ ;;
++ none) break ;;
++ esac
++ if depmode=$depmode \
++ source=sub/conftest.c object=$am__obj \
++ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
++ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
++ >/dev/null 2>conftest.err &&
++ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
++ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
++ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
++ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
++ # icc doesn't choke on unknown options, it will just issue warnings
++ # or remarks (even with -Werror). So we grep stderr for any message
++ # that says an option was ignored or not supported.
++ # When given -MP, icc 7.0 and 7.1 complain thusly:
++ # icc: Command line warning: ignoring option '-M'; no argument required
++ # The diagnosis changed in icc 8.0:
++ # icc: Command line remark: option '-MP' not supported
++ if (grep 'ignoring option' conftest.err ||
++ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
++ am_cv_CC_dependencies_compiler_type=$depmode
++ break
++ fi
++ fi
++ done
++
++ cd ..
++ rm -rf conftest.dir
++else
++ am_cv_CC_dependencies_compiler_type=none
++fi
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
++$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
++CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
++
++ if
++ test "x$enable_dependency_tracking" != xno \
++ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
++ am__fastdepCC_TRUE=
++ am__fastdepCC_FALSE='#'
++else
++ am__fastdepCC_TRUE='#'
++ am__fastdepCC_FALSE=
++fi
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
++$as_echo_n "checking whether ln -s works... " >&6; }
++LN_S=$as_ln_s
++if test "$LN_S" = "ln -s"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
++$as_echo "no, using $LN_S" >&6; }
++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
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
++$as_echo_n "checking build system type... " >&6; }
++if ${ac_cv_build+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ 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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
++$as_echo "$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
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
++$as_echo_n "checking host system type... " >&6; }
++if ${ac_cv_host+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ 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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
++$as_echo "$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
++
++
++enable_win32_dll=yes
++
++case $host in
++*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
++set dummy ${ac_tool_prefix}as; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_AS+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$AS"; then
++ ac_cv_prog_AS="$AS" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_AS="${ac_tool_prefix}as"
++ $as_echo "$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
++AS=$ac_cv_prog_AS
++if test -n "$AS"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
++$as_echo "$AS" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_AS"; then
++ ac_ct_AS=$AS
++ # Extract the first word of "as", so it can be a program name with args.
++set dummy as; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_AS+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_AS"; then
++ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_AS="as"
++ $as_echo "$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_AS=$ac_cv_prog_ac_ct_AS
++if test -n "$ac_ct_AS"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
++$as_echo "$ac_ct_AS" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_AS" = x; then
++ AS="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ AS=$ac_ct_AS
++ fi
++else
++ AS="$ac_cv_prog_AS"
++fi
++
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
++set dummy ${ac_tool_prefix}dlltool; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_DLLTOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$DLLTOOL"; then
++ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DLLTOOL="${ac_tool_prefix}dlltool"
++ $as_echo "$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
++DLLTOOL=$ac_cv_prog_DLLTOOL
++if test -n "$DLLTOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
++$as_echo "$DLLTOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_DLLTOOL"; then
++ ac_ct_DLLTOOL=$DLLTOOL
++ # Extract the first word of "dlltool", so it can be a program name with args.
++set dummy dlltool; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_DLLTOOL"; then
++ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DLLTOOL="dlltool"
++ $as_echo "$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_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
++if test -n "$ac_ct_DLLTOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
++$as_echo "$ac_ct_DLLTOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_DLLTOOL" = x; then
++ DLLTOOL="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ DLLTOOL=$ac_ct_DLLTOOL
++ fi
++else
++ DLLTOOL="$ac_cv_prog_DLLTOOL"
++fi
++
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
++set dummy ${ac_tool_prefix}objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OBJDUMP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$OBJDUMP"; then
++ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OBJDUMP="${ac_tool_prefix}objdump"
++ $as_echo "$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
++OBJDUMP=$ac_cv_prog_OBJDUMP
++if test -n "$OBJDUMP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
++$as_echo "$OBJDUMP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OBJDUMP"; then
++ ac_ct_OBJDUMP=$OBJDUMP
++ # Extract the first word of "objdump", so it can be a program name with args.
++set dummy objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_OBJDUMP"; then
++ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OBJDUMP="objdump"
++ $as_echo "$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_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
++if test -n "$ac_ct_OBJDUMP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
++$as_echo "$ac_ct_OBJDUMP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_OBJDUMP" = x; then
++ OBJDUMP="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ OBJDUMP=$ac_ct_OBJDUMP
++ fi
++else
++ OBJDUMP="$ac_cv_prog_OBJDUMP"
++fi
++
++ ;;
++esac
++
++test -z "$AS" && AS=as
++
++
++
++
++
++test -z "$DLLTOOL" && DLLTOOL=dlltool
++
++
++
++
++
++test -z "$OBJDUMP" && OBJDUMP=objdump
++
++
++
++
++
++
++
++case `pwd` in
++ *\ * | *\ *)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
++$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
++esac
++
++
++
++macro_version='2.4.6'
++macro_revision='2.4.6'
++
++
++
++
++
++
++
++
++
++
++
++
++
++ltmain=$ac_aux_dir/ltmain.sh
++
++# Backslashify metacharacters that are still active within
++# double-quoted strings.
++sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
++
++# Same as above, but do not quote variable references.
++double_quote_subst='s/\(["`\\]\)/\\\1/g'
++
++# Sed substitution to delay expansion of an escaped shell variable in a
++# double_quote_subst'ed string.
++delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
++
++# Sed substitution to delay expansion of an escaped single quote.
++delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
++
++# Sed substitution to avoid accidental globbing in evaled expressions
++no_glob_subst='s/\*/\\\*/g'
++
++ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
++ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
++ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
++$as_echo_n "checking how to print strings... " >&6; }
++# Test print first, because it will be a builtin if present.
++if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
++ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
++ ECHO='print -r --'
++elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
++ ECHO='printf %s\n'
++else
++ # Use this function as a fallback that always works.
++ func_fallback_echo ()
++ {
++ eval 'cat <<_LTECHO_EOF
++$1
++_LTECHO_EOF'
++ }
++ ECHO='func_fallback_echo'
++fi
++
++# func_echo_all arg...
++# Invoke $ECHO with all args, space-separated.
++func_echo_all ()
++{
++ $ECHO ""
++}
++
++case $ECHO in
++ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
++$as_echo "printf" >&6; } ;;
++ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
++$as_echo "print -r" >&6; } ;;
++ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
++$as_echo "cat" >&6; } ;;
++esac
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
++$as_echo_n "checking for a sed that does not truncate output... " >&6; }
++if ${ac_cv_path_SED+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
++ for ac_i in 1 2 3 4 5 6 7; do
++ ac_script="$ac_script$as_nl$ac_script"
++ done
++ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
++ { ac_script=; unset ac_script;}
++ if test -z "$SED"; then
++ ac_path_SED_found=false
++ # Loop through the user's path and test for each of PROGNAME-LIST
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_prog in sed gsed; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
++ as_fn_executable_p "$ac_path_SED" || continue
++# Check for GNU ac_path_SED and select it if it is found.
++ # Check for GNU $ac_path_SED
++case `"$ac_path_SED" --version 2>&1` in
++*GNU*)
++ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
++*)
++ ac_count=0
++ $as_echo_n 0123456789 >"conftest.in"
++ while :
++ do
++ cat "conftest.in" "conftest.in" >"conftest.tmp"
++ mv "conftest.tmp" "conftest.in"
++ cp "conftest.in" "conftest.nl"
++ $as_echo '' >> "conftest.nl"
++ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
++ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
++ as_fn_arith $ac_count + 1 && ac_count=$as_val
++ if test $ac_count -gt ${ac_path_SED_max-0}; then
++ # Best one so far, save it but keep looking for a better one
++ ac_cv_path_SED="$ac_path_SED"
++ ac_path_SED_max=$ac_count
++ fi
++ # 10*(2^10) chars as input seems more than enough
++ test $ac_count -gt 10 && break
++ done
++ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
++esac
++
++ $ac_path_SED_found && break 3
++ done
++ done
++ done
++IFS=$as_save_IFS
++ if test -z "$ac_cv_path_SED"; then
++ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
++ fi
++else
++ ac_cv_path_SED=$SED
++fi
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
++$as_echo "$ac_cv_path_SED" >&6; }
++ SED="$ac_cv_path_SED"
++ rm -f conftest.sed
++
++test -z "$SED" && SED=sed
++Xsed="$SED -e 1s/^X//"
++
++
++
++
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
++$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
++if ${ac_cv_path_GREP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -z "$GREP"; then
++ ac_path_GREP_found=false
++ # Loop through the user's path and test for each of PROGNAME-LIST
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_prog in grep ggrep; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
++ as_fn_executable_p "$ac_path_GREP" || continue
++# Check for GNU ac_path_GREP and select it if it is found.
++ # Check for GNU $ac_path_GREP
++case `"$ac_path_GREP" --version 2>&1` in
++*GNU*)
++ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
++*)
++ ac_count=0
++ $as_echo_n 0123456789 >"conftest.in"
++ while :
++ do
++ cat "conftest.in" "conftest.in" >"conftest.tmp"
++ mv "conftest.tmp" "conftest.in"
++ cp "conftest.in" "conftest.nl"
++ $as_echo 'GREP' >> "conftest.nl"
++ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
++ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
++ as_fn_arith $ac_count + 1 && ac_count=$as_val
++ if test $ac_count -gt ${ac_path_GREP_max-0}; then
++ # Best one so far, save it but keep looking for a better one
++ ac_cv_path_GREP="$ac_path_GREP"
++ ac_path_GREP_max=$ac_count
++ fi
++ # 10*(2^10) chars as input seems more than enough
++ test $ac_count -gt 10 && break
++ done
++ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
++esac
++
++ $ac_path_GREP_found && break 3
++ done
++ done
++ done
++IFS=$as_save_IFS
++ if test -z "$ac_cv_path_GREP"; then
++ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
++ fi
++else
++ ac_cv_path_GREP=$GREP
++fi
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
++$as_echo "$ac_cv_path_GREP" >&6; }
++ GREP="$ac_cv_path_GREP"
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
++$as_echo_n "checking for egrep... " >&6; }
++if ${ac_cv_path_EGREP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
++ then ac_cv_path_EGREP="$GREP -E"
++ else
++ if test -z "$EGREP"; then
++ ac_path_EGREP_found=false
++ # Loop through the user's path and test for each of PROGNAME-LIST
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_prog in egrep; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
++ as_fn_executable_p "$ac_path_EGREP" || continue
++# Check for GNU ac_path_EGREP and select it if it is found.
++ # Check for GNU $ac_path_EGREP
++case `"$ac_path_EGREP" --version 2>&1` in
++*GNU*)
++ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
++*)
++ ac_count=0
++ $as_echo_n 0123456789 >"conftest.in"
++ while :
++ do
++ cat "conftest.in" "conftest.in" >"conftest.tmp"
++ mv "conftest.tmp" "conftest.in"
++ cp "conftest.in" "conftest.nl"
++ $as_echo 'EGREP' >> "conftest.nl"
++ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
++ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
++ as_fn_arith $ac_count + 1 && ac_count=$as_val
++ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
++ # Best one so far, save it but keep looking for a better one
++ ac_cv_path_EGREP="$ac_path_EGREP"
++ ac_path_EGREP_max=$ac_count
++ fi
++ # 10*(2^10) chars as input seems more than enough
++ test $ac_count -gt 10 && break
++ done
++ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
++esac
++
++ $ac_path_EGREP_found && break 3
++ done
++ done
++ done
++IFS=$as_save_IFS
++ if test -z "$ac_cv_path_EGREP"; then
++ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
++ fi
++else
++ ac_cv_path_EGREP=$EGREP
++fi
++
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
++$as_echo "$ac_cv_path_EGREP" >&6; }
++ EGREP="$ac_cv_path_EGREP"
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
++$as_echo_n "checking for fgrep... " >&6; }
++if ${ac_cv_path_FGREP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
++ then ac_cv_path_FGREP="$GREP -F"
++ else
++ if test -z "$FGREP"; then
++ ac_path_FGREP_found=false
++ # Loop through the user's path and test for each of PROGNAME-LIST
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_prog in fgrep; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
++ as_fn_executable_p "$ac_path_FGREP" || continue
++# Check for GNU ac_path_FGREP and select it if it is found.
++ # Check for GNU $ac_path_FGREP
++case `"$ac_path_FGREP" --version 2>&1` in
++*GNU*)
++ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
++*)
++ ac_count=0
++ $as_echo_n 0123456789 >"conftest.in"
++ while :
++ do
++ cat "conftest.in" "conftest.in" >"conftest.tmp"
++ mv "conftest.tmp" "conftest.in"
++ cp "conftest.in" "conftest.nl"
++ $as_echo 'FGREP' >> "conftest.nl"
++ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
++ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
++ as_fn_arith $ac_count + 1 && ac_count=$as_val
++ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
++ # Best one so far, save it but keep looking for a better one
++ ac_cv_path_FGREP="$ac_path_FGREP"
++ ac_path_FGREP_max=$ac_count
++ fi
++ # 10*(2^10) chars as input seems more than enough
++ test $ac_count -gt 10 && break
++ done
++ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
++esac
++
++ $ac_path_FGREP_found && break 3
++ done
++ done
++ done
++IFS=$as_save_IFS
++ if test -z "$ac_cv_path_FGREP"; then
++ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
++ fi
++else
++ ac_cv_path_FGREP=$FGREP
++fi
++
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
++$as_echo "$ac_cv_path_FGREP" >&6; }
++ FGREP="$ac_cv_path_FGREP"
++
++
++test -z "$GREP" && GREP=grep
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++@%:@ Check whether --with-gnu-ld was given.
++if test "${with_gnu_ld+set}" = set; then :
++ withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
++else
++ with_gnu_ld=no
++fi
++
++ac_prog=ld
++if test yes = "$GCC"; then
++ # Check if gcc -print-prog-name=ld gives a path.
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
++$as_echo_n "checking for ld used by $CC... " >&6; }
++ case $host in
++ *-*-mingw*)
++ # gcc leaves a trailing carriage return, which upsets mingw
++ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
++ *)
++ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
++ esac
++ case $ac_prog in
++ # Accept absolute paths.
++ [\\/]* | ?:[\\/]*)
++ re_direlt='/[^/][^/]*/\.\./'
++ # Canonicalize the pathname of ld
++ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
++ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
++ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
++ done
++ test -z "$LD" && LD=$ac_prog
++ ;;
++ "")
++ # If it fails, then pretend we aren't using GCC.
++ ac_prog=ld
++ ;;
++ *)
++ # If it is relative, then search for the first ld in PATH.
++ with_gnu_ld=unknown
++ ;;
++ esac
++elif test yes = "$with_gnu_ld"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
++$as_echo_n "checking for GNU ld... " >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
++$as_echo_n "checking for non-GNU ld... " >&6; }
++fi
++if ${lt_cv_path_LD+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -z "$LD"; then
++ lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
++ for ac_dir in $PATH; do
++ IFS=$lt_save_ifs
++ test -z "$ac_dir" && ac_dir=.
++ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
++ lt_cv_path_LD=$ac_dir/$ac_prog
++ # Check to see if the program is GNU ld. I'd rather use --version,
++ # but apparently some variants of GNU ld only accept -v.
++ # Break only if it was the GNU/non-GNU ld that we prefer.
++ case `"$lt_cv_path_LD" -v 2>&1 &5
++$as_echo "$LD" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
++$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
++if ${lt_cv_prog_gnu_ld+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ # I'd rather use --version here, but apparently some GNU lds only accept -v.
++case `$LD -v 2>&1 &5
++$as_echo "$lt_cv_prog_gnu_ld" >&6; }
++with_gnu_ld=$lt_cv_prog_gnu_ld
++
++
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
++$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
++if ${lt_cv_path_NM+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$NM"; then
++ # Let the user override the test.
++ lt_cv_path_NM=$NM
++else
++ lt_nm_to_check=${ac_tool_prefix}nm
++ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
++ lt_nm_to_check="$lt_nm_to_check nm"
++ fi
++ for lt_tmp_nm in $lt_nm_to_check; do
++ lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
++ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
++ IFS=$lt_save_ifs
++ test -z "$ac_dir" && ac_dir=.
++ tmp_nm=$ac_dir/$lt_tmp_nm
++ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
++ # Check to see if the nm accepts a BSD-compat flag.
++ # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
++ # nm: unknown option "B" ignored
++ # Tru64's nm complains that /dev/null is an invalid object file
++ # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
++ case $build_os in
++ mingw*) lt_bad_file=conftest.nm/nofile ;;
++ *) lt_bad_file=/dev/null ;;
++ esac
++ case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
++ *$lt_bad_file* | *'Invalid file or object type'*)
++ lt_cv_path_NM="$tmp_nm -B"
++ break 2
++ ;;
++ *)
++ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
++ */dev/null*)
++ lt_cv_path_NM="$tmp_nm -p"
++ break 2
++ ;;
++ *)
++ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
++ continue # so that we can try to find one that supports BSD flags
++ ;;
++ esac
++ ;;
++ esac
++ fi
++ done
++ IFS=$lt_save_ifs
++ done
++ : ${lt_cv_path_NM=no}
++fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
++$as_echo "$lt_cv_path_NM" >&6; }
++if test no != "$lt_cv_path_NM"; then
++ NM=$lt_cv_path_NM
++else
++ # Didn't find any BSD compatible name lister, look for dumpbin.
++ if test -n "$DUMPBIN"; then :
++ # Let the user override the test.
++ else
++ if test -n "$ac_tool_prefix"; then
++ for ac_prog in dumpbin "link -dump"
++ 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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_DUMPBIN+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$DUMPBIN"; then
++ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DUMPBIN="$ac_tool_prefix$ac_prog"
++ $as_echo "$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
++DUMPBIN=$ac_cv_prog_DUMPBIN
++if test -n "$DUMPBIN"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
++$as_echo "$DUMPBIN" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$DUMPBIN" && break
++ done
++fi
++if test -z "$DUMPBIN"; then
++ ac_ct_DUMPBIN=$DUMPBIN
++ for ac_prog in dumpbin "link -dump"
++do
++ # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_DUMPBIN"; then
++ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DUMPBIN="$ac_prog"
++ $as_echo "$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_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
++if test -n "$ac_ct_DUMPBIN"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
++$as_echo "$ac_ct_DUMPBIN" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$ac_ct_DUMPBIN" && break
++done
++
++ if test "x$ac_ct_DUMPBIN" = x; then
++ DUMPBIN=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ DUMPBIN=$ac_ct_DUMPBIN
++ fi
++fi
++
++ case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
++ *COFF*)
++ DUMPBIN="$DUMPBIN -symbols -headers"
++ ;;
++ *)
++ DUMPBIN=:
++ ;;
++ esac
++ fi
++
++ if test : != "$DUMPBIN"; then
++ NM=$DUMPBIN
++ fi
++fi
++test -z "$NM" && NM=nm
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
++$as_echo_n "checking the name lister ($NM) interface... " >&6; }
++if ${lt_cv_nm_interface+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_nm_interface="BSD nm"
++ echo "int some_variable = 0;" > conftest.$ac_ext
++ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
++ (eval "$ac_compile" 2>conftest.err)
++ cat conftest.err >&5
++ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
++ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
++ cat conftest.err >&5
++ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
++ cat conftest.out >&5
++ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
++ lt_cv_nm_interface="MS dumpbin"
++ fi
++ rm -f conftest*
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
++$as_echo "$lt_cv_nm_interface" >&6; }
++
++# find the maximum length of command line arguments
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
++$as_echo_n "checking the maximum length of command line arguments... " >&6; }
++if ${lt_cv_sys_max_cmd_len+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ i=0
++ teststring=ABCD
++
++ case $build_os in
++ msdosdjgpp*)
++ # On DJGPP, this test can blow up pretty badly due to problems in libc
++ # (any single argument exceeding 2000 bytes causes a buffer overrun
++ # during glob expansion). Even if it were fixed, the result of this
++ # check would be larger than it should be.
++ lt_cv_sys_max_cmd_len=12288; # 12K is about right
++ ;;
++
++ gnu*)
++ # Under GNU Hurd, this test is not required because there is
++ # no limit to the length of command line arguments.
++ # Libtool will interpret -1 as no limit whatsoever
++ lt_cv_sys_max_cmd_len=-1;
++ ;;
++
++ cygwin* | mingw* | cegcc*)
++ # On Win9x/ME, this test blows up -- it succeeds, but takes
++ # about 5 minutes as the teststring grows exponentially.
++ # Worse, since 9x/ME are not pre-emptively multitasking,
++ # you end up with a "frozen" computer, even though with patience
++ # the test eventually succeeds (with a max line length of 256k).
++ # Instead, let's just punt: use the minimum linelength reported by
++ # all of the supported platforms: 8192 (on NT/2K/XP).
++ lt_cv_sys_max_cmd_len=8192;
++ ;;
++
++ mint*)
++ # On MiNT this can take a long time and run out of memory.
++ lt_cv_sys_max_cmd_len=8192;
++ ;;
++
++ amigaos*)
++ # On AmigaOS with pdksh, this test takes hours, literally.
++ # So we just punt and use a minimum line length of 8192.
++ lt_cv_sys_max_cmd_len=8192;
++ ;;
++
++ bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
++ # This has been around since 386BSD, at least. Likely further.
++ if test -x /sbin/sysctl; then
++ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
++ elif test -x /usr/sbin/sysctl; then
++ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
++ else
++ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
++ fi
++ # And add a safety zone
++ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
++ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
++ ;;
++
++ interix*)
++ # We know the value 262144 and hardcode it with a safety zone (like BSD)
++ lt_cv_sys_max_cmd_len=196608
++ ;;
++
++ os2*)
++ # The test takes a long time on OS/2.
++ lt_cv_sys_max_cmd_len=8192
++ ;;
++
++ osf*)
++ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
++ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
++ # nice to cause kernel panics so lets avoid the loop below.
++ # First set a reasonable default.
++ lt_cv_sys_max_cmd_len=16384
++ #
++ if test -x /sbin/sysconfig; then
++ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
++ *1*) lt_cv_sys_max_cmd_len=-1 ;;
++ esac
++ fi
++ ;;
++ sco3.2v5*)
++ lt_cv_sys_max_cmd_len=102400
++ ;;
++ sysv5* | sco5v6* | sysv4.2uw2*)
++ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
++ if test -n "$kargmax"; then
++ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
++ else
++ lt_cv_sys_max_cmd_len=32768
++ fi
++ ;;
++ *)
++ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
++ if test -n "$lt_cv_sys_max_cmd_len" && \
++ test undefined != "$lt_cv_sys_max_cmd_len"; then
++ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
++ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
++ else
++ # Make teststring a little bigger before we do anything with it.
++ # a 1K string should be a reasonable start.
++ for i in 1 2 3 4 5 6 7 8; do
++ teststring=$teststring$teststring
++ done
++ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
++ # If test is not a shell built-in, we'll probably end up computing a
++ # maximum length that is only half of the actual maximum length, but
++ # we can't tell.
++ while { test X`env echo "$teststring$teststring" 2>/dev/null` \
++ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
++ test 17 != "$i" # 1/2 MB should be enough
++ do
++ i=`expr $i + 1`
++ teststring=$teststring$teststring
++ done
++ # Only check the string length outside the loop.
++ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
++ teststring=
++ # Add a significant safety factor because C++ compilers can tack on
++ # massive amounts of additional arguments before passing them to the
++ # linker. It appears as though 1/2 is a usable value.
++ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
++ fi
++ ;;
++ esac
++
++fi
++
++if test -n "$lt_cv_sys_max_cmd_len"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
++$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
++$as_echo "none" >&6; }
++fi
++max_cmd_len=$lt_cv_sys_max_cmd_len
++
++
++
++
++
++
++: ${CP="cp -f"}
++: ${MV="mv -f"}
++: ${RM="rm -f"}
++
++if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
++ lt_unset=unset
++else
++ lt_unset=false
++fi
++
++
++
++
++
++# test EBCDIC or ASCII
++case `echo X|tr X '\101'` in
++ A) # ASCII based system
++ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
++ lt_SP2NL='tr \040 \012'
++ lt_NL2SP='tr \015\012 \040\040'
++ ;;
++ *) # EBCDIC based system
++ lt_SP2NL='tr \100 \n'
++ lt_NL2SP='tr \r\n \100\100'
++ ;;
++esac
++
++
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
++$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
++if ${lt_cv_to_host_file_cmd+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ case $host in
++ *-*-mingw* )
++ case $build in
++ *-*-mingw* ) # actually msys
++ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
++ ;;
++ *-*-cygwin* )
++ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
++ ;;
++ * ) # otherwise, assume *nix
++ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
++ ;;
++ esac
++ ;;
++ *-*-cygwin* )
++ case $build in
++ *-*-mingw* ) # actually msys
++ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
++ ;;
++ *-*-cygwin* )
++ lt_cv_to_host_file_cmd=func_convert_file_noop
++ ;;
++ * ) # otherwise, assume *nix
++ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
++ ;;
++ esac
++ ;;
++ * ) # unhandled hosts (and "normal" native builds)
++ lt_cv_to_host_file_cmd=func_convert_file_noop
++ ;;
++esac
++
++fi
++
++to_host_file_cmd=$lt_cv_to_host_file_cmd
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
++$as_echo "$lt_cv_to_host_file_cmd" >&6; }
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
++$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
++if ${lt_cv_to_tool_file_cmd+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ #assume ordinary cross tools, or native build.
++lt_cv_to_tool_file_cmd=func_convert_file_noop
++case $host in
++ *-*-mingw* )
++ case $build in
++ *-*-mingw* ) # actually msys
++ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
++ ;;
++ esac
++ ;;
++esac
++
++fi
++
++to_tool_file_cmd=$lt_cv_to_tool_file_cmd
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
++$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
++$as_echo_n "checking for $LD option to reload object files... " >&6; }
++if ${lt_cv_ld_reload_flag+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_ld_reload_flag='-r'
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
++$as_echo "$lt_cv_ld_reload_flag" >&6; }
++reload_flag=$lt_cv_ld_reload_flag
++case $reload_flag in
++"" | " "*) ;;
++*) reload_flag=" $reload_flag" ;;
++esac
++reload_cmds='$LD$reload_flag -o $output$reload_objs'
++case $host_os in
++ cygwin* | mingw* | pw32* | cegcc*)
++ if test yes != "$GCC"; then
++ reload_cmds=false
++ fi
++ ;;
++ darwin*)
++ if test yes = "$GCC"; then
++ reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
++ else
++ reload_cmds='$LD$reload_flag -o $output$reload_objs'
++ fi
++ ;;
++esac
++
++
++
++
++
++
++
++
++
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
++set dummy ${ac_tool_prefix}objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OBJDUMP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$OBJDUMP"; then
++ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OBJDUMP="${ac_tool_prefix}objdump"
++ $as_echo "$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
++OBJDUMP=$ac_cv_prog_OBJDUMP
++if test -n "$OBJDUMP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
++$as_echo "$OBJDUMP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OBJDUMP"; then
++ ac_ct_OBJDUMP=$OBJDUMP
++ # Extract the first word of "objdump", so it can be a program name with args.
++set dummy objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_OBJDUMP"; then
++ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OBJDUMP="objdump"
++ $as_echo "$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_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
++if test -n "$ac_ct_OBJDUMP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
++$as_echo "$ac_ct_OBJDUMP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_OBJDUMP" = x; then
++ OBJDUMP="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ OBJDUMP=$ac_ct_OBJDUMP
++ fi
++else
++ OBJDUMP="$ac_cv_prog_OBJDUMP"
++fi
++
++test -z "$OBJDUMP" && OBJDUMP=objdump
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
++$as_echo_n "checking how to recognize dependent libraries... " >&6; }
++if ${lt_cv_deplibs_check_method+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_file_magic_cmd='$MAGIC_CMD'
++lt_cv_file_magic_test_file=
++lt_cv_deplibs_check_method='unknown'
++# Need to set the preceding variable on all platforms that support
++# interlibrary dependencies.
++# 'none' -- dependencies not supported.
++# 'unknown' -- same as none, but documents that we really don't know.
++# 'pass_all' -- all dependencies passed with no checks.
++# 'test_compile' -- check by making test program.
++# 'file_magic [[regex]]' -- check by looking for files in library path
++# that responds to the $file_magic_cmd with a given extended regex.
++# If you have 'file' or equivalent on your system and you're not sure
++# whether 'pass_all' will *always* work, you probably want this one.
++
++case $host_os in
++aix[4-9]*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++beos*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++bsdi[45]*)
++ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
++ lt_cv_file_magic_cmd='/usr/bin/file -L'
++ lt_cv_file_magic_test_file=/shlib/libc.so
++ ;;
++
++cygwin*)
++ # func_win32_libid is a shell function defined in ltmain.sh
++ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
++ lt_cv_file_magic_cmd='func_win32_libid'
++ ;;
++
++mingw* | pw32*)
++ # Base MSYS/MinGW do not provide the 'file' command needed by
++ # func_win32_libid shell function, so use a weaker test based on 'objdump',
++ # unless we find 'file', for example because we are cross-compiling.
++ if ( file / ) >/dev/null 2>&1; then
++ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
++ lt_cv_file_magic_cmd='func_win32_libid'
++ else
++ # Keep this pattern in sync with the one in func_win32_libid.
++ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
++ lt_cv_file_magic_cmd='$OBJDUMP -f'
++ fi
++ ;;
++
++cegcc*)
++ # use the weaker test based on 'objdump'. See mingw*.
++ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
++ lt_cv_file_magic_cmd='$OBJDUMP -f'
++ ;;
++
++darwin* | rhapsody*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++freebsd* | dragonfly*)
++ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
++ case $host_cpu in
++ i*86 )
++ # Not sure whether the presence of OpenBSD here was a mistake.
++ # Let's accept both of them until this is cleared up.
++ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
++ lt_cv_file_magic_cmd=/usr/bin/file
++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
++ ;;
++ esac
++ else
++ lt_cv_deplibs_check_method=pass_all
++ fi
++ ;;
++
++haiku*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++hpux10.20* | hpux11*)
++ lt_cv_file_magic_cmd=/usr/bin/file
++ case $host_cpu in
++ ia64*)
++ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
++ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
++ ;;
++ hppa*64*)
++ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
++ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
++ ;;
++ *)
++ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
++ lt_cv_file_magic_test_file=/usr/lib/libc.sl
++ ;;
++ esac
++ ;;
++
++interix[3-9]*)
++ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
++ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
++ ;;
++
++irix5* | irix6* | nonstopux*)
++ case $LD in
++ *-32|*"-32 ") libmagic=32-bit;;
++ *-n32|*"-n32 ") libmagic=N32;;
++ *-64|*"-64 ") libmagic=64-bit;;
++ *) libmagic=never-match;;
++ esac
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++# This must be glibc/ELF.
++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++netbsd*)
++ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
++ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
++ else
++ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
++ fi
++ ;;
++
++newos6*)
++ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
++ lt_cv_file_magic_cmd=/usr/bin/file
++ lt_cv_file_magic_test_file=/usr/lib/libnls.so
++ ;;
++
++*nto* | *qnx*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++openbsd* | bitrig*)
++ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
++ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
++ else
++ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
++ fi
++ ;;
++
++osf3* | osf4* | osf5*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++rdos*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++solaris*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
++sysv4 | sysv4.3*)
++ case $host_vendor in
++ motorola)
++ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
++ ;;
++ ncr)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++ sequent)
++ lt_cv_file_magic_cmd='/bin/file'
++ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
++ ;;
++ sni)
++ lt_cv_file_magic_cmd='/bin/file'
++ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
++ lt_cv_file_magic_test_file=/lib/libc.so
++ ;;
++ siemens)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++ pc)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++ esac
++ ;;
++
++tpf*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++os2*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++esac
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
++$as_echo "$lt_cv_deplibs_check_method" >&6; }
++
++file_magic_glob=
++want_nocaseglob=no
++if test "$build" = "$host"; then
++ case $host_os in
++ mingw* | pw32*)
++ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
++ want_nocaseglob=yes
++ else
++ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
++ fi
++ ;;
++ esac
++fi
++
++file_magic_cmd=$lt_cv_file_magic_cmd
++deplibs_check_method=$lt_cv_deplibs_check_method
++test -z "$deplibs_check_method" && deplibs_check_method=unknown
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
++set dummy ${ac_tool_prefix}dlltool; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_DLLTOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$DLLTOOL"; then
++ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DLLTOOL="${ac_tool_prefix}dlltool"
++ $as_echo "$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
++DLLTOOL=$ac_cv_prog_DLLTOOL
++if test -n "$DLLTOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
++$as_echo "$DLLTOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_DLLTOOL"; then
++ ac_ct_DLLTOOL=$DLLTOOL
++ # Extract the first word of "dlltool", so it can be a program name with args.
++set dummy dlltool; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_DLLTOOL"; then
++ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DLLTOOL="dlltool"
++ $as_echo "$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_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
++if test -n "$ac_ct_DLLTOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
++$as_echo "$ac_ct_DLLTOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_DLLTOOL" = x; then
++ DLLTOOL="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ DLLTOOL=$ac_ct_DLLTOOL
++ fi
++else
++ DLLTOOL="$ac_cv_prog_DLLTOOL"
++fi
++
++test -z "$DLLTOOL" && DLLTOOL=dlltool
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
++$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
++if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_sharedlib_from_linklib_cmd='unknown'
++
++case $host_os in
++cygwin* | mingw* | pw32* | cegcc*)
++ # two different shell functions defined in ltmain.sh;
++ # decide which one to use based on capabilities of $DLLTOOL
++ case `$DLLTOOL --help 2>&1` in
++ *--identify-strict*)
++ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
++ ;;
++ *)
++ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
++ ;;
++ esac
++ ;;
++*)
++ # fallback: assume linklib IS sharedlib
++ lt_cv_sharedlib_from_linklib_cmd=$ECHO
++ ;;
++esac
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
++$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
++sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
++test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
++
++
++
++
++
++
++
++
++if test -n "$ac_tool_prefix"; then
++ for ac_prog in ar
++ 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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_AR+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$AR"; then
++ ac_cv_prog_AR="$AR" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_AR="$ac_tool_prefix$ac_prog"
++ $as_echo "$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
++AR=$ac_cv_prog_AR
++if test -n "$AR"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
++$as_echo "$AR" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$AR" && break
++ done
++fi
++if test -z "$AR"; then
++ ac_ct_AR=$AR
++ for ac_prog in ar
++do
++ # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_AR+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_AR"; then
++ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_AR="$ac_prog"
++ $as_echo "$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_AR=$ac_cv_prog_ac_ct_AR
++if test -n "$ac_ct_AR"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
++$as_echo "$ac_ct_AR" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ test -n "$ac_ct_AR" && break
++done
++
++ if test "x$ac_ct_AR" = x; then
++ AR="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ AR=$ac_ct_AR
++ fi
++fi
++
++: ${AR=ar}
++: ${AR_FLAGS=cru}
++
++
++
++
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
++$as_echo_n "checking for archiver @FILE support... " >&6; }
++if ${lt_cv_ar_at_file+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_ar_at_file=no
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ echo conftest.$ac_objext > conftest.lst
++ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
++ (eval $lt_ar_try) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }
++ if test 0 -eq "$ac_status"; then
++ # Ensure the archiver fails upon bogus file names.
++ rm -f conftest.$ac_objext libconftest.a
++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
++ (eval $lt_ar_try) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }
++ if test 0 -ne "$ac_status"; then
++ lt_cv_ar_at_file=@
++ fi
++ fi
++ rm -f conftest.* libconftest.a
++
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
++$as_echo "$lt_cv_ar_at_file" >&6; }
++
++if test no = "$lt_cv_ar_at_file"; then
++ archiver_list_spec=
++else
++ archiver_list_spec=$lt_cv_ar_at_file
++fi
++
++
++
++
++
++
++
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
++set dummy ${ac_tool_prefix}strip; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_STRIP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$STRIP"; then
++ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_STRIP="${ac_tool_prefix}strip"
++ $as_echo "$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
++STRIP=$ac_cv_prog_STRIP
++if test -n "$STRIP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
++$as_echo "$STRIP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_STRIP"; then
++ ac_ct_STRIP=$STRIP
++ # Extract the first word of "strip", so it can be a program name with args.
++set dummy strip; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_STRIP"; then
++ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_STRIP="strip"
++ $as_echo "$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_STRIP=$ac_cv_prog_ac_ct_STRIP
++if test -n "$ac_ct_STRIP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
++$as_echo "$ac_ct_STRIP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_STRIP" = x; then
++ STRIP=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ STRIP=$ac_ct_STRIP
++ fi
++else
++ STRIP="$ac_cv_prog_STRIP"
++fi
++
++test -z "$STRIP" && STRIP=:
++
++
++
++
++
++
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
++set dummy ${ac_tool_prefix}ranlib; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_RANLIB+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$RANLIB"; then
++ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_RANLIB="${ac_tool_prefix}ranlib"
++ $as_echo "$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
++RANLIB=$ac_cv_prog_RANLIB
++if test -n "$RANLIB"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
++$as_echo "$RANLIB" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_RANLIB"; then
++ ac_ct_RANLIB=$RANLIB
++ # Extract the first word of "ranlib", so it can be a program name with args.
++set dummy ranlib; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_RANLIB"; then
++ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_RANLIB="ranlib"
++ $as_echo "$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_RANLIB=$ac_cv_prog_ac_ct_RANLIB
++if test -n "$ac_ct_RANLIB"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
++$as_echo "$ac_ct_RANLIB" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_RANLIB" = x; then
++ RANLIB=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ RANLIB=$ac_ct_RANLIB
++ fi
++else
++ RANLIB="$ac_cv_prog_RANLIB"
++fi
++
++test -z "$RANLIB" && RANLIB=:
++
++
++
++
++
++
++# Determine commands to create old-style static archives.
++old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
++old_postinstall_cmds='chmod 644 $oldlib'
++old_postuninstall_cmds=
++
++if test -n "$RANLIB"; then
++ case $host_os in
++ bitrig* | openbsd*)
++ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
++ ;;
++ *)
++ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
++ ;;
++ esac
++ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
++fi
++
++case $host_os in
++ darwin*)
++ lock_old_archive_extraction=yes ;;
++ *)
++ lock_old_archive_extraction=no ;;
++esac
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++# If no C compiler was specified, use CC.
++LTCC=${LTCC-"$CC"}
++
++# If no C compiler flags were specified, use CFLAGS.
++LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
++
++# Allow CC to be a program name with arguments.
++compiler=$CC
++
++
++# Check for command to grab the raw symbol name followed by C symbol from nm.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
++$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
++if ${lt_cv_sys_global_symbol_pipe+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++
++# These are sane defaults that work on at least a few old systems.
++# [They come from Ultrix. What could be older than Ultrix?!! ;)]
++
++# Character class describing NM global symbol codes.
++symcode='[BCDEGRST]'
++
++# Regexp to match symbols that can be accessed directly from C.
++sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
++
++# Define system-specific variables.
++case $host_os in
++aix*)
++ symcode='[BCDT]'
++ ;;
++cygwin* | mingw* | pw32* | cegcc*)
++ symcode='[ABCDGISTW]'
++ ;;
++hpux*)
++ if test ia64 = "$host_cpu"; then
++ symcode='[ABCDEGRST]'
++ fi
++ ;;
++irix* | nonstopux*)
++ symcode='[BCDEGRST]'
++ ;;
++osf*)
++ symcode='[BCDEGQRST]'
++ ;;
++solaris*)
++ symcode='[BDRT]'
++ ;;
++sco3.2v5*)
++ symcode='[DT]'
++ ;;
++sysv4.2uw2*)
++ symcode='[DT]'
++ ;;
++sysv5* | sco5v6* | unixware* | OpenUNIX*)
++ symcode='[ABDT]'
++ ;;
++sysv4)
++ symcode='[DFNSTU]'
++ ;;
++esac
++
++# If we're using GNU nm, then use its standard symbol codes.
++case `$NM -V 2>&1` in
++*GNU* | *'with BFD'*)
++ symcode='[ABCDGIRSTW]' ;;
++esac
++
++if test "$lt_cv_nm_interface" = "MS dumpbin"; then
++ # Gets list of data symbols to import.
++ lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
++ # Adjust the below global symbol transforms to fixup imported variables.
++ lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
++ lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'"
++ lt_c_name_lib_hook="\
++ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\
++ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'"
++else
++ # Disable hooks by default.
++ lt_cv_sys_global_symbol_to_import=
++ lt_cdecl_hook=
++ lt_c_name_hook=
++ lt_c_name_lib_hook=
++fi
++
++# Transform an extracted symbol line into a proper C declaration.
++# Some systems (esp. on ia64) link data and code symbols differently,
++# so use this general approach.
++lt_cv_sys_global_symbol_to_cdecl="sed -n"\
++$lt_cdecl_hook\
++" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
++" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
++
++# Transform an extracted symbol line into symbol name and symbol address
++lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
++$lt_c_name_hook\
++" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
++" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'"
++
++# Transform an extracted symbol line into symbol name with lib prefix and
++# symbol address.
++lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
++$lt_c_name_lib_hook\
++" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
++" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\
++" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'"
++
++# Handle CRLF in mingw tool chain
++opt_cr=
++case $build_os in
++mingw*)
++ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
++ ;;
++esac
++
++# Try without a prefix underscore, then with it.
++for ac_symprfx in "" "_"; do
++
++ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
++ symxfrm="\\1 $ac_symprfx\\2 \\2"
++
++ # Write the raw and C identifiers.
++ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
++ # Fake it for dumpbin and say T for any non-static function,
++ # D for any global variable and I for any imported variable.
++ # Also find C++ and __fastcall symbols from MSVC++,
++ # which start with @ or ?.
++ lt_cv_sys_global_symbol_pipe="$AWK '"\
++" {last_section=section; section=\$ 3};"\
++" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
++" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
++" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
++" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
++" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
++" \$ 0!~/External *\|/{next};"\
++" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
++" {if(hide[section]) next};"\
++" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
++" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
++" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
++" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
++" ' prfx=^$ac_symprfx"
++ else
++ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
++ fi
++ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
++
++ # Check to see that the pipe works correctly.
++ pipe_works=no
++
++ rm -f conftest*
++ cat > conftest.$ac_ext <<_LT_EOF
++#ifdef __cplusplus
++extern "C" {
++#endif
++char nm_test_var;
++void nm_test_func(void);
++void nm_test_func(void){}
++#ifdef __cplusplus
++}
++#endif
++int main(){nm_test_var='a';nm_test_func();return(0);}
++_LT_EOF
++
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ # Now try to grab the symbols.
++ nlist=conftest.nm
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
++ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; } && test -s "$nlist"; then
++ # Try sorting and uniquifying the output.
++ if sort "$nlist" | uniq > "$nlist"T; then
++ mv -f "$nlist"T "$nlist"
++ else
++ rm -f "$nlist"T
++ fi
++
++ # Make sure that we snagged all the symbols we need.
++ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
++ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
++ cat <<_LT_EOF > conftest.$ac_ext
++/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
++#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
++/* DATA imports from DLLs on WIN32 can't be const, because runtime
++ relocations are performed -- see ld's documentation on pseudo-relocs. */
++# define LT@&t@_DLSYM_CONST
++#elif defined __osf__
++/* This system does not cope well with relocations in const data. */
++# define LT@&t@_DLSYM_CONST
++#else
++# define LT@&t@_DLSYM_CONST const
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++_LT_EOF
++ # Now generate the symbol file.
++ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
++
++ cat <<_LT_EOF >> conftest.$ac_ext
++
++/* The mapping between symbol names and symbols. */
++LT@&t@_DLSYM_CONST struct {
++ const char *name;
++ void *address;
++}
++lt__PROGRAM__LTX_preloaded_symbols[] =
++{
++ { "@PROGRAM@", (void *) 0 },
++_LT_EOF
++ $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
++ cat <<\_LT_EOF >> conftest.$ac_ext
++ {0, (void *) 0}
++};
++
++/* This works around a problem in FreeBSD linker */
++#ifdef FREEBSD_WORKAROUND
++static const void *lt_preloaded_setup() {
++ return lt__PROGRAM__LTX_preloaded_symbols;
++}
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++_LT_EOF
++ # Now try linking the two files.
++ mv conftest.$ac_objext conftstm.$ac_objext
++ lt_globsym_save_LIBS=$LIBS
++ lt_globsym_save_CFLAGS=$CFLAGS
++ LIBS=conftstm.$ac_objext
++ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
++ (eval $ac_link) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; } && test -s conftest$ac_exeext; then
++ pipe_works=yes
++ fi
++ LIBS=$lt_globsym_save_LIBS
++ CFLAGS=$lt_globsym_save_CFLAGS
++ else
++ echo "cannot find nm_test_func in $nlist" >&5
++ fi
++ else
++ echo "cannot find nm_test_var in $nlist" >&5
++ fi
++ else
++ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
++ fi
++ else
++ echo "$progname: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ fi
++ rm -rf conftest* conftst*
++
++ # Do not use the global_symbol_pipe unless it works.
++ if test yes = "$pipe_works"; then
++ break
++ else
++ lt_cv_sys_global_symbol_pipe=
++ fi
++done
++
++fi
++
++if test -z "$lt_cv_sys_global_symbol_pipe"; then
++ lt_cv_sys_global_symbol_to_cdecl=
++fi
++if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
++$as_echo "failed" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
++$as_echo "ok" >&6; }
++fi
++
++# Response file support.
++if test "$lt_cv_nm_interface" = "MS dumpbin"; then
++ nm_file_list_spec='@'
++elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
++ nm_file_list_spec='@'
++fi
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
++$as_echo_n "checking for sysroot... " >&6; }
++
++@%:@ Check whether --with-sysroot was given.
++if test "${with_sysroot+set}" = set; then :
++ withval=$with_sysroot;
++else
++ with_sysroot=no
++fi
++
++
++lt_sysroot=
++case $with_sysroot in #(
++ yes)
++ if test yes = "$GCC"; then
++ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
++ fi
++ ;; #(
++ /*)
++ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
++ ;; #(
++ no|'')
++ ;; #(
++ *)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5
++$as_echo "$with_sysroot" >&6; }
++ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
++ ;;
++esac
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
++$as_echo "${lt_sysroot:-no}" >&6; }
++
++
++
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5
++$as_echo_n "checking for a working dd... " >&6; }
++if ${ac_cv_path_lt_DD+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ printf 0123456789abcdef0123456789abcdef >conftest.i
++cat conftest.i conftest.i >conftest2.i
++: ${lt_DD:=$DD}
++if test -z "$lt_DD"; then
++ ac_path_lt_DD_found=false
++ # Loop through the user's path and test for each of PROGNAME-LIST
++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_prog in dd; do
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext"
++ as_fn_executable_p "$ac_path_lt_DD" || continue
++if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then
++ cmp -s conftest.i conftest.out \
++ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
++fi
++ $ac_path_lt_DD_found && break 3
++ done
++ done
++ done
++IFS=$as_save_IFS
++ if test -z "$ac_cv_path_lt_DD"; then
++ :
++ fi
++else
++ ac_cv_path_lt_DD=$lt_DD
++fi
++
++rm -f conftest.i conftest2.i conftest.out
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5
++$as_echo "$ac_cv_path_lt_DD" >&6; }
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5
++$as_echo_n "checking how to truncate binary pipes... " >&6; }
++if ${lt_cv_truncate_bin+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ printf 0123456789abcdef0123456789abcdef >conftest.i
++cat conftest.i conftest.i >conftest2.i
++lt_cv_truncate_bin=
++if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then
++ cmp -s conftest.i conftest.out \
++ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
++fi
++rm -f conftest.i conftest2.i conftest.out
++test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5
++$as_echo "$lt_cv_truncate_bin" >&6; }
++
++
++
++
++
++
++
++# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
++func_cc_basename ()
++{
++ for cc_temp in @S|@*""; do
++ case $cc_temp in
++ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
++ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
++ \-*) ;;
++ *) break;;
++ esac
++ done
++ func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
++}
++
++@%:@ Check whether --enable-libtool-lock was given.
++if test "${enable_libtool_lock+set}" = set; then :
++ enableval=$enable_libtool_lock;
++fi
++
++test no = "$enable_libtool_lock" || enable_libtool_lock=yes
++
++# Some flags need to be propagated to the compiler or linker for good
++# libtool support.
++case $host in
++ia64-*-hpux*)
++ # Find out what ABI is being produced by ac_compile, and set mode
++ # options accordingly.
++ echo 'int i;' > conftest.$ac_ext
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ case `/usr/bin/file conftest.$ac_objext` in
++ *ELF-32*)
++ HPUX_IA64_MODE=32
++ ;;
++ *ELF-64*)
++ HPUX_IA64_MODE=64
++ ;;
++ esac
++ fi
++ rm -rf conftest*
++ ;;
++*-*-irix6*)
++ # Find out what ABI is being produced by ac_compile, and set linker
++ # options accordingly.
++ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ if test yes = "$lt_cv_prog_gnu_ld"; then
++ case `/usr/bin/file conftest.$ac_objext` in
++ *32-bit*)
++ LD="${LD-ld} -melf32bsmip"
++ ;;
++ *N32*)
++ LD="${LD-ld} -melf32bmipn32"
++ ;;
++ *64-bit*)
++ LD="${LD-ld} -melf64bmip"
++ ;;
++ esac
++ else
++ case `/usr/bin/file conftest.$ac_objext` in
++ *32-bit*)
++ LD="${LD-ld} -32"
++ ;;
++ *N32*)
++ LD="${LD-ld} -n32"
++ ;;
++ *64-bit*)
++ LD="${LD-ld} -64"
++ ;;
++ esac
++ fi
++ fi
++ rm -rf conftest*
++ ;;
++
++mips64*-*linux*)
++ # Find out what ABI is being produced by ac_compile, and set linker
++ # options accordingly.
++ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ emul=elf
++ case `/usr/bin/file conftest.$ac_objext` in
++ *32-bit*)
++ emul="${emul}32"
++ ;;
++ *64-bit*)
++ emul="${emul}64"
++ ;;
++ esac
++ case `/usr/bin/file conftest.$ac_objext` in
++ *MSB*)
++ emul="${emul}btsmip"
++ ;;
++ *LSB*)
++ emul="${emul}ltsmip"
++ ;;
++ esac
++ case `/usr/bin/file conftest.$ac_objext` in
++ *N32*)
++ emul="${emul}n32"
++ ;;
++ esac
++ LD="${LD-ld} -m $emul"
++ fi
++ rm -rf conftest*
++ ;;
++
++x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
++s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
++ # Find out what ABI is being produced by ac_compile, and set linker
++ # options accordingly. Note that the listed cases only cover the
++ # situations where additional linker options are needed (such as when
++ # doing 32-bit compilation for a host where ld defaults to 64-bit, or
++ # vice versa); the common cases where no linker options are needed do
++ # not appear in the list.
++ echo 'int i;' > conftest.$ac_ext
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ case `/usr/bin/file conftest.o` in
++ *32-bit*)
++ case $host in
++ x86_64-*kfreebsd*-gnu)
++ LD="${LD-ld} -m elf_i386_fbsd"
++ ;;
++ x86_64-*linux*)
++ case `/usr/bin/file conftest.o` in
++ *x86-64*)
++ LD="${LD-ld} -m elf32_x86_64"
++ ;;
++ *)
++ LD="${LD-ld} -m elf_i386"
++ ;;
++ esac
++ ;;
++ powerpc64le-*linux*)
++ LD="${LD-ld} -m elf32lppclinux"
++ ;;
++ powerpc64-*linux*)
++ LD="${LD-ld} -m elf32ppclinux"
++ ;;
++ s390x-*linux*)
++ LD="${LD-ld} -m elf_s390"
++ ;;
++ sparc64-*linux*)
++ LD="${LD-ld} -m elf32_sparc"
++ ;;
++ esac
++ ;;
++ *64-bit*)
++ case $host in
++ x86_64-*kfreebsd*-gnu)
++ LD="${LD-ld} -m elf_x86_64_fbsd"
++ ;;
++ x86_64-*linux*)
++ LD="${LD-ld} -m elf_x86_64"
++ ;;
++ powerpcle-*linux*)
++ LD="${LD-ld} -m elf64lppc"
++ ;;
++ powerpc-*linux*)
++ LD="${LD-ld} -m elf64ppc"
++ ;;
++ s390*-*linux*|s390*-*tpf*)
++ LD="${LD-ld} -m elf64_s390"
++ ;;
++ sparc*-*linux*)
++ LD="${LD-ld} -m elf64_sparc"
++ ;;
++ esac
++ ;;
++ esac
++ fi
++ rm -rf conftest*
++ ;;
++
++*-*-sco3.2v5*)
++ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
++ SAVE_CFLAGS=$CFLAGS
++ CFLAGS="$CFLAGS -belf"
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
++$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
++if ${lt_cv_cc_needs_belf+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ 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
++
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ lt_cv_cc_needs_belf=yes
++else
++ lt_cv_cc_needs_belf=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++ 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
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
++$as_echo "$lt_cv_cc_needs_belf" >&6; }
++ if test yes != "$lt_cv_cc_needs_belf"; then
++ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
++ CFLAGS=$SAVE_CFLAGS
++ fi
++ ;;
++*-*solaris*)
++ # Find out what ABI is being produced by ac_compile, and set linker
++ # options accordingly.
++ echo 'int i;' > conftest.$ac_ext
++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ case `/usr/bin/file conftest.o` in
++ *64-bit*)
++ case $lt_cv_prog_gnu_ld in
++ yes*)
++ case $host in
++ i?86-*-solaris*|x86_64-*-solaris*)
++ LD="${LD-ld} -m elf_x86_64"
++ ;;
++ sparc*-*-solaris*)
++ LD="${LD-ld} -m elf64_sparc"
++ ;;
++ esac
++ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
++ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
++ LD=${LD-ld}_sol2
++ fi
++ ;;
++ *)
++ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
++ LD="${LD-ld} -64"
++ fi
++ ;;
++ esac
++ ;;
++ esac
++ fi
++ rm -rf conftest*
++ ;;
++esac
++
++need_locks=$enable_libtool_lock
++
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
++set dummy ${ac_tool_prefix}mt; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$MANIFEST_TOOL"; then
++ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_MANIFEST_TOOL="${ac_tool_prefix}mt"
++ $as_echo "$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
++MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
++if test -n "$MANIFEST_TOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
++$as_echo "$MANIFEST_TOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
++ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
++ # Extract the first word of "mt", so it can be a program name with args.
++set dummy mt; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_MANIFEST_TOOL"; then
++ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_MANIFEST_TOOL="mt"
++ $as_echo "$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_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
++if test -n "$ac_ct_MANIFEST_TOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
++$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_MANIFEST_TOOL" = x; then
++ MANIFEST_TOOL=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
++ fi
++else
++ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
++fi
++
++test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
++$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
++if ${lt_cv_path_mainfest_tool+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_path_mainfest_tool=no
++ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
++ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
++ cat conftest.err >&5
++ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
++ lt_cv_path_mainfest_tool=yes
++ fi
++ rm -f conftest*
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
++$as_echo "$lt_cv_path_mainfest_tool" >&6; }
++if test yes != "$lt_cv_path_mainfest_tool"; then
++ MANIFEST_TOOL=:
++fi
++
++
++
++
++
++
++ case $host_os in
++ rhapsody* | darwin*)
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
++set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_DSYMUTIL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$DSYMUTIL"; then
++ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DSYMUTIL="${ac_tool_prefix}dsymutil"
++ $as_echo "$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
++DSYMUTIL=$ac_cv_prog_DSYMUTIL
++if test -n "$DSYMUTIL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
++$as_echo "$DSYMUTIL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_DSYMUTIL"; then
++ ac_ct_DSYMUTIL=$DSYMUTIL
++ # Extract the first word of "dsymutil", so it can be a program name with args.
++set dummy dsymutil; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_DSYMUTIL"; then
++ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_DSYMUTIL="dsymutil"
++ $as_echo "$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_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
++if test -n "$ac_ct_DSYMUTIL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
++$as_echo "$ac_ct_DSYMUTIL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_DSYMUTIL" = x; then
++ DSYMUTIL=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ DSYMUTIL=$ac_ct_DSYMUTIL
++ fi
++else
++ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
++fi
++
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
++set dummy ${ac_tool_prefix}nmedit; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_NMEDIT+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$NMEDIT"; then
++ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_NMEDIT="${ac_tool_prefix}nmedit"
++ $as_echo "$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
++NMEDIT=$ac_cv_prog_NMEDIT
++if test -n "$NMEDIT"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
++$as_echo "$NMEDIT" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_NMEDIT"; then
++ ac_ct_NMEDIT=$NMEDIT
++ # Extract the first word of "nmedit", so it can be a program name with args.
++set dummy nmedit; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_NMEDIT"; then
++ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_NMEDIT="nmedit"
++ $as_echo "$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_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
++if test -n "$ac_ct_NMEDIT"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
++$as_echo "$ac_ct_NMEDIT" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_NMEDIT" = x; then
++ NMEDIT=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ NMEDIT=$ac_ct_NMEDIT
++ fi
++else
++ NMEDIT="$ac_cv_prog_NMEDIT"
++fi
++
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
++set dummy ${ac_tool_prefix}lipo; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_LIPO+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$LIPO"; then
++ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_LIPO="${ac_tool_prefix}lipo"
++ $as_echo "$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
++LIPO=$ac_cv_prog_LIPO
++if test -n "$LIPO"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
++$as_echo "$LIPO" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_LIPO"; then
++ ac_ct_LIPO=$LIPO
++ # Extract the first word of "lipo", so it can be a program name with args.
++set dummy lipo; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_LIPO"; then
++ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_LIPO="lipo"
++ $as_echo "$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_LIPO=$ac_cv_prog_ac_ct_LIPO
++if test -n "$ac_ct_LIPO"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
++$as_echo "$ac_ct_LIPO" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_LIPO" = x; then
++ LIPO=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ LIPO=$ac_ct_LIPO
++ fi
++else
++ LIPO="$ac_cv_prog_LIPO"
++fi
++
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
++set dummy ${ac_tool_prefix}otool; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OTOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$OTOOL"; then
++ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OTOOL="${ac_tool_prefix}otool"
++ $as_echo "$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
++OTOOL=$ac_cv_prog_OTOOL
++if test -n "$OTOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
++$as_echo "$OTOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OTOOL"; then
++ ac_ct_OTOOL=$OTOOL
++ # Extract the first word of "otool", so it can be a program name with args.
++set dummy otool; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_OTOOL"; then
++ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OTOOL="otool"
++ $as_echo "$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_OTOOL=$ac_cv_prog_ac_ct_OTOOL
++if test -n "$ac_ct_OTOOL"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
++$as_echo "$ac_ct_OTOOL" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_OTOOL" = x; then
++ OTOOL=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ OTOOL=$ac_ct_OTOOL
++ fi
++else
++ OTOOL="$ac_cv_prog_OTOOL"
++fi
++
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
++set dummy ${ac_tool_prefix}otool64; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OTOOL64+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$OTOOL64"; then
++ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OTOOL64="${ac_tool_prefix}otool64"
++ $as_echo "$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
++OTOOL64=$ac_cv_prog_OTOOL64
++if test -n "$OTOOL64"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
++$as_echo "$OTOOL64" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OTOOL64"; then
++ ac_ct_OTOOL64=$OTOOL64
++ # Extract the first word of "otool64", so it can be a program name with args.
++set dummy otool64; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_OTOOL64"; then
++ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ 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_OTOOL64="otool64"
++ $as_echo "$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_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
++if test -n "$ac_ct_OTOOL64"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
++$as_echo "$ac_ct_OTOOL64" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_OTOOL64" = x; then
++ OTOOL64=":"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ OTOOL64=$ac_ct_OTOOL64
++ fi
++else
++ OTOOL64="$ac_cv_prog_OTOOL64"
++fi
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
++$as_echo_n "checking for -single_module linker flag... " >&6; }
++if ${lt_cv_apple_cc_single_mod+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_apple_cc_single_mod=no
++ if test -z "$LT_MULTI_MODULE"; then
++ # By default we will add the -single_module flag. You can override
++ # by either setting the environment variable LT_MULTI_MODULE
++ # non-empty at configure time, or by adding -multi_module to the
++ # link flags.
++ rm -rf libconftest.dylib*
++ echo "int foo(void){return 1;}" > conftest.c
++ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
++-dynamiclib -Wl,-single_module conftest.c" >&5
++ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
++ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
++ _lt_result=$?
++ # If there is a non-empty error log, and "single_module"
++ # appears in it, assume the flag caused a linker warning
++ if test -s conftest.err && $GREP single_module conftest.err; then
++ cat conftest.err >&5
++ # Otherwise, if the output was created with a 0 exit code from
++ # the compiler, it worked.
++ elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
++ lt_cv_apple_cc_single_mod=yes
++ else
++ cat conftest.err >&5
++ fi
++ rm -rf libconftest.dylib*
++ rm -f conftest.*
++ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
++$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
++$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
++if ${lt_cv_ld_exported_symbols_list+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_ld_exported_symbols_list=no
++ save_LDFLAGS=$LDFLAGS
++ echo "_main" > conftest.sym
++ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ lt_cv_ld_exported_symbols_list=yes
++else
++ lt_cv_ld_exported_symbols_list=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++ LDFLAGS=$save_LDFLAGS
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
++$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
++$as_echo_n "checking for -force_load linker flag... " >&6; }
++if ${lt_cv_ld_force_load+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ lt_cv_ld_force_load=no
++ cat > conftest.c << _LT_EOF
++int forced_loaded() { return 2;}
++_LT_EOF
++ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
++ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
++ echo "$AR cru libconftest.a conftest.o" >&5
++ $AR cru libconftest.a conftest.o 2>&5
++ echo "$RANLIB libconftest.a" >&5
++ $RANLIB libconftest.a 2>&5
++ cat > conftest.c << _LT_EOF
++int main() { return 0;}
++_LT_EOF
++ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
++ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
++ _lt_result=$?
++ if test -s conftest.err && $GREP force_load conftest.err; then
++ cat conftest.err >&5
++ elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
++ lt_cv_ld_force_load=yes
++ else
++ cat conftest.err >&5
++ fi
++ rm -f conftest.err libconftest.a conftest conftest.c
++ rm -rf conftest.dSYM
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
++$as_echo "$lt_cv_ld_force_load" >&6; }
++ case $host_os in
++ rhapsody* | darwin1.[012])
++ _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
++ darwin1.*)
++ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
++ darwin*) # darwin 5.x on
++ # if running on 10.5 or later, the deployment target defaults
++ # to the OS version, if on x86, and 10.4, the deployment
++ # target defaults to 10.4. Don't you love it?
++ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
++ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
++ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
++ 10.[012][,.]*)
++ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
++ 10.*)
++ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
++ esac
++ ;;
++ esac
++ if test yes = "$lt_cv_apple_cc_single_mod"; then
++ _lt_dar_single_mod='$single_module'
++ fi
++ if test yes = "$lt_cv_ld_exported_symbols_list"; then
++ _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
++ else
++ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
++ fi
++ if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
++ _lt_dsymutil='~$DSYMUTIL $lib || :'
++ else
++ _lt_dsymutil=
++ fi
++ ;;
++ esac
++
++# func_munge_path_list VARIABLE PATH
++# -----------------------------------
++# VARIABLE is name of variable containing _space_ separated list of
++# directories to be munged by the contents of PATH, which is string
++# having a format:
++# "DIR[:DIR]:"
++# string "DIR[ DIR]" will be prepended to VARIABLE
++# ":DIR[:DIR]"
++# string "DIR[ DIR]" will be appended to VARIABLE
++# "DIRP[:DIRP]::[DIRA:]DIRA"
++# string "DIRP[ DIRP]" will be prepended to VARIABLE and string
++# "DIRA[ DIRA]" will be appended to VARIABLE
++# "DIR[:DIR]"
++# VARIABLE will be replaced by "DIR[ DIR]"
++func_munge_path_list ()
++{
++ case x@S|@2 in
++ x)
++ ;;
++ *:)
++ eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
++ ;;
++ x:*)
++ eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
++ ;;
++ *::*)
++ eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
++ eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
++ ;;
++ *)
++ eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
++ ;;
++ esac
++}
++
++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
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
++$as_echo_n "checking how to run the C preprocessor... " >&6; }
++# On Suns, sometimes $CPP names a directory.
++if test -n "$CPP" && test -d "$CPP"; then
++ CPP=
++fi
++if test -z "$CPP"; then
++ if ${ac_cv_prog_CPP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ # Double quotes because CPP needs to be expanded
++ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
++ do
++ ac_preproc_ok=false
++for ac_c_preproc_warn_flag in '' yes
++do
++ # Use a header file that comes with gcc, so configuring glibc
++ # with a fresh cross-compiler works.
++ # Prefer to if __STDC__ is defined, since
++ # exists even on freestanding compilers.
++ # On the NeXT, cc -E runs the code through the compiler's parser,
++ # not just through cpp. "Syntax error" is here to catch this case.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++@%:@ifdef __STDC__
++@%:@ include
++@%:@else
++@%:@ include
++@%:@endif
++ Syntax error
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++
++else
++ # Broken: fails on valid input.
++continue
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
++
++ # OK, works on sane cases. Now check whether nonexistent headers
++ # can be detected and how.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++@%:@include
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++ # Broken: success on invalid input.
++continue
++else
++ # Passes both tests.
++ac_preproc_ok=:
++break
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
++
++done
++# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
++rm -f conftest.i conftest.err conftest.$ac_ext
++if $ac_preproc_ok; then :
++ break
++fi
++
++ done
++ ac_cv_prog_CPP=$CPP
++
++fi
++ CPP=$ac_cv_prog_CPP
++else
++ ac_cv_prog_CPP=$CPP
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
++$as_echo "$CPP" >&6; }
++ac_preproc_ok=false
++for ac_c_preproc_warn_flag in '' yes
++do
++ # Use a header file that comes with gcc, so configuring glibc
++ # with a fresh cross-compiler works.
++ # Prefer to if __STDC__ is defined, since
++ # exists even on freestanding compilers.
++ # On the NeXT, cc -E runs the code through the compiler's parser,
++ # not just through cpp. "Syntax error" is here to catch this case.
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++@%:@ifdef __STDC__
++@%:@ include