pax_global_header00006660000000000000000000000064150051116360014510gustar00rootroot0000000000000052 comment=7a44a8351c4431184d6e304ab9727c50659fd5f1 gphoto-gphotofs-7a44a83/000077500000000000000000000000001500511163600151745ustar00rootroot00000000000000gphoto-gphotofs-7a44a83/.cvsignore000066400000000000000000000002461500511163600171760ustar00rootroot00000000000000.deps Makefile Makefile.in aclocal.m4 autom4te.cache compile config.h config.h.in config.log config.status configure depcomp install-sh missing stamp-h1 *.o gphotofs gphoto-gphotofs-7a44a83/.gitignore000066400000000000000000000005441500511163600171670ustar00rootroot00000000000000# Generated by autoreconf run /aclocal.m4 /auto-aux/ /autom4te.cache/ /config.h.in /configure /m4/ Makefile.in # Generated by configure run /config.h /config.log /config.status /libtool /po/POTFILES /stamp-h1 .deps/ Makefile # Generated by make run /gphotofs *.o # Generated by "make test" /test-suite.log # Miscellaneous /_b/ /_build/ /_i/ /_install/ gphoto-gphotofs-7a44a83/.travis.yml000066400000000000000000000011731500511163600173070ustar00rootroot00000000000000language: c os: - linux env: - EXTRALIBS="libusb-1.0-0-dev libfuse-dev" before_install: - sudo apt-get update -qq - sudo apt-get install autopoint $EXTRALIBS compiler: - gcc script: - export PATH=/usr/local/opt/gettext/bin:$PATH:. ; mkdir lg2 ; cd lg2 ; git clone https://github.com/gphoto/libgphoto2.git ; cd libgphoto2 ; autoreconf -i -f ; ./configure --prefix=/usr --libdir=/usr/lib && make && sudo make install ; cd ../../ - libtoolize --copy --force - autoreconf -i -f - ./configure && make && make check notifications: recipient: - marcus@jet.franken.de email: on_success: change on_failure: always gphoto-gphotofs-7a44a83/AUTHORS000066400000000000000000000001241500511163600162410ustar00rootroot00000000000000Philip Langdale Marcus Meissner gphoto-gphotofs-7a44a83/COPYING000066400000000000000000000431101500511163600162260ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. gphoto-gphotofs-7a44a83/ChangeLog000066400000000000000000000071501500511163600167510ustar00rootroot000000000000002007-01-24 Marcus Meissner * gphotofs.c: Rev down to fuse 2.5 requirement, inject -s instead. * configure.ac: 2.3.0.trunk.5 2007-01-21 Marcus Meissner * gphotofs.c: - Use single threaded loop (libgphoto2 cannot cope being accessed multithread currently). - Needed to use fuse version 2.6 for this (all others fail one way or the other). - basic statfs support. - charset is always utf-8, because thats what the kernel uses. 2007-01-14 Marcus Meissner * gphotofs.c: Fixed the bugs in the upload code. Upload is working now (needs latest libgphoto2 SVN trunk for working PTP2 driver). 2007-01-14 Philip Langdale (merged by Marcus) * gphotofs.c: Merged the write code. 2007-01-10 Philip Langdale (merged by Marcus) * gphotofs.c: added rmdir/mkdir from write branch. 2006-09-03 Philip Langdale * AUTHORS * README * configure.ac: Update for the 0.3 release and make sure my contact information is accurate. 2006-09-03 Philip Langdale * gphotofs.c: (gphotofs_init). Fix --model to actually work. I needed to load the abilities list before it would be useful... 2006-05-27 Philip Langdale * README: Fix a typo and test svn commit. 2006-01-29 Philip Langdale * gphotofs.c: (main) (gphotofs_init). Implement --port support. 2006-01-12 Philip Langdale * gphotofs.c: (main) (gphotofs_init). Start adding support for relevant command line options. --speed and --model have been implemented while --port and --usbid are pending. 2006-01-12 Philip Langdale * po/POTFILES.in: Add this in preparation for localisation support. 2006-01-04 Philip Langdale * configure.ac * NEWS: 0.2 Release 2006-01-01 Philip Langdale * gphotofs.c: (gpresultToErrno). Add the result codes from gphoto2-port-result.h (gphotofs_readdir). Fix rampant memory leak where the file list wasn't being freed. (gphotofs_read). Report errors. (gphotofs_release). Made a little more robust. 2005-12-30 Philip Langdale * gphotofs.c: (gphotofs_readdir) (gphotofs_getattr). Set the uid and gid of files to match those of the process. This is cosmetic as real access control is provided by the allow_other or allow_root options. 2005-12-29 Philip Langdale * configure.ac * Makefile.am * NEWS * README: 0.1 Release 2005-12-29 Philip Langdale * gphotofs.c: (gphotofs_unlink). Test the result of the delete operation correctly. 2005-12-29 Philip Langdale * gphotofs.c: Lots of stuff. - (struct OpenFile) (freeOpenFile) (gphotofs_open) (gphotofs_release). Add a count for open files so that they aren't closed too early. - (gpresultToErrno). Map libgphoto2 errors to errnos, or at least try to. Prevents things going off the deepend if there is an error. - (gphotofs_getattr). Don't go into an infinite loop if called for a non-existent file. - (gphotofs_readdir). Set the block count for files. This allows du to report a meaningful result. 2005-12-29 Philip Langdale A autogen.sh * configure.ac: Bump version to 0.0.99 for cvs. Checking in to gphoto cvs. 2005-12-28 Philip Langdale * Initial 0.0 Release. gphoto-gphotofs-7a44a83/INSTALL000066400000000000000000000374011500511163600162320ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. ===================== Debian Install ===================== Requirements: libfuse-dev ```sudo apt-get install libfuse-dev``` 1. Download source packages from git ```git clone https://github.com/gphoto/gphotofs.git``` 2. Generate the configuration file for the next step: ```autoreconf --install --symlink``` 3. Configure the package before doing the make operations ``` ./configure``` 4. Make the package ```make``` or for newer systems with more cores ```make -j4``` where 4 is the number of cores. 5. Install the package ```sudo make install``` gphoto-gphotofs-7a44a83/Makefile.am000066400000000000000000000007741500511163600172400ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in SUBDIRS = gphoto-m4 ACLOCAL_AMFLAGS = -I m4 -I gphoto-m4 EXTRA_DIST = test-gphotofs.sh bin_PROGRAMS = gphotofs gphotofs_SOURCES = gphotofs.c gphotofs_CPPFLAGS = \ $(AM_CPPFLAGS) $(CPPFLAGS) \ -DFUSE_USE_VERSION=30 $(FUSE_CFLAGS) \ $(GLIB_CFLAGS) \ $(LIBGPHOTO2_CFLAGS) gphotofs_LDADD = \ $(FUSE_LIBS) $(GLIB_LIBS) \ $(LIBGPHOTO2_LIBS) TESTS_ENVIRONMENT = testdir=test-realdir srcdir=$(srcdir) mountpoint=test-mp TESTS = # test-gphotofs.sh gphoto-gphotofs-7a44a83/NEWS000066400000000000000000000025621500511163600157000ustar00rootroot00000000000000What's new in 1.0 ----------------- - ported to fuse3 - do not check events in read (slows it down too much) - use the random read function if present to avoid using too much memory - refresh directories on file/folder addition - Updates live when you do add or remove files on the device/camera. - Fixed removal protection permissions. What's new in 0.5 ----------------- - ported to work with new libgphoto2 2.5.0 and later What's new in 0.4 ----------------- - Statfs support - FUSE 2.6 API - Single threaded main loop - Write support - mkdir/rmdir What's new in 0.3 ----------------- - Command line options to select a specific camera, like gphoto2. What's new in 0.2 ----------------- - Fixed a big memory leak that happened whenever a directory was listed. - Report libgphoto2_port errors. - Set UID and GID to match the user who ran gphotofs. - This is cosmetic. The allow_root and allow_other fuse options are what really control access. What's new in 0.1 ----------------- * First respectable release. - Notices libgphoto2 errors and tries to map them to errnos. - Doesn't go into an infinite loop when attempting to stat a nonexistent file. What's new in 0.0 ------------------ * Initial release - Can view directory structure and read files off one camera. (I have no idea how it will act will multiple cameras plugged in.) - Can delete files. gphoto-gphotofs-7a44a83/README000066400000000000000000000056151500511163600160630ustar00rootroot00000000000000GPhotoFS -------- GPhotoFS is a filesystem client based on libgphoto2 that exposes supported cameras as filesystems; while some cameras implement the USB Mass Storage class and already appear as filesystems (making this program redundant), many use the Picture Transfer Protocol (PTP) or some other custom protocol. But as long as the camera is supported by libgphoto2, it can be mounted as a filesystem using this program. As libgphoto2 is a userspace library for interacting with cameras, it is natural that if one is to build a filesystem ontop of it, one should use FUSE, and that is what I have done. Getting it ---------- Releases are available at: http://www.gphoto.org/ and the current source code is available in the gphoto project's github repository: http://github.com/gphoto/gphotofs Requirements ------------ FUSE >= 2.2 GLib >= 2.6 libgphoto2 >= 2.1 (Maybe one can go further back but I haven't tried). How to mount a filesystem ------------------------- GPhotoFS implements the same model/port/speed command line options that gphoto2 does, so you can use them to fine tune your choice of camera - but for most people, the autodetection will Just Work(tm) - all you do is run it and give it a mount point. (The --usbid option is not yet supported, but will be eventually). So, just do: gphotofs and when you're finished, you can unmount with: fusermount -u Usage ----- As you'd expect, once you've mounted the camera, you can interact with it like a filesystem, though with limitations. You can: - Traverse directories - Read the contents of files - Delete files - Move files (Read + delete) - Use 'du' to measure file size - Mount the filesystem before plugging in a camera. - Add/Remove directories - Add (upload) files (depends on camera used). - Get free space information - This one seems to be very much at the mercy of the camera manufacturer. I don't know if it'll ever be possible in a general way. (Depends on gp_camera_get_storageinfo()). You cannot: - Modify files still has some problems. - Rename files/directories - Unplug and replug a camera and expect things to keep working. - The backend gets confused and you'll just get errors when you try to do anything. Unmount and remount the filesystem and you'll be back in business. Acknowledgements ---------------- Christopher Lester wrote a FUSE filesystem that is built on top of the gphoto2 command line utility rather than libgphoto2. As he indicated he was not inclined to move it over to the library, and as I wanted to have a go at writing a FUSE filesystem, I went ahead and did it. For the time being, his one is more featureful, but has problems compiling with the latest release of FUSE and is self-admittedly slow. http://www.hep.phy.cam.ac.uk/~lester/gphoto2-fuse-fs/ Contact info ------------ Philip Langdale Marcus Meissner gphoto-gphotofs-7a44a83/configure.ac000066400000000000000000000015701500511163600174650ustar00rootroot00000000000000AC_PREREQ(2.59) AC_INIT([gphoto filesystem], [1.0], [gphoto-devel@lists.sourceforge.net], [gphotofs]) AC_CONFIG_SRCDIR([gphotofs.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([auto-aux]) AM_INIT_AUTOMAKE([gnu 1.9 dist-bzip2]) GP_CHECK_SHELL_ENVIRONMENT AC_PROG_CC AC_PROG_CPP AM_PROG_LIBTOOL AC_PROG_INSTALL AM_PROG_CC_C_O GP_PKG_CONFIG PKG_CHECK_MODULES([FUSE], [fuse3 >= 2.5]) AC_SUBST([FUSE_CFLAGS]) AC_SUBST([FUSE_LIBS]) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.6]) AC_SUBST([GLIB_CFLAGS]) AC_SUBST([GLIB_LIBS]) GP_CHECK_LIBRARY([LIBGPHOTO2], [libgphoto2], [>= 2.5]) ALL_LINGUAS="" GETTEXT_PACKAGE="gphotofs" AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the Gettext package name.]) AM_GLIB_GNU_GETTEXT AC_CONFIG_FILES([ Makefile gphoto-m4/Makefile ]) AC_OUTPUT GP_CONFIG_OUTPUT gphoto-gphotofs-7a44a83/gphoto-m4/000077500000000000000000000000001500511163600170125ustar00rootroot00000000000000gphoto-gphotofs-7a44a83/gphoto-m4/Makefile.am000066400000000000000000000007601500511163600210510ustar00rootroot00000000000000EXTRA_DIST = gp-byteorder.m4 gp-camlibs.m4 gp-check-doxygen.m4 gp-check-library.m4 gp-check-popt.m4 gp-check-shell-environment.m4 gp-config-msg.m4 gp-documentation.m4 gp-dynamic-libraries.m4 gp-gettext-hack.m4 gp-internal-docs.m4 gp-libltdl.m4 gp-manual-docbook-xml.m4 gp-manual-documentation.m4 gp-manual-fig2dev.m4 gp-manual-graphviz.m4 gp-manual-gtk-doc.m4 gp-manual-pstoimg.m4 gp-manual-w3m.m4 gp-packaging.m4 gp-pkg-config.m4 gp-references.m4 gp-stdint.m4 gp-udev.m4 gp-va-copy.m4 README.m4 gphoto-gphotofs-7a44a83/gphoto-m4/README.m4000066400000000000000000000003531500511163600202120ustar00rootroot00000000000000This is the gPhoto projects' collection of autoconf/automake m4 macros. It has been designed to be used in - gphoto2 - libgphoto2 - libgphoto2_port (located in libgphoto2/) - gtkam Some macros are re-used ones from libexif. gphoto-gphotofs-7a44a83/gphoto-m4/gp-byteorder.m4000066400000000000000000000300641500511163600216620ustar00rootroot00000000000000dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE ) dnl Originally written by Dan Fandrich dnl My contribution is hereby placed into the public domain. dnl No warranty is expressed or implied. dnl dnl Create a header file that guarantees that byte swapping macros of the dnl ntohl variety as well as the extended types included in OpenBSD and dnl NetBSD such as le32toh are defined. If possible, the standard ntohl dnl are overloaded as they are optimized for the given platform, but when dnl this is not possible (e.g. on a big-endian machine) they are defined dnl in this file. dnl Look for a symbol in a header file dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) AC_DEFUN([AC_HAVE_SYMBOL], [ AC_MSG_CHECKING(for $1 in $2) AC_EGREP_CPP([symbol is present|\<$1\>],[ #include <$2> #ifdef $1 symbol is present #endif ], [AC_MSG_RESULT(yes) $3 ], [AC_MSG_RESULT(no) $4 ])]) dnl Create a header file that defines extended byte swapping macros AC_DEFUN([AC_NEED_BYTEORDER_H], [ ac_dir=`AS_DIRNAME(["$1"])` if test "$ac_dir" != "$1" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && AS_MKDIR_P(["$ac_dir"]) fi # We're only interested in the target CPU, but it's not always set effective_target="$target" if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then effective_target="$host" fi AC_SUBST(effective_target) cat > "$1" << EOF /* This file is generated automatically by configure */ /* It is valid only for the system type ${effective_target} */ #ifndef __BYTEORDER_H #define __BYTEORDER_H EOF dnl First, do an endian check AC_C_BIGENDIAN dnl Look for NetBSD-style extended byte swapping macros AC_HAVE_SYMBOL(le32toh,machine/endian.h, [HAVE_LE32TOH=1 cat >> "$1" << EOF /* extended byte swapping macros are already available */ #include EOF], [ dnl Look for standard byte swapping macros AC_HAVE_SYMBOL(ntohl,arpa/inet.h, [cat >> "$1" << EOF /* ntohl and relatives live here */ #include EOF], [AC_HAVE_SYMBOL(ntohl,netinet/in.h, [cat >> "$1" << EOF /* ntohl and relatives live here */ #include EOF],true)]) ]) dnl Look for generic byte swapping macros dnl OpenBSD AC_HAVE_SYMBOL(swap32,machine/endian.h, [cat >> "$1" << EOF /* swap32 and swap16 are defined in machine/endian.h */ EOF], [ dnl Linux GLIBC AC_HAVE_SYMBOL(bswap_32,byteswap.h, [cat >> "$1" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) bswap_16(x) #define swap32(x) bswap_32(x) #define swap64(x) bswap_64(x) EOF], [ dnl NetBSD AC_HAVE_SYMBOL(bswap32,machine/endian.h, dnl We're already including machine/endian.h if this test succeeds [cat >> "$1" << EOF /* Define generic byte swapping functions */ EOF if test "$HAVE_LE32TOH" != "1"; then echo '#include '>> "$1" fi cat >> "$1" << EOF #define swap16(x) bswap16(x) #define swap32(x) bswap32(x) #define swap64(x) bswap64(x) EOF], [ dnl FreeBSD AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h, [cat >> "$1" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) __byte_swap_word(x) #define swap32(x) __byte_swap_long(x) /* No optimized 64 bit byte swapping macro is available */ #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF], [ dnl OS X AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h, [cat >> "$1" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) NXSwapShort(x) #define swap32(x) NXSwapLong(x) #define swap64(x) NXSwapLongLong(x) EOF], [ if test $ac_cv_c_bigendian = yes; then cat >> "$1" << EOF /* No other byte swapping functions are available on this big-endian system */ #define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8))) #define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\ ((uint32_t)(x) << 8) & 0x00ff0000UL | \\ ((x) >> 8) & 0x0000ff00UL | \\ ((x) >> 24) & 0x000000ffUL)) #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF else cat >> "$1" << EOF /* Use these as generic byteswapping macros on this little endian system */ #define swap16(x) ntohs(x) #define swap32(x) ntohl(x) /* No optimized 64 bit byte swapping macro is available */ #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF fi ]) ]) ]) ]) ]) [ if test "$HAVE_LE32TOH" != "1"; then cat >> "$1" << EOF /* The byte swapping macros have the form: */ /* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */ /* le (little-endian), NN is 16 or 32 (number of bits) and a, */ /* if present, indicates that the endian side is a pointer to an */ /* array of uint8_t bytes instead of an integer of the specified length. */ /* h refers to the host's ordering method. */ /* So, to convert a 32-bit integer stored in a buffer in little-endian */ /* format into a uint32_t usable on this machine, you could use: */ /* uint32_t value = le32atoh(&buf[3]); */ /* To put that value back into the buffer, you could use: */ /* htole32a(&buf[3], value); */ /* Define aliases for the standard byte swapping macros */ /* Arguments to these macros must be properly aligned on natural word */ /* boundaries in order to work properly on all architectures */ #ifndef htobe16 # define htobe16(x) htons(x) #endif #ifndef htobe32 # define htobe32(x) htonl(x) #endif #ifndef be16toh # define be16toh(x) ntohs(x) #endif #ifndef be32toh # define be32toh(x) ntohl(x) #endif #define HTOBE16(x) (x) = htobe16(x) #define HTOBE32(x) (x) = htobe32(x) #define BE32TOH(x) (x) = be32toh(x) #define BE16TOH(x) (x) = be16toh(x) EOF if test $ac_cv_c_bigendian = yes; then cat >> "$1" << EOF /* Define our own extended byte swapping macros for big-endian machines */ #ifndef htole16 # define htole16(x) swap16(x) #endif #ifndef htole32 # define htole32(x) swap32(x) #endif #ifndef le16toh # define le16toh(x) swap16(x) #endif #ifndef le32toh # define le32toh(x) swap32(x) #endif #ifndef le64toh # define le64toh(x) swap64(x) #endif #ifndef htobe64 # define htobe64(x) (x) #endif #ifndef be64toh # define be64toh(x) (x) #endif #define HTOLE16(x) (x) = htole16(x) #define HTOLE32(x) (x) = htole32(x) #define LE16TOH(x) (x) = le16toh(x) #define LE32TOH(x) (x) = le32toh(x) #define LE64TOH(x) (x) = le64toh(x) #define HTOBE64(x) (void) (x) #define BE64TOH(x) (void) (x) EOF else cat >> "$1" << EOF /* On little endian machines, these macros are null */ #ifndef htole16 # define htole16(x) (x) #endif #ifndef htole32 # define htole32(x) (x) #endif #ifndef htole64 # define htole64(x) (x) #endif #ifndef le16toh # define le16toh(x) (x) #endif #ifndef le32toh # define le32toh(x) (x) #endif #ifndef le64toh # define le64toh(x) (x) #endif #define HTOLE16(x) (void) (x) #define HTOLE32(x) (void) (x) #define HTOLE64(x) (void) (x) #define LE16TOH(x) (void) (x) #define LE32TOH(x) (void) (x) #define LE64TOH(x) (void) (x) /* These don't have standard aliases */ #ifndef htobe64 # define htobe64(x) swap64(x) #endif #ifndef be64toh # define be64toh(x) swap64(x) #endif #define HTOBE64(x) (x) = htobe64(x) #define BE64TOH(x) (x) = be64toh(x) EOF fi fi cat >> "$1" << EOF /* Define the C99 standard length-specific integer types */ #include <_stdint.h> EOF case "${effective_target}" in i[3456]86-*) cat >> "$1" << EOF /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* The i386 and compatibles can handle unaligned memory access, */ /* so use the optimized macros above to do this job */ #ifndef be16atoh # define be16atoh(x) be16toh(*(uint16_t*)(x)) #endif #ifndef be32atoh # define be32atoh(x) be32toh(*(uint32_t*)(x)) #endif #ifndef be64atoh # define be64atoh(x) be64toh(*(uint64_t*)(x)) #endif #ifndef le16atoh # define le16atoh(x) le16toh(*(uint16_t*)(x)) #endif #ifndef le32atoh # define le32atoh(x) le32toh(*(uint32_t*)(x)) #endif #ifndef le64atoh # define le64atoh(x) le64toh(*(uint64_t*)(x)) #endif #ifndef htob16a # define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x) #endif #ifndef htobe32a # define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x) #endif #ifndef htobe64a # define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x) #endif #ifndef htole16a # define htole16a(a,x) *(uint16_t*)(a) = htole16(x) #endif #ifndef htole32a # define htole32a(a,x) *(uint32_t*)(a) = htole32(x) #endif #ifndef htole64a # define htole64a(a,x) *(uint64_t*)(a) = htole64(x) #endif EOF ;; *) cat >> "$1" << EOF /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* Non-optimized but portable macros */ #define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1])) #define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) #define be64atoh_x(x,off,shift) (((uint64_t)((x)[off]))<>8), (a)[1]=(uint8_t)(x) #define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\ (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) #define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\ (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\ (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\ (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) #define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\ (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\ (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) EOF ;; esac ] cat >> "$1" << EOF #endif /*__BYTEORDER_H*/ EOF]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-camlibs.m4000066400000000000000000000124251500511163600212760ustar00rootroot00000000000000dnl GP_CAMLIB & Co. dnl dnl Redundancy free definition of libgphoto2 camlibs. dnl dnl Removes the redundany from the camlib lists, and executes dnl additional consistency checks, e.g. to ensure that subdirectories dnl actually exist. dnl dnl You can mark camlibs as unlisted, i.e. they won't be listed dnl explicitly but still be recognized. dnl dnl Example usage: dnl dnl GP_CAMLIB([canon]) dnl GP_CAMLIB([casio]) dnl [...] dnl GP_CAMLIB([ptp],[unlisted]) dnl GP_CAMLIB([ptp2]) dnl [...] dnl GP_CAMLIB([toshiba]) dnl GP_CAMLIBS_DEFINE([camlibs]) dnl dnl The camlibs basedir parameter of GP_CAMLIBS_DEFINE is optional. dnl dnl #################################################################### dnl AC_DEFUN([GP_CAMLIBS_INIT],[dnl AC_BEFORE([$0],[GP_CAMLIB])dnl m4_define_default([gp_camlib_srcdir], [camlibs])dnl m4_define_default([gp_camlibs], [])dnl m4_define_default([gp_camlibs_unlisted], [])dnl ])dnl dnl dnl #################################################################### dnl AC_DEFUN([GP_CAMLIB],[dnl AC_REQUIRE([GP_CAMLIBS_INIT])dnl AC_BEFORE([$0],[GP_CAMLIBS_DEFINE])dnl m4_if([$2],[unlisted],[dnl # $0($1,$2) m4_append([gp_camlibs_unlisted], [$1], [ ])dnl ],[$#],[1],[dnl # $0($1) m4_append([gp_camlibs], [$1], [ ])dnl ],[dnl m4_errprint(__file__:__line__:[ Error: *** Illegal parameter 2 to $0: `$2' *** Valid values are: undefined or [unlisted] ])dnl m4_exit(1)dnl ])dnl ])dnl dnl dnl #################################################################### dnl AC_DEFUN([GP_CAMLIBS_WARNING],[dnl AC_MSG_WARN([ # Caution: You have chosen to build a non-standard set of camlibs. # You may have disabled the camlib required for your camera, or # enabled a camlib that does *not* work, and overrides the camlib # that does work. Consequently, # YOUR CAMERA MAY NOT WORK! # # Many cameras of several brands are supported by a camlib with a # name different from the name of the camera brand or model. If you # are unsure, please # * enable at least the "ptp2" camlib # * or even better, just build "all" camlibs. ]) sleep 2 ]) dnl dnl #################################################################### dnl AC_DEFUN([GP_CAMLIBS_DEFINE],[dnl AC_REQUIRE([GP_CAMLIBS_INIT])dnl m4_pattern_allow([m4_strip])dnl m4_ifval([$1],[m4_define([gp_camlib_srcdir],[$1])])dnl dnl for camlib in m4_strip(gp_camlibs) m4_strip(gp_camlibs_unlisted) dnl do dnl if test -d "$srcdir/m4_strip(gp_camlib_srcdir)/$camlib"; then :; else dnl AC_MSG_ERROR([ dnl * Fatal: dnl * Source subdirectory for camlib \`$camlib' not found in dnl * directory \`$srcdir/m4_strip(gp_camlib_srcdir)/' dnl ]) dnl fi dnl done AC_MSG_CHECKING([which camlibs to compile]) dnl Yes, that help output won't be all that pretty, but we at least dnl do not have to edit it by hand. AC_ARG_WITH([camlibs],[AS_HELP_STRING( [--with-camlibs=], [Compile camera drivers (camlibs) in . ]dnl [Drivers may be separated with commas. ]dnl [CAUTION: DRIVER NAMES AND CAMERA NAMES MAY DIFFER. ]dnl ['all' is the default and compiles all camlibs. ]dnl [Possible camlibs are: ]dnl m4_strip(gp_camlibs))], [camlibs="$withval"], [camlibs="all"])dnl dnl ALL_DEFINED_CAMLIBS="m4_strip(gp_camlibs) m4_strip(gp_camlibs_unlisted)" ALL_DEFAULT_CAMLIBS="m4_strip(gp_camlibs)" BUILD_THESE_CAMLIBS_BASE="" if test "$camlibs" = "all"; then BUILD_THESE_CAMLIBS_BASE="$ALL_DEFAULT_CAMLIBS" AC_MSG_RESULT([all]) else # If the string starts with "all,", we start with the default list # and add the explicitly defined ones later if echo "$camlibs" | grep "^all," > /dev/null; then BUILD_THESE_CAMLIBS_BASE="$ALL_DEFAULT_CAMLIBS" camlibs="$(echo "$camlibs" | sed 's/^all,//')" fi # camlibs=$(echo $camlibs | sed 's/,/ /g') IFS_save="$IFS" IFS=",$IFS" # Walk through enumeration of camlibs given by user and add them to list # of camlibs to build if we know them. for camlib in ${camlibs}; do IFS="$IFS_save" found=false for from_all_camlib in ${ALL_DEFINED_CAMLIBS}; do if test "$camlib" = "$from_all_camlib"; then if test "x$BUILD_THESE_CAMLIBS_BASE" = "x"; then BUILD_THESE_CAMLIBS_BASE="$camlib" else BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE $camlib" fi found=: break fi done if $found; then :; else AC_MSG_ERROR([Unknown camlib $camlib!]) fi done if test "x$BUILD_THESE_CAMLIBS_BASE" = "xcanon" ; then # Gentoo mode... if user just said "canon", add "ptp2" ... should save support requests. BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE ptp2" camlibs="$camlibs ptp2" AC_MSG_WARN([ "You have just selected the old canon driver. However most current Canons\n" "are supported by the PTP2 driver.\n" "Autoselecting ptp2 driver too to avoid support requests.\n" ]) fi IFS="$IFS_save" AC_MSG_RESULT([$camlibs]) GP_CAMLIBS_WARNING AC_DEFINE_UNQUOTED([INCOMPLETE_CAMLIB_SET], ["$BUILD_THESE_CAMLIBS_BASE"], [Whether the set of camlibs built is incomplete]) fi BUILD_THESE_CAMLIBS="" for f in $BUILD_THESE_CAMLIBS_BASE do BUILD_THESE_CAMLIBS="${BUILD_THESE_CAMLIBS}${BUILD_THESE_CAMLIBS+ }${f}.la" done AC_SUBST([BUILD_THESE_CAMLIBS]) AC_SUBST([ALL_DEFINED_CAMLIBS]) AC_SUBST([ALL_DEFAULT_CAMLIBS]) ])dnl dnl dnl #################################################################### dnl dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-check-doxygen.m4000066400000000000000000000012041500511163600224050ustar00rootroot00000000000000dnl doxygen related stuff dnl look for tools dnl define substitutions for Doxyfile.in AC_DEFUN([GP_CHECK_DOXYGEN],[dnl AC_REQUIRE([GP_CHECK_DOC_DIR])dnl AC_PATH_PROG([DOT], [dot], [false]) AC_PATH_PROG([DOXYGEN], [doxygen], [false]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "xfalse"]) AM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "xfalse"]) if test "x$DOT" != "xfalse"; then AC_SUBST([HAVE_DOT],[YES]) else AC_SUBST([HAVE_DOT],[NO]) fi AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"]) AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output]) AC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"]) ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-check-library.m4000066400000000000000000000377171500511163600224160ustar00rootroot00000000000000dnl @synopsis GP_CHECK_LIBRARY([VARNAMEPART],[libname],[VERSION-REQUIREMENT], dnl [headername],[functionname], dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], dnl [OPTIONAL-REQUIRED-ETC],[WHERE-TO-GET-IT]) dnl dnl Checks for the presence of a certain library. dnl dnl Parameters: dnl dnl VARNAMEPART partial variable name for variable definitions dnl libname name of library dnl VERSION-REQUIREMENT check for the version using pkg-config. dnl default: [] dnl headername name of header file dnl default: [] dnl functionname name of function name in library dnl default: [] dnl ACTION-IF-FOUND shell action to execute if found dnl default: [] dnl ACTION-IF-NOT-FOUND shell action to execute if not found dnl default: [] dnl OPTIONAL-REQUIRED-ETC one of "mandatory", "default-on", "default-off" dnl "disable-explicitly" dnl default: [mandatory] dnl WHERE-TO-GET-IT place where to find the library, e.g. a URL dnl default: [] dnl dnl What the ACTION-IFs can do: dnl dnl * change the variable have_[$1] to "yes" or "no" and thus change dnl the outcome of the test dnl * execute additional checks to define more specific variables, e.g. dnl for different API versions dnl dnl What the OPTIONAL-REQUIRED-ETC options mean: dnl dnl mandatory Absolute requirement, cannot be disabled. dnl default-on If found, it is used. If not found, it is not used. dnl default-off In case of --with-libfoo, detect it. Without dnl --with-libfoo, do not look for and use it. dnl disable-explicitly Required by default, but can be disabled by dnl explicitly giving --without-libfoo. dnl dnl These results have happened after calling GP_CHECK_LIBRARY: dnl dnl AM_CONDITIONAL([HAVE_VARPREFIX],[ if found ]) dnl AM_SUBST([have_VARPREFIX], [ "yes" if found, "no" if not found ]) dnl AM_SUBST([VARPREFIX_CFLAGS],[ -I, -D and stuff ]) dnl AM_SUBST([VARPREFIX_LIBS], [ /path/to/libname.la -L/path -lfoo ]) dnl dnl Parameters to ./configure which influence the GP_CHECK_LIBRARY results: dnl dnl * VARNAMEPART_LIBS=/foobar/arm-palmos/lib/libname.la dnl VARNAMEPART_CFLAGS=-I/foobar/include dnl * --without-libfoo dnl * --with-libfoo=/usr/local dnl * --with-libfoo-include-dir=/foobar/include dnl * --with-libfoo-lib=/foobar/arm-palmos/lib dnl * --with-libfoo=autodetect dnl dnl Examples: dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif])dnl dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif-gtk], [>= 0.3.3])dnl dnl note the space! ^ dnl dnl Possible enhancements: dnl dnl * Derive VAR_PREFIX directly from libname dnl This will change the calling conventions, so be aware of that. dnl * Give names of a header file and function name and to a test dnl compilation. dnl AC_DEFUN([_GP_CHECK_LIBRARY_SOEXT],[dnl AC_MSG_CHECKING([for dynamic library extension]) soext="" case "$host" in *linux*) soext=".so" ;; *sunos*) soext=".so" ;; *solaris*) soext=".so" ;; *bsd*) soext=".so" ;; *darwin*) soext=".dylib" ;; *w32*) soext=".dll" ;; esac case "$host_os" in gnu*) soext=".so" ;; esac if test "x$soext" = "x"; then soext=".so" AC_MSG_RESULT([${soext}]) AC_MSG_WARN([ Host system "${host}" not recognized, defaulting to "${soext}". ]) else AC_MSG_RESULT([${soext}]) fi ])dnl dnl AC_DEFUN([_GP_CHECK_LIBRARY],[ # ---------------------------------------------------------------------- # [GP_CHECK_LIBRARY]([$1],[$2],[$3], # [$4],[$5], # [...],[...],[$8]) m4_ifval([$9],[dnl # $9 ])dnl # ---------------------------------------------------------------------- dnl AC_REQUIRE([GP_CONFIG_MSG])dnl AC_REQUIRE([GP_PKG_CONFIG])dnl AC_REQUIRE([_GP_CHECK_LIBRARY_SOEXT])dnl # Use _CFLAGS and _LIBS given to configure. # This makes it possible to set these vars in a configure script # and AC_CONFIG_SUBDIRS this configure. AC_ARG_VAR([$1][_CFLAGS], [CFLAGS for compiling with ][$2])dnl AC_ARG_VAR([$1][_LIBS], [LIBS to add for linking against ][$2])dnl dnl AC_MSG_CHECKING([for ][$2][ to use]) m4_ifval([$3],[REQUIREMENTS_FOR_][$1][="][$2][ $3]["], [REQUIREMENTS_FOR_][$1][="][$2]["]) userdef_[$1]=no have_[$1]=no if test "x${[$1][_LIBS]}" = "x" && test "x${[$1][_CFLAGS]}" = "x"; then # define --with/--without argument m4_if([$8], [default-off], [m4_pushdef([gp_lib_arg],[--without-][$2])dnl try_[$1]=no ], [m4_pushdef([gp_lib_arg],[--with-][$2])dnl try_[$1]=auto ])dnl AC_ARG_WITH([$2],[AS_HELP_STRING([gp_lib_arg][=PREFIX],[where to find ][$2][, "no" or "auto"])],[try_][$1][="$withval"]) if test "x${[try_][$1]}" = "xno"; then [REQUIREMENTS_FOR_][$1][=] fi if test "x${[try_][$1]}" = "xauto"; then [try_][$1]=autodetect; fi AC_MSG_RESULT([${try_][$1][}]) m4_popdef([gp_lib_arg])dnl if test "x${[try_][$1]}" = "xautodetect"; then # OK, we have to autodetect. # We start autodetection with the cleanest known method: pkg-config if test "x${[have_][$1]}" = "xno"; then # we need that line break after the PKG_CHECK_MODULES m4_ifval([$3], [PKG_CHECK_MODULES([$1],[$2][ $3],[have_][$1][=yes],[:])], [PKG_CHECK_MODULES([$1],[$2], [have_][$1][=yes],[:])] ) fi # If pkg-config didn't find anything, try the libfoo-config program # certain known libraries ship with. if test "x${[have_][$1]}" = "xno"; then AC_MSG_CHECKING([$2][ config program]) m4_pushdef([gp_lib_config],[m4_if([$2],[libusb],[libusb-config], [$2],[libgphoto2],[gphoto2-config], [$2],[libgphoto2_port],[gphoto2-port-config], [$2],[libgd],[gdlib-config], [$2],[libxml-2.0],[xml2-config], [none])])dnl AC_MSG_RESULT([gp_lib_config]) AC_PATH_PROG([$1][_CONFIG_PROG],[gp_lib_config]) if test -n "${[$1][_CONFIG_PROG]}" && test "${[$1][_CONFIG_PROG]}" != "none"; then m4_ifval([$3],[ AC_MSG_CHECKING([for ][$2][ version according to ][gp_lib_config]) m4_pushdef([gp_lib_compop],[regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*.*], [\1])])dnl comparison operator m4_if( gp_lib_compop,[>=],[_][$1][_COMPN="-lt"], gp_lib_compop,[>], [_][$1][_COMPN="-le"], gp_lib_compop,[<], [_][$1][_COMPN="-ge"], gp_lib_compop,[<=],[_][$1][_COMPN="-gt"], gp_lib_compop,[=], [_][$1][_COMPN="-ne"], [m4_errprint(__file__:__line__:[ Error: Illegal version comparison operator: `gp_lib_compop' It must be one of ">=", ">", "<", "<=", "=". ])m4_exit(1)]) m4_popdef([gp_lib_compop])dnl # split requested version number using m4 regexps _[$1]_REQ_1="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\).*], [\2])" _[$1]_REQ_2="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\).*], [\3])" _[$1]_REQ_3="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\).*], [\4])" _[$1]_REQ_4="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)\(.*\)], [\5])" # split installed version number via shell and sed _[$1]_VERSION="$("${[$1][_CONFIG_PROG]}" --version | sed 's/^.* //')" _[$1]_VER_1="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\).*/\1/g')" _[$1]_VER_2="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/g')" _[$1]_VER_3="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/g')" _[$1]_VER_4="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)\(.*\)/\4/g')" AC_MSG_RESULT([${_][$1][_VERSION}]) _tmp=false if test "${_[$1]_VER_1}" "${_[$1]_COMPN}" "${_[$1]_REQ_1}"; then _tmp=true; elif test "${_[$1]_VER_2}" "${_[$1]_COMPN}" "${_[$1]_REQ_2}"; then _tmp=true; elif test "${_[$1]_VER_3}" "${_[$1]_COMPN}" "${_[$1]_REQ_3}"; then _tmp=true; elif test "x${_[$1]_VER_4}" = "x" && test "x${_[$1]_REQ_4}" != "x"; then _tmp=true; elif test "${_[$1]_VER_4}" "${_[$1]_COMPN}" "${_[$1]_REQ_4}"; then _tmp=true; fi AC_MSG_CHECKING([if ][$2][ version is matching requirement ][$3]) if "${_tmp}"; then AC_MSG_RESULT([no]) AC_MSG_ERROR([Version requirement ][$2][ ][$3][ not met. Found: ${_][$1][_VERSION}]) else AC_MSG_RESULT([yes]) fi ])dnl if version requirement given AC_MSG_CHECKING([for ][$2][ parameters from ][gp_lib_config]) [$1]_LIBS="$(${[$1][_CONFIG_PROG]} --libs || echo "*error*")" [$1]_CFLAGS="$(${[$1][_CONFIG_PROG]} --cflags || echo "*error*")" if test "x${[$1]_LIBS}" = "*error*" || test "x${[$1]_CFLAGS}" = "*error*"; then AC_MSG_RESULT([error]) else have_[$1]=yes AC_MSG_RESULT([ok]) fi fi m4_popdef([gp_lib_config])dnl fi m4_ifval([$3],[# Version requirement given, so we do not rely on probing.],[ # Neither pkg-config, nor the libfoo-config program have found anything. # So let's just probe the system. AC_MSG_WARN([The `$2' library could not be found using pkg-config or its known config program. No version checks will be performed if it is found using any other method.]) if test "x${[have_][$1]}" = "xno"; then ifs="$IFS" IFS=":" # FIXME: for W32 and OS/2 we may need ";" here for _libdir_ in \ ${LD_LIBRARY_PATH} \ "${libdir}" \ "${prefix}/lib64" "${prefix}/lib" \ /usr/lib64 /usr/lib \ /usr/local/lib64 /usr/local/lib \ /opt/lib64 /opt/lib do IFS="$ifs" for _soext_ in .la ${soext} .a; do if test -f "${_libdir_}/[$2]${_soext_}" then if test "x${_soext_}" = "x.la" || test "x${_soext_}" = "x.a"; then [$1]_LIBS="${_libdir_}/[$2]${_soext_}" else [$1]_LIBS="-L${_libdir_} -l$(echo "$2" | sed 's/^lib//')" fi break fi done if test "x${[$1][_LIBS]}" != "x"; then break fi done IFS="$ifs" if test "x${[$1][_LIBS]}" != "x"; then have_[$1]=yes fi fi ]) elif test "x${[try_][$1]}" = "xno"; then : else # We've been given a prefix to look in for library $2. # We start looking for $2.la files first. AC_MSG_CHECKING([for ][$2][.la file in ${[try_][$1]}]) if test -f "${[try_][$1]}/lib/[$2].la"; then [$1][_LIBS]="${[try_][$1]}/lib/[$2].la" [$1][_CFLAGS]="-I${[try_][$1]}/include" AC_MSG_RESULT([libtool file $][$1][_LIBS (good)]) have_[$1]=yes elif test -f "${[try_][$1]}/lib64/[$2].la"; then # HACK [$1][_LIBS]="${[try_][$1]}/lib64/[$2].la" [$1][_CFLAGS]="-I${[try_][$1]}/include" AC_MSG_RESULT([libtool file $][$1][_LIBS (good)]) have_[$1]=yes else AC_MSG_RESULT([wild guess that something is in $try_][$1]) [$1][_LIBS]="-L${[try_][$1]}/lib -l$(echo "$2" | sed 's/^lib//')" [$1][_CFLAGS]="-I${[try_][$1]}/include" have_[$1]=yes AC_MSG_WARN([ * Warning: * libtool file $2.la could not be found. * We may be linking against the WRONG library. ]) fi fi elif test "x${[$1][_LIBS]}" != "x" && test "x${[$1][_CFLAGS]}" != "x"; then AC_MSG_RESULT([user-defined]) userdef_[$1]=yes have_[$1]=yes else AC_MSG_RESULT([broken call]) AC_MSG_ERROR([ * Fatal: * When calling configure for ${PACKAGE_TARNAME} * ${PACKAGE_NAME} * either set both [$1][_LIBS] *and* [$1][_CFLAGS] * or neither. ]) fi AC_SUBST([REQUIREMENTS_FOR_][$1]) dnl dnl ACTION-IF-FOUND dnl m4_ifval([$6],[dnl if test "x${[have_][$1]}" = "xyes"; then # ACTION-IF-FOUND $6 fi ])dnl dnl dnl ACTION-IF-NOT-FOUND dnl m4_ifval([$7],[dnl if test "x${[have_][$1]}" = "xno"; then # ACTION-IF-NOT-FOUND $7 fi ])dnl dnl dnl Run our own test compilation dnl m4_ifval([$4],[dnl if test "x${[have_][$1]}" = "xyes"; then dnl AC_MSG_CHECKING([whether ][$2][ test compile succeeds]) dnl AC_MSG_RESULT([${[have_][$1]}]) CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="${[$1]_CFLAGS}" AC_CHECK_HEADER([$4],[have_][$1][=yes],[have_][$1][=no]) CPPFLAGS="$CPPFLAGS_save" fi ])dnl dnl dnl Run our own test link dnl Does not work for libraries which be built after configure time, dnl so we deactivate it for them (userdef_). dnl m4_ifval([$5],[dnl if test "x${[userdef_][$1]}" = "xno" && test "x${[have_][$1]}" = "xyes"; then AC_MSG_CHECKING([for function ][$5][ in ][$2]) LIBS_save="$LIBS" LIBS="${[$1]_LIBS}" AC_TRY_LINK_FUNC([$5],[],[have_][$1][=no]) LIBS="$LIBS_save" AC_MSG_RESULT([${[have_][$1]}]) fi ])dnl dnl dnl Abort configure script if mandatory, but not found dnl m4_if([$8],[mandatory],[ if test "x${[have_][$1]}" = "xno"; then AC_MSG_ERROR([ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} [$1][_LIBS]=${[$1][_LIBS]} [$1][_CFLAGS]=${[$1][_CFLAGS]} * Fatal: ${PACKAGE_NAME} requires $2 $3 to build. * * Possible solutions: * - set PKG_CONFIG_PATH to adequate value * - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=.. * - call configure with one of the --with-$2 parameters ][m4_ifval([$9],[dnl * - get $2 and install it: * $9],[dnl * - get $2 and install it])]) fi ])dnl dnl dnl Abort configure script if not found and not explicitly disabled dnl m4_if([$8],[disable-explicitly],[ if test "x${[try_][$1]}" != "xno" && test "x${[have_][$1]}" = "xno"; then AC_MSG_ERROR([ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} [$1][_LIBS]=${[$1][_LIBS]} [$1][_CFLAGS]=${[$1][_CFLAGS]} * Fatal: ${PACKAGE_NAME} by default requires $2 $3 to build. * You must explicitly disable $2 to build ${PACKAGE_TARNAME} without it. * * Possible solutions: * - call configure with --with-$2=no or --without-$2 * - set PKG_CONFIG_PATH to adequate value * - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=.. * - call configure with one of the --with-$2 parameters ][m4_ifval([$9],[dnl * - get $2 and install it: * $9],[dnl * - get $2 and install it ])][m4_if([$2],[libusb],[dnl * - if you have libusb >= 1.0 installed, you must also install * either the libusb0 compat library or a libusb 0.x version ])]) fi ])dnl AM_CONDITIONAL([HAVE_][$1], [test "x$have_[$1]" = "xyes"]) if test "x$have_[$1]" = "xyes"; then AC_DEFINE([HAVE_][$1], 1, [whether we compile with ][$2][ support]) GP_CONFIG_MSG([$2],[yes])dnl AC_MSG_CHECKING([$2][ library flags]) AC_MSG_RESULT(["${[$1][_LIBS]}"]) AC_MSG_CHECKING([$2][ cpp flags]) AC_MSG_RESULT(["${[$1][_CFLAGS]}"]) else GP_CONFIG_MSG([$2],[no])dnl fi dnl AC_SUBST is done implicitly by AC_ARG_VAR above. dnl AC_SUBST([$1][_LIBS]) dnl AC_SUBST([$1][_CFLAGS]) ])dnl dnl dnl #################################################################### dnl AC_DEFUN([_GP_CHECK_LIBRARY_SYNTAX_ERROR],[dnl m4_errprint(__file__:__line__:[ Error: *** Calling $0 macro with old syntax *** Aborting. ])dnl m4_exit(1)dnl ])dnl dnl dnl #################################################################### dnl AC_DEFUN([GP_CHECK_LIBRARY],[dnl m4_if([$4], [mandatory], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)], [$4], [default-enabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)], [$4], [default-disabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)])dnl m4_if([$8], [], [dnl _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[mandatory],[$9])], [$8], [default-on], [dnl _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], [$8], [disable-explicitly], [dnl _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], [$8], [default-off], [dnl _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], [$8], [mandatory], [dnl _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], [m4_errprint(__file__:__line__:[ Error: Illegal argument 6 to $0: `$6' It must be one of "default-on", "default-off", "mandatory". ])m4_exit(1)])dnl ])dnl dnl m4_pattern_disallow([GP_CHECK_LIBRARY]) m4_pattern_disallow([_GP_CHECK_LIBRARY]) m4_pattern_disallow([_GP_CHECK_LIBRARY_SYNTAX_ERROR]) m4_pattern_disallow([_GP_CHECK_LIBRARY_SOEXT]) dnl dnl #################################################################### dnl dnl Please do not remove this: dnl filetype: 6e60b4f0-acb2-4cd5-8258-42014f92bd2c dnl I use this to find all the different instances of this file which dnl are supposed to be synchronized. dnl dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-check-popt.m4000066400000000000000000000114301500511163600217140ustar00rootroot00000000000000dnl @synopsis GP_CHECK_POPT(FLAG) dnl dnl Check whether libpopt is available. dnl FLAG must be one of dnl "mandatory" dnl "default-enabled" dnl "default-disabled" dnl AC_DEFUN([GP_CHECK_POPT],[ # # [GP_CHECK_POPT] # AC_REQUIRE([GP_CONFIG_MSG])dnl m4_if([$1],[mandatory], [_GP_CHECK_POPT([mandatory])], [$1],[default-enabled], [_GP_CHECK_POPT([disable])], [$1],[default-disabled], [_GP_CHECK_POPT([enable])], [m4_errprint(__file__:__line__:[ Error: Illegal argument to $0: `$1' Valid values are: mandatory, default-enabled, default-disabled ])m4_exit(1)])dnl ])dnl dnl AC_DEFUN([_GP_CHECK_POPT],[ m4_if([$1],[mandatory],[ try_popt=yes require_popt=yes ],[ try_popt=auto require_popt=no AC_ARG_ENABLE([popt], [AS_HELP_STRING([--$1-popt],[Do not use popt])], [ if test "x$enableval" = xno \ || test "x$enableval" = xoff \ || test "x$enableval" = xfalse; then try_popt=no require_popt=no elif test "x$enableval" = xyes \ || test "x$enableval" = xon \ || test "x$enableval" = xtrue then try_popt=yes require_popt=yes fi ])dnl ])dnl AC_MSG_CHECKING([whether popt is required]) AC_MSG_RESULT([${require_popt}]) if test "$require_popt" != yes; then AC_MSG_CHECKING([whether popt is requested]) AC_MSG_RESULT([${try_popt}]) fi dnl Implicit AC_SUBST AC_ARG_VAR([POPT_CFLAGS],[cppflags to compile with libpopt])dnl AC_ARG_VAR([POPT_LIBS],[location of libpopt to link against])dnl have_popt=no if test "x$POPT_CFLAGS" = "x" && test "x$POPT_LIBS" = "x"; then # try to find options to compile popt.h CPPFLAGS_save="$CPPFLAGS" popth_found=no for popt_prefix in "" /usr /usr/local do if test -n "${popt_prefix}"; then : elif test -d "${popt_prefix}/include"; then CPPFLAGS="-I${popt_prefix}/include ${CPPFLAGS}" else continue fi ac_cv_header_popt_h="" unset ac_cv_header_popt_h AC_CHECK_HEADER([popt.h], [popth_found=yes]) if test "$popth_found" = yes; then break; fi done CPPFLAGS="$CPPFLAGS_save" if test "$popth_found" = "yes"; then if test "$popt_prefix" = ""; then POPT_CFLAGS="" else POPT_CFLAGS="-I${popt_prefix}/include" fi elif test "$require_popt" = "yes"; then AC_MSG_ERROR([ * Cannot autodetect popt.h * * Set POPT_CFLAGS and POPT_LIBS correctly. ]) fi # try to find options to link against popt LDFLAGS_save="$LDFLAGS" popt_links=no for popt_prefix in /usr "" /usr/local; do # We could have "/usr" and "lib64" at the beginning of the # lists. Then the first tested location would # incidentally be the right one on 64bit systems, and # thus work around a bug in libtool on 32bit systems: # # 32bit libtool doesn't know about 64bit systems, and so the # compilation will fail when linking a 32bit library from # /usr/lib to a 64bit binary. # # This hack has been confirmed to workwith a # 32bit Debian Sarge and 64bit Fedora Core 3 system. for ldir in lib64 "" lib; do popt_libdir="${popt_prefix}/${ldir}" if test "${popt_libdir}" = "/"; then popt_libdir="" elif test -d "${popt_libdir}"; then LDFLAGS="-L${popt_libdir} ${LDFLAGS}" else continue fi # Avoid caching of results ac_cv_lib_popt_poptStuffArgs="" unset ac_cv_lib_popt_poptStuffArgs AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes]) if test "$popt_links" = yes; then break; fi done if test "$popt_links" = yes; then break; fi done LDFLAGS="$LDFLAGS_save" if test "$popt_links" = "yes"; then if test "$popt_libdir" = ""; then POPT_LIBS="-lpopt" else POPT_LIBS="-L${popt_libdir} -lpopt" fi have_popt=yes elif test "$require_popt" = "yes"; then AC_MSG_ERROR([ * Cannot autodetect library directory containing popt * * Set POPT_CFLAGS and POPT_LIBS correctly. ]) fi elif test "x$POPT_CFLAGS" != "x" && test "x$POPT_LIBS" != "x"; then # just use the user specivied option popt_msg="yes (user specified)" have_popt=yes else AC_MSG_ERROR([ * Fatal: Either set both POPT_CFLAGS and POPT_LIBS or neither. ]) fi AC_MSG_CHECKING([if popt is functional]) if test "$require_popt$have_popt" = "yesno"; then AC_MSG_RESULT([no, but required]) AC_MSG_ERROR([ * popt library not found * Fatal: ${PACKAGE_NAME} (${PACKAGE_TARNAME}) requires popt * Please install it and/or set POPT_CFLAGS and POPT_LIBS. ]) fi AC_MSG_RESULT([${have_popt}]) GP_CONFIG_MSG([use popt library], [${have_popt}]) if test "$have_popt" = "yes"; then AC_DEFINE([HAVE_POPT],[1],[whether the popt library is available]) GP_CONFIG_MSG([popt libs],[${POPT_LIBS}]) GP_CONFIG_MSG([popt cppflags],[${POPT_CFLAGS}]) fi AM_CONDITIONAL([HAVE_POPT],[test "$have_popt" = "yes"]) ])dnl dnl dnl Please do not remove this: dnl filetype: 7595380e-eff3-49e5-90ab-e40f1d544639 dnl I use this to find all the different instances of this file which dnl are supposed to be synchronized. dnl dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-check-shell-environment.m4000066400000000000000000000022041500511163600244020ustar00rootroot00000000000000dnl @synopsis GP_CHECK_SHELL_ENVIRONMENT([SHOW-LOCALE-VARS]) dnl dnl Check that the shell environment is sane. dnl dnl If SHOW-LOCALE-VARS is set to [true], print all LC_* and LANG* dnl variables at configure time. (WARNING: This is not portable!) dnl dnl AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT], [ # make sure "cd" doesn't print anything on stdout if test x"${CDPATH+set}" = xset then CDPATH=: export CDPATH fi # make sure $() command substitution works AC_MSG_CHECKING([for POSIX sh \$() command substitution]) if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # '''' then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) uname=`uname 2>&1` # '' uname_a=`uname -a 2>&1` # '' AC_MSG_ERROR([ * POSIX sh \$() command substition does not work with this shell. * * You are running a very rare species of shell. Please report this * sighting to <${PACKAGE_BUGREPORT}>: * SHELL=${SHELL} * uname=${uname} * uname-a=${uname_a} * Please also include your OS and version. * * Run this configure script using a better (i.e. POSIX compliant) shell. ]) fi dnl m4_if([$1],[true],[dnl printenv | grep -E '^(LC_|LANG)' ])dnl dnl ])dnl dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-config-msg.m4000066400000000000000000000052341500511163600217150ustar00rootroot00000000000000dnl dnl GP_CONFIG_INIT dnl use default LHS width (called implicitly if not called explicitly) dnl GP_CONFIG_INIT([WIDTH-OF-LHS]) dnl explicitly set the LHS width to the given value dnl dnl GP_CONFIG_MSG dnl empty output line dnl GP_CONFIG_MSG([LHS],[RHS]) dnl formatted output line "LHS: RHS" dnl dnl GP_CONFIG_OUTPUT dnl print all the output messages we collected in the mean time dnl dnl Simple way to print a configuration summary at the end of ./configure. dnl dnl Example usage: dnl dnl GP_CONFIG_INIT dnl GP_CONFIG_MSG([Source code location],[${srcdir}]) dnl GP_CONFIG_MSG([Compiler],[${CC}]) dnl GP_CONFIG_MSG dnl GP_CONFIG_MSG([Feature foo],[${foo}]) dnl GP_CONFIG_MSG([Location of bar],[${bar}]) dnl [...] dnl AC_OUTPUT dnl GP_CONFIG_OUTPUT dnl dnl AC_DEFUN([GP_CONFIG_INIT], [dnl AC_REQUIRE([GP_CHECK_SHELL_ENVIRONMENT]) dnl the empty string must contain at least as many spaces as the substr length dnl FIXME: let m4 determine that length dnl (collect left parts in array and choose largest length) m4_if([$1],[],[gp_config_len="30"],[gp_config_len="$1"]) gp_config_empty="" gp_config_len3="$(expr "$gp_config_len" - 3)" n="$gp_config_len" while test "$n" -gt 0; do gp_config_empty="${gp_config_empty} " n="$(expr "$n" - 1)" done gp_config_msg=" Configuration (${PACKAGE_TARNAME} ${PACKAGE_VERSION}): " ])dnl dnl dnl AC_DEFUN([GP_CONFIG_MSG], [AC_REQUIRE([GP_CONFIG_INIT])dnl m4_if([$1],[],[ gp_config_msg="${gp_config_msg} " ],[$2],[],[ gp_config_msg="${gp_config_msg} [$1] " ],[ gp_config_msg_len="$(expr "[$1]" : '.*')" if test "$gp_config_msg_len" -ge "$gp_config_len"; then gp_config_msg_lhs="$(expr "[$1]" : "\(.\{0,${gp_config_len3}\}\)")..:" else gp_config_msg_lhs="$(expr "[$1]:${gp_config_empty}" : "\(.\{0,${gp_config_len}\}\)")" fi gp_config_msg="${gp_config_msg} ${gp_config_msg_lhs} [$2] " ])])dnl dnl AC_DEFUN([GP_CONFIG_MSG_SUBDIRS],[dnl # Message about configured subprojects if test "x$subdirs" != "x"; then GP_CONFIG_MSG()dnl _subdirs="" for sd in $subdirs; do ssd="$(basename "$sd")" if test "x$_subdirs" = "x"; then _subdirs="$ssd"; else _subdirs="$_subdirs $ssd" fi done GP_CONFIG_MSG([Subprojects],[${_subdirs}])dnl fi ])dnl dnl AC_DEFUN([GP_CONFIG_OUTPUT], [AC_REQUIRE([GP_CONFIG_INIT])dnl AC_REQUIRE([GP_CONFIG_MSG])dnl AC_REQUIRE([GP_CONFIG_MSG_SUBDIRS])dnl echo "${gp_config_msg} You may run \"make\" and \"make install\" now." ])dnl dnl dnl Please do not remove this: dnl filetype: de774af3-dc3b-4b1d-b6f2-4aca35d3da16 dnl I use this to find all the different instances of this file which dnl are supposed to be synchronized. dnl dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-documentation.m4000066400000000000000000000063461500511163600225420ustar00rootroot00000000000000dnl dnl check where to install documentation dnl dnl determines documentation "root directory", i.e. the directory dnl where all documentation will be placed in dnl AC_DEFUN([GP_CHECK_DOC_DIR], [ AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl AC_ARG_WITH([doc-dir], [AS_HELP_STRING([--with-doc-dir=PATH], [Where to install docs [default=autodetect]])]) # check for the main ("root") documentation directory AC_MSG_CHECKING([main docdir]) if test "x${with_doc_dir}" != "x" then # docdir is given as parameter docdir="${with_doc_dir}" AC_MSG_RESULT([${docdir} (from parameter)]) else # otherwise invent a docdir hopefully compatible with system policy if test -d "/usr/share/doc" then maindocdir='${prefix}/share/doc' AC_MSG_RESULT([${maindocdir} (FHS style)]) elif test -d "/usr/doc" then maindocdir='${prefix}/doc' AC_MSG_RESULT([${maindocdir} (old style)]) else maindocdir='${datadir}/doc' AC_MSG_RESULT([${maindocdir} (default value)]) fi AC_MSG_CHECKING([package docdir]) # check whether to include package version into documentation path # FIXME: doesn't work properly. if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1 then docdir="${maindocdir}/${PACKAGE}-${VERSION}" AC_MSG_RESULT([${docdir} (redhat style)]) else docdir="${maindocdir}/${PACKAGE}" AC_MSG_RESULT([${docdir} (default style)]) fi fi AC_SUBST([docdir]) ])dnl dnl dnl check whether to build docs and where to: dnl dnl * determine presence of prerequisites (only gtk-doc for now) dnl * determine destination directory for HTML files dnl AC_DEFUN([GP_BUILD_GTK_DOCS], [ # docdir has to be determined in advance AC_REQUIRE([GP_CHECK_DOC_DIR]) # --------------------------------------------------------------------------- # gtk-doc: We use gtk-doc for building our documentation. However, we # require the user to explicitely request the build. # --------------------------------------------------------------------------- try_gtkdoc=false gtkdoc_msg="no (not requested)" have_gtkdoc=false AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs], [Use gtk-doc to build documentation [default=no]])],[ if test x$enableval = xyes; then try_gtkdoc=true fi ]) if $try_gtkdoc; then AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb]) if test -n "${GTKDOC}"; then have_gtkdoc=true gtkdoc_msg="yes" else gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)" fi fi AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc]) GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg]) # --------------------------------------------------------------------------- # Give the user the possibility to install html documentation in a # user-defined location. # --------------------------------------------------------------------------- AC_ARG_WITH([html-dir], [AS_HELP_STRING([--with-html-dir=PATH], [Where to install html docs [default=autodetect]])]) AC_MSG_CHECKING([for html dir]) if test "x${with_html_dir}" = "x" ; then htmldir="${docdir}/html" AC_MSG_RESULT([${htmldir} (default)]) else htmldir="${with_html_dir}" AC_MSG_RESULT([${htmldir} (from parameter)]) fi AC_SUBST([htmldir]) apidocdir="${htmldir}/api" AC_SUBST([apidocdir]) ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-dynamic-libraries.m4000066400000000000000000000036131500511163600232610ustar00rootroot00000000000000AC_DEFUN([GP_DYNAMIC_LIBRARIES],[dnl dnl We require either of those dnl AC_REQUIRE([AC_LIBTTDL_INSTALLABLE])dnl dnl AC_REQUIRE([AC_LIBLTDL_CONVENIENCE])dnl AC_REQUIRE([AC_LIBTOOL_DLOPEN])dnl AC_REQUIRE([AC_PROG_LIBTOOL])dnl dnl --------------------------------------------------------------------------- dnl Check for libltdl: dnl - lt_dlforeachfile has been introduced in libtool-1.4. dnl - However, there are still systems out there running libtool-1.3. dnl For those, we will use our shipped libltdl. This has the welcome dnl side effect that we don't have to distinguish between libltdl 1.3 with dnl and without the notorious segfault bug. dnl - FIXME: In case we're using our own version, we have to check whether dnl -ldl is required? dnl --------------------------------------------------------------------------- # $0 ltdl_msg="no (not found or too old)" have_ltdl=false LIBS_save="$LIBS" LIBS="$LIBLTDL" AC_CHECK_LIB([ltdl], [lt_dlforeachfile],[ CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$LTDLINCL" AC_CHECK_HEADER([ltdl.h],[ AC_DEFINE([HAVE_LTDL],1,[whether we use libltdl]) ltdl_msg="yes (from system)" have_ltdl=: ]) CPPFLAGS="$CPPFLAGS_save" ]) LIBS="$LIBS_save" if "$have_ltdl"; then :; else AC_MSG_CHECKING([for included libltdl]) if test -d "$srcdir/libltdl"; then LIBLTDL="\$(top_builddir)/libltdl/libltdlc.la" LTDLINCL="-I\$(top_srcdir)/libltdl" have_ltdl=: ltdl_msg="yes (included)" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([ *** Could not detect or configure libltdl. ]) fi fi GP_CONFIG_MSG([libltdl],["${ltdl_msg}"]) ])dnl dnl dnl #################################################################### dnl dnl Please do not remove this: dnl filetype: 2b993145-3256-47b4-84fd-ec4dcdf4fdf9 dnl I use this to find all the different instances of this file which dnl are supposed to be synchronized. dnl dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-gettext-hack.m4000066400000000000000000000046641500511163600222620ustar00rootroot00000000000000dnl dnl GP_GETTEXT_HACK dnl dnl gettext hack, originally designed for libexif, libgphoto2, and Co. dnl This creates a po/Makevars file with adequate values if the dnl po/Makevars.template is present. dnl dnl Example usage: dnl GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}], dnl [Copyright Holder], dnl [foo-translation@example.org]) dnl ALL_LINGUAS="de es fr" dnl AM_GNU_GETTEXT_VERSION([0.14.1]) dnl AM_GNU_GETTEXT([external]) dnl AM_PO_SUBDIRS() dnl AM_ICONV() dnl GP_GETTEXT_FLAGS dnl dnl You can leave out the GP_GETTEXT_HACK parameters if you want to, dnl GP_GETTEXT_HACK will try fall back to sensible values in that case: dnl AC_DEFUN([GP_GETTEXT_HACK], [ AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl m4_if([$1],[],[GETTEXT_PACKAGE="${PACKAGE_TARNAME}"],[GETTEXT_PACKAGE="$1"]) AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [The gettext domain we're using]) AC_SUBST([GETTEXT_PACKAGE]) sed_cmds="s|^DOMAIN.*|DOMAIN = ${GETTEXT_PACKAGE}|" m4_if([$2],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $2|"]) m4_ifval([$3],[ if test -n "$PACKAGE_BUGREPORT"; then sed_mb="${PACKAGE_BUGREPORT}" else AC_MSG_ERROR([ *** Your configure.{ac,in} is wrong. *** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax) *** or give [GP_GETTEXT_HACK] the third parameter. *** ]) fi ],[ sed_mb="$3" ]) sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|" # Not so sure whether this hack is all *that* evil... AC_MSG_CHECKING([for po/Makevars requiring hack]) if test -f "${srcdir}/po/Makevars.template"; then sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars" AC_MSG_RESULT([yes, done.]) else AC_MSG_RESULT([no]) fi ]) AC_DEFUN([GP_GETTEXT_FLAGS], [ AC_REQUIRE([AM_GNU_GETTEXT]) AC_REQUIRE([GP_CONFIG_INIT]) if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl" fi GP_CONFIG_MSG([Use translations],[${USE_NLS}]) if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}]) fi ]) dnl Please do not remove this: dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81 dnl I use this to find all the different instances of this file which dnl are supposed to be synchronized. dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-internal-docs.m4000066400000000000000000000016321500511163600224240ustar00rootroot00000000000000dnl dnl dnl AC_DEFUN([GP_INTERNAL_DOCS],[dnl # Whether to enable the internal docs build. # # This takes quite some time due to the generation of lots of call # graphs, so it is disabled by default. set_enable_internal_docs=no AC_ARG_ENABLE([internal-docs], [dnl AS_HELP_STRING([--enable-internal-docs], [Build internal code docs if doxygen available])], [dnl dnl If either --enable-foo nor --disable-foo were given, execute this. if test "x$enableval" = xno \ || test "x$enableval" = xoff \ || test "x$enableval" = xfalse; then set_enable_internal_docs=no elif test "x$enableval" = xyes \ || test "x$enableval" = xon \ || test "x$enableval" = xtrue then set_enable_internal_docs=yes fi ]) AC_MSG_CHECKING([whether to create internal code docs]) AC_MSG_RESULT([${set_enable_internal_docs}]) AM_CONDITIONAL([ENABLE_INTERNAL_DOCS], [test "x${set_enable_internal_docs}" = "xyes"]) ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-libltdl.m4000066400000000000000000000034601500511163600213110ustar00rootroot00000000000000dnl Written by Hans Ulrich Niedermann dnl LDFLAGS vs LIBS fix by Dan Nicholson dnl dnl We are using our own libltdl checks instead of AC_WITH_LTDL dnl because we do not want to ship our own copy of libltdl any more. dnl Not shipping libltdl makes it possible to ditch our own autogen.sh dnl and relying on standard autoconf's "autoreconf". dnl dnl Look for external libltdl, not shipping internal libltdl. AC_DEFUN([GP_LIB_LTDL],[dnl AC_ARG_VAR([LTDLINCL],[CFLAGS for compiling with libltdl]) AC_ARG_VAR([LIBLTDL],[LIBS to add for linking against libltdl]) if test "x${LTDLINCL}${LIBLTDL}" = "x"; then AC_CHECK_HEADER([ltdl.h], [dnl AC_CHECK_LIB([ltdl], [lt_dlinit],[dnl LTDLINCL="" LIBLTDL="-lltdl" AC_DEFINE([HAVE_LTDL],[1],[Whether libltdl (of libtool fame) is present]) ],[dnl AC_MSG_ERROR([ $PACKAGE requires the ltdl library, included with libtool Please make sure that the proper development package is installed (libltdl-dev, libtool-ltdl-devel, etc.) ])[]dnl ])dnl ]) else AC_MSG_CHECKING([for libltdl flags]) AC_MSG_RESULT([set explicitly: ${LTDLINCL} ${LIBLTDL}]) fi AC_SUBST([LTDLINCL]) AC_SUBST([LIBLTDL]) dnl dnl Make sure we can actually compile and link against libltdl AC_LANG_PUSH([C]) AC_MSG_CHECKING([that we can compile and link with libltdl]) saved_CPPFLAGS="$CPPFLAGS" saved_LIBS="$LIBS" CPPFLAGS="$CPPFLAGS $LTDLINCL" LIBS="$LIBS $LIBLTDL" AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl #include /* for NULL */ #include /* for lt_* */ ],[dnl int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL); ])], [AC_MSG_RESULT([yes])], [dnl AC_MSG_RESULT([no]) AC_MSG_ERROR([cannot compile and link against libltdl ${PACKAGE_TARNAME} requires libltdl (the libtool dl* library), but cannot compile and link against it. Aborting. ]) ]) CPPFLAGS="$saved_CPPFLAGS" LIBS="$saved_LIBS" AC_LANG_POP ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-manual-docbook-xml.m4000066400000000000000000000026441500511163600233570ustar00rootroot00000000000000dnl ------------------------------------------------------------------------ dnl try to find xmlto (required for generation of man pages and html docs) dnl ------------------------------------------------------------------------ AC_DEFUN([GP_CHECK_DOCBOOK_XML], [ AC_MSG_CHECKING([for XML catalogs]) XML_CATALOG_FILES="`find /etc/xml /usr/share/xml /usr/share/sgml -type f \( -iname 'catalog.xml' -or -iname 'catalog' \) -print 2> /dev/null | while read file; do echo -n "$file "; done`" if test "x$XML_CATALOG_FILES" = "x" then AC_MSG_RESULT([none found.]) else AC_MSG_RESULT([found ${XML_CATALOG_FILES}]) fi AC_SUBST(XML_CATALOG_FILES) #XML_DEBUG_CATALOG=0 #AC_SUBST(XML_DEBUG_CATALOG) manual_msg="no (http://cyberelk.net/tim/xmlto/)" try_xmlto=true have_xmlto=false AC_ARG_WITH(xmlto, [ --without-xmlto Don't use xmlto],[ if test x$withval = xno; then try_xmlto=false fi]) if $try_xmlto; then AC_PATH_PROG(XMLTO,xmlto) if test -n "${XMLTO}"; then have_xmlto=true manual_msg="yes" PURE_XMLTO="$XMLTO" if true || test "x$XML_CATALOG_FILES" = "x"; then unset XML_CATALOG_FILES XMLTO="${XMLTO} -m \$(top_srcdir)/src/xsl/custom.xsl" else XMLTO="env XML_CATALOG_FILES=\"${XML_CATALOG_FILES}\" ${XMLTO} -m ${top_srcdir}/src/xsl/custom.xsl" fi else # in case anybody runs $(XMLTO) somewhere, we return false XMLTO=false fi fi AM_CONDITIONAL(XMLTO, $have_xmlto) ]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-manual-documentation.m4000066400000000000000000000226071500511163600240130ustar00rootroot00000000000000dnl dnl check where to install documentation dnl dnl determines documentation "root directory", i.e. the directory dnl where all documentation will be placed in dnl AC_DEFUN([GP_CHECK_DOCDIR], [ AC_ARG_WITH(doc-dir, [ --with-doc-dir=PATH Where to install docs [default=autodetect]])dnl # check for the main ("root") documentation directory AC_MSG_CHECKING([main docdir]) if test "x${with_doc_dir}" != "x" then # docdir is given as parameter docdir="${with_doc_dir}" AC_MSG_RESULT([${docdir} (from parameter)]) else # otherwise invent a docdir hopefully compatible with system policy if test -d "/usr/share/doc" then maindocdir='${prefix}/share/doc' AC_MSG_RESULT([${maindocdir} (FHS style)]) elif test -d "/usr/doc" then maindocdir='${prefix}/doc' AC_MSG_RESULT([${maindocdir} (old style)]) else maindocdir='${datadir}/doc' AC_MSG_RESULT([${maindocdir} (default value)]) fi AC_MSG_CHECKING(package docdir) # check whether to include package version into documentation path # FIXME: doesn't work properly. if ls -d /usr/{share/,}doc/*-[[]0-9[]]* > /dev/null 2>&1 then docdir="${maindocdir}/${PACKAGE}-${VERSION}" AC_MSG_RESULT([${docdir} (redhat style)]) else docdir="${maindocdir}/${PACKAGE}" AC_MSG_RESULT([${docdir} (default style)]) fi fi AC_SUBST(docdir) ])dnl dnl Solaris hack for grep and tr AC_DEFUN([GP_CHECK_TR], [ if test -n "`echo $host_os | grep '[sS]olaris'`"; then TR=/usr/xpg4/bin/tr GREP=/usr/xpg4/bin/grep else TR=tr GREP=grep fi ]) dnl dnl check whether to build docs and where to: dnl dnl * determine presence of prerequisites (only gtk-doc for now) dnl * determine destination directory for HTML files dnl AC_DEFUN([GP_BUILD_DOCS], [ # doc dir has to be determined in advance AC_REQUIRE([GP_CHECK_DOCDIR]) AC_REQUIRE([GP_CHECK_GTK_DOC]) AC_REQUIRE([GP_CHECK_FIG2DEV]) AC_REQUIRE([GP_CHECK_DOCBOOK_XML]) AC_REQUIRE([GP_CHECK_TR]) AC_REQUIRE([GP_CHECK_PSTOIMG]) AC_REQUIRE([GP_CHECK_DOT]) AC_REQUIRE([GP_CHECK_W3M]) gphoto2xml='$(top_srcdir)/src/gphoto2.xml' AC_SUBST(gphoto2xml) dnl --------------------------------------------------------------------------- dnl Give the user the possibility to install documentation in dnl user-defined locations. dnl --------------------------------------------------------------------------- AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Where to install html docs [default=autodetect]]) AC_MSG_CHECKING([for html dir]) if test "x${with_html_dir}" = "x" ; then htmldir="${docdir}/html" AC_MSG_RESULT([${htmldir} (default)]) else htmldir="${with_html_dir}" AC_MSG_RESULT([${htmldir} (from parameter)]) fi AC_SUBST(htmldir) AC_ARG_WITH(xhtml-dir, [ --with-xhtml-dir=PATH Where to install xhtml docs [default=autodetect]]) AC_MSG_CHECKING([for xhtml dir]) if test "x${with_xhtml_dir}" = "x" ; then xhtmldir="${docdir}/xhtml" AC_MSG_RESULT([${xhtmldir} (default)]) else xhtmldir="${with_xhtml_dir}" AC_MSG_RESULT([${xhtmldir} (from parameter)]) fi AC_SUBST(xhtmldir) AC_ARG_WITH(html-nochunks-dir, [ --with-html-nochunks-dir=PATH Where to install html-nochunks docs [default=autodetect]]) AC_MSG_CHECKING([for html-nochunks dir]) if test "x${with_html_nochunks_dir}" = "x" ; then htmlnochunksdir="${docdir}/html-nochunks" AC_MSG_RESULT([${htmlnochunksdir} (default)]) else htmlnochunksdir="${with_html_nochunks_dir}" AC_MSG_RESULT([${htmlnochunksdir} (from parameter)]) fi AC_SUBST(htmlnochunksdir) AC_ARG_WITH(xhtml-nochunks-dir, [ --with-xhtml-nochunks-dir=PATH Where to install xhtml-nochunks docs [default=autodetect]]) AC_MSG_CHECKING([for xhtml-nochunks dir]) if test "x${with_xhtml_nochunks_dir}" = "x" ; then xhtmlnochunksdir="${docdir}/xhtml-nochunks" AC_MSG_RESULT([${xhtmlnochunksdir} (default)]) else xhtmlnochunksdir="${with_xhtml_nochunks_dir}" AC_MSG_RESULT([${xhtmlnochunksdir} (from parameter)]) fi AC_SUBST(xhtmlnochunksdir) AC_ARG_WITH(xml-dir, [ --with-xml-dir=PATH Where to install xml docs [default=autodetect]]) AC_MSG_CHECKING([for xml dir]) if test "x${with_xml_dir}" = "x" ; then xmldir="${docdir}/xml" AC_MSG_RESULT([${xmldir} (default)]) else xmldir="${with_xml_dir}" AC_MSG_RESULT([${xmldir} (from parameter)]) fi AC_SUBST(xmldir) xmlcssdir="${xmldir}/css" AC_SUBST(xmlcssdir) AC_ARG_WITH(txt-dir, [ --with-txt-dir=PATH Where to install txt docs [default=autodetect]]) AC_MSG_CHECKING([for txt dir]) if test "x${with_txt_dir}" = "x" ; then txtdir="${docdir}/txt" AC_MSG_RESULT([${txtdir} (default)]) else txtdir="${with_txt_dir}" AC_MSG_RESULT([${txtdir} (from parameter)]) fi AC_SUBST(txtdir) AC_ARG_WITH(man-dir, [ --with-man-dir=PATH Where to install man docs [default=autodetect]]) AC_MSG_CHECKING([for man dir]) if test "x${with_man_dir}" = "x" ; then manmandir="${docdir}/man" AC_MSG_RESULT([${manmandir} (default)]) else manmandir="${with_man_dir}" AC_MSG_RESULT([${manmandir} (from parameter)]) fi AC_SUBST(manmandir) AC_ARG_WITH(pdf-dir, [ --with-pdf-dir=PATH Where to install pdf docs [default=autodetect]]) AC_MSG_CHECKING([for pdf dir]) if test "x${with_pdf_dir}" = "x" ; then pdfdir="${docdir}/pdf" AC_MSG_RESULT([${pdfdir} (default)]) else pdfdir="${with_pdf_dir}" AC_MSG_RESULT([${pdfdir} (from parameter)]) fi AC_SUBST(pdfdir) AC_ARG_WITH(ps-dir, [ --with-ps-dir=PATH Where to install ps docs [default=autodetect]]) AC_MSG_CHECKING([for ps dir]) if test "x${with_ps_dir}" = "x" ; then psdir="${docdir}/ps" AC_MSG_RESULT([${psdir} (default)]) else psdir="${with_ps_dir}" AC_MSG_RESULT([${psdir} (from parameter)]) fi AC_SUBST(psdir) AC_ARG_WITH(figure-dir, [ --with-figure-dir=PATH Where to install figures [default=autodetect]]) AC_MSG_CHECKING([for figure dir]) if test "x${with_figure_dir}" = "x" ; then figuredir="${docdir}/figures" AC_MSG_RESULT([${figuredir} (default)]) else figuredir="${with_figure_dir}" AC_MSG_RESULT([${figuredir} (from parameter)]) fi AC_SUBST(figuredir) AC_ARG_WITH(screenshots-dir, [ --with-screenshots-dir=PATH Where to install screenshotss [default=autodetect]]) AC_MSG_CHECKING([for screenshots dir]) if test "x${with_screenshots_dir}" = "x" ; then screenshotsdir="${docdir}/screenshots" AC_MSG_RESULT([${screenshotsdir} (default)]) else screenshotsdir="${with_screenshots_dir}" AC_MSG_RESULT([${screenshotsdir} (from parameter)]) fi AC_SUBST(screenshotsdir) screenshotsgtkamdir="${screenshotsdir}/gtkam" AC_SUBST(screenshotsgtkamdir) doc_formats_list='man html txt ps pdf' # initialize have_xmlto* to false for i in $doc_formats_list; do d=`echo $i | $TR A-Z a-z` eval "have_xmlto$d=false" done AC_MSG_CHECKING(checking doc formats) AC_ARG_WITH(doc_formats, [ --with-doc-formats= create doc with format in ; ] [ 'all' build all doc formats; ] [ possible formats are: ] [ man, html, ps, pdf ], doc_formats="$withval", doc_formats="man html txt") if test "$doc_formats" = "all"; then doc_formats=$doc_formats_list else doc_formats=`echo $doc_formats | sed 's/,/ /g'` fi # set have_xmlto* to true if requested and possible if $have_xmlto; then for i in $doc_formats; do if test -n "`echo $doc_formats_list | $GREP -E \"(^| )$i( |\$)\"`"; then eval "have_xmlto$i=true" else AC_ERROR(Unknown doc format $i!) fi done AC_MSG_RESULT($doc_formats) else AC_MSG_RESULT([deactivated (requires xmlto)]) fi # Make sure that xmltopdf actually works if $have_xmltopdf; then AC_MSG_CHECKING([whether pdf creation works]) oldcwd="$(pwd)" top_srcdir() { echo "$srcdir"; } mkdir test-pdf cd test-pdf cat>test-db.xml< Foo Title Foo Chapter Foo bar blah blah . EOF ${PURE_XMLTO} pdf -o . test-db.xml --searchpath .. if test -s test-db.pdf; then AC_MSG_RESULT([yes, look at $(pwd)/test-db.pdf to verify]) else if $have_xmltopdf; then AC_MSG_ERROR([PDF creation requested, but failed. See $(pwd) ...]) else AC_MSG_RESULT([no, but not requested]) fi fi cd "$oldcwd" unset top_srcdir fi AM_CONDITIONAL(XMLTOHTML,$have_xmltohtml) AM_CONDITIONAL(XMLTOMAN,$have_xmltoman) AM_CONDITIONAL(XMLTOTXT,$have_xmltotxt) AM_CONDITIONAL(XMLTOTXT2,$have_xmltotxt && $have_w3m) AM_CONDITIONAL(XMLTOPDF,$have_xmltopdf) AM_CONDITIONAL(XMLTOPS,$have_xmltops) # create list of supported formats AC_MSG_CHECKING([for manual formats to re­create]) xxx="" manual_html="" manual_pdf="" manual_ps="" if $have_xmltohtml; then xxx="${xxx} html" fi if $have_xmltoman; then xxx="${xxx} man" fi if $have_xmltopdf; then xxx="${xxx} pdf" fi if $have_xmltops; then xxx="${xxx} ps" fi if $have_xmltotxt; then xxx="${xxx} txt" fi AC_SUBST(manual_html) AC_SUBST(manual_pdf) AC_SUBST(manual_ps) AC_MSG_RESULT($xxx) if test "x$xxx" != "x" then if $have_fig2dev; then fig_out="" else fig_out="out" fi manual_msg="in (${xxx} ) formats with${fig_out} figures" fi ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-manual-fig2dev.m4000066400000000000000000000017111500511163600224610ustar00rootroot00000000000000dnl --------------------------------------------------------------------------- dnl fig2dev: This program is needed for processing images. If not found, dnl documentation can still be built, but without figures. dnl --------------------------------------------------------------------------- AC_DEFUN([GP_CHECK_FIG2DEV], [ try_fig2dev=true have_fig2dev=false AC_ARG_WITH(fig2dev, [ --without-fig2dev Don't use fig2dev],[ if test "x$withval" = "xno"; then try_fig2dev=false fi]) if $try_fig2dev; then AC_PATH_PROG(FIG2DEV,fig2dev) if test -n "${FIG2DEV}"; then have_fig2dev=true fi fi if $have_fig2dev; then AC_SUBST(FIG2DEV) ${FIG2DEV} -L ps > /dev/null < /dev/null < /dev/null if test $? != 0 || test ! -f tesseract.png; then have_pstoimg=false AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) fi rm -f tesseract.png fi AM_CONDITIONAL(ENABLE_PSTOIMG, $have_pstoimg) ]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-manual-w3m.m4000066400000000000000000000021441500511163600216420ustar00rootroot00000000000000dnl --------------------------------------------------------------------------- dnl w3m: This program is needed for converting HTML to text. dnl --------------------------------------------------------------------------- AC_DEFUN([GP_CHECK_W3M], [ try_w3m=true have_w3m=false AC_ARG_WITH(w3m, [ --without-w3m Don't use w3m],[ if test "x$withval" = "xno"; then try_w3m=false fi]) if $try_w3m; then AC_PATH_PROG(W3M,w3m) if test -n "${W3M}"; then have_w3m=true fi fi if $have_w3m; then AC_MSG_CHECKING([whether ${W3M} works]) cat > html2text-test.xxxhtml 2> /dev/null < <h1>HTML2TEXT Test</h1>

