3 # Set up for building SWIG bindings. Note that shipped tarballs contain pre-built
4 # SWIG bindings, so there should be no need for SWIG on non-developer machines.
7 # Find perl and SWIG, and substitute PERL_INC, the -I command that will lead the compiler
8 # to perl.h and friends.
10 # Supports --with-perlextlibs, for adding extra LIBS declarations to perl extensions.
12 AC_DEFUN([AMANDA_SETUP_SWIG],
14 AC_REQUIRE([AMANDA_PROG_SWIG])
15 AC_REQUIRE([AMANDA_PROG_PERL])
17 # If we want cygwin to copy ddl to modules directory.
18 WANT_CYGWIN_COPY_PERL_DLL="false"
20 # test for ExtUtils::Embed
21 AC_PERL_MODULE_VERSION([ExtUtils::Embed 0.0], [], [
22 AC_MSG_ERROR([*** Amanda requires the perl package ExtUtils::Embed to build its perl modules])
25 # get the include path for building perl extensions
26 PERL_INC=`$PERL -MExtUtils::Embed -e perl_inc`
29 if test x"$enable_shared" = x"no"; then
30 AC_MSG_ERROR([*** Amanda cannot be compiled without shared-library support (do not use --disable-shared)])
34 *freebsd@<:@123456@:>@*) # up to and including FreeBSD 6.*
35 # Before 7.0, FreeBSD systems don't include a DT_NEEDS segment in
36 # libgthread to automatically pull in the desired threading library.
37 # Instead, they assume that any application linking against
38 # libgthread will pull in the threading library. This is fine for
39 # Amanda C applications, but for Perl applications this assumption
40 # means that the perl binary would pull in the threading library.
41 # But perl is compiled without threading by default.
43 # Specifically, this occurs on any FreeBSD using gcc-3.*: the linking
44 # decision is made in gcc's spec files, which were changed in
45 # gcc-4.0. For a more in-depth discussion, see
46 # http://wiki.zmanda.com/index.php/Installation/OS_Specific_Notes/Installing_Amanda_on_FreeBSD
48 # The easiest solution for the "default" case is to link all perl
49 # extension libraries against the threading library, so it is loaded
50 # when perl loads the extension library. The default threading
51 # library in FreeBSD is libpthread. The below default will work on
52 # such a FreeBSD system, but ports maintainers and those with
53 # different configurations may need to override this value with
56 # We can't use -pthread because gcc on FreeBSD ignores -pthread in
57 # combination with -shared. See
58 # http://lists.freebsd.org/pipermail/freebsd-stable/2006-June/026229.html
60 PERLEXTLIBS="-lpthread"
63 # When need -lperl and the '-L' where it is located,
64 # we don't want the DynaLoader.a
65 PERLEXTLIBS=`perl -MExtUtils::Embed -e ldopts | sed -e 's/^.*-L/-L/'`
66 WANT_CYGWIN_COPY_PERL_DLL="true";
69 AM_CONDITIONAL(WANT_CYGWIN_COPY_PERL_DLL,$WANT_CYGWIN_COPY_PERL_DLL)
71 AC_ARG_WITH(perlextlibs,
72 AC_HELP_STRING([--with-perlextlibs=libs],[extra LIBS for Perl extensions]),
75 y|ye|yes) AC_MSG_ERROR([*** You must specify a value for --with-perlextlibs]);;
76 n|no) PERLEXTLIBS='';;
77 *) PERLEXTLIBS="$withval" ;;