diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
| commit | cfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch) | |
| tree | 8016486f8ee7157213f2d09ff2491bfa9c94638a /gnulib-m4/libdl.m4 | |
| parent | 14e4d584d0121031ec40e6c35869745f1747ff29 (diff) | |
| parent | 1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff) | |
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'gnulib-m4/libdl.m4')
| -rw-r--r-- | gnulib-m4/libdl.m4 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gnulib-m4/libdl.m4 b/gnulib-m4/libdl.m4 new file mode 100644 index 00000000..79d69063 --- /dev/null +++ b/gnulib-m4/libdl.m4 @@ -0,0 +1,46 @@ +# libdl.m4 +# serial 3 +dnl Copyright (C) 2024-2026 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +dnl Set LIBDL to '-ldl' if it is needed to use the functions declared +dnl in <dlfcn.h> (dlopen, dlsym, etc.), or to empty otherwise. +AC_DEFUN([gl_LIBDL], +[ + dnl dlopen, dlsym are + dnl - in libc on glibc >= 2.34, musl libc, macOS, FreeBSD, NetBSD, OpenBSD, + dnl AIX, Solaris, Cygwin, Haiku, + dnl - in a separate libdl on glibc < 2.34, uClibc, Android. + AC_CACHE_CHECK([for library needed for dlopen and dlsym], + [gl_cv_lib_dl], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <dlfcn.h> + ]], + [[return ! dlsym (RTLD_DEFAULT, "main");]])], + [gl_cv_lib_dl=none], + [gl_cv_lib_dl=maybe]) + if test $gl_cv_lib_dl = maybe; then + saved_LIBS="$LIBS" + LIBS="$LIBS -ldl" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <dlfcn.h> + ]], + [[return ! dlsym (RTLD_DEFAULT, "main");]])], + [gl_cv_lib_dl='-ldl'], + [gl_cv_lib_dl=none]) + LIBS="$saved_LIBS" + fi + ]) + case "$gl_cv_lib_dl" in + none) LIBDL='' ;; + *) LIBDL="$gl_cv_lib_dl" ;; + esac + AC_SUBST([LIBDL]) +]) |
