| 1 |
# Configure paxutils. |
| 2 |
# Copyright 2009-2023 Free Software Foundation, Inc. |
| 3 |
# This file is free software; the Free Software Foundation |
| 4 |
# gives unlimited permission to copy and/or distribute it, |
| 5 |
# with or without modifications, as long as this notice is preserved. |
| 6 |
|
| 7 |
AC_DEFUN([PU_RMT],[ |
| 8 |
# Set LIB_SETSOCKOPT to -lnsl -lsocket if necessary. |
| 9 |
pu_save_LIBS=$LIBS |
| 10 |
LIB_SETSOCKOPT= |
| 11 |
AC_SEARCH_LIBS(setsockopt, [socket], , |
| 12 |
[AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])]) |
| 13 |
AC_SEARCH_LIBS(setsockopt, [nsl]) |
| 14 |
|
| 15 |
case "$ac_cv_search_setsockopt" in |
| 16 |
-l*) LIB_SETSOCKOPT=$ac_cv_search_setsockopt |
| 17 |
esac |
| 18 |
AC_SUBST(LIB_SETSOCKOPT) |
| 19 |
LIBS=$pu_save_LIBS |
| 20 |
|
| 21 |
enable_rmt() { |
| 22 |
if test $ac_cv_header_sys_mtio_h = yes; then |
| 23 |
AC_CACHE_CHECK(for remote tape header files, pu_cv_header_rmt, |
| 24 |
[AC_PREPROC_IFELSE( |
| 25 |
[AC_LANG_SOURCE( |
| 26 |
[[ |
| 27 |
#if HAVE_SGTTY_H |
| 28 |
# include <sgtty.h> |
| 29 |
#endif |
| 30 |
#include <sys/socket.h> |
| 31 |
]])], |
| 32 |
pu_cv_header_rmt=yes, |
| 33 |
pu_cv_header_rmt=no)]) |
| 34 |
test $pu_cv_header_rmt = yes && PU_RMT_PROG='rmt$(EXEEXT)' |
| 35 |
AC_SUBST(PU_RMT_PROG) |
| 36 |
fi |
| 37 |
} |
| 38 |
|
| 39 |
AC_CHECK_HEADERS([sys/mtio.h]) |
| 40 |
AC_CACHE_CHECK(which ioctl field to test for reversed bytes, |
| 41 |
pu_cv_header_mtio_check_field, |
| 42 |
[AC_EGREP_HEADER(mt_model, sys/mtio.h, |
| 43 |
pu_cv_header_mtio_check_field=mt_model, |
| 44 |
pu_cv_header_mtio_check_field=mt_type)]) |
| 45 |
AC_DEFINE_UNQUOTED(MTIO_CHECK_FIELD, |
| 46 |
$pu_cv_header_mtio_check_field, |
| 47 |
[Define to mt_model (v.g., for DG/UX), else to mt_type.]) |
| 48 |
|
| 49 |
|
| 50 |
AC_ARG_VAR([DEFAULT_RMT_DIR], |
| 51 |
[Define full file name of the directory where to install `rmt'. (default: $(libexecdir))]) |
| 52 |
if test "x$DEFAULT_RMT_DIR" != x; then |
| 53 |
DEFAULT_RMT_COMMAND=$DEFAULT_RMT_DIR/rmt |
| 54 |
else |
| 55 |
DEFAULT_RMT_DIR='$(libexecdir)' |
| 56 |
fi |
| 57 |
|
| 58 |
AC_MSG_CHECKING([whether to build rmt]) |
| 59 |
AC_ARG_WITH([rmt], |
| 60 |
AS_HELP_STRING([--with-rmt=FILE], |
| 61 |
[Use FILE as the default `rmt' program. Do not build included copy of `rmt'.]), |
| 62 |
[case $withval in |
| 63 |
yes|no) AC_MSG_ERROR([Invalid argument to --with-rmt]);; |
| 64 |
/*) DEFAULT_RMT_COMMAND=$withval |
| 65 |
AC_MSG_RESULT([no, use $withval instead]);; |
| 66 |
*) AC_MSG_ERROR([Argument to --with-rmt must be an absolute file name]);; |
| 67 |
esac], |
| 68 |
[AC_MSG_RESULT([yes]) |
| 69 |
enable_rmt |
| 70 |
if test "$PU_RMT_PROG" = ""; then |
| 71 |
AC_MSG_WARN([not building rmt, required header files are missing]) |
| 72 |
fi]) |
| 73 |
|
| 74 |
AC_SUBST(DEFAULT_RMT_COMMAND) |
| 75 |
if test "x$DEFAULT_RMT_COMMAND" != x; then |
| 76 |
AC_DEFINE_UNQUOTED(DEFAULT_RMT_COMMAND, "$DEFAULT_RMT_COMMAND", |
| 77 |
[Define full file name of rmt program.]) |
| 78 |
fi |
| 79 |
AM_CONDITIONAL([PU_RMT_COND],[test "$pu_cv_header_rmt" = yes]) |
| 80 |
]) |