mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Require PCRE library.
This library is widely available in distros.
This commit is contained in:
4
README
4
README
@@ -58,12 +58,12 @@ For basic functionality and the C tools:
|
||||
|
||||
- gperf
|
||||
|
||||
- pcre (Perl Compatible Regular Expressions C library)
|
||||
|
||||
- genisoimage (NOT mkisofs any more)
|
||||
|
||||
- hivex >= 1.2.7 (http://libguestfs.org/download) (optional)
|
||||
|
||||
- pcre (Perl Compatible Regular Expressions C library) (optional)
|
||||
|
||||
- libmagic (the library that corresponds to the 'file' command) (optional)
|
||||
|
||||
- libvirt (optional)
|
||||
|
||||
11
configure.ac
11
configure.ac
@@ -411,6 +411,9 @@ AS_IF([test "x$with_readline" != xno],
|
||||
dnl For i18n.
|
||||
AM_GNU_GETTEXT([external])
|
||||
|
||||
dnl Check for PCRE (required)
|
||||
PKG_CHECK_MODULES([PCRE], [libpcre])
|
||||
|
||||
dnl libmagic (highly recommended)
|
||||
AC_CHECK_LIB([magic],[magic_file],
|
||||
[AC_CHECK_HEADER([magic.h],
|
||||
@@ -420,14 +423,6 @@ AC_CHECK_LIB([magic],[magic_file],
|
||||
],
|
||||
[AC_MSG_WARN([libmagic not found, some core features will be disabled])])
|
||||
|
||||
dnl Check for PCRE (highly recommended)
|
||||
PKG_CHECK_MODULES([PCRE], [libpcre],
|
||||
[AC_SUBST([PCRE_CFLAGS])
|
||||
AC_SUBST([PCRE_LIBS])
|
||||
AC_DEFINE([HAVE_PCRE],[1],[PCRE found at compile time.])
|
||||
],
|
||||
[AC_MSG_WARN([PCRE not found, some core features will be disabled])])
|
||||
|
||||
dnl libvirt (highly recommended)
|
||||
PKG_CHECK_MODULES([LIBVIRT], [libvirt],
|
||||
[AC_SUBST([LIBVIRT_CFLAGS])
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -43,7 +41,7 @@
|
||||
#include "guestfs.h"
|
||||
#include "guestfs-internal.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX) && defined(DB_DUMP)
|
||||
#if defined(HAVE_HIVEX) && defined(DB_DUMP)
|
||||
|
||||
static unsigned char *convert_hex_to_binary (guestfs_h *g, const char *hex, size_t hexlen, size_t *binlen_rtn);
|
||||
|
||||
@@ -217,4 +215,4 @@ convert_hex_to_binary (guestfs_h *g, const char *hex, size_t hexlen,
|
||||
return bin;
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_PCRE) && defined(HAVE_HIVEX) && defined(DB_DUMP) */
|
||||
#endif /* defined(HAVE_HIVEX) && defined(DB_DUMP) */
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
#include <magic.h>
|
||||
#endif
|
||||
@@ -40,7 +39,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_LIBMAGIC)
|
||||
#if defined(HAVE_LIBMAGIC)
|
||||
|
||||
static pcre *re_file_elf;
|
||||
static pcre *re_elf_ppc64;
|
||||
@@ -258,12 +257,12 @@ guestfs__file_architecture (guestfs_h *g, const char *path)
|
||||
return ret; /* caller frees */
|
||||
}
|
||||
|
||||
#else /* no PCRE or libmagic at compile time */
|
||||
#else /* no libmagic at compile time */
|
||||
|
||||
/* XXX Should be an optgroup. */
|
||||
|
||||
#define NOT_IMPL(r) \
|
||||
error (g, _("file-architecture API not available since this version of libguestfs was compiled without PCRE or libmagic libraries")); \
|
||||
error (g, _("file-architecture API not available since this version of libguestfs was compiled without the libmagic library")); \
|
||||
return r
|
||||
|
||||
char *
|
||||
@@ -272,4 +271,4 @@ guestfs__file_architecture (guestfs_h *g, const char *path)
|
||||
NOT_IMPL(NULL);
|
||||
}
|
||||
|
||||
#endif /* no PCRE or libmagic at compile time */
|
||||
#endif /* no libmagic at compile time */
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#define STREQ(a,b) (strcmp((a),(b)) == 0)
|
||||
#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0)
|
||||
@@ -348,12 +346,10 @@ extern int guestfs___build_appliance (guestfs_h *g, char **kernel, char **initrd
|
||||
extern void guestfs___launch_send_progress (guestfs_h *g, int perdozen);
|
||||
extern void guestfs___print_BufferIn (FILE *out, const char *buf, size_t buf_size);
|
||||
extern void guestfs___print_BufferOut (FILE *out, const char *buf, size_t buf_size);
|
||||
#ifdef HAVE_PCRE
|
||||
extern int guestfs___match (guestfs_h *g, const char *str, const pcre *re);
|
||||
extern char *guestfs___match1 (guestfs_h *g, const char *str, const pcre *re);
|
||||
extern int guestfs___match2 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2);
|
||||
extern int guestfs___match3 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3);
|
||||
#endif
|
||||
extern int guestfs___feature_available (guestfs_h *g, const char *feature);
|
||||
extern void guestfs___free_string_list (char **);
|
||||
extern size_t guestfs___checkpoint_cmdline (guestfs_h *g);
|
||||
@@ -361,7 +357,7 @@ extern void guestfs___rollback_cmdline (guestfs_h *g, size_t pos);
|
||||
extern void guestfs___call_callbacks_void (guestfs_h *g, uint64_t event);
|
||||
extern void guestfs___call_callbacks_message (guestfs_h *g, uint64_t event, const char *buf, size_t buf_len);
|
||||
extern void guestfs___call_callbacks_array (guestfs_h *g, uint64_t event, const uint64_t *array, size_t array_len);
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
extern int guestfs___check_for_filesystem_on (guestfs_h *g, const char *device, int is_block, int is_partnum);
|
||||
extern char *guestfs___download_to_tmp (guestfs_h *g, struct inspect_fs *fs, const char *filename, const char *basename, int64_t max_size);
|
||||
extern char *guestfs___case_sensitive_path_silently (guestfs_h *g, const char *);
|
||||
@@ -391,11 +387,9 @@ extern int guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs);
|
||||
#define safe_strndup guestfs_safe_strndup
|
||||
#define safe_memdup guestfs_safe_memdup
|
||||
#define safe_asprintf guestfs_safe_asprintf
|
||||
#ifdef HAVE_PCRE
|
||||
#define match guestfs___match
|
||||
#define match1 guestfs___match1
|
||||
#define match2 guestfs___match2
|
||||
#define match3 guestfs___match3
|
||||
#endif
|
||||
|
||||
#endif /* GUESTFS_INTERNAL_H_ */
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -46,7 +44,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
|
||||
/* The main inspection code. */
|
||||
char **
|
||||
@@ -591,12 +589,12 @@ guestfs___search_for_root (guestfs_h *g, const char *root)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else /* no PCRE or hivex at compile time */
|
||||
#else /* no hivex at compile time */
|
||||
|
||||
/* XXX These functions should be in an optgroup. */
|
||||
|
||||
#define NOT_IMPL(r) \
|
||||
error (g, _("inspection API not available since this version of libguestfs was compiled without PCRE or hivex libraries")); \
|
||||
error (g, _("inspection API not available since this version of libguestfs was compiled without the hivex library")); \
|
||||
return r
|
||||
|
||||
char **
|
||||
@@ -726,7 +724,7 @@ guestfs__inspect_is_multipart (guestfs_h *g, const char *root)
|
||||
NOT_IMPL(-1);
|
||||
}
|
||||
|
||||
#endif /* no PCRE or hivex at compile time */
|
||||
#endif /* no hivex at compile time */
|
||||
|
||||
void
|
||||
guestfs___free_inspect_info (guestfs_h *g)
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -46,7 +44,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
|
||||
#ifdef DB_DUMP
|
||||
static struct guestfs_application_list *list_applications_rpm (guestfs_h *g, struct inspect_fs *fs);
|
||||
@@ -601,12 +599,12 @@ sort_applications (struct guestfs_application_list *apps)
|
||||
compare_applications);
|
||||
}
|
||||
|
||||
#else /* no PCRE or hivex at compile time */
|
||||
#else /* no hivex at compile time */
|
||||
|
||||
/* XXX These functions should be in an optgroup. */
|
||||
|
||||
#define NOT_IMPL(r) \
|
||||
error (g, _("inspection API not available since this version of libguestfs was compiled without PCRE or hivex libraries")); \
|
||||
error (g, _("inspection API not available since this version of libguestfs was compiled without the hivex library")); \
|
||||
return r
|
||||
|
||||
struct guestfs_application_list *
|
||||
@@ -615,4 +613,4 @@ guestfs__inspect_list_applications (guestfs_h *g, const char *root)
|
||||
NOT_IMPL(NULL);
|
||||
}
|
||||
|
||||
#endif /* no PCRE or hivex at compile time */
|
||||
#endif /* no hivex at compile time */
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -46,7 +44,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
|
||||
/* Compile all the regular expressions once when the shared library is
|
||||
* loaded. PCRE is thread safe so we're supposedly OK here if
|
||||
@@ -538,4 +536,4 @@ guestfs___first_egrep_of_file (guestfs_h *g, const char *filename,
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_PCRE) && defined(HAVE_HIVEX) */
|
||||
#endif /* defined(HAVE_HIVEX) */
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -46,7 +44,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
|
||||
/* Debian/Ubuntu install disks are easy ...
|
||||
*
|
||||
@@ -401,4 +399,4 @@ guestfs___check_installer_root (guestfs_h *g, struct inspect_fs *fs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_PCRE) && defined(HAVE_HIVEX) */
|
||||
#endif /* defined(HAVE_HIVEX) */
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -46,7 +44,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
|
||||
/* Compile all the regular expressions once when the shared library is
|
||||
* loaded. PCRE is thread safe so we're supposedly OK here if
|
||||
@@ -850,4 +848,4 @@ inspect_with_augeas (guestfs_h *g, struct inspect_fs *fs, const char *filename,
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_PCRE) && defined(HAVE_HIVEX) */
|
||||
#endif /* defined(HAVE_HIVEX) */
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIVEX
|
||||
#include <hivex.h>
|
||||
@@ -46,7 +44,7 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
#if defined(HAVE_PCRE) && defined(HAVE_HIVEX)
|
||||
#if defined(HAVE_HIVEX)
|
||||
|
||||
/* Compile all the regular expressions once when the shared library is
|
||||
* loaded. PCRE is thread safe so we're supposedly OK here if
|
||||
@@ -529,4 +527,4 @@ guestfs___case_sensitive_path_silently (guestfs_h *g, const char *path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_PCRE) && defined(HAVE_HIVEX) */
|
||||
#endif /* defined(HAVE_HIVEX) */
|
||||
|
||||
@@ -22,15 +22,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "guestfs-internal.h"
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
|
||||
/* Match a regular expression which contains no captures. Returns
|
||||
* true if it matches or false if it doesn't.
|
||||
*/
|
||||
@@ -124,5 +120,3 @@ guestfs___match3 (guestfs_h *g, const char *str, const pcre *re,
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* HAVE_PCRE */
|
||||
|
||||
Reference in New Issue
Block a user