CMake: Fix build on systems lacking inttypes format string macros

Define _SF64_PREFIX and _SF32_PREFIX on systems that do not have these
macros: PRIu64, PRIx64, PRIi64, PRIu32, PRIi32, PRIx32

This logic is the same as in the previous build system, here:
https://github.com/Cisco-Talos/clamav/blob/rel/0.102/m4/reorganization/types.m4#L83

Patch courtesy of Mark Fortescue.
pull/250/head
Micah Snyder 4 years ago committed by Micah Snyder
parent 657a8e0ff8
commit 1cda765843
  1. 21
      CMakeLists.txt
  2. 1
      NEWS.md
  3. 10
      docs/man/clamav-milter.8.in
  4. 2
      docs/man/clamav-milter.conf.5.in
  5. 58
      docs/man/clamd.8.in
  6. 2
      docs/man/clamd.conf.5.in
  7. 2
      docs/man/clamonacc.8.in
  8. 6
      docs/man/clamscan.1.in
  9. 8
      docs/man/freshclam.1.in
  10. 4
      docs/man/freshclam.conf.5.in

@ -51,6 +51,8 @@ math(EXPR LIBFRESHCLAM_SOVERSION "${LIBFRESHCLAM_CURRENT} - ${LIBFRESHCLAM_AGE}"
set(LIBFRESHCLAM_VERSION "${LIBFRESHCLAM_SOVERSION}.${LIBFRESHCLAM_AGE}.${LIBFRESHCLAM_REVISION}")
HexVersion(LIBFRESHCLAM_VERSION_NUM ${LIBFRESHCLAM_CURRENT} ${LIBFRESHCLAM_REVISION} ${LIBFRESHCLAM_AGE})
set(GENERATE_WARNING "WARNING: This file was generated by CMake. Do not edit!")
#
# Define C_LINUX and C_BSD because CMake only defines UNIX, APPLE, WIN32, MSVC
#
@ -513,6 +515,7 @@ check_type_size("long long" SIZEOF_LONG_LONG)
#
# Variables for clamav-types.h.in
#
#TODO: Move this to a .cmake file
if(HAVE_SYS_INT_TYPES_H)
set(INT_TYPES_HEADER "#include <sys/int_types.h>")
elseif(HAVE_INTTYPES_H)
@ -530,7 +533,7 @@ else()
if(SIZEOF_INT EQUAL 2)
set(INT16_DEF "typedef signed int int16_t;")
set(UINT16_DEF "typedef unsigned int uint16_t;")
elif(SIZEOF_SHORT EQUAL 2)
elseif(SIZEOF_SHORT EQUAL 2)
set(INT16_DEF "typedef signed short int16_t;")
set(UINT16_DEF "typedef unsigned short uint16_t;")
endif()
@ -538,7 +541,7 @@ else()
if(SIZEOF_INT EQUAL 4)
set(INT32_DEF "typedef signed int int32_t;")
set(UINT32_DEF "typedef unsigned int uint32_t;")
elif(SIZEOF_LONG EQUAL 4)
elseif(SIZEOF_LONG EQUAL 4)
set(INT32_DEF "typedef signed long int32_t;")
set(UINT32_DEF "typedef unsigned long uint32_t;")
endif()
@ -546,12 +549,24 @@ else()
if(SIZEOF_LONG EQUAL 8)
set(INT64_DEF "typedef signed long int64_t;")
set(UINT64_DEF "typedef unsigned long uint64_t;")
elif(SIZEOF_LONG_LONG EQUAL 8)
elseif(SIZEOF_LONG_LONG EQUAL 8)
set(INT64_DEF "typedef signed long long int64_t;")
set(UINT64_DEF "typedef unsigned long long uint64_t;")
endif()
endif()
# Always do this
if(SIZEOF_INT EQUAL 4)
set(DEFINE_SF32_PREFIX "#define _SF32_PREFIX \"\"")
elseif(SIZEOF_LONG EQUAL 4)
set(DEFINE_SF32_PREFIX "#define _SF32_PREFIX \"l\"")
endif()
if(SIZEOF_LONG EQUAL 8)
set(DEFINE_SF64_PREFIX "#define _SF64_PREFIX \"l\"")
elseif(SIZEOF_LONG_LONG EQUAL 8)
set(DEFINE_SF64_PREFIX "#define _SF64_PREFIX \"ll\"")
endif()
# Check for restrict keyword
#TODO: Move this to a .cmake file
foreach( ac_kw __restrict __restrict__ _Restrict restrict )

@ -158,6 +158,7 @@ The ClamAV team thanks the following individuals for their code submissions:
- Gianluigi Tiesi
- Jonas Zaddach
- Kenneth Hau
- Mark Fortescue
- Markus Strehle
- Olliver Schinagl
- Orion Poplawski

@ -19,17 +19,17 @@ goes down.
.TP
\fB\-h, \-\-help\fR
Output help information and exit.
.TP
.TP
\fB\-V, \-\-version\fR
Print the version number and exit.
.TP
.TP
\fB\-c FILE, \-\-config\-file=FILE\fR
Read configuration from FILE.
.SH "FILES"
.LP
@CFGDIR@/clamav-milter.conf
.LP
@CONFDIR@/clamav-milter.conf
.SH "AUTHOR"
.LP
.LP
aCaB <acab@clamav.net>
.SH "SEE ALSO"
.LP

@ -239,7 +239,7 @@ Default: no
All options expressing a size are limited to max 4GB. Values in excess will be reset to the maximum.
.SH "FILES"
.LP
@CFGDIR@/clamav-milter.conf
@CONFDIR@/clamav-milter.conf
.SH "AUTHOR"
.LP
aCaB <acab@clamav.net>

@ -1,42 +1,42 @@
.TH "Clam Daemon" "8" "February 12, 2009" "ClamAV @VERSION@" "Clam AntiVirus"
.SH "NAME"
.LP
.LP
clamd \- an anti\-virus daemon
.SH "SYNOPSIS"
.LP
.LP
clamd [options]
.SH "DESCRIPTION"
.LP
The daemon listens for incoming connections on Unix and/or TCP socket and scans files or directories on demand. It reads the configuration from @CFGDIR@/clamd.conf
.LP
The daemon listens for incoming connections on Unix and/or TCP socket and scans files or directories on demand. It reads the configuration from @CONFDIR@/clamd.conf
.SH "COMMANDS"
.LP
.LP
It's recommended to prefix clamd commands with the letter \fBz\fR (eg. zSCAN) to indicate that the command will be delimited by a NULL character and that clamd should continue reading command data until a NULL character is read. The null delimiter assures that the complete command and its entire argument will be processed as a single command. Alternatively commands may be prefixed with the letter \fBn\fR (e.g. nSCAN) to use a newline character as the delimiter. Clamd replies will honour the requested terminator in turn.
If clamd doesn't recognize the command, or the command doesn't follow the requirements specified below, it will reply with an error message, and close the connection.
.LP
Clamd recognizes the following commands:
.TP
.TP
\fBPING\fR
Check the server's state. It should reply with "PONG".
.TP
.TP
\fBVERSION\fR
Print program and database versions.
.TP
.TP
\fBRELOAD\fR
Reload the virus databases.
.TP
.TP
\fBSHUTDOWN\fR
Perform a clean exit.
.TP
.TP
\fBSCAN file/directory\fR
Scan a file or a directory (recursively) with archive support enabled (if not disabled in clamd.conf). A full path is required.
.TP
.TP
\fBCONTSCAN file/directory\fR
Scan file or directory (recursively) with archive support enabled and don't stop the scanning when a virus is found.
.TP
.TP
\fBMULTISCAN file/directory\fR
Scan file in a standard way or scan directory (recursively) using multiple threads (to make the scanning faster on SMP machines).
.TP
.TP
\fBALLMATCHSCAN file/directory\fR
ALLMATCHSCAN works just like SCAN except that it sets a mode where scanning continues after finding a match within a file.
.TP
@ -83,54 +83,54 @@ their version, without the commands list.
This command can be used as an easy way to check for IDSESSION support for
example.
.LP
.TP
.TP
\fBDEPRECATED COMMANDS\fR
.TP
\fBSTREAM\fR
Scan stream \- on this command clamd will return "PORT number" you should connect to and send data to scan. (\fBDEPRECATED\fR, use INSTREAM instead)
Scan stream \- on this command clamd will return "PORT number" you should connect to and send data to scan. (\fBDEPRECATED\fR, use INSTREAM instead)
.LP
.TP
\fBNOT SUPPORTED COMMANDS\fR
.TP
.TP
\fBSESSION, END\fR
Start/end a clamd session which will allow you to run multiple commands per TCP session. (use IDSESSION instead)
.SH "OPTIONS"
.LP
.TP
.LP
.TP
\fB\-h, \-\-help\fR
Output help information and exit.
.TP
.TP
\fB\-V, \-\-version\fR
Print the version number and exit.
.TP
.TP
\fB\-F, \-\-foreground\fR
Run in foreground; do not daemonize.
.TP
.TP
\fB\-\-debug\fR
Enable debug mode.
.TP
\fB\-c FILE, \-\-config\-file=FILE\fR
Read configuration from FILE.
.SH "SIGNALS"
.LP
.LP
Clamd recognizes the following signals:
.TP
.TP
\fBSIGHUP\fR
Reopen the logfile.
.TP
.TP
\fBSIGUSR2\fR
Reload the signature databases.
.TP
.TP
\fBSIGTERM\fR
Perform a clean exit.
.SH "FILES"
.LP
@CFGDIR@/clamd.conf
.LP
@CONFDIR@/clamd.conf
.SH "CREDITS"
Please check the full documentation for credits.
.SH "AUTHOR"
.LP
.LP
Tomasz Kojm <tkojm@clamav.net>
.SH "SEE ALSO"
.LP
.LP
clamd.conf(5), clamdscan(1), freshclam(1), freshclam.conf(5), clamav\-milter(8)

@ -765,7 +765,7 @@ Default: no
All options expressing a size are limited to max 4GB. Values in excess will be reset to the maximum.
.SH "FILES"
.LP
@CFGDIR@/clamd.conf
@CONFDIR@/clamd.conf
.SH "AUTHORS"
.LP
Tomasz Kojm <tkojm@clamav.net>, Kevin Lin <klin@sourcefire.com>

@ -73,7 +73,7 @@ Reload the signature databases.
Perform a clean exit.
.SH "FILES"
.LP
@CFGDIR@/clamd.conf
@CONFDIR@/clamd.conf
.SH "CREDITS"
Please check the full documentation for credits.
.SH "AUTHOR"

@ -46,7 +46,7 @@ Skip printing OK files
Sound bell on virus detection.
.TP
\fB\-\-tempdir=DIRECTORY\fR
Create temporary files in DIRECTORY. Directory must be writable for the '@CLAMAVUSER@' user or unprivileged user running clamscan.
Create temporary files in DIRECTORY. Directory must be writable for the '@CLAMAV_USER@' user or unprivileged user running clamscan.
.TP
\fB\-\-leave\-temps\fR
Do not remove temporary files.
@ -85,10 +85,10 @@ Scan files listed line by line in FILE.
Remove infected files. \fBBe careful!\fR
.TP
\fB\-\-move=DIRECTORY\fR
Move infected files into DIRECTORY. Directory must be writable for the '@CLAMAVUSER@' user or unprivileged user running clamscan.
Move infected files into DIRECTORY. Directory must be writable for the '@CLAMAV_USER@' user or unprivileged user running clamscan.
.TP
\fB\-\-copy=DIRECTORY\fR
Copy infected files into DIRECTORY. Directory must be writable for the '@CLAMAVUSER@' user or unprivileged user running clamscan.
Copy infected files into DIRECTORY. Directory must be writable for the '@CLAMAV_USER@' user or unprivileged user running clamscan.
.TP
\fB\-\-exclude=REGEX, \-\-exclude\-dir=REGEX\fR
Don't scan file/directory names matching regular expression. These options can be used multiple times.

@ -52,7 +52,7 @@ Write daemon's pid to FILE.
Don't fork into background (for use in daemon mode).
.TP
\fB\-u USER, \-\-user USER\fR
Run as USER. By default (when started by root) freshclam drops privileges and operates as the '@CLAMAVUSER@' user.
Run as USER. By default (when started by root) freshclam drops privileges and operates as the '@CLAMAV_USER@' user.
.TP
\fB\-\-no\-dns\fR
This option forces old non\-DNS verification method (without a TTL delay).
@ -61,7 +61,7 @@ This option forces old non\-DNS verification method (without a TTL delay).
Check #n times per day for a new database. #n must be between 1 and 50.
.TP
\fB\-\-datadir=DIRECTORY\fR
Install new database in DIRECTORY. The directory must be writable for the '@CLAMAVUSER@' user or unprivileged user running freshclam.
Install new database in DIRECTORY. The directory must be writable for the '@CLAMAV_USER@' user or unprivileged user running freshclam.
.TP
\fB\-\-daemon\-notify=/path/to/clamd.conf\fR
Notify the daemon about the new database. By default it reads a hardcoded config file but you can use a different one. Both local and TCP sockets are supported.
@ -121,14 +121,14 @@ Some return codes of freshclam can be overwritten with a built-in command EXIT_n
.TP
59: Mirrors are not fully synchronized (try again later).
.TP
60: Can't get information about '@CLAMAVUSER@' user from /etc/passwd.
60: Can't get information about '@CLAMAV_USER@' user from /etc/passwd.
.TP
61: Can't drop privileges.
.TP
62: Can't initialize logger.
.SH "FILES"
.LP
@CFGDIR@/freshclam.conf
@CONFDIR@/freshclam.conf
.SH "CREDITS"
Please check the full documentation for credits.
.SH "AUTHOR"

@ -84,7 +84,7 @@ Default: disabled.
\fBDatabaseOwner STRING\fR
When started by root, drop privileges to a specified user.
.br
Default: @CLAMAVUSER@
Default: @CLAMAV_USER@
.TP
\fBChecks NUMBER\fR
Number of database checks per day.
@ -210,7 +210,7 @@ This option enables downloading of bytecode.cvd, which includes additional detec
Default: yes
.SH "FILES"
.LP
@CFGDIR@/freshclam.conf
@CONFDIR@/freshclam.conf
.SH "AUTHOR"
.LP
Thomas Lamy <thomas.lamy@netwake.de>, Tomasz Kojm <tkojm@clamav.net>, Kevin Lin <klin@sourcefire.com>

Loading…
Cancel
Save