1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
dnl Checks for libexe required headers and functions
dnl
dnl Version: 20201114
dnl Function to detect if libexe is available
dnl ac_libexe_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
AC_DEFUN([AX_LIBEXE_CHECK_LIB],
[AS_IF(
[test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libexe" = xno],
[ac_cv_libexe=no],
[ac_cv_libexe=check
dnl Check if the directory provided as parameter exists
AS_IF(
[test "x$ac_cv_with_libexe" != x && test "x$ac_cv_with_libexe" != xauto-detect],
[AS_IF(
[test -d "$ac_cv_with_libexe"],
[CFLAGS="$CFLAGS -I${ac_cv_with_libexe}/include"
LDFLAGS="$LDFLAGS -L${ac_cv_with_libexe}/lib"],
[AC_MSG_FAILURE(
[no such directory: $ac_cv_with_libexe],
[1])
])
],
[dnl Check for a pkg-config file
AS_IF(
[test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"],
[PKG_CHECK_MODULES(
[libexe],
[libexe >= 20120405],
[ac_cv_libexe=yes],
[ac_cv_libexe=check])
])
AS_IF(
[test "x$ac_cv_libexe" = xyes && test "x$ac_cv_enable_wide_character_type" != xno],
[AC_CACHE_CHECK(
[whether libexe/features.h defines LIBEXE_HAVE_WIDE_CHARACTER_TYPE as 1],
[ac_cv_header_libexe_features_h_have_wide_character_type],
[AC_LANG_PUSH(C)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <libexe/features.h>]],
[[#if !defined( LIBEXE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBEXE_HAVE_WIDE_CHARACTER_TYPE != 1 )
#error LIBEXE_HAVE_WIDE_CHARACTER_TYPE not defined
#endif]] )],
[ac_cv_header_libexe_features_h_have_wide_character_type=yes],
[ac_cv_header_libexe_features_h_have_wide_character_type=no])
AC_LANG_POP(C)],
[ac_cv_header_libexe_features_h_have_wide_character_type=no])
AS_IF(
[test "x$ac_cv_header_libexe_features_h_have_wide_character_type" = xno],
[ac_cv_libexe=no])
])
AS_IF(
[test "x$ac_cv_libexe" = xyes],
[ac_cv_libexe_CPPFLAGS="$pkg_cv_libexe_CFLAGS"
ac_cv_libexe_LIBADD="$pkg_cv_libexe_LIBS"])
])
AS_IF(
[test "x$ac_cv_libexe" = xcheck],
[dnl Check for headers
AC_CHECK_HEADERS([libexe.h])
AS_IF(
[test "x$ac_cv_header_libexe_h" = xno],
[ac_cv_libexe=no],
[dnl Check for the individual functions
ac_cv_libexe=yes
AC_CHECK_LIB(
exe,
libexe_get_version,
[ac_cv_libexe_dummy=yes],
[ac_cv_libexe=no])
dnl TODO add functions
ac_cv_libexe_LIBADD="-lexe"])
])
AS_IF(
[test "x$ac_cv_with_libexe" != x && test "x$ac_cv_with_libexe" != xauto-detect && test "x$ac_cv_libexe" != xyes],
[AC_MSG_FAILURE(
[unable to find supported libexe in directory: $ac_cv_with_libexe],
[1])
])
])
AS_IF(
[test "x$ac_cv_libexe" = xyes],
[AC_DEFINE(
[HAVE_LIBEXE],
[1],
[Define to 1 if you have the `exe' library (-lexe).])
])
AS_IF(
[test "x$ac_cv_libexe" = xyes],
[AC_SUBST(
[HAVE_LIBEXE],
[1]) ],
[AC_SUBST(
[HAVE_LIBEXE],
[0])
])
])
dnl Function to detect if libexe dependencies are available
AC_DEFUN([AX_LIBEXE_CHECK_LOCAL],
[ac_cv_libexe_CPPFLAGS="-I../libexe";
ac_cv_libexe_LIBADD="../libexe/libexe.la";
ac_cv_libexe=local
])
dnl Function to detect how to enable libexe
AC_DEFUN([AX_LIBEXE_CHECK_ENABLE],
[AX_COMMON_ARG_WITH(
[libexe],
[libexe],
[search for libexe in includedir and libdir or in the specified DIR, or no if to use local version],
[auto-detect],
[DIR])
dnl Check for a shared library version
AX_LIBEXE_CHECK_LIB
dnl Check if the dependencies for the local library version
AS_IF(
[test "x$ac_cv_libexe" != xyes],
[AX_LIBEXE_CHECK_LOCAL
AC_DEFINE(
[HAVE_LOCAL_LIBEXE],
[1],
[Define to 1 if the local version of libexe is used.])
AC_SUBST(
[HAVE_LOCAL_LIBEXE],
[1])
])
AM_CONDITIONAL(
[HAVE_LOCAL_LIBEXE],
[test "x$ac_cv_libexe" = xlocal])
AS_IF(
[test "x$ac_cv_libexe_CPPFLAGS" != "x"],
[AC_SUBST(
[LIBEXE_CPPFLAGS],
[$ac_cv_libexe_CPPFLAGS])
])
AS_IF(
[test "x$ac_cv_libexe_LIBADD" != "x"],
[AC_SUBST(
[LIBEXE_LIBADD],
[$ac_cv_libexe_LIBADD])
])
AS_IF(
[test "x$ac_cv_libexe" = xyes],
[AC_SUBST(
[ax_libexe_pc_libs_private],
[-lexe])
])
AS_IF(
[test "x$ac_cv_libexe" = xyes],
[AC_SUBST(
[ax_libexe_spec_requires],
[libexe])
AC_SUBST(
[ax_libexe_spec_build_requires],
[libexe-devel])
])
])
|