| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "sd-dlopen.h" |
| 5 |
|
| 6 |
#include "shared-forward.h" |
| 7 |
|
| 8 |
#if HAVE_LIBIDN2 |
| 9 |
#include <idn2.h> |
| 10 |
|
| 11 |
#include "dlfcn-util.h" |
| 12 |
|
| 13 |
extern DLSYM_PROTOTYPE(idn2_lookup_u8); |
| 14 |
extern const char *(*sym_idn2_strerror)(int rc) _const_; |
| 15 |
extern DLSYM_PROTOTYPE(idn2_to_unicode_8z8z); |
| 16 |
|
| 17 |
#define IDN_NOTE(priority) \ |
| 18 |
SD_ELF_NOTE_DLOPEN("idn", \ |
| 19 |
"Support for internationalized domain names", \ |
| 20 |
priority, \ |
| 21 |
"libidn2.so.0") |
| 22 |
|
| 23 |
#define DLOPEN_IDN(log_level, priority) \ |
| 24 |
({ \ |
| 25 |
IDN_NOTE(priority); \ |
| 26 |
dlopen_idn(log_level); \ |
| 27 |
}) |
| 28 |
#else |
| 29 |
#define DLOPEN_IDN(log_level, priority) dlopen_idn(log_level) |
| 30 |
#endif |
| 31 |
|
| 32 |
int dlopen_idn(int log_level); |