[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] [PATCH 1/2] improve dynamic extension build logic
From: |
Mike Frysinger |
Subject: |
[bug-gawk] [PATCH 1/2] improve dynamic extension build logic |
Date: |
Sat, 7 Dec 2013 01:54:22 -0500 |
The current extension logic is a hack (the comments say as much) and break
cross-compiling. Instead, move all the logic to the main configure script
and add a flag to control it.
---
configure.ac | 62 +++++++++++++++++++++++++++++++-------------------
extension/Makefile.am | 15 ------------
extension/configure.ac | 11 ---------
3 files changed, 38 insertions(+), 50 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3c6a758..0619a75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -283,32 +283,44 @@ AC_FUNC_MBRTOWC
dnl check for dynamic linking
dnl This is known to be very primitive
-dnl On MirBSD (and probably other systems), don't even try.
-case `uname` in
-MirBSD | MirOS)
- : ;;
-*)
-AC_CHECK_HEADER(dlfcn.h,
- [
- # Check this separately. Some systems have dlopen
- # in libc. Notably freebsd and cygwin.
- # HP-NSK has it in zrldsrl
- AC_SEARCH_LIBS(dlopen, dl zrldsrl, gawk_have_dlopen=yes,
gawk_have_dlopen=no)
- # Only do DYNAMIC if we have the lib. z/OS (some versions) have
- # the header but not the lib, apparently
- if test "$gawk_have_dlopen" = yes
- then
- AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
- # Add -export-dynamic for old extensions. Only works for GCC
- if test "$GCC" = yes &&
- uname | $EGREP -i 'linux|freebsd' > /dev/null
+AC_ARG_ENABLE([extensions],
+ [AS_HELP_STRING([--disable-extensions], [disable dynamic extensions
(default is detect)])])
+if test "x$enable_extensions" != "xno"; then
+ extensions_supported=no
+
+ dnl On MirBSD (and probably other systems), don't even try.
+ case `uname` in
+ MirBSD | MirOS)
+ : ;;
+ *)
+ AC_CHECK_HEADER(dlfcn.h,
+ [
+ # Check this separately. Some systems have dlopen
+ # in libc. Notably freebsd and cygwin.
+ # HP-NSK has it in zrldsrl
+ AC_SEARCH_LIBS(dlopen, dl zrldsrl, gawk_have_dlopen=yes,
gawk_have_dlopen=no)
+ # Only do DYNAMIC if we have the lib. z/OS (some versions) have
+ # the header but not the lib, apparently
+ if test "$gawk_have_dlopen" = yes
then
- LDFLAGS="$LDFLAGS -export-dynamic"
+ extensions_supported=yes
+ AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
+ # Add -export-dynamic for old extensions. Only works
for GCC
+ if test "$GCC" = yes &&
+ uname | $EGREP -i 'linux|freebsd' > /dev/null
+ then
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ fi
fi
+ ])
+ ;;
+ esac
+
+ if test "x$enable_extensions$extensions_supported" = "xyesno"; then
+ AC_MSG_ERROR([extension support requested, but unavailable])
fi
-])
- ;;
-esac
+ enable_extensions=$extensions_supported
+fi
dnl check for how to use getpgrp
dnl have to hardwire it for VMS POSIX. Sigh.
@@ -388,5 +400,7 @@ AC_CONFIG_FILES(Makefile
doc/Makefile
po/Makefile.in
test/Makefile)
-AC_CONFIG_SUBDIRS(extension)
+if test "x$enable_extensions" = "xyes"; then
+ AC_CONFIG_SUBDIRS(extension)
+fi
AC_OUTPUT
diff --git a/extension/Makefile.am b/extension/Makefile.am
index 3ef7256..9c49bb8 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -122,18 +122,3 @@ dist_man_MANS = \
# gettext requires this
SUBDIRS =
-
-# This is an ugly hack, initially for MirBSD but probably needed for other
-# systems. If gawk doesn't have the API built in, don't try to build the
-# extensions.
-#
-# Given the workaround in configure, this isn't strictly necessary, but
-# we're leaving it in, in case of some other system needing it.
-check-recursive all-recursive: check-for-shared-lib-support
-
-check-for-shared-lib-support:
- @if ../gawk$(EXEEXT) --version | sed 1q | grep API > /dev/null; \
- then : do nothing ; \
- else echo Building the extensions is not supported on this platform
; \
- exit 1; \
- fi
diff --git a/extension/configure.ac b/extension/configure.ac
index d819ebf..412fec0 100644
--- a/extension/configure.ac
+++ b/extension/configure.ac
@@ -81,15 +81,4 @@ AC_C_INLINE
AC_CONFIG_HEADERS([config.h:configh.in])
AC_CONFIG_FILES(Makefile)
-AC_OUTPUT_COMMANDS([
-case `uname` in
-MirBSD | MirOS | "OS/390")
- cat << \EOF > Makefile
-all dist check clean distclean install uninstall distcheck:
- @exit 0
-EOF
- ;;
-*)
-esac
-])dnl
AC_OUTPUT
--
1.8.4.3
- [bug-gawk] [PATCH 1/2] improve dynamic extension build logic,
Mike Frysinger <=