diff options
author | Timothy Pearson <[email protected]> | 2014-12-27 08:13:20 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2014-12-27 08:13:20 -0600 |
commit | 9b92536e6c51b66406d593745a938975e226f95e (patch) | |
tree | a40b0066dc774827f602f5e372c2f53656007553 /configure.ac | |
download | libr-9b92536e6c51b66406d593745a938975e226f95e.tar.gz libr-9b92536e6c51b66406d593745a938975e226f95e.zip |
Initial import
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..de6e818 --- /dev/null +++ b/configure.ac @@ -0,0 +1,81 @@ +AC_INIT(libr.c) +AM_INIT_AUTOMAKE(libr,0.6.0) +AC_CONFIG_SRCDIR([src/libr.c]) + +AC_PROG_CC +AC_PROG_CC_STDC +AC_HEADER_STDC +AC_PROG_INSTALL +AM_GNU_GETTEXT([external]) + +# It is important to build both a static and a shared version of the libr +# library. The shared version is for future-proofing, whereas the static +# version should be used to make a more portable binary until libr is +# more widely distributed (as in distributed at all). +AC_ENABLE_SHARED +AC_ENABLE_STATIC + +# Setup libtool +AC_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) + +## Handle optional libraries (only header files are used) +PKG_CHECK_MODULES(LIBGLADE, libglade-2.0 >= 2.0.0) + +## Handle required components +# Is this the best check for zlib that can be made? +AC_CHECK_HEADERS(zlib.h math.h pthread.h) +EXTRA_LIBS="-lz -lm -lpthread" +EXTRA_CFLAGS="-fvisibility=hidden" +AC_SUBST(EXTRA_CFLAGS) +AC_SUBST(EXTRA_LIBS) + +## Handle backend configuration +LIBR_BACKEND="bfd" +BACKEND_NAME="libbfd" +AC_ARG_ENABLE(libelf, [ --enable-libelf use the libelf backend ], [ + if test "$enableval" = "yes" ; then + LIBR_BACKEND="elf" + BACKEND_NAME="libelf" + fi +]) +AC_ARG_ENABLE(libbfd, [ --enable-libbfd use the libbfd backend (default) ], [ + if test "$enableval" == "yes" ; then + LIBR_BACKEND="bfd" + BACKEND_NAME="libbfd" + fi +]) +AC_ARG_ENABLE(ro, [ --enable-ro use the read-only backend ], [ + if test "$enableval" == "yes" ; then + LIBR_BACKEND="ro" + BACKEND_NAME="readonly" + fi +]) +echo "Using ${BACKEND_NAME} backend." +if test "${LIBR_BACKEND}" == "bfd" ; then + AC_CHECK_HEADER([bfd.h], [], [ + AC_MSG_ERROR([Could not find libbfd header file (bfd.h)! This file is usually included in the package binutils-dev.]) + ]) + BACKEND_PKG="binutils" + BACKEND_LIBS="-lbfd" + BACKEND_CFLAGS="" + AC_SUBST(BACKEND_LIBS) + AC_SUBST(BACKEND_CFLAGS) +elif test "${LIBR_BACKEND}" == "elf" ; then + # Is libelf 0.8.2 safe enough? testing is currently on 0.8.6 + BACKEND_PKG="elfutils" + pkg_modules="libelf >= 0.8.2" + PKG_CHECK_MODULES(BACKEND, [$pkg_modules]) +fi +AC_SUBST(BACKEND_NAME) +AC_SUBST(LIBR_BACKEND) +AC_SUBST(BACKEND_PKG) + + +AC_CONFIG_HEADERS(config.h) +AC_OUTPUT( + src/Makefile + man/Makefile + po/Makefile.in + Makefile +) |