-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for libcups3 (libcups of CUPS 3.x)
With these changes libcupsfilters can be built either with libcups2 (libcups of CUPS 2.x) or libcups3 (libcups of CUPS 3.x). NOTE: Any further development on the code has to be done using the API of libcups3, and for libcups2 support any additional conversion has to get defined in cupsfilters/libcups2-private.h (if C code is needed for the conversion, it goes into cupsfilters/libcups2.c). The actual code is now fully converted to the API of libcups3. To allow building it with libcups2 and to avoid having it full of "#ifdef HAVE_LIBCUPS2" conditionals, we have added the header file libcups2-private.h file, which gets only applied (by "#ifdef HAVE_LIBCUPS2") when we build with libcups2. It converts the code to the libcups2 API by - Applying "#define ..." macro definitions for all renamings of functions and data types - Converting the "cupsCreateTempFd(NULL, NULL, buffer, bufsize)" calls to "cupsTempFd(buffer, bufsize)" calls (new function has more arguments). - Defining (backports) the "http_resolve_t" enumeration data type, which got only introduced in libcups3. - Introducing the type "cups_len_t", as "int" for libcups2 and "size_t" for libcups3. In some functions there are parameters which make a hard switch from "int" to "size_t" with the transition to libcups3. For those we use this type. We also add the file libcups2.c for the code of our former "cfResolveURI2()" function, our DNS-SD URI resolver function based on ipptool which is capable of resolving both print and fax URIs. The function is only used when building with libcups2, as in libcups3 the "httpResolveURI()" function which was formerly libcups-internal is now a public API function, which saves us now from the ugly workarounds we had to use in our functions."cfResolveURI2()" gets a wrapper calling this new function then. The code of the print-only "cfResolveURI()" function got dropped and replaced by a simple call of "cfResolveURI2()". We have a libcups3-related change in the public API header files, here "cups_page_header2_t" got renamed into "cups_page_header_t". Due to the fact that libcups2-private.h gets HAVE_LIBCUPS2 from config.h, we cannot use it in the API headers (and we also do not want all these conversions to apply to a user's code). So we simply add a renaming "#define ..." under "#if CUPS_VERSION_MAJOR < 3" to the affected API headers. We drop support for the old "cups_page_header_t" data type from CUPS 1.x, as with the minimum requirement of CUPS 2.2.2 this is for sure not needed any more. We need to pay special attention to "cupsArrayNew()" and "cupsArrayNew3()" calls in the old libcups2-based code. In the former ones we keep the name but add ", NULL, 0, NULL, NULL" to the end of the parameter list, the latter ones get renamed to "cupsArrayNew()" and the parameter list not changed. For building the code with libcups2, the "#define cupsArrayNew cupsArrayNew3" then serves for both cases. In configure.ac we check for libcups3 via pkg-config first and if not present for libcups2 via cups-config. In both cases we set all relevan variables, as compiler/linker arguments, directories, ... and in case of libcups2 we define HAVE_LIBCUPS2 in config.h. In Makefile.am we do not only add the new files to the build process but we also fix the compiler flag definition for C++, "libcupsfilters_la_CXXFLAGS". It was messed up and the C++ parts did not build any more with libcups3.
- Loading branch information
1 parent
4a2a4cf
commit 26f9c3f
Showing
27 changed files
with
710 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.