]> git.ipfire.org Git - thirdparty/cups.git/blame - vcnet/config.h
Merge pull request #1316 from weblate/weblate-cups-cups
[thirdparty/cups.git] / vcnet / config.h
CommitLineData
ef416fc2 1/*
5a1d7a17 2 * Configuration file for CUPS on Windows.
ef416fc2 3 *
25f65dd9 4 * Copyright © 2021-2025 by OpenPrinting
5f145615
MS
5 * Copyright © 2007-2019 by Apple Inc.
6 * Copyright © 1997-2007 by Easy Software Products.
ef416fc2 7 *
5f145615
MS
8 * Licensed under Apache License v2.0. See the file "LICENSE" for more
9 * information.
ef416fc2 10 */
11
12#ifndef _CUPS_CONFIG_H_
13#define _CUPS_CONFIG_H_
14
536bc2c6
MS
15#include <stdio.h>
16#include <stdlib.h>
17#include <string.h>
18#include <stdarg.h>
536bc2c6 19#include <io.h>
3cc0333e 20#include <fcntl.h>
7cf5915e 21#include <direct.h>
536bc2c6
MS
22
23
24/*
7a0cbd5e 25 * Microsoft renames the POSIX functions to _name, and introduces
536bc2c6
MS
26 * a broken compatibility layer using the original names. As a result,
27 * random crashes can occur when, for example, strdup() allocates memory
28 * from a different heap than used by malloc() and free().
29 *
30 * To avoid moronic problems like this, we #define the POSIX function
31 * names to the corresponding non-standard Microsoft names.
32 */
33
34#define access _access
35#define close _close
36#define fileno _fileno
37#define lseek _lseek
7cf5915e 38#define mkdir(d,p) _mkdir(d)
536bc2c6 39#define open _open
e3952d3e 40#define poll WSAPoll
536bc2c6 41#define read _read
7cf5915e 42#define rmdir _rmdir
5e5ff4a6 43#define snprintf _snprintf
536bc2c6
MS
44#define strdup _strdup
45#define unlink _unlink
5e5ff4a6 46#define vsnprintf _vsnprintf
536bc2c6
MS
47#define write _write
48
49
f4a99aeb
MS
50/*
51 * Microsoft "safe" functions use a different argument order than POSIX...
52 */
53
54#define gmtime_r(t,tm) gmtime_s(tm,t)
55#define localtime_r(t,tm) localtime_s(tm,t)
56
57
015214aa 58/*
5f07499d
MS
59 * Map the POSIX strcasecmp() and strncasecmp() functions to the Win32
60 * _stricmp() and _strnicmp() functions...
015214aa
MS
61 */
62
d3a97696
MS
63#define strcasecmp _stricmp
64#define strncasecmp _strnicmp
015214aa
MS
65
66
5180a04c
MS
67/*
68 * Map the POSIX sleep() and usleep() functions to the Win32 Sleep() function...
69 */
70
33c9220c 71typedef unsigned long useconds_t;
5180a04c
MS
72#define sleep(X) Sleep(1000 * (X))
73#define usleep(X) Sleep((X)/1000)
74
75
6d2f911b
MS
76/*
77 * Map various parameters to Posix style system calls
78 */
79
80# define F_OK 00
81# define W_OK 02
82# define R_OK 04
83# define O_RDONLY _O_RDONLY
84# define O_WRONLY _O_WRONLY
015214aa 85# define O_CREAT _O_CREAT
6d2f911b
MS
86# define O_TRUNC _O_TRUNC
87
88
ef416fc2 89/*
90 * Compiler stuff...
91 */
92
93#undef const
94#undef __CHAR_UNSIGNED__
95
96
97/*
98 * Version of software...
99 */
100
37db6e26
MS
101#define CUPS_SVERSION "CUPS v2.5b1"
102#define CUPS_MINIMAL "CUPS/2.5b1"
ef416fc2 103
104
105/*
536bc2c6 106 * Default user and groups...
ef416fc2 107 */
108
6d2f911b
MS
109#define CUPS_DEFAULT_USER ""
110#define CUPS_DEFAULT_GROUP ""
111#define CUPS_DEFAULT_SYSTEM_GROUPS ""
112#define CUPS_DEFAULT_PRINTOPERATOR_AUTH ""
61b7ebde 113#define CUPS_DEFAULT_SYSTEM_AUTHKEY ""
536bc2c6
MS
114
115
116/*
117 * Default file permissions...
118 */
119
61b7ebde 120#define CUPS_DEFAULT_CONFIG_FILE_PERM 0644
536bc2c6
MS
121#define CUPS_DEFAULT_LOG_FILE_PERM 0644
122
123
124/*
125 * Default logging settings...
126 */
127
128#define CUPS_DEFAULT_LOG_LEVEL "warn"
61b7ebde 129#define CUPS_DEFAULT_ACCESS_LOG_LEVEL "none"
956623c7 130#define CUPS_DEFAULT_MAX_LOG_SIZE "1m"
536bc2c6
MS
131
132
133/*
134 * Default fatal error settings...
135 */
136
137#define CUPS_DEFAULT_FATAL_ERRORS "config"
138
139
140/*
141 * Default browsing settings...
142 */
143
144#define CUPS_DEFAULT_BROWSING 1
61b7ebde 145#define CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS "dnssd"
536bc2c6 146#define CUPS_DEFAULT_DEFAULT_SHARED 1
ef416fc2 147
148
149/*
150 * Default IPP port...
151 */
152
536bc2c6
MS
153#define CUPS_DEFAULT_IPP_PORT 631
154
155
156/*
157 * Default printcap file...
158 */
159
160#define CUPS_DEFAULT_PRINTCAP ""
ef416fc2 161
162
956623c7
MS
163/*
164 * Default ErrorPolicy value...
165 */
166
167#define CUPS_DEFAULT_ERROR_POLICY "stop-printer"
168
169
536bc2c6
MS
170/*
171 * Default MaxCopies value...
172 */
173
174#define CUPS_DEFAULT_MAX_COPIES 9999
ef416fc2 175
176
9c1dcee0
MS
177/*
178 * Default SyncOnClose value...
179 */
180
181/* #undef CUPS_DEFAULT_SYNC_ON_CLOSE */
182
183
ef416fc2 184/*
1e564ac8 185 * Do we have domain socket support, and if so what is the default one?
ef416fc2 186 */
187
188#undef CUPS_DEFAULT_DOMAINSOCKET
189
190
db8b865d
MS
191/*
192 * Default WebInterface value...
193 */
194
61b7ebde 195#define CUPS_DEFAULT_WEBIF 0
db8b865d
MS
196
197
ef416fc2 198/*
199 * Where are files stored?
200 *
201 * Note: These are defaults, which can be overridden by environment
202 * variables at run-time...
203 */
204
536bc2c6
MS
205#define CUPS_BINDIR "C:/CUPS/bin"
206#define CUPS_CACHEDIR "C:/CUPS/cache"
207#define CUPS_DATADIR "C:/CUPS/share"
208#define CUPS_DOCROOT "C:/CUPS/share/doc"
536bc2c6
MS
209#define CUPS_LOCALEDIR "C:/CUPS/locale"
210#define CUPS_LOGDIR "C:/CUPS/logs"
211#define CUPS_REQUESTS "C:/CUPS/spool"
212#define CUPS_SBINDIR "C:/CUPS/sbin"
213#define CUPS_SERVERBIN "C:/CUPS/lib"
214#define CUPS_SERVERROOT "C:/CUPS/etc"
215#define CUPS_STATEDIR "C:/CUPS/run"
ef416fc2 216
217
ef416fc2 218/*
219 * Do we have PAM stuff?
220 */
221
ef416fc2 222#define HAVE_LIBPAM 0
536bc2c6
MS
223/* #undef HAVE_PAM_PAM_APPL_H */
224/* #undef HAVE_PAM_SET_ITEM */
225/* #undef HAVE_PAM_SETCRED */
ef416fc2 226
227
f8b3a85b 228/*
db8b865d 229 * Use <stdint.h>?
f8b3a85b
MS
230 */
231
db8b865d 232/* #undef HAVE_STDINT_H */
f8b3a85b
MS
233
234
ef416fc2 235/*
236 * Use <string.h>, <strings.h>, and/or <bstring.h>?
237 */
238
536bc2c6
MS
239#define HAVE_STRING_H 1
240/* #undef HAVE_STRINGS_H */
241/* #undef HAVE_BSTRING_H */
ef416fc2 242
243
244/*
245 * Do we have the long long type?
246 */
247
536bc2c6 248/* #undef HAVE_LONG_LONG */
ef416fc2 249
250#ifdef HAVE_LONG_LONG
251# define CUPS_LLFMT "%lld"
252# define CUPS_LLCAST (long long)
253#else
254# define CUPS_LLFMT "%ld"
255# define CUPS_LLCAST (long)
256#endif /* HAVE_LONG_LONG */
257
258
259/*
260 * Do we have the strtoll() function?
261 */
262
536bc2c6 263/* #undef HAVE_STRTOLL */
ef416fc2 264
265#ifndef HAVE_STRTOLL
266# define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
267#endif /* !HAVE_STRTOLL */
268
269
ef416fc2 270/*
271 * Do we have the geteuid() function?
272 */
273
536bc2c6 274/* #undef HAVE_GETEUID */
ef416fc2 275
276
88f9aafc
MS
277/*
278 * Do we have the setpgid() function?
279 */
280
281/* #undef HAVE_SETPGID */
282
283
ef416fc2 284/*
285 * Do we have the vsyslog() function?
286 */
287
536bc2c6 288/* #undef HAVE_VSYSLOG */
ef416fc2 289
290
61b7ebde
MS
291/*
292 * Do we have the systemd journal functions?
293 */
294
295/* #undef HAVE_SYSTEMD_SD_JOURNAL_H */
296
297
ef416fc2 298/*
299 * What wait functions to use?
300 */
301
536bc2c6
MS
302/* #undef HAVE_WAITPID */
303/* #undef HAVE_WAIT3 */
ef416fc2 304
305
306/*
307 * Do we have the mallinfo function and malloc.h?
308 */
309
536bc2c6
MS
310/* #undef HAVE_MALLINFO */
311/* #undef HAVE_MALLOC_H */
312
313
314/*
315 * Do we have the POSIX ACL functions?
316 */
317
318/* #undef HAVE_ACL_INIT */
ef416fc2 319
320
321/*
322 * Do we have the langinfo.h header file?
323 */
324
536bc2c6 325/* #undef HAVE_LANGINFO_H */
ef416fc2 326
327
328/*
329 * Which encryption libraries do we have?
330 */
331
3e9f2c04 332#define HAVE_OPENSSL 1
536bc2c6 333/* #undef HAVE_GNUTLS */
536bc2c6
MS
334
335
1e564ac8
MS
336/*
337 * Do we have the gnutls_transport_set_pull_timeout_function function?
338 */
339
340/* #undef HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION */
341
342
19ba6878
MS
343/*
344 * Do we have the gnutls_priority_set_direct function?
345 */
346
347/* #undef HAVE_GNUTLS_PRIORITY_SET_DIRECT */
348
349
536bc2c6 350/*
db8b865d 351 * What Security framework headers do we have?
eac3a0a0
MS
352 */
353
db8b865d 354/* #undef HAVE_AUTHORIZATION_H */
db8b865d 355/* #undef HAVE_SECCERTIFICATE_H */
db8b865d 356/* #undef HAVE_SECITEM_H */
db8b865d 357/* #undef HAVE_SECPOLICY_H */
eac3a0a0
MS
358
359
1e564ac8
MS
360/*
361 * Do we have the SecGenerateSelfSignedCertificate function?
362 */
363
364/* #undef HAVE_SECGENERATESELFSIGNEDCERTIFICATE */
365
366
536bc2c6 367/*
db8b865d 368 * Do we have libpaper?
536bc2c6
MS
369 */
370
db8b865d 371/* #undef HAVE_LIBPAPER */
ef416fc2 372
373
ef416fc2 374/*
15b61dfb 375 * Do we have mDNSResponder for DNS-SD?
ef416fc2 376 */
377
25f65dd9 378/* #undef HAVE_MDNSRESPONDER */
15b61dfb
MS
379
380
381/*
382 * Do we have Avahi for DNS-SD?
383 */
384
385/* #undef HAVE_AVAHI */
536bc2c6
MS
386
387
388/*
db8b865d 389 * Do we have <sys/ioctl.h>?
536bc2c6
MS
390 */
391
15b61dfb 392/* #undef HAVE_SYS_IOCTL_H */
536bc2c6
MS
393
394
eac3a0a0
MS
395/*
396 * Does the "stat" structure contain the "st_gen" member?
397 */
398
399/* #undef HAVE_ST_GEN */
400
401
ef416fc2 402/*
403 * Does the "tm" structure contain the "tm_gmtoff" member?
404 */
405
536bc2c6 406/* #undef HAVE_TM_GMTOFF */
ef416fc2 407
408
c87f28db
MS
409/*
410 * Do we have the timegm function?
411 */
412
413/*#undef HAVE_TIMEGM */
414
415
ef416fc2 416/*
417 * Do we have getifaddrs()?
418 */
419
536bc2c6 420/* #undef HAVE_GETIFADDRS */
ef416fc2 421
422
423/*
424 * Do we have hstrerror()?
425 */
426
536bc2c6
MS
427/* #undef HAVE_HSTRERROR */
428
429
430/*
431 * Do we have res_init()?
432 */
433
434/* #undef HAVE_RES_INIT */
435
436
437/*
438 * Do we have <resolv.h>
439 */
440
441/* #undef HAVE_RESOLV_H */
ef416fc2 442
443
444/*
445 * Do we have the <sys/sockio.h> header file?
446 */
447
536bc2c6 448/* #undef HAVE_SYS_SOCKIO_H */
ef416fc2 449
450
451/*
452 * Does the sockaddr structure contain an sa_len parameter?
453 */
454
536bc2c6 455/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
ef416fc2 456
457
ef416fc2 458/*
459 * Do we have pthread support?
460 */
461
536bc2c6
MS
462/* #undef HAVE_PTHREAD_H */
463
464
1166bf58
MS
465/*
466 * Do we have on-demand support (launchd/systemd/upstart)?
467 */
468
469/* #undef HAVE_ONDEMAND */
470
471
536bc2c6
MS
472/*
473 * Do we have launchd support?
474 */
475
476/* #undef HAVE_LAUNCH_H */
477/* #undef HAVE_LAUNCHD */
ef416fc2 478
479
1e564ac8
MS
480/*
481 * Do we have systemd support?
482 */
483
484/* #undef HAVE_SYSTEMD */
485
486
1166bf58
MS
487/*
488 * Do we have upstart support?
489 */
490
491/* #undef HAVE_UPSTART */
492
493
536bc2c6 494/*
fa26ab95 495 * Do we have CoreFoundation public headers?
536bc2c6
MS
496 */
497
498/* #undef HAVE_COREFOUNDATION_H */
536bc2c6
MS
499
500
6d2f911b
MS
501/*
502 * Do we have ApplicationServices public headers?
503 */
504
505/* #undef HAVE_APPLICATIONSERVICES_H */
506
507
508/*
509 * Do we have the SCDynamicStoreCopyComputerName function?
510 */
511
512/* #undef HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME */
513
514
6eb98aee
MS
515/*
516 * Do we have the getgrouplist() function?
517 */
518
519#undef HAVE_GETGROUPLIST
520
521
536bc2c6 522/*
8072030b 523 * Do we have macOS 10.4's mbr_XXX functions?
536bc2c6
MS
524 */
525
526/* #undef HAVE_MEMBERSHIP_H */
536bc2c6
MS
527/* #undef HAVE_MBR_UID_TO_UUID */
528
529
530/*
eac3a0a0 531 * Do we have Darwin's notify_post header and function?
536bc2c6
MS
532 */
533
534/* #undef HAVE_NOTIFY_H */
535/* #undef HAVE_NOTIFY_POST */
536
537
536bc2c6 538/*
eac3a0a0 539 * Do we have DBUS?
536bc2c6
MS
540 */
541
eac3a0a0
MS
542/* #undef HAVE_DBUS */
543/* #undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND */
1e564ac8 544/* #undef HAVE_DBUS_THREADS_INIT */
536bc2c6
MS
545
546
547/*
548 * Do we have the GSSAPI support library (for Kerberos support)?
549 */
550
eac3a0a0
MS
551/* #undef HAVE_GSS_ACQUIRE_CRED_EX_F */
552/* #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE */
553/* #undef HAVE_GSS_GSSAPI_H */
554/* #undef HAVE_GSS_GSSAPI_SPI_H */
536bc2c6 555/* #undef HAVE_GSSAPI */
536bc2c6 556/* #undef HAVE_GSSAPI_GSSAPI_H */
eac3a0a0 557/* #undef HAVE_GSSAPI_H */
536bc2c6
MS
558
559
560/*
561 * Default GSS service name...
562 */
563
f8b3a85b 564#define CUPS_DEFAULT_GSSSERVICENAME "host"
536bc2c6
MS
565
566
536bc2c6
MS
567/*
568 * Do we have the <dlfcn.h> header?
569 */
570
571/* #undef HAVE_DLFCN_H */
572
573
574/*
575 * Do we have <sys/param.h>?
576 */
577
578/* #undef HAVE_SYS_PARAM_H */
579
580
581/*
582 * Do we have <sys/ucred.h>?
583 */
584
585/* #undef HAVE_SYS_UCRED_H */
586
587
588/*
589 * Do we have removefile()?
590 */
591
592/* #undef HAVE_REMOVEFILE */
593
594
595/*
596 * Do we have <sandbox.h>?
597 */
598
599/* #undef HAVE_SANDBOX_H */
600
601
602/*
603 * Which random number generator function to use...
604 */
605
f8b3a85b 606/* #undef HAVE_ARC4RANDOM */
536bc2c6 607/* #undef HAVE_RANDOM */
536bc2c6
MS
608/* #undef HAVE_LRAND48 */
609
f8b3a85b
MS
610#ifdef HAVE_ARC4RANDOM
611# define CUPS_RAND() arc4random()
61b7ebde 612# define CUPS_SRAND(v)
f8b3a85b
MS
613#elif defined(HAVE_RANDOM)
614# define CUPS_RAND() random()
615# define CUPS_SRAND(v) srandom(v)
616#elif defined(HAVE_LRAND48)
617# define CUPS_RAND() lrand48()
618# define CUPS_SRAND(v) srand48(v)
619#else
620# define CUPS_RAND() rand()
621# define CUPS_SRAND(v) srand(v)
622#endif /* HAVE_ARC4RANDOM */
623
536bc2c6 624
536bc2c6
MS
625/*
626 * Do we have libusb?
627 */
628
db8b865d 629/* #undef HAVE_LIBUSB */
536bc2c6
MS
630
631
632/*
633 * Do we have libwrap and tcpd.h?
634 */
635
636/* #undef HAVE_TCPD_H */
ef416fc2 637
638
eac3a0a0
MS
639/*
640 * Do we have <iconv.h>?
641 */
642
643/* #undef HAVE_ICONV_H */
644
645
646/*
647 * Do we have statfs or statvfs and one of the corresponding headers?
648 */
649
650/* #undef HAVE_STATFS */
651/* #undef HAVE_STATVFS */
652/* #undef HAVE_SYS_MOUNT_H */
653/* #undef HAVE_SYS_STATFS_H */
654/* #undef HAVE_SYS_STATVFS_H */
655/* #undef HAVE_SYS_VFS_H */
656
657
eac3a0a0 658/*
db8b865d 659 * Do we have XPC?
eac3a0a0
MS
660 */
661
db8b865d 662/* #undef HAVE_XPC */
db8b865d
MS
663
664
665/*
666 * Do we have the C99 abs() function?
667 */
eac3a0a0 668
db8b865d
MS
669/* #undef HAVE_ABS */
670#if !defined(HAVE_ABS) && !defined(abs)
671# if defined(__GNUC__) || __STDC_VERSION__ >= 199901L
672# define abs(x) _cups_abs(x)
673static inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
674# elif defined(_MSC_VER)
675# define abs(x) _cups_abs(x)
676static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
677# else
678# define abs(x) ((x) < 0 ? -(x) : (x))
679# endif /* __GNUC__ || __STDC_VERSION__ */
680#endif /* !HAVE_ABS && !abs */
eac3a0a0 681
ef416fc2 682#endif /* !_CUPS_CONFIG_H_ */