2021-11-21 23:59:44 +00:00
|
|
|
dnl Copyright (c) Meta Platforms, Inc. and affiliates.
|
2021-04-03 09:10:35 +01:00
|
|
|
dnl SPDX-License-Identifier: GPL-3.0-or-later
|
2020-05-15 23:13:02 +01:00
|
|
|
|
2022-10-12 20:00:54 +01:00
|
|
|
AC_INIT([libdrgn], [0.0.21],
|
Rewrite drgn core in C
The current mixed Python/C implementation works well, but it has a
couple of important limitations:
- It's too slow for some common use cases, like iterating over large
data structures.
- It can't be reused in utilities written in other languages.
This replaces the internals with a new library written in C, libdrgn. It
includes Python bindings with mostly the same public interface as
before, with some important improvements:
- Types are now represented by a single Type class rather than the messy
polymorphism in the Python implementation.
- Qualifiers are a bitmask instead of a set of strings.
- Bit fields are not considered a separate type.
- The lvalue/rvalue terminology is replaced with reference/value.
- Structure, union, and array values are better supported.
- Function objects are supported.
- Program distinguishes between lookups of variables, constants, and
functions.
The C rewrite is about 6x as fast as the original Python when using the
Python bindings, and about 8x when using the C API directly.
Currently, the exposed API in C is fairly conservative. In the future,
the memory reader, type index, and object index APIs will probably be
exposed for more flexibility.
2019-03-22 23:27:46 +00:00
|
|
|
[https://github.com/osandov/drgn/issues],,
|
|
|
|
[https://github.com/osandov/drgn])
|
|
|
|
|
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
AC_PROG_CC
|
|
|
|
|
2019-10-18 10:03:32 +01:00
|
|
|
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects])
|
2020-05-10 08:12:50 +01:00
|
|
|
AM_SILENT_RULES([yes])
|
Rewrite drgn core in C
The current mixed Python/C implementation works well, but it has a
couple of important limitations:
- It's too slow for some common use cases, like iterating over large
data structures.
- It can't be reused in utilities written in other languages.
This replaces the internals with a new library written in C, libdrgn. It
includes Python bindings with mostly the same public interface as
before, with some important improvements:
- Types are now represented by a single Type class rather than the messy
polymorphism in the Python implementation.
- Qualifiers are a bitmask instead of a set of strings.
- Bit fields are not considered a separate type.
- The lvalue/rvalue terminology is replaced with reference/value.
- Structure, union, and array values are better supported.
- Function objects are supported.
- Program distinguishes between lookups of variables, constants, and
functions.
The C rewrite is about 6x as fast as the original Python when using the
Python bindings, and about 8x when using the C API directly.
Currently, the exposed API in C is fairly conservative. In the future,
the memory reader, type index, and object index APIs will probably be
exposed for more flexibility.
2019-03-22 23:27:46 +00:00
|
|
|
AM_PROG_AR
|
|
|
|
|
|
|
|
LT_INIT
|
|
|
|
|
2021-04-21 21:19:49 +01:00
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
|
2020-01-24 01:55:29 +00:00
|
|
|
AC_ARG_ENABLE([openmp],
|
|
|
|
[AS_HELP_STRING([--enable-openmp@<:@=ARG@:>@],
|
|
|
|
[use OpenMP. ARG may be yes, no, or the name of
|
|
|
|
the OpenMP runtime library to use (e.g., gomp or
|
|
|
|
omp)
|
|
|
|
@<:@default=yes@:>@])],
|
|
|
|
[], [enable_openmp=yes])
|
|
|
|
|
|
|
|
OPENMP_CFLAGS=
|
|
|
|
OPENMP_LIBS=
|
|
|
|
AS_CASE(["x$enable_openmp"],
|
|
|
|
[xyes], [OPENMP_CFLAGS=-fopenmp],
|
|
|
|
[xno], [],
|
|
|
|
dnl Use -Wc so that -fopenmp only gets passed when compiling, not
|
|
|
|
dnl linking, otherwise the linker will add the default runtime library.
|
|
|
|
[OPENMP_CFLAGS=-Wc,-fopenmp
|
|
|
|
OPENMP_LIBS=-l$enable_openmp])
|
|
|
|
AC_SUBST(OPENMP_CFLAGS)
|
|
|
|
AC_SUBST(OPENMP_LIBS)
|
|
|
|
|
2022-02-01 21:30:51 +00:00
|
|
|
dnl We need Python for code generation even if we're not building the bindings.
|
|
|
|
AM_PATH_PYTHON([3.6])
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([python],
|
|
|
|
[AS_HELP_STRING([--enable-python],
|
|
|
|
[build Python bindings @<:@default=no@:>@])],
|
|
|
|
[], [enable_python=no])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" != xno])
|
|
|
|
AM_COND_IF([ENABLE_PYTHON],
|
|
|
|
[AS_IF([test -z "$PYTHON_CPPFLAGS"],
|
2019-05-03 21:35:11 +01:00
|
|
|
[prog="import sysconfig
|
2019-04-03 19:33:37 +01:00
|
|
|
include = sysconfig.get_path('include')
|
|
|
|
platinclude = sysconfig.get_path('platinclude')
|
|
|
|
include_paths = [[include]]
|
|
|
|
if platinclude != include:
|
|
|
|
include_paths.append(plat_include)
|
|
|
|
print(' '.join('-I' + path for path in include_paths))"
|
2019-05-03 21:35:11 +01:00
|
|
|
PYTHON_CPPFLAGS=`"$PYTHON" -c "$prog"`])
|
|
|
|
AC_SUBST(PYTHON_CPPFLAGS)
|
|
|
|
AC_MSG_CHECKING([for $PYTHON development headers])
|
|
|
|
save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <Python.h>]])],
|
|
|
|
[AC_MSG_RESULT([yes])],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
AC_MSG_ERROR(
|
|
|
|
[Could not compile test program with Python headers.
|
|
|
|
|
|
|
|
You may need to install your distribution's Python development package (e.g.,
|
|
|
|
python3-devel or python3-dev) or specify the location of the Python development
|
|
|
|
headers by setting the PYTHON_CPPFLAGS environment variable.])])
|
|
|
|
CPPFLAGS="$save_CPPFLAGS"])
|
2019-04-03 19:33:37 +01:00
|
|
|
|
2019-09-04 22:40:47 +01:00
|
|
|
PKG_PROG_PKG_CONFIG
|
2021-03-14 09:28:50 +00:00
|
|
|
|
2021-03-22 06:05:45 +00:00
|
|
|
PKG_CHECK_MODULES(elfutils, [libelf >= 0.165 libdw >= 0.165])
|
2021-03-14 09:28:50 +00:00
|
|
|
|
2019-08-02 08:00:59 +01:00
|
|
|
AC_ARG_WITH([libkdumpfile],
|
|
|
|
[AS_HELP_STRING([--with-libkdumpfile],
|
|
|
|
[build with support for the makedumpfile kernel
|
|
|
|
core dump format using libkdumpfile
|
|
|
|
@<:@default=auto@:>@])],
|
|
|
|
[], [with_libkdumpfile=auto])
|
|
|
|
AS_CASE(["x$with_libkdumpfile"],
|
|
|
|
[xyes], [PKG_CHECK_MODULES(libkdumpfile, [libkdumpfile])],
|
|
|
|
[xauto], [PKG_CHECK_MODULES(libkdumpfile, [libkdumpfile],
|
|
|
|
[with_libkdumpfile=yes],
|
|
|
|
[with_libkdumpfile=no])])
|
|
|
|
AM_CONDITIONAL([WITH_LIBKDUMPFILE], [test "x$with_libkdumpfile" = xyes])
|
|
|
|
AM_COND_IF([WITH_LIBKDUMPFILE], [AC_DEFINE(WITH_LIBKDUMPFILE)])
|
|
|
|
|
2022-03-01 23:38:05 +00:00
|
|
|
AC_ARG_ENABLE([compiler-warnings],
|
|
|
|
[AS_HELP_STRING([--enable-compiler-warnings@<:@=no|yes|error@:>@],
|
|
|
|
[enable compiler warnings. If no, then only the
|
|
|
|
default compiler warnings are enabled. If yes,
|
|
|
|
then additional warnings required by the package
|
|
|
|
are enabled. If error, then warnings are treated
|
|
|
|
as errors (this is only intended for
|
|
|
|
developers). @<:@default=yes@:>@])],
|
|
|
|
[], [enable_compiler_warnings=no])
|
|
|
|
|
|
|
|
dnl Make Clang error instead of warn for unknown warning options.
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],
|
|
|
|
[compiler_flags_test="-Werror=unknown-warning-option"],
|
|
|
|
[compiler_flags_test=""])
|
|
|
|
AS_IF([test "x$enable_compiler_warnings" != xno],
|
|
|
|
[AX_APPEND_COMPILE_FLAGS([ dnl
|
|
|
|
-Wall dnl
|
|
|
|
-Wformat-overflow=2 dnl
|
|
|
|
-Wformat-truncation=2 dnl
|
2022-10-05 07:36:01 +01:00
|
|
|
-Wimplicit-fallthrough dnl
|
2022-03-01 23:38:05 +00:00
|
|
|
], [WARN_CFLAGS], [$compiler_flags_test])])
|
|
|
|
AS_IF([test "x$enable_compiler_warnings" = xerror],
|
|
|
|
[AX_APPEND_FLAG([-Werror], [WARN_CFLAGS])])
|
|
|
|
AC_SUBST(WARN_CFLAGS)
|
|
|
|
|
2022-01-28 00:16:56 +00:00
|
|
|
AC_ARG_ENABLE([asan],
|
|
|
|
[AS_HELP_STRING([--enable-asan], [enable AddressSanitizer])],
|
|
|
|
[], [enable_asan=no])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_asan" != xno],
|
2022-03-01 20:00:44 +00:00
|
|
|
[AX_APPEND_FLAG([-fsanitize=address], [SANITIZER_CFLAGS])
|
|
|
|
AX_APPEND_FLAG([-fno-omit-frame-pointer], [SANITIZER_CFLAGS])
|
|
|
|
AX_APPEND_FLAG([-fsanitize=address], [SANITIZER_LDFLAGS])])
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([ubsan],
|
|
|
|
[AS_HELP_STRING([--enable-ubsan],
|
|
|
|
[enable UndefinedBehaviorSanitizer])],
|
|
|
|
[], [enable_ubsan=no])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_ubsan" != xno],
|
|
|
|
[AX_APPEND_FLAG([-fsanitize=undefined], [SANITIZER_CFLAGS])
|
|
|
|
AX_APPEND_FLAG([-fno-omit-frame-pointer], [SANITIZER_CFLAGS])
|
|
|
|
AX_APPEND_FLAG([-fsanitize=undefined], [SANITIZER_LDFLAGS])])
|
|
|
|
|
2022-01-28 00:16:56 +00:00
|
|
|
AC_SUBST(SANITIZER_CFLAGS)
|
|
|
|
AC_SUBST(SANITIZER_LDFLAGS)
|
|
|
|
|
2021-03-14 09:28:50 +00:00
|
|
|
AC_CONFIG_FILES([Makefile])
|
Rewrite drgn core in C
The current mixed Python/C implementation works well, but it has a
couple of important limitations:
- It's too slow for some common use cases, like iterating over large
data structures.
- It can't be reused in utilities written in other languages.
This replaces the internals with a new library written in C, libdrgn. It
includes Python bindings with mostly the same public interface as
before, with some important improvements:
- Types are now represented by a single Type class rather than the messy
polymorphism in the Python implementation.
- Qualifiers are a bitmask instead of a set of strings.
- Bit fields are not considered a separate type.
- The lvalue/rvalue terminology is replaced with reference/value.
- Structure, union, and array values are better supported.
- Function objects are supported.
- Program distinguishes between lookups of variables, constants, and
functions.
The C rewrite is about 6x as fast as the original Python when using the
Python bindings, and about 8x when using the C API directly.
Currently, the exposed API in C is fairly conservative. In the future,
the memory reader, type index, and object index APIs will probably be
exposed for more flexibility.
2019-03-22 23:27:46 +00:00
|
|
|
AC_OUTPUT
|