conf.set10('ENABLE_PAM_HOME', have)
feature = get_option('remote')
-have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
- conf.get('HAVE_LIBCURL') == 1]
-# sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
-# it's possible to build one without the other. Complain only if
-# support was explicitly requested. The auxiliary files like sysusers
-# config should be installed when any of the programs are built.
-if feature.enabled() and not (have_deps[0] and have_deps[1])
- error('remote support was requested, but dependencies are not available')
-endif
-have = feature.allowed() and (have_deps[0] or have_deps[1])
-conf.set10('ENABLE_REMOTE', have)
+if feature.enabled()
+ if conf.get('HAVE_MICROHTTPD') != 1
+ error('remote support was requested, but microhttpd is not available')
+ endif
+ if conf.get('HAVE_LIBCURL') != 1
+ error('remote support was requested, but libcurl is not available')
+ endif
+endif
+# A more minimal version of systemd-journal-remote can always be built, even if neither
+# libcurl nor microhttpd are available.
+conf.set10('ENABLE_REMOTE', feature.allowed())
feature = get_option('vmspawn').disable_auto_if(conf.get('BUILD_MODE_DEVELOPER') == 0)
conf.set10('ENABLE_VMSPAWN', feature.allowed())
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(journal_write_split_mode, JournalWriteSplitMode);
static DEFINE_CONFIG_PARSE_ENUM(config_parse_write_split_mode, journal_write_split_mode, JournalWriteSplitMode);
+#if HAVE_MICROHTTPD
+
typedef struct MHDDaemonWrapper {
uint64_t fd;
struct MHD_Daemon *daemon;
uint64_t, uint64_hash_func, uint64_compare_func,
MHDDaemonWrapper, MHDDaemonWrapper_free);
+#endif
+
/**********************************************************************
**********************************************************************
**********************************************************************/
**********************************************************************
**********************************************************************/
+#if HAVE_MICROHTTPD
+
static int null_timer_event_handler(sd_event_source *s,
uint64_t usec,
void *userdata);
return MHD_YES;
}
+#endif
+
static int setup_microhttpd_server(RemoteServer *s,
int fd,
const char *key,
const char *cert,
const char *trust) {
+
+#if HAVE_MICROHTTPD
struct MHD_OptionItem opts[] = {
{ MHD_OPTION_EXTERNAL_LOGGER, (intptr_t) microhttpd_logger},
{ MHD_OPTION_NOTIFY_COMPLETED, (intptr_t) request_meta_free},
TAKE_PTR(d);
s->active++;
return 0;
+#else
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "microhttpd support not compiled in");
+#endif
}
static int setup_microhttpd_socket(RemoteServer *s,
return setup_microhttpd_server(s, fd, key, cert, trust);
}
+#if HAVE_MICROHTTPD
+
static int null_timer_event_handler(sd_event_source *timer_event,
uint64_t usec,
void *userdata) {
return 1; /* work to do */
}
+#endif
+
/**********************************************************************
**********************************************************************
**********************************************************************/
journal_browse_prepare();
+#if HAVE_MICROHTTPD
if (arg_listen_http || arg_listen_https) {
r = setup_gnutls_logger(arg_gnutls_log);
if (r < 0)
return r;
}
+#endif
if (arg_listen_https || https_socket >= 0) {
r = load_certificates(&key, &cert, &trust);
libexec_template + {
'name' : 'systemd-journal-remote',
'public' : true,
- 'conditions' : ['HAVE_MICROHTTPD'],
'sources' : [systemd_journal_remote_sources, systemd_journal_remote_extract_sources],
'extract' : systemd_journal_remote_extract_sources,
'dependencies' : common_deps + [libmicrohttpd],
},
fuzz_template + {
'sources' : files('fuzz-journal-remote.c'),
- 'conditions' : ['HAVE_MICROHTTPD'],
'objects' : ['systemd-journal-remote'],
'dependencies' : common_deps + [libmicrohttpd],
},
#include "string-util.h"
#include "strv.h"
+#if HAVE_MICROHTTPD
+
void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
char *f;
return 0;
}
#endif
+
+#endif
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#if HAVE_MICROHTTPD
+
#include <microhttpd.h>
#include <stdarg.h>
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct MHD_Daemon*, MHD_stop_daemon, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct MHD_Response*, MHD_destroy_response, NULL);
+
+#endif