This is a test.

EOF ${W3M} -T text/html -cols 78 -dump html2text-test.xxxhtml > html2text-test.txt if test $? != 0 || test ! -f html2text-test.txt || test ! -s html2text-test.txt then have_w3m=false AC_MSG_RESULT([no (see http://www.w3m.org/ or http://w3m.sourceforge.net/ ...)]) W3M=false AC_SUBST(W3M) else AC_MSG_RESULT([yes]) AC_SUBST(W3M) fi fi AM_CONDITIONAL([HAVE_W3M], [$have_w3m]) ]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-packaging.m4000066400000000000000000000042041500511163600216040ustar00rootroot00000000000000AC_DEFUN([GPKG_CHECK_RPM], [ AC_ARG_WITH([rpmbuild], [AS_HELP_STRING([--with-rpmbuild=PATH], [Program to use for building RPMs])]) AC_MSG_CHECKING([for rpmbuild or rpm]) if test -x "${with_rpmbuild}" then RPMBUILD="${with_rpmbuild}" AC_MSG_RESULT([${RPMBUILD} (from parameter)]) else AC_MSG_RESULT([using autodetection]) AC_CHECK_PROGS(RPMBUILD, [rpmbuild rpm], false) AC_MSG_CHECKING([for rpmbuild or rpm]) AC_MSG_RESULT([${RPMBUILD} (autodetected)]) fi AC_SUBST([RPMBUILD]) AM_CONDITIONAL([ENABLE_RPM], [test "$RPMBUILD" != "false"]) ]) AC_DEFUN([GPKG_CHECK_LINUX], [ # effective_target has to be determined in advance AC_REQUIRE([AC_NEED_BYTEORDER_H]) is_linux=false case "$effective_target" in *linux*) is_linux=true ;; esac AM_CONDITIONAL([HAVE_LINUX], ["$is_linux"]) # required for docdir # FIXME: Implicit dependency # AC_REQUIRE(GP_CHECK_DOC_DIR) AC_ARG_WITH([hotplug-doc-dir], [AS_HELP_STRING([--with-hotplug-doc-dir=PATH], [Where to install hotplug scripts as docs [default=autodetect]])]) if "$is_linux"; then AC_MSG_CHECKING([for hotplug doc dir]) if test "x${with_hotplug_doc_dir}" != "x" then # given as parameter hotplugdocdir="${with_hotplug_doc_dir}" AC_MSG_RESULT([${hotplugdocdir} (from parameter)]) else # start at docdir hotplugdocdir="${docdir}/linux-hotplug" AC_MSG_RESULT([${hotplugdocdir} (default)]) fi else hotplugdocdir="" fi AC_ARG_WITH([hotplug-usermap-dir], [AS_HELP_STRING([--with-hotplug-usermap-dir=PATH], [Where to install hotplug scripts as docs [default=autodetect]])]) if "$is_linux"; then AC_MSG_CHECKING([for hotplug usermap dir]) if test "x${with_hotplug_usermap_dir}" != "x" then # given as parameter hotplugusermapdir="${with_hotplug_usermap_dir}" AC_MSG_RESULT([${hotplugusermapdir} (from parameter)]) else # start at docdir hotplugusermapdir="${docdir}/linux-hotplug" AC_MSG_RESULT([${hotplugusermapdir} (default)]) fi else hotplugusermapdir="" fi # Let us hope that automake does not create "" directories # on non-Linux systems now. AC_SUBST([hotplugdocdir]) AC_SUBST([hotplugusermapdir]) ]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-pkg-config.m4000066400000000000000000000022041500511163600217020ustar00rootroot00000000000000dnl @synopsis GP_PKG_CONFIG dnl dnl If you want to set the PKG_CONFIG_PATH, best do so before dnl calling GP_PKG_CONFIG AC_DEFUN([GP_PKG_CONFIG],[ # # [GP_PKG_CONFIG] # AC_ARG_VAR([PKG_CONFIG],[pkg-config package config utility]) export PKG_CONFIG AC_ARG_VAR([PKG_CONFIG_PATH],[directory where pkg-config looks for *.pc files]) export PKG_CONFIG_PATH AC_MSG_CHECKING([PKG_CONFIG_PATH]) if test "x${PKG_CONFIG_PATH}" = "x"; then AC_MSG_RESULT([empty]) else AC_MSG_RESULT([${PKG_CONFIG_PATH}]) fi dnl AC_REQUIRE([PKG_CHECK_MODULES]) AC_PATH_PROG([PKG_CONFIG],[pkg-config],[false]) if test "$PKG_CONFIG" = "false"; then AC_MSG_ERROR([ *** Build requires pkg-config *** *** Possible solutions: *** - set PKG_CONFIG to where your pkg-config is located *** - set PATH to include the directory where pkg-config is installed *** - get it from http://freedesktop.org/software/pkgconfig/ and install it ]) fi ])dnl dnl Please do not remove this: dnl filetype: d87b877b-80ec-447c-b042-21ec4a27c6f0 dnl I use this to find all the different instances of this file which dnl are supposed to be synchronized. dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphoto-m4/gp-references.m4000066400000000000000000000022711500511163600220030ustar00rootroot00000000000000dnl dnl Define external references dnl dnl Define once, use many times. dnl No more URLs and Mail addresses in translated strings and stuff. dnl AC_DEFUN([GP_REF],[ AC_SUBST([$1],["$2"]) AC_DEFINE_UNQUOTED([$1],["$2"],[$3]) ]) AC_DEFUN([GP_REFERENCES], [ GP_REF( [URL_GPHOTO_HOME], [http://www.gphoto.org/], [gphoto project home page])dnl GP_REF( [URL_GPHOTO_GITHUB], [http://github.com/gphoto/], [gphoto github project page]) GP_REF( [URL_GPHOTO_PROJECT], [http://sourceforge.net/projects/gphoto], [gphoto sourceforge project page]) GP_REF( [URL_DIGICAM_LIST], [http://www.teaser.fr/~hfiguiere/linux/digicam.html], [camera list with support status]) GP_REF( [URL_JPHOTO_HOME], [http://jphoto.sourceforge.net/], [jphoto home page]) GP_REF( [URL_USB_MASSSTORAGE], [http://www.linux-usb.org/USB-guide/x498.html], [information about using USB mass storage]) GP_REF( [MAIL_GPHOTO_DEVEL], [], [gphoto development mailing list]) GP_REF( [MAIL_GPHOTO_USER], [], [gphoto user mailing list]) GP_REF( [MAIL_GPHOTO_TRANSLATION], [], [gphoto translation mailing list]) ]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-stdint.m4000066400000000000000000000570021500511163600211710ustar00rootroot00000000000000dnl AC_NEED_STDINT_H ( HEADER-TO-GENERATE ) dnl Originally written 2001 by Dan Fandrich dnl My contribution is hereby placed into the public domain. dnl No warranty is expressed or implied. dnl dnl Look for a header file that defines size-specific integer types like the dnl ones recommended to be in stdint.h in the C99 standard (e.g. uint32_t). dnl This is a dumbed-down version of the macro of the same name in the file dnl ac_need_stdint_h.m4 which is part of the ac-archive, available at dnl (also, another macro dnl AC_CREATE_STDINT_H by the same author). This version is not as smart, dnl but works on older autoconf versions and has a different license. dnl AX_CHECK_DEFINED_TYPE ( TYPE, FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) dnl This is similar to _AC_CHECK_TYPE_NEW (a.k.a. new syntax version of dnl AC_CHECK_TYPE) in autoconf 2.50 but works on older versions AC_DEFUN([AX_CHECK_DEFINED_TYPE], [AC_MSG_CHECKING([for $1 in $2]) AC_EGREP_CPP(changequote(<<,>>)dnl <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl changequote([,]), [#include <$2>], ac_cv_type_$1=yes, ac_cv_type_$1=no)dnl AC_MSG_RESULT($ac_cv_type_$1) if test $ac_cv_type_$1 = yes; then $3 else $4 fi ]) dnl Look for a header file that defines size-specific integer types AC_DEFUN([AX_NEED_STDINT_H], [ ac_dir=`AS_DIRNAME(["$1"])` if test "$ac_dir" != "$1" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && AS_MKDIR_P(["$ac_dir"]) fi AX_CHECK_DEFINED_TYPE(uint8_t, stdint.h, [ cat > "$1" < EOF], [AX_CHECK_DEFINED_TYPE(uint8_t, inttypes.h, [cat > "$1" < EOF], [AX_CHECK_DEFINED_TYPE(uint8_t, sys/types.h, [cat > "$1" < EOF], [AX_CHECK_DEFINED_TYPE(u_int8_t, sys/types.h, [cat > "$1" < typedef u_int8_t uint8_t; typedef u_int16_t uint16_t; typedef u_int32_t uint32_t; EOF AX_CHECK_DEFINED_TYPE(u_int64_t, sys/types.h, [cat >> "$1" <> "$1" <]) AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) m4_ifvaln([$1],[$1]) break done AC_MSG_CHECKING([for stdint uintptr_t]) ]) ]) AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[ AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[ ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h) AC_MSG_RESULT([(..)]) for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h stdint.h]) ; do unset ac_cv_type_uint32_t unset ac_cv_type_uint64_t AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>]) AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) m4_ifvaln([$1],[$1]) break break; done AC_MSG_CHECKING([for stdint uint32_t]) ]) ]) AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[ AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[ ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h) AC_MSG_RESULT([(..)]) for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do unset ac_cv_type_u_int32_t unset ac_cv_type_u_int64_t AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>]) AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>]) m4_ifvaln([$1],[$1]) break break; done AC_MSG_CHECKING([for stdint u_int32_t]) ]) ]) AC_DEFUN([AX_CREATE_STDINT_H], [# ------ AX CREATE STDINT H ------------------------------------- AC_MSG_CHECKING([for stdint types]) ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` # try to shortcircuit - if the default include path of the compiler # can find a "stdint.h" header then we assume that all compilers can. AC_CACHE_VAL([ac_cv_header_stdint_t],[ old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS="" old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="" old_CFLAGS="$CFLAGS" ; CFLAGS="" AC_TRY_COMPILE([#include ],[int_least32_t v = 0;], [ac_cv_stdint_result="(assuming C99 compatible system)" ac_cv_header_stdint_t="stdint.h"; ], [ac_cv_header_stdint_t=""]) CXXFLAGS="$old_CXXFLAGS" CPPFLAGS="$old_CPPFLAGS" CFLAGS="$old_CFLAGS" ]) v="... $ac_cv_header_stdint_h" if test "$ac_stdint_h" = "stdint.h" ; then AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)]) elif test "$ac_stdint_h" = "inttypes.h" ; then AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)]) elif test "_$ac_cv_header_stdint_t" = "_" ; then AC_MSG_RESULT([(putting them into $ac_stdint_h)$v]) else ac_cv_header_stdint="$ac_cv_header_stdint_t" AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)]) fi if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit.. dnl .....intro message done, now do a few system checks..... dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type, dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW dnl instead that is triggered with 3 or more arguments (see types.m4) inttype_headers=`echo $2 | sed -e 's/,/ /g'` ac_cv_stdint_result="(no helpful system typedefs seen)" AX_CHECK_HEADER_STDINT_X(dnl stdint.h inttypes.h sys/inttypes.h $inttype_headers, ac_cv_stdint_result="(seen uintptr_t$and64 in $i)") if test "_$ac_cv_header_stdint_x" = "_" ; then AX_CHECK_HEADER_STDINT_O(dnl, inttypes.h sys/inttypes.h stdint.h $inttype_headers, ac_cv_stdint_result="(seen uint32_t$and64 in $i)") fi if test "_$ac_cv_header_stdint_x" = "_" ; then if test "_$ac_cv_header_stdint_o" = "_" ; then AX_CHECK_HEADER_STDINT_U(dnl, sys/types.h inttypes.h sys/inttypes.h $inttype_headers, ac_cv_stdint_result="(seen u_int32_t$and64 in $i)") fi fi dnl if there was no good C99 header file, do some typedef checks... if test "_$ac_cv_header_stdint_x" = "_" ; then AC_MSG_CHECKING([for stdint datatype model]) AC_MSG_RESULT([(..)]) AX_CHECK_DATA_MODEL fi if test "_$ac_cv_header_stdint_x" != "_" ; then ac_cv_header_stdint="$ac_cv_header_stdint_x" elif test "_$ac_cv_header_stdint_o" != "_" ; then ac_cv_header_stdint="$ac_cv_header_stdint_o" elif test "_$ac_cv_header_stdint_u" != "_" ; then ac_cv_header_stdint="$ac_cv_header_stdint_u" else ac_cv_header_stdint="stddef.h" fi AC_MSG_CHECKING([for extra inttypes in chosen header]) AC_MSG_RESULT([($ac_cv_header_stdint)]) dnl see if int_least and int_fast types are present in _this_ header. unset ac_cv_type_int_least32_t unset ac_cv_type_int_fast32_t AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>]) fi # shortcircut to system "stdint.h" # ------------------ PREPARE VARIABLES ------------------------------ if test "$GCC" = "yes" ; then ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1` else ac_cv_stdint_message="using $CC" fi AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl $ac_cv_stdint_result]) dnl ----------------------------------------------------------------- # ----------------- DONE inttypes.h checks START header ------------- AC_CONFIG_COMMANDS([$ac_stdint_h],[ AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h) ac_stdint=$tmp/_stdint.h echo "#ifndef" $_ac_stdint_h >$ac_stdint echo "#define" $_ac_stdint_h "1" >>$ac_stdint echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint if test "_$ac_cv_header_stdint_t" != "_" ; then echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint echo "#include " >>$ac_stdint echo "#endif" >>$ac_stdint echo "#endif" >>$ac_stdint else cat >>$ac_stdint < #else #include /* .................... configured part ............................ */ STDINT_EOF echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint if test "_$ac_cv_header_stdint_x" != "_" ; then ac_header="$ac_cv_header_stdint_x" echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint else echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint fi echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint if test "_$ac_cv_header_stdint_o" != "_" ; then ac_header="$ac_cv_header_stdint_o" echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint else echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint fi echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint if test "_$ac_cv_header_stdint_u" != "_" ; then ac_header="$ac_cv_header_stdint_u" echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint else echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint fi echo "" >>$ac_stdint if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then echo "#include <$ac_header>" >>$ac_stdint echo "" >>$ac_stdint fi fi echo "/* which 64bit typedef has been found */" >>$ac_stdint if test "$ac_cv_type_uint64_t" = "yes" ; then echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint fi if test "$ac_cv_type_u_int64_t" = "yes" ; then echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint fi echo "" >>$ac_stdint echo "/* which type model has been detected */" >>$ac_stdint if test "_$ac_cv_char_data_model" != "_" ; then echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint else echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint fi echo "" >>$ac_stdint echo "/* whether int_least types were detected */" >>$ac_stdint if test "$ac_cv_type_int_least32_t" = "yes"; then echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint fi echo "/* whether int_fast types were detected */" >>$ac_stdint if test "$ac_cv_type_int_fast32_t" = "yes"; then echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint fi echo "/* whether intmax_t type was detected */" >>$ac_stdint if test "$ac_cv_type_intmax_t" = "yes"; then echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint fi echo "" >>$ac_stdint cat >>$ac_stdint <= 199901L #define _HAVE_UINT64_T #define _HAVE_LONGLONG_UINT64_T typedef long long int64_t; typedef unsigned long long uint64_t; #elif !defined __STRICT_ANSI__ #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ #define _HAVE_UINT64_T typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ /* note: all ELF-systems seem to have loff-support which needs 64-bit */ #if !defined _NO_LONGLONG #define _HAVE_UINT64_T #define _HAVE_LONGLONG_UINT64_T typedef long long int64_t; typedef unsigned long long uint64_t; #endif #elif defined __alpha || (defined __mips && defined _ABIN32) #if !defined _NO_LONGLONG typedef long int64_t; typedef unsigned long uint64_t; #endif /* compiler/cpu type to define int64_t */ #endif #endif #endif #if defined _STDINT_HAVE_U_INT_TYPES /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ typedef u_int8_t uint8_t; typedef u_int16_t uint16_t; typedef u_int32_t uint32_t; /* glibc compatibility */ #ifndef __int8_t_defined #define __int8_t_defined #endif #endif #ifdef _STDINT_NEED_INT_MODEL_T /* we must guess all the basic types. Apart from byte-adressable system, */ /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */ /* (btw, those nibble-addressable systems are way off, or so we assume) */ dnl /* have a look at "64bit and data size neutrality" at */ dnl /* http://unix.org/version2/whatsnew/login_64bit.html */ dnl /* (the shorthand "ILP" types always have a "P" part) */ #if defined _STDINT_BYTE_MODEL #if _STDINT_LONG_MODEL+0 == 242 /* 2:4:2 = IP16 = a normal 16-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned long uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef long int32_t; #endif #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444 /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */ /* 4:4:4 = ILP32 = a normal 32-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef int int32_t; #endif #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488 /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */ /* 4:8:8 = LP64 = a normal 64-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef int int32_t; #endif /* this system has a "long" of 64bit */ #ifndef _HAVE_UINT64_T #define _HAVE_UINT64_T typedef unsigned long uint64_t; typedef long int64_t; #endif #elif _STDINT_LONG_MODEL+0 == 448 /* LLP64 a 64-bit system derived from a 32-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef int int32_t; #endif /* assuming the system has a "long long" */ #ifndef _HAVE_UINT64_T #define _HAVE_UINT64_T #define _HAVE_LONGLONG_UINT64_T typedef unsigned long long uint64_t; typedef long long int64_t; #endif #else #define _STDINT_NO_INT32_T #endif #else #define _STDINT_NO_INT8_T #define _STDINT_NO_INT32_T #endif #endif /* * quote from SunOS-5.8 sys/inttypes.h: * Use at your own risk. As of February 1996, the committee is squarely * behind the fixed sized types; the "least" and "fast" types are still being * discussed. The probability that the "fast" types may be removed before * the standard is finalized is high enough that they are not currently * implemented. */ #if defined _STDINT_NEED_INT_LEAST_T typedef int8_t int_least8_t; typedef int16_t int_least16_t; typedef int32_t int_least32_t; #ifdef _HAVE_UINT64_T typedef int64_t int_least64_t; #endif typedef uint8_t uint_least8_t; typedef uint16_t uint_least16_t; typedef uint32_t uint_least32_t; #ifdef _HAVE_UINT64_T typedef uint64_t uint_least64_t; #endif /* least types */ #endif #if defined _STDINT_NEED_INT_FAST_T typedef int8_t int_fast8_t; typedef int int_fast16_t; typedef int32_t int_fast32_t; #ifdef _HAVE_UINT64_T typedef int64_t int_fast64_t; #endif typedef uint8_t uint_fast8_t; typedef unsigned uint_fast16_t; typedef uint32_t uint_fast32_t; #ifdef _HAVE_UINT64_T typedef uint64_t uint_fast64_t; #endif /* fast types */ #endif #ifdef _STDINT_NEED_INTMAX_T #ifdef _HAVE_UINT64_T typedef int64_t intmax_t; typedef uint64_t uintmax_t; #else typedef long intmax_t; typedef unsigned long uintmax_t; #endif #endif #ifdef _STDINT_NEED_INTPTR_T #ifndef __intptr_t_defined #define __intptr_t_defined /* we encourage using "long" to store pointer values, never use "int" ! */ #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484 typedef unsinged int uintptr_t; typedef int intptr_t; #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444 typedef unsigned long uintptr_t; typedef long intptr_t; #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T typedef uint64_t uintptr_t; typedef int64_t intptr_t; #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */ typedef unsigned long uintptr_t; typedef long intptr_t; #endif #endif #endif /* The ISO C99 standard specifies that in C++ implementations these should only be defined if explicitly requested. */ #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS #ifndef UINT32_C /* Signed. */ # define INT8_C(c) c # define INT16_C(c) c # define INT32_C(c) c # ifdef _HAVE_LONGLONG_UINT64_T # define INT64_C(c) c ## L # else # define INT64_C(c) c ## LL # endif /* Unsigned. */ # define UINT8_C(c) c ## U # define UINT16_C(c) c ## U # define UINT32_C(c) c ## U # ifdef _HAVE_LONGLONG_UINT64_T # define UINT64_C(c) c ## UL # else # define UINT64_C(c) c ## ULL # endif /* Maximal type. */ # ifdef _HAVE_LONGLONG_UINT64_T # define INTMAX_C(c) c ## L # define UINTMAX_C(c) c ## UL # else # define INTMAX_C(c) c ## LL # define UINTMAX_C(c) c ## ULL # endif /* literalnumbers */ #endif #endif /* These limits are merily those of a two complement byte-oriented system */ /* Minimum of signed integral types. */ # define INT8_MIN (-128) # define INT16_MIN (-32767-1) # define INT32_MIN (-2147483647-1) # define INT64_MIN (-__INT64_C(9223372036854775807)-1) /* Maximum of signed integral types. */ # define INT8_MAX (127) # define INT16_MAX (32767) # define INT32_MAX (2147483647) # define INT64_MAX (__INT64_C(9223372036854775807)) /* Maximum of unsigned integral types. */ # define UINT8_MAX (255) # define UINT16_MAX (65535) # define UINT32_MAX (4294967295U) # define UINT64_MAX (__UINT64_C(18446744073709551615)) /* Minimum of signed integral types having a minimum size. */ # define INT_LEAST8_MIN INT8_MIN # define INT_LEAST16_MIN INT16_MIN # define INT_LEAST32_MIN INT32_MIN # define INT_LEAST64_MIN INT64_MIN /* Maximum of signed integral types having a minimum size. */ # define INT_LEAST8_MAX INT8_MAX # define INT_LEAST16_MAX INT16_MAX # define INT_LEAST32_MAX INT32_MAX # define INT_LEAST64_MAX INT64_MAX /* Maximum of unsigned integral types having a minimum size. */ # define UINT_LEAST8_MAX UINT8_MAX # define UINT_LEAST16_MAX UINT16_MAX # define UINT_LEAST32_MAX UINT32_MAX # define UINT_LEAST64_MAX UINT64_MAX /* shortcircuit*/ #endif /* once */ #endif #endif STDINT_EOF fi if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then AC_MSG_NOTICE([$ac_stdint_h is unchanged]) else ac_dir=`AS_DIRNAME(["$ac_stdint_h"])` AS_MKDIR_P(["$ac_dir"]) rm -f $ac_stdint_h mv $ac_stdint $ac_stdint_h fi ],[# variables for create stdint.h replacement PACKAGE="$PACKAGE" VERSION="$VERSION" ac_stdint_h="$ac_stdint_h" _ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h) ac_cv_stdint_message="$ac_cv_stdint_message" ac_cv_header_stdint_t="$ac_cv_header_stdint_t" ac_cv_header_stdint_x="$ac_cv_header_stdint_x" ac_cv_header_stdint_o="$ac_cv_header_stdint_o" ac_cv_header_stdint_u="$ac_cv_header_stdint_u" ac_cv_type_uint64_t="$ac_cv_type_uint64_t" ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" ac_cv_char_data_model="$ac_cv_char_data_model" ac_cv_long_data_model="$ac_cv_long_data_model" ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" ac_cv_type_intmax_t="$ac_cv_type_intmax_t" ]) ]) gphoto-gphotofs-7a44a83/gphoto-m4/gp-subpackage.m4000066400000000000000000000002761500511163600217720ustar00rootroot00000000000000AC_DEFUN([GP_SUBPACKAGE], [ AC_ARG_VAR([enable_subpackage_][$1], [enable subpackage ][$1][ (true or false)]) test "x${[enable_subpackage_][$1]}" = "x" && [enable_subpackage_][$1]=true ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-udev.m4000066400000000000000000000007301500511163600206230ustar00rootroot00000000000000dnl Determines whether UDEV code should be compiled. dnl $1 contains shell code that returns 0 if all other prerequisites (like dnl libusb) are available. AC_DEFUN([GP_UDEV],[dnl if test "x${udevscriptdir}" = "x"; then udevscriptdir="\${libdir}/udev"; fi AC_ARG_VAR([udevscriptdir],[Directory where udev scripts like check-ptp-camera will be installed]) AC_SUBST([udevscriptdir]) AM_CONDITIONAL([HAVE_UDEV],[if echo "$host"|grep -i linux >/dev/null ; then $1; fi ]) ])dnl gphoto-gphotofs-7a44a83/gphoto-m4/gp-va-copy.m4000066400000000000000000000021221500511163600212330ustar00rootroot00000000000000dnl @synopsis GP_VA_COPY dnl dnl Checks whether one of these compiles and links: dnl 1. va_copy() dnl 2. __va_copy() dnl 3. fallback dnl dnl In case of 1 or 2, AC_DEFINE(HAVE_VA_COPY). dnl In case of 2, AC_DEFINE(va_copy,__va_copy) dnl dnl In code, use it like this dnl #ifdef HAVE_VA_COPY dnl ... code with va_copy ... dnl #else dnl ... code without va_copy or with error ... dnl #endif dnl AC_DEFUN([GP_VA_COPY],[dnl dnl AC_CHECK_HEADER([stdarg.h],[],[ AC_MSG_ERROR([ Building $PACKAGE_NAME requires . ]) ]) dnl have_va_copy=no AC_TRY_LINK([ #include ],[ va_list a,b; va_copy(a,b); ],[ have_va_copy="va_copy" ],[ AC_TRY_LINK([ #include ],[ va_list a,b; __va_copy(a,b); ],[ have_va_copy="__va_copy" AC_DEFINE([va_copy],[__va_copy],[__va_copy() was the originally proposed name]) ]) ]) dnl AC_MSG_CHECKING([for va_copy() or replacement]) AC_MSG_RESULT([$have_va_copy]) dnl if test "x$have_va_copy" != "xno"; then AC_DEFINE([HAVE_VA_COPY],1,[Whether we have the va_copy() function]) fi ])dnl dnl dnl dnl Local Variables: dnl mode: autoconf dnl End: gphoto-gphotofs-7a44a83/gphotofs.c000066400000000000000000000651431500511163600172020ustar00rootroot00000000000000/* FUSE Filesystem for libgphoto2. Copyright (C) 2005 Philip Langdale Copyright (C) 2007 Marcus Meissner Copyright (C) 2015,2017 Marcus Meissner This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include /* * The OpenFile struct encapsulates a CameraFile and an open count. * This allows us to track multiple overlapping open/release calls * on a file. */ struct OpenFile { CameraFile *file; unsigned long count; void *buf; unsigned long size; int writing; gchar *destdir; gchar *destname; }; typedef struct OpenFile OpenFile; static void freeOpenFile(OpenFile *openFile) { if (openFile->file) gp_file_unref(openFile->file); g_free(openFile); } /* * gpresultToErrno: * * Maps libgphoto2 errors to errnos. For some errors, there isn't * really a good mapping, so a best effort has to be made. */ static int gpresultToErrno(int result) { switch (result) { case GP_OK: return 0; case GP_ERROR: return -EPROTO; case GP_ERROR_BAD_PARAMETERS: return -EINVAL; case GP_ERROR_NO_MEMORY: return -ENOMEM; case GP_ERROR_LIBRARY: return -ENOSYS; case GP_ERROR_UNKNOWN_PORT: return -ENXIO; case GP_ERROR_NOT_SUPPORTED: return -EPROTONOSUPPORT; case GP_ERROR_TIMEOUT: return -ETIMEDOUT; case GP_ERROR_IO: case GP_ERROR_IO_SUPPORTED_SERIAL: case GP_ERROR_IO_SUPPORTED_USB: case GP_ERROR_IO_INIT: case GP_ERROR_IO_READ: case GP_ERROR_IO_WRITE: case GP_ERROR_IO_UPDATE: case GP_ERROR_IO_SERIAL_SPEED: case GP_ERROR_IO_USB_CLEAR_HALT: return -EIO; case GP_ERROR_IO_USB_FIND: return -ENXIO; case GP_ERROR_IO_USB_CLAIM: case GP_ERROR_IO_LOCK: return -EIO; case GP_ERROR_CAMERA_BUSY: return -EBUSY; case GP_ERROR_FILE_NOT_FOUND: case GP_ERROR_DIRECTORY_NOT_FOUND: return -ENOENT; case GP_ERROR_FILE_EXISTS: case GP_ERROR_DIRECTORY_EXISTS: return -EEXIST; case GP_ERROR_PATH_NOT_ABSOLUTE: return -ENOTDIR; case GP_ERROR_CORRUPTED_DATA: return -EIO; case GP_ERROR_CANCEL: return -ECANCELED; /* These are pretty dubious mappings. */ case GP_ERROR_MODEL_NOT_FOUND: return -ENXIO; case GP_ERROR_CAMERA_ERROR: return -EPERM; case GP_ERROR_OS_FAILURE: return -EPIPE; } return -EINVAL; } struct GPCtx { Camera *camera; GPContext *context; CameraAbilitiesList *abilities; int debug_func_id; gchar *directory; GHashTable *files; GHashTable *dirs; GHashTable *reads; GHashTable *writes; }; typedef struct GPCtx GPCtx; /* * Static variables set by command line arguments. */ static gchar *sPort = NULL; static gchar *sModel = NULL; static gchar *sUsbid = NULL; static gint sSpeed = 0; static gboolean sHelp = FALSE; static struct timeval glob_tv_zero; static GPCtx *sGPGlobalCtx = NULL; /* * Function definitions */ static int gphotofs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags); static int dummyfiller(void *buf, const char *name, const struct stat *stbuf, off_t off, enum fuse_fill_dir_flags flags ) { return 0; } /* Just quickly check for pending events */ static int gphotofs_check_events() { int ret = GP_OK; GPCtx *p = (GPCtx *)fuse_get_context()->private_data; CameraEventType eventtype; void *eventdata; static int ineventcheck = 0; if (ineventcheck) return GP_OK; ineventcheck = 1; do { eventdata = NULL; ret = gp_camera_wait_for_event(p->camera, 1, &eventtype, &eventdata, p->context); if (ret != GP_OK) break; switch (eventtype) { case GP_EVENT_FOLDER_ADDED: case GP_EVENT_FILE_ADDED: { CameraFilePath *path = eventdata; gphotofs_readdir(path->folder, NULL, dummyfiller, 0, NULL, 0); break; } case GP_EVENT_UNKNOWN: case GP_EVENT_TIMEOUT: case GP_EVENT_CAPTURE_COMPLETE: break; } free(eventdata); } while (eventtype != GP_EVENT_TIMEOUT); ineventcheck = 0; return ret; } static int gphotofs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags) { GPCtx *p; CameraList *list = NULL; int i; int ret = 0; int event_ret = 0; p = (GPCtx *)fuse_get_context()->private_data; event_ret = gphotofs_check_events(); if (event_ret == GP_ERROR_IO_USB_FIND || event_ret == GP_ERROR_MODEL_NOT_FOUND) return gpresultToErrno(event_ret); filler(buf, ".", NULL, 0, 0); filler(buf, "..", NULL, 0, 0); /* Read directories */ gp_list_new(&list); ret = gp_camera_folder_list_folders(p->camera, path, list, p->context); if (ret != 0) { goto error; } for (i = 0; i < gp_list_count(list); i++) { struct stat *stbuf; const char *name; gchar *key; stbuf = g_new0(struct stat, 1); stbuf->st_mode = S_IFDIR | 0755; /* This is not a correct number in general. */ stbuf->st_nlink = 2; stbuf->st_uid = getuid(); stbuf->st_gid = getgid(); gp_list_get_name(list, i, &name); filler(buf, name, stbuf, 0, 0); key = g_build_filename(path, name, NULL); g_hash_table_replace(p->dirs, key, stbuf); } gp_list_free(list); list = NULL; /* Read files */ gp_list_new(&list); ret = gp_camera_folder_list_files(p->camera, path, list, p->context); if (ret != 0) { goto error; } for (i = 0; i < gp_list_count(list); i++) { struct stat *stbuf; const char *name; gchar *key; CameraFileInfo info; gp_list_get_name(list, i, &name); ret = gp_camera_file_get_info(p->camera, path, name, &info, p->context); if (ret != 0) { goto error; } stbuf = g_new0(struct stat, 1); stbuf->st_mode = S_IFREG; if (info.file.fields & GP_FILE_INFO_PERMISSIONS) { if (info.file.permissions & GP_FILE_PERM_DELETE) stbuf->st_mode |= 0644; else stbuf->st_mode |= 0444; } else { stbuf->st_mode |= 0644; } stbuf->st_nlink = 1; stbuf->st_uid = getuid(); stbuf->st_gid = getgid(); stbuf->st_size = info.file.size; stbuf->st_mtime = info.file.mtime; stbuf->st_blocks = (info.file.size / 512) + (info.file.size % 512 > 0 ? 1 : 0); filler(buf, name, stbuf, 0, 0); key = g_build_filename(path, name, NULL); g_hash_table_replace(p->files, key, stbuf); } exit: if (list) { gp_list_free(list); } return ret; error: ret = gpresultToErrno(ret); goto exit; } static int gphotofs_getattr(const char *path, struct stat *stbuf, struct fuse_file_info *fileinfo) { int ret = 0; GPCtx *p = (GPCtx *)fuse_get_context()->private_data; struct stat *mystbuf = NULL; gpointer value; guint i; int event_ret = 0; event_ret = gphotofs_check_events(); if (event_ret == GP_ERROR_IO_USB_FIND || event_ret == GP_ERROR_MODEL_NOT_FOUND) return gpresultToErrno(event_ret); memset(stbuf, 0, sizeof(struct stat)); if(strcmp(path, "/") == 0) { stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; stbuf->st_uid = getuid(); stbuf->st_gid = getgid(); return 0; } /* * Due to the libgphoto2 api, the best way of verifying * if a file exists is to iterate the contents of that * directory; so if we don't know about the file already, * turn around and call readdir on the directory and try * again. */ for (i = 2; i > 0; i--) { gchar *dir; value = g_hash_table_lookup(p->files, path); if (!value) { value = g_hash_table_lookup(p->dirs, path); } if (value) { mystbuf = (struct stat *)value; break; } dir = g_path_get_dirname(path); ret = gphotofs_readdir(dir, NULL, dummyfiller, 0, NULL, 0); g_free(dir); if (ret != 0) { return ret; } } if (mystbuf) { stbuf->st_mode = mystbuf->st_mode; stbuf->st_nlink = mystbuf->st_nlink; stbuf->st_uid = mystbuf->st_uid; stbuf->st_gid = mystbuf->st_gid; stbuf->st_size = mystbuf->st_size; stbuf->st_blocks = mystbuf->st_blocks; stbuf->st_mtime = mystbuf->st_mtime; } else { ret = -ENOENT; } return ret; } static int gphotofs_open(const char *path, struct fuse_file_info *fi) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; OpenFile *openFile; int ret; ret = gphotofs_check_events(); if (ret == GP_ERROR_IO_USB_FIND || ret == GP_ERROR_MODEL_NOT_FOUND) return gpresultToErrno(ret); if ((fi->flags & O_ACCMODE) == O_RDONLY) { openFile = g_hash_table_lookup(p->reads, path); if (!openFile) { gchar *dir = g_path_get_dirname(path); gchar *file = g_path_get_basename(path); openFile = g_new0(OpenFile, 1); openFile->file = NULL; openFile->count = 1; openFile->destdir = g_strdup(dir); openFile->destname = g_strdup(file); g_hash_table_replace(p->reads, g_strdup(path), openFile); g_free(file); g_free(dir); } else { openFile->count++; } return 0; } if ((fi->flags & O_ACCMODE) == O_WRONLY) { openFile = g_hash_table_lookup(p->writes, path); if (!openFile) { gchar *dir = g_path_get_dirname(path); gchar *file = g_path_get_basename(path); openFile = g_new0(OpenFile, 1); openFile->file = NULL; openFile->count = 1; openFile->size = 0; openFile->writing = 1; openFile->destdir = g_strdup(dir); openFile->destname = g_strdup(file); openFile->buf = malloc(1); if (!openFile->buf) return -1; g_hash_table_replace(p->writes, g_strdup(path), openFile); g_free(dir); g_free(file); } else { openFile->count++; } return 0; } return -EINVAL; } static int gphotofs_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; OpenFile *openFile; const char *data; unsigned long int dataSize; uint64_t xsize; int ret; /* gphotofs_check_events(); ... probably on doing small reads this will take too much time */ openFile = g_hash_table_lookup(p->reads, path); xsize = size; ret = gp_camera_file_read(p->camera, openFile->destdir, openFile->destname, GP_FILE_TYPE_NORMAL, offset, buf, &xsize, p->context); if (ret == GP_OK) return xsize; if (ret != GP_ERROR_NOT_SUPPORTED) return gpresultToErrno(ret); /* gp_camera_file_read NOTSUPPORTED -> fall back to old method */ if (!openFile->file) { CameraFile *cFile; gp_file_new(&cFile); ret = gp_camera_file_get(p->camera, openFile->destdir, openFile->destname, GP_FILE_TYPE_NORMAL, cFile, p->context); openFile->file = cFile; } ret = gp_file_get_data_and_size(openFile->file, &data, &dataSize); if (ret == GP_OK) { if (offset < dataSize) { if (offset + size > dataSize) { size = dataSize - offset; } memcpy(buf, data + offset, size); ret = size; } else { ret = 0; } } else { ret = gpresultToErrno(ret); } return ret; } /* ================================================================================== */ static int gphotofs_write(const char *path, const char *wbuf, size_t size, off_t offset, struct fuse_file_info *fi) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; OpenFile *openFile = g_hash_table_lookup (p->writes, path); if (!openFile) return -1; if (offset + size > openFile->size) { openFile->size = offset + size; openFile->buf = realloc (openFile->buf, openFile->size); } memcpy(openFile->buf+offset, wbuf, size); return size; } static int gphotofs_mkdir(const char *path, mode_t mode) { int ret = 0; GPCtx *p = (GPCtx *)fuse_get_context()->private_data; gchar *dir = g_path_get_dirname(path); gchar *file = g_path_get_basename(path); gphotofs_check_events(); ret = gp_camera_folder_make_dir(p->camera, dir, file, p->context); if (ret != 0) { ret = gpresultToErrno(ret); } else { struct stat *stbuf; stbuf = g_new0(struct stat, 1); stbuf->st_mode = S_IFDIR | 0555; /* This is not a correct number in general. */ stbuf->st_nlink = 2; stbuf->st_uid = getuid(); stbuf->st_gid = getgid(); g_hash_table_replace(p->dirs, g_strdup (path), stbuf); } g_free(dir); g_free(file); return ret; } static int gphotofs_rmdir(const char *path) { int ret = 0; GPCtx *p = (GPCtx *)fuse_get_context()->private_data; gchar *dir = g_path_get_dirname(path); gchar *file = g_path_get_basename(path); gphotofs_check_events(); ret = gp_camera_folder_remove_dir(p->camera, dir, file, p->context); if (ret != 0) { ret = gpresultToErrno(ret); } else { g_hash_table_remove(p->dirs, path); } g_free(dir); g_free(file); return ret; } static int gphotofs_mknod(const char *path, mode_t mode, dev_t rdev) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; gchar *dir = g_path_get_dirname(path); gchar *file = g_path_get_basename(path); char *data; int res; CameraFile *cfile; gphotofs_check_events(); gp_file_new (&cfile); data = malloc(1); data[0] = 'c'; res = gp_file_set_data_and_size (cfile, data, 1); if (res < 0) { gp_file_unref (cfile); return -1; } res = gp_camera_folder_put_file (p->camera, dir, file, GP_FILE_TYPE_NORMAL, cfile, p->context); gp_file_unref (cfile); g_free(dir); g_free(file); return 0; } static int gphotofs_flush(const char *path, struct fuse_file_info *fi) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; OpenFile *openFile = g_hash_table_lookup(p->writes, path); gphotofs_check_events(); if (!openFile) return 0; if (openFile->writing) { int res; CameraFile *file; char *data; gp_file_new (&file); data = malloc (openFile->size); if (!data) return -ENOMEM; memcpy (data, openFile->buf, openFile->size); /* The call below takes over responsbility of freeing data. */ res = gp_file_set_data_and_size (file, data, openFile->size); if (res < 0) { gp_file_unref (file); return -1; } res = gp_camera_file_delete(p->camera, openFile->destdir, openFile->destname, p->context); res = gp_camera_folder_put_file (p->camera, openFile->destdir, openFile->destname, GP_FILE_TYPE_NORMAL, file, p->context); if (res < 0) return -ENOSPC; gp_file_unref (file); } return 0; } static int gphotofs_fsync(const char *path, int isdatasync, struct fuse_file_info *fi) { (void) isdatasync; return gphotofs_flush(path, fi); } static int gphotofs_chmod(const char *path, mode_t mode, struct fuse_file_info *fi) { return 0; } static int gphotofs_chown(const char *path, uid_t uid, gid_t gid, struct fuse_file_info *fi) { return 0; } static int gphotofs_statfs(const char *path, struct statvfs *stvfs) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; CameraStorageInformation *sifs; CameraStorageInformation *si; int ret, nrofsifs; int i; ret = gphotofs_check_events(); if (ret == GP_ERROR_IO_USB_FIND || ret == GP_ERROR_MODEL_NOT_FOUND) return gpresultToErrno(ret); ret = gp_camera_get_storageinfo (p->camera, &sifs, &nrofsifs, p->context); if (ret < GP_OK) return gpresultToErrno(ret); if (nrofsifs == 0) return -ENOSYS; stvfs->f_bsize = 1024; stvfs->f_frsize = 1024; for (i=0; i < nrofsifs; i++) { si = (sifs) + i; if (!si) continue; stvfs->f_blocks += si->capacitykbytes; stvfs->f_bfree += si->freekbytes; stvfs->f_bavail += si->freekbytes; } if (sifs) free(sifs); return 0; } static int gphotofs_release(const char *path, struct fuse_file_info *fi) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; OpenFile *openFile = g_hash_table_lookup(p->reads, path); if (!openFile) openFile = g_hash_table_lookup(p->writes, path); if (openFile) { openFile->count--; if (openFile->count == 0) { if (openFile->writing) { free (openFile->buf); g_hash_table_remove(p->writes, path); } else { g_hash_table_remove(p->reads, path); } } } return 0; } static int gphotofs_unlink(const char *path) { GPCtx *p = (GPCtx *)fuse_get_context()->private_data; gchar *dir = g_path_get_dirname(path); gchar *file = g_path_get_basename(path); int ret = 0; gphotofs_check_events(); /* Don't allow deletion of open files. */ if (g_hash_table_lookup(p->reads, path)) { ret = -EBUSY; goto exit; } ret = gp_camera_file_delete(p->camera, dir, file, p->context); if (ret != 0) { ret = gpresultToErrno(ret); goto exit; } g_hash_table_remove(p->files, path); exit: g_free(dir); g_free(file); return ret; } #if 0 static void debug_func (GPLogLevel level, const char *domain, const char *str, void *data) { struct timeval tv; long sec, usec; FILE *logfile = data; gettimeofday (&tv,NULL); sec = tv.tv_sec - glob_tv_zero.tv_sec; usec = tv.tv_usec - glob_tv_zero.tv_usec; if (usec < 0) {sec--; usec += 1000000L;} fprintf (logfile, "%li.%06li %s(%i): ", sec, usec, domain, level); fprintf (logfile, "%s", str); fputc ('\n', logfile); fflush (logfile); } #endif /* Find and try to connect to a device */ static int gphotofs_connect() { int ret = GP_OK; GPCtx *p = g_new0(GPCtx, 1); sGPGlobalCtx = p; #if 0 /* enable for debugging */ int fd = -1; FILE *f = NULL; fd = open("/tmp/gpfs.log",O_WRONLY|O_CREAT,0600); if (fd != -1) { f = fdopen(fd,"a"); if (f) p->debug_func_id = gp_log_add_func (GP_LOG_ALL, debug_func, (void *) f); } fprintf(f, "log opened on pid %d\n", getpid()); #endif p->context = gp_context_new(); gettimeofday(&glob_tv_zero, NULL); setlocale(LC_CTYPE,"en_US.UTF-8"); /* for ptp2 driver to convert to utf-8 */ gp_camera_new(&p->camera); gp_abilities_list_new(&p->abilities); gp_abilities_list_load(p->abilities, p->context); do { if (sSpeed) { GPPortInfo info; GPPortType type; /* Make sure we've got a serial port. */ ret = gp_camera_get_port_info(p->camera, &info); gp_port_info_get_type (info, &type); if (ret != 0) { break; } else if (type != GP_PORT_SERIAL) { g_fprintf(stderr, "%s\n", _("You can only specify speeds for serial ports.")); ret = GP_ERROR_IO_SUPPORTED_SERIAL; break; } /* Set the speed. */ ret = gp_camera_set_port_speed(p->camera, sSpeed); if (ret != 0) break; } if (sModel) { CameraAbilities a; int m; m = gp_abilities_list_lookup_model(p->abilities, sModel); if (m < 0) { g_fprintf(stderr, _("Model %s was not recognised."), sModel); g_fprintf(stderr, "\n"); ret = m; break; } ret = gp_abilities_list_get_abilities(p->abilities, m, &a); if (ret != 0) break; ret = gp_camera_set_abilities(p->camera, a); if (ret != 0) break; /* Marcus: why save it? puzzling. */ ret = gp_setting_set("gphoto2", "model", a.model); if (ret != 0) break; } if (sPort) { GPPortInfo info; GPPortInfoList *il = NULL; int i; ret = gp_port_info_list_new(&il); if (ret != 0) break; ret = gp_port_info_list_load(il); if (ret != 0) break; i = gp_port_info_list_lookup_path(il, sPort); if (i == GP_ERROR_UNKNOWN_PORT) { g_fprintf(stderr, _("The port you specified ('%s') can not " "be found. Please specify one of the ports " "found by 'gphoto2 --list-ports' make sure " "the spelling is correct (i.e. with prefix " "'serial:' or 'usb:')."), sPort); g_fprintf(stderr, "\n"); ret = i; break; } else if (i < 0) { ret = i; break; } else { char *xpath; ret = gp_port_info_list_get_info(il, i, &info); if (ret != 0) break; ret = gp_camera_set_port_info (p->camera, info); if (ret != 0) break; /* Marcus: why save it? puzzling. */ gp_port_info_get_path (info, &xpath); gp_setting_set("gphoto2", "port", xpath); gp_port_info_list_free(il); } } /* Check the connection by checking the storage info of the device. * Abort if the device has no valid storage listed. */ CameraStorageInformation *sifs; int nrofsifs = 0; ret = gp_camera_get_storageinfo (p->camera, &sifs, &nrofsifs, p->context); if (ret < GP_OK) break; if (sifs) free(sifs); if (nrofsifs == 0) { ret = GP_ERROR_IO_USB_FIND; g_fprintf(stderr, _("Could not retrieve device storage. Make sure that your device is unlocked.")); g_fprintf(stderr, "\n"); break; } /* Init and first connection successful */ } while (0); return ret; } static void * gphotofs_init() { GPCtx *p; if (!sGPGlobalCtx) { g_fprintf(stderr, _("Error initialising gphotofs: %s"), gp_result_as_string(GP_ERROR_LIBRARY)); g_fprintf(stderr, "\n"); // In theory, the following command should be used to exit properly // with the correct cleanup of fuse and automatic unmount. // fuse_exit(fuse_get_context()->fuse); // But that could be dangerous as the "mount" will already have succeeded // at this step and so some one try to write to the wrong FS if it is // automatically un-mounted. // With the following hard exit, at least fuse will return an "ENOTCONN" error // if someone try to use the mount point. // Final note: the EXIT_FAILURE will not be reported as at the "init" step, // the mount has already succeeded. exit(EXIT_FAILURE); } p = sGPGlobalCtx; /* Initialize the local cache */ p->dirs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); p->files = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); p->reads = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)freeOpenFile); p->writes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)freeOpenFile); return p; } static void gphotofs_destroy(void *context) { if (!context) { return; } GPCtx *p = (GPCtx *)context; if (p->reads) { g_hash_table_destroy(p->reads); } if (p->files) { g_hash_table_destroy(p->files); } if (p->dirs) { g_hash_table_destroy(p->dirs); } g_free(p->directory); if (p->abilities) { gp_abilities_list_free(p->abilities); } if (p->camera) { gp_camera_unref(p->camera); } if (p->context) { gp_context_unref(p->context); } g_free(p); } static struct fuse_operations gphotofs_oper = { .init = gphotofs_init, .destroy = gphotofs_destroy, .readdir = gphotofs_readdir, .getattr = gphotofs_getattr, .open = gphotofs_open, .read = gphotofs_read, .release = gphotofs_release, .unlink = gphotofs_unlink, .write = gphotofs_write, .mkdir = gphotofs_mkdir, .rmdir = gphotofs_rmdir, .mknod = gphotofs_mknod, .flush = gphotofs_flush, .fsync = gphotofs_fsync, .chmod = gphotofs_chmod, .chown = gphotofs_chown, .statfs = gphotofs_statfs }; static GOptionEntry options[] = { { "port", 0, 0, G_OPTION_ARG_STRING, &sPort, N_("Specify port device"), "path" }, { "speed", 0, 0, G_OPTION_ARG_INT, &sSpeed, N_("Specify serial transfer speed"), "speed" }, { "camera", 0, 0, G_OPTION_ARG_STRING, &sModel, N_("Specify camera model"), "model" }, { "usbid", 0, 0, G_OPTION_ARG_STRING, &sUsbid, N_("(expert only) Override USB IDs"), "usbid" }, { "help-fuse", 'h', 0, G_OPTION_ARG_NONE, &sHelp, N_("Show FUSE help options"), NULL }, NULL }; int main(int argc, char *argv[]) { int ret = GP_OK; GError *error = NULL; GOptionContext *context = g_option_context_new(_("- gphoto filesystem")); g_option_context_add_main_entries(context, options, GETTEXT_PACKAGE); g_option_context_set_ignore_unknown_options(context, TRUE); g_option_context_parse(context, &argc, &argv, &error); if (sHelp) { const char *fusehelp[] = { argv[0], "-ho", NULL}; return fuse_main(2, (char **)fusehelp, &gphotofs_oper, NULL); } else if (sUsbid) { g_fprintf(stderr, "--usbid is not yet implemented\n"); return 1; } else { char **newargv = malloc ( (argc+2)*sizeof(char*)); memcpy (newargv+2,argv+1,sizeof(char*)*(argc-1)); newargv[0] = argv[0]; newargv[1] = "-s"; /* disable multithreading */ ret = gphotofs_connect(); if (ret != GP_OK || sGPGlobalCtx == NULL) { g_fprintf(stderr, _("Error initialising gphotofs: %s"), gp_result_as_string(ret)); g_fprintf(stderr, "\n"); return 1; } return fuse_main(argc+1, newargv, &gphotofs_oper, NULL); } } gphoto-gphotofs-7a44a83/po/000077500000000000000000000000001500511163600156125ustar00rootroot00000000000000gphoto-gphotofs-7a44a83/po/.cvsignore000066400000000000000000000000111500511163600176020ustar00rootroot00000000000000POTFILES gphoto-gphotofs-7a44a83/po/POTFILES.in000066400000000000000000000002031500511163600173620ustar00rootroot00000000000000 # List of source files containing translatable strings. # Please keep this list in alphabetic order. [encoding: UTF-8] gphotofs.c gphoto-gphotofs-7a44a83/test-gphotofs.sh000077500000000000000000000013521500511163600203420ustar00rootroot00000000000000#!/bin/sh set -ex mountpoint=${mountpoint-test-mountpoint} testdir="${testdir-.}" camera="Mass Storage Camera" # FIXME: # If libgphoto2 is not installed yet, # - IOLIBS must be pointed to where the "disk" iolib is. # - CAMLIBS must be pointed to where the "directory" camlib is. trap "umount ${mountpoint}; rm "$testdir"/*; rmdir ${mountpoint} $testdir" EXIT if test -d "$mountpoint"; then rmdir "$mountpoint"; fi if test -d "$testdir"; then rmdir "$testdir"; fi mkdir "${mountpoint}" "$testdir" cp "$srcdir/gphotofs.c" "$testdir/" "./gphotofs" --port "disk:$(cd "$testdir" > /dev/null && pwd)" --camera "$camera" "${mountpoint}" sleep 2 ls -al "${mountpoint}" umount "${mountpoint}" rm -f "$testdir"/* rmdir "${mountpoint}" "$testdir"