autotools: now "make distcheck" also works.

* Fix distcheck by having all the targets installed under $prefix
* But by default (no prefix or prefix=/usr), revert to older pathes:
  - /etc/dahdi
  - udev rules in /etc/udev/rules.d
  - perl in perl sitelib
  - man pages in /usr/share/man
* Add configure options:
  --with-udevrules= (e.g.: /lib/udev/rules.d)
  --with-perllib= (e.g.: `perl -V:vendorlib)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2014-12-21 10:29:35 -05:00 committed by Tzafrir Cohen
parent 94ca4a1bb4
commit 66e2c3ba11
No known key found for this signature in database
GPG Key ID: 8EFD4C2F0325A0CE
2 changed files with 53 additions and 12 deletions

View File

@ -25,21 +25,42 @@ AM_CONDITIONAL([SILENT_RULES], [test "$AM_DEFAULT_VERBOSITY" = '0'])
AC_COPYRIGHT("dahdi-tools") AC_COPYRIGHT("dahdi-tools")
AC_REVISION($Revision$) AC_REVISION($Revision$)
ac_default_prefix=/usr # Preserve old defaults if called without --prefix or --prefix=/usr
if test ${sysconfdir} = '${prefix}/etc'; then # prefix=/usr
sysconfdir=/etc # sysconfdir=/etc
fi
if test ${mandir} = '${prefix}/man'; then
mandir=/usr/share/man
fi
if test ${localstatedir} = '${prefix}/var'; then ac_default_prefix=/usr
localstatedir=/var if test "$prefix" = 'NONE' -o "$prefix" = '/usr'; then
if test ${sysconfdir} = '${prefix}/etc'; then
sysconfdir=/etc
fi
if test ${mandir} = '${prefix}/man'; then
mandir=/usr/share/man
fi
if test ${localstatedir} = '${prefix}/var'; then
localstatedir=/var
fi
fi fi
AC_SUBST([dahditoolsdir], ['${datadir}/dahdi']) AC_SUBST([dahditoolsdir], ['${datadir}/dahdi'])
AC_SUBST([dahdiincludedir], ['${includedir}/dahdi']) AC_SUBST([dahdiincludedir], ['${includedir}/dahdi'])
AC_SUBST([udevrulesdir], '${sysconfdir}/udev/rules.d') # Where to install udev rules?
# * Our default is $sysconfdir/udev/rules.d:
# - This preserve legacy location.
# - It doesn't write into modern vendor supplied location (/lib/udev/rules.d)
# - It doesn't break "make distcheck" (where everything should be relative
# to prefix.
# * Packagers are encouraged to use --udevrules=/lib/udev/rules.d
#
m4_define([_UDEV_RULES_DIR_DEFAULT], [${sysconfdir}/udev/rules.d])dnl
AC_ARG_WITH(udevrules,
[AS_HELP_STRING([--with-udevrules=PATH],
[Location of UDEV rules @<:@default=]_UDEV_RULES_DIR_DEFAULT[@:>@])],
[udevrulesdir=$withval],
[udevrulesdir=]'_UDEV_RULES_DIR_DEFAULT'
)
AC_SUBST([udevrulesdir], "$udevrulesdir")
# specify output header file # specify output header file
AC_CONFIG_HEADER(autoconfig.h) AC_CONFIG_HEADER(autoconfig.h)
@ -94,9 +115,28 @@ AC_PATH_PROG([PERL], [perl])
if test "$PERL" = ''; then if test "$PERL" = ''; then
AC_MSG_ERROR(perl is mandatory) AC_MSG_ERROR(perl is mandatory)
fi fi
# Where to install perl modules?
# * Packagers are encouraged to use the result of "perl -V:vendorlib"
# * Our default is:
# - The result of "perl -V:sitelib" for our default prefix (/usr)
# - The "$datadir/perl5" directory otherwise (e.g: during "make distcheck")
#
AC_MSG_CHECKING(for perl libdir) AC_MSG_CHECKING(for perl libdir)
eval `"$PERL" -V:sitelib` m4_define([_PERL_LIBDIR_DEFAULT], [${datadir}/perl5])dnl
AC_SUBST([perllibdir], [`echo "$sitelib"`]) AC_ARG_WITH(perllib,
[AS_HELP_STRING([--with-perllib=PATH],
[Location of perl modules @<:@default=]_PERL_LIBDIR_DEFAULT[, or perl -V:sitelib@:>@])],
[perllibdir=$withval],
[
if test "$prefix" = 'NONE' -o "$prefix" = '/usr'; then
eval `"$PERL" -V:sitelib`
perllibdir="$sitelib"
else
perllibdir='_PERL_LIBDIR_DEFAULT'
fi
]
)
AC_SUBST([perllibdir], "$perllibdir")
AC_MSG_RESULT([$perllibdir]) AC_MSG_RESULT([$perllibdir])
AM_CONDITIONAL([PERL], [test "$perllibdir" != '']) AM_CONDITIONAL([PERL], [test "$perllibdir" != ''])

View File

@ -1,3 +1,4 @@
perllibdir = @perllibdir@
nobase_perllib_DATA = \ nobase_perllib_DATA = \
Dahdi.pm \ Dahdi.pm \
Dahdi/Hardware.pm \ Dahdi/Hardware.pm \