Blame m4/slibtool.m4

ad93f0
###############################################################################
ad93f0
#                                                                             #
ad93f0
#   slibtool.m4: native slibtool integration for autoconf-based projects      #
ad93f0
#                                                                             #
160233
#   Copyright (C) 2016--2024  SysDeer Technologies, LLC                       #
ad93f0
#                                                                             #
ad93f0
#   Permission is hereby granted, free of charge, to any person obtaining     #
ad93f0
#   a copy of this software and associated documentation files (the           #
ad93f0
#   "Software"), to deal in the Software without restriction, including       #
ad93f0
#   without limitation the rights to use, copy, modify, merge, publish,       #
ad93f0
#   distribute, sublicense, and/or sell copies of the Software, and to        #
ad93f0
#   permit persons to whom the Software is furnished to do so, subject to     #
ad93f0
#   the following conditions:                                                 #
ad93f0
#                                                                             #
ad93f0
#   The above copyright notice and this permission notice shall be included   #
ad93f0
#   in all copies or substantial portions of the Software.                    #
ad93f0
#                                                                             #
ad93f0
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   #
ad93f0
#   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                #
ad93f0
#   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    #
ad93f0
#   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      #
ad93f0
#   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,      #
ad93f0
#   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE         #
ad93f0
#   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                    #
ad93f0
#                                                                             #
ad93f0
###############################################################################
ad93f0
ad93f0
ad93f0
ad93f0
# _SLIBTOOL_DEFAULTS
ad93f0
# ------------------
ad93f0
AC_DEFUN([_SLIBTOOL_DEFAULTS],[
ad93f0
AC_BEFORE([$0],[SLIBTOOL_INIT])
ad93f0
AC_BEFORE([$0],[_SLIBTOOL_ARGUMENT_HANDLING])
ad93f0
ad93f0
# slibtool: implementation defaults
ad93f0
# ---------------------------------
ad93f0
slibtool_enable_shared_default='yes'
ad93f0
slibtool_enable_static_default='yes'
ad93f0
slibtool_enable_dlopen_default='yes'
ad93f0
slibtool_enable_win32_dll_default='yes'
ad93f0
slibtool_enable_fast_install_default='yes'
ad93f0
slibtool_pic_mode_default='default'
5a20d9
slibtool_sysroot_default=
1dbc30
])
a24c5d
a24c5d
# slibtool: refined logic for ar, nm, ranlib, etc.
a24c5d
#
1dbc30
m4_ifdef([SLIBTOOL_INIT],[],[
1dbc30
#
a24c5d
m4_ifdef([AC_PROG_AR],     [m4_undefine([AC_PROG_AR])])
a24c5d
m4_ifdef([AM_PROG_AR],     [m4_undefine([AM_PROG_AR])])
a24c5d
a24c5d
m4_ifdef([AC_PROG_NM],     [m4_undefine([AC_PROG_NM])])
a24c5d
m4_ifdef([AM_PROG_NM],     [m4_undefine([AM_PROG_NM])])
a24c5d
a24c5d
m4_ifdef([AC_PROG_RANLIB], [m4_undefine([AC_PROG_RANLIB])])
a24c5d
m4_ifdef([AM_PROG_RANLIB], [m4_undefine([AM_PROG_RANLIB])])
376aa7
376aa7
m4_ifdef([AC_PROG_LEX],    [m4_undefine([AC_PROG_LEX])])
376aa7
m4_ifdef([AM_PROG_LEX],    [m4_undefine([AM_PROG_LEX])])
e5c426
e5c426
m4_ifdef([LT_LIB_M],       [m4_undefine([LT_LIB_M])])
e5c426
m4_ifdef([LT_LIB_DLLOAD],  [m4_undefine([LT_LIB_DLLOAD])])
ad93f0
])
ad93f0
e5c426
# _SLIBTOOL_CONVENIENCE
e5c426
# ---------------------
e5c426
AC_DEFUN([LT_DEVAL],[$1]=[$2])
e5c426
ad93f0
# _SLIBTOOL_ARGUMENT_HANDLING
ad93f0
# ---------------------------
ad93f0
AC_DEFUN([_SLIBTOOL_ARGUMENT_HANDLING],[
ad93f0
AC_BEFORE([$0],[_SLIBTOOL_ARG_ENABLE])
ad93f0
AC_BEFORE([$0],[_SLIBTOOL_ARG_WITH])
ad93f0
ad93f0
# slibtool: argument handling
ad93f0
# ---------------------------
ad93f0
slibtool_arg_enable()
ad93f0
{
ad93f0
	case "${enableval}" in
ad93f0
		'yes')
ad93f0
			slbt_eval_expr="${slbt_var}='yes'"
ad93f0
			eval $slbt_eval_expr
ad93f0
			;;
ad93f0
ad93f0
		'no')
ad93f0
			slbt_eval_expr="${slbt_var}='no'"
ad93f0
			eval $slbt_eval_expr
ad93f0
			;;
ad93f0
ad93f0
		*)
ad93f0
			slbt_package="${PACKAGE:-default}"
ad93f0
ad93f0
			slbt_eval_expr="${slbt_var}='no'"
ad93f0
			eval $slbt_eval_expr
ad93f0
ad93f0
			slbt_cfg_ifs="${IFS}"
ad93f0
			IFS="${PATH_SEPARATOR}${IFS}"
ad93f0
ad93f0
			for slbt_pkg in ${enableval}; do
b23a2f
				if [[ "_${slbt_pkg}" = "_${slbt_package}" ]]; then
ad93f0
					slbt_eval_expr="${slbt_var}='yes'"
ad93f0
					eval $slbt_eval_expr
ad93f0
				fi
ad93f0
			done
ad93f0
ad93f0
			IFS="${slbt_cfg_ifs}"
ad93f0
			unset slbt_cfg_ifs
ad93f0
			;;
ad93f0
	esac
ad93f0
}
ad93f0
ad93f0
ad93f0
slibtool_arg_with()
ad93f0
{
5a20d9
	case "${slbt_var}" in
5a20d9
		'slibtool_sysroot')
5a20d9
			case "${withval}" in
5a20d9
				'yes')
5a20d9
					slbt_eval_expr="${slbt_var}='yes'"
5a20d9
					eval $slbt_eval_expr
5a20d9
					;;
5a20d9
5a20d9
				'no')
5a20d9
					slbt_eval_expr="${slbt_var}='no'"
5a20d9
					eval $slbt_eval_expr
5a20d9
					;;
5a20d9
5a20d9
				*)
5a20d9
					slbt_eval_expr="${slbt_var}=${withval}"
5a20d9
					eval $slbt_eval_expr
5a20d9
					;;
5a20d9
			esac
5a20d9
5a20d9
			;;
5a20d9
5a20d9
		*)
5a20d9
			enableval="${withval}"
5a20d9
			slibtool_arg_enable
5a20d9
			;;
5a20d9
	esac
ad93f0
}
ad93f0
])
ad93f0
ad93f0
ad93f0
# _SLIBTOOL_ARG_ENABLE(_feature_,_help_string_,_var_)
ad93f0
# ---------------------------------------------------
ad93f0
AC_DEFUN([_SLIBTOOL_ARG_ENABLE],[
ad93f0
AC_ARG_ENABLE($1,
ad93f0
[AS_HELP_STRING([--enable-]$1[@<:@=PKGS@:>@],$2  @<:@default=[$]$3_default@:>@)],[
ad93f0
  slbt_var=$3
ad93f0
  slibtool_arg_enable],[dnl
ad93f0
$3=[$]$3_default])
ad93f0
])
ad93f0
ad93f0
ad93f0
# _SLIBTOOL_ARG_WITH(_feature_,_help_string_,_var_)
ad93f0
# -------------------------------------------------
ad93f0
AC_DEFUN([_SLIBTOOL_ARG_WITH],[
ad93f0
AC_ARG_WITH($1,
ad93f0
[AS_HELP_STRING([--with-]$1[@<:@=PKGS@:>@],$2  @<:@default=[$]$3_default@:>@)],[
ad93f0
  slbt_var=$3
ad93f0
  slibtool_arg_with],[dnl
ad93f0
$3=[$]$3_default])
ad93f0
])
ad93f0
ad93f0
ad93f0
# _SLIBTOOL_SET_FLAVOR
ad93f0
# --------------------
ad93f0
AC_DEFUN([_SLIBTOOL_SET_FLAVOR],[
ad93f0
AC_BEFORE([$0],[SLIBTOOL_INIT])
ad93f0
ad93f0
# slibtool: set SLIBTOOL to the default/package-default/user-requested flavor
ad93f0
# ---------------------------------------------------------------------------
ad93f0
slibtool_set_flavor()
ad93f0
{
3be227
	if [[ -z "${SLIBTOOL:-}" ]]; then
3be227
		SLIBTOOL="${LIBTOOL:-}"
3be227
	fi
3be227
16eff7
	_slibtool="${SLIBTOOL:-slibtool}"
16eff7
16eff7
	if [[ "${_slibtool%/*}" = "${_slibtool}" ]]; then
16eff7
		_slibtool_path=
16eff7
	else
16eff7
		_slibtool_path="${_slibtool%/*}/"
16eff7
	fi
16eff7
16eff7
	case "${_slibtool##*/}" in
16eff7
		'rlibtool')
16eff7
			SLIBTOOL="${_slibtool_path}"'slibtool'
16eff7
			;;
16eff7
16eff7
		'rclibtool')
16eff7
			SLIBTOOL="${_slibtool_path}"'clibtool'
16eff7
			;;
16eff7
16eff7
		'rdlibtool')
16eff7
			SLIBTOOL="${_slibtool_path}"'dlibtool'
16eff7
			;;
16eff7
16eff7
		'rdclibtool')
16eff7
			SLIBTOOL="${_slibtool_path}"'dclibtool'
16eff7
			;;
16eff7
	esac
16eff7
ad93f0
	case "_${slibtool_enable_shared}_${slibtool_enable_static}" in
ad93f0
		'_yes_yes')
16eff7
			SLIBTOOL="${SLIBTOOL:-slibtool}"
ad93f0
			;;
ad93f0
ad93f0
		'_yes_no')
16eff7
			SLIBTOOL="${SLIBTOOL:-slibtool}-shared"
ad93f0
			;;
ad93f0
ad93f0
		'_no_yes')
16eff7
			SLIBTOOL="${SLIBTOOL:-slibtool}-static"
ad93f0
			;;
ad93f0
ad93f0
		'_no_no')
ad93f0
			SLIBTOOL='false'
ad93f0
			;;
ad93f0
ad93f0
		*)
ad93f0
			SLIBTOOL='false'
1ca682
			slibtool_enable_shared='no'
1ca682
			slibtool_enable_static='no'
ad93f0
			;;
ad93f0
	esac
ad93f0
5a20d9
	case "_${slibtool_sysroot}" in
5a20d9
		'_')
5a20d9
			;;
5a20d9
5a20d9
		'_yes'|'_no')
5a20d9
			slibtool_err_arg=[$with_sysroot]
5a20d9
			slibtool_err_msg='slibtool: the command-line --sysroot argument is always respected.'
5a20d9
			AC_MSG_RESULT([slibtool: --with-sysroot=$slibtool_err_arg])
5a20d9
			AC_MSG_ERROR([$slibtool_err_msg])
5a20d9
			;;
5a20d9
5a20d9
		_/*)
5a20d9
			SLIBTOOL_SYSROOT="--sysroot=${slibtool_sysroot}"
5a20d9
			SLIBTOOL="${SLIBTOOL} \$(SLIBTOOL_SYSROOT)"
5a20d9
			;;
5a20d9
5a20d9
		*)
5a20d9
			slibtool_err_arg=[$with_sysroot]
5a20d9
			slibtool_err_msg='slibtool: relative sysroot paths are not supported.'
5a20d9
			AC_MSG_RESULT([slibtool: --with-sysroot=$slibtool_err_arg])
5a20d9
			AC_MSG_ERROR([$slibtool_err_msg])
5a20d9
			;;
5a20d9
	esac
5a20d9
ad93f0
	# drop-in replacement
ad93f0
	enable_shared=${slibtool_enable_shared}
ad93f0
	enable_static=${slibtool_enable_static}
ad93f0
	enable_dlopen=${slibtool_enable_dlopen}
ad93f0
	enable_win32_dll=${slibtool_enable_win32_dll}
ad93f0
	enable_fast_install=${slibtool_enable_fast_install}
ad93f0
	pic_mode=${slibtool_pic_mode}
ad93f0
}
ad93f0
])
ad93f0
ad93f0
ba1cf4
# SLIBTOOL_ENABLE_SHARED
ba1cf4
# ----------------------
ba1cf4
AC_DEFUN([SLIBTOOL_ENABLE_SHARED],[
ba1cf4
AC_BEFORE([$0],[SLIBTOOL_INIT])
ba1cf4
ba1cf4
# slibtool: SLIBTOOL_ENABLE_SHARED
ba1cf4
# --------------------------------
ba1cf4
slibtool_options="${slibtool_options:-}"
ba1cf4
slibtool_options="${slibtool_options} shared"
ba1cf4
])
ba1cf4
ba1cf4
ba1cf4
# SLIBTOOL_ENABLE_STATIC
ba1cf4
# ----------------------
ba1cf4
AC_DEFUN([SLIBTOOL_ENABLE_STATIC],[
ba1cf4
AC_BEFORE([$0],[SLIBTOOL_INIT])
ba1cf4
ba1cf4
# slibtool: SLIBTOOL_ENABLE_STATIC
ba1cf4
# --------------------------------
ba1cf4
slibtool_options="${slibtool_options:-}"
ba1cf4
slibtool_options="${slibtool_options} static"
ba1cf4
])
ba1cf4
ba1cf4
ba1cf4
# SLIBTOOL_DISABLE_SHARED
ba1cf4
# -----------------------
ba1cf4
AC_DEFUN([SLIBTOOL_DISABLE_SHARED],[
ba1cf4
AC_BEFORE([$0],[SLIBTOOL_INIT])
ba1cf4
ba1cf4
# slibtool: SLIBTOOL_DISABLE_SHARED
ba1cf4
# ---------------------------------
ba1cf4
slibtool_options="${slibtool_options:-}"
ba1cf4
slibtool_options="${slibtool_options} disable-shared"
ba1cf4
])
ba1cf4
ba1cf4
ba1cf4
# SLIBTOOL_DISABLE_STATIC
ba1cf4
# -----------------------
ba1cf4
AC_DEFUN([SLIBTOOL_DISABLE_STATIC],[
ba1cf4
AC_BEFORE([$0],[SLIBTOOL_INIT])
ba1cf4
ba1cf4
# slibtool: SLIBTOOL_DISABLE_STATIC
ba1cf4
# ---------------------------------
ba1cf4
slibtool_options="${slibtool_options:-}"
ba1cf4
slibtool_options="${slibtool_options} disable-static"
ba1cf4
])
ba1cf4
ba1cf4
904d48
# SLIBTOOL_PROG_AR
904d48
# ----------------
904d48
AC_DEFUN([SLIBTOOL_PROG_AR],[
904d48
904d48
# slibtool: SLIBTOOL_PROG_AR
904d48
# --------------------------
904d48
if [[ -n "${host_alias}" ]]; then
904d48
	AC_CHECK_PROG([AR],"${host_alias}-"[ar],"${host_alias}-"[ar])
904d48
fi
904d48
904d48
if [[ -n "${host}" ]] && [[ "${host}" != "${host_alias:-}" ]] &&  [[ -z "${AR}" ]]; then
904d48
	AC_CHECK_PROG([AR],"${host}-"[ar],"${host}-"[ar])
904d48
fi
904d48
904d48
if [[ -n "${host}" ]] &&  [[ -z "${AR}" ]]; then
904d48
	AC_CHECK_PROG([AR],[llvm-ar],[llvm-ar])
904d48
fi
904d48
904d48
if [[ -z "${host}" ]]; then
904d48
	AC_CHECK_PROG([AR],[ar],[ar])
904d48
fi
904d48
])
904d48
904d48
c424f4
# SLIBTOOL_PROG_RANLIB
c424f4
# --------------------
c424f4
AC_DEFUN([SLIBTOOL_PROG_RANLIB],[
c424f4
c424f4
# slibtool: SLIBTOOL_PROG_RANLIB
c424f4
# ------------------------------
c424f4
if [[ -n "${host_alias}" ]]; then
c424f4
	AC_CHECK_PROG([RANLIB],"${host_alias}-"[ranlib],"${host_alias}-"[ranlib])
c424f4
fi
c424f4
c424f4
if [[ -n "${host}" ]] && [[ "${host}" != "${host_alias:-}" ]] &&  [[ -z "${RANLIB}" ]]; then
c424f4
	AC_CHECK_PROG([RANLIB],"${host}-"[ranlib],"${host}-"[ranlib])
c424f4
fi
c424f4
c424f4
if [[ -n "${host}" ]] &&  [[ -z "${RANLIB}" ]]; then
c424f4
	AC_CHECK_PROG([RANLIB],[llvm-ranlib],[llvm-ranlib])
c424f4
fi
c424f4
c424f4
if [[ -z "${host}" ]]; then
c424f4
	AC_CHECK_PROG([RANLIB],[ranlib],[ranlib])
c424f4
fi
c424f4
])
c424f4
c424f4
240d0f
# SLIBTOOL_PROG_NM
240d0f
# ----------------
240d0f
AC_DEFUN([SLIBTOOL_PROG_NM],[
240d0f
240d0f
# slibtool: SLIBTOOL_PROG_NM
240d0f
# --------------------------
dc73e4
if [[ -n "${host_alias}" ]]; then
dc73e4
	AC_CHECK_PROG([NM],"${host_alias}-"[nm],"${host_alias}-"[nm])
240d0f
fi
240d0f
dc73e4
if [[ -n "${host}" ]] && [[ "${host}" != "${host_alias:-}" ]] &&  [[ -z "${NM}" ]]; then
dc73e4
	AC_CHECK_PROG([NM],"${host}-"[nm],"${host}-"[nm])
dc73e4
fi
dc73e4
dc73e4
if [[ -n "${host}" ]] &&  [[ -z "${NM}" ]]; then
dc73e4
	AC_CHECK_PROG([NM],[llvm-nm],[llvm-nm])
dc73e4
fi
dc73e4
dc73e4
if [[ -z "${host}" ]]; then
dc73e4
	AC_CHECK_PROG([NM],[nm],[nm])
dc73e4
fi
240d0f
])
240d0f
240d0f
376aa7
# SLIBTOOL_PROG_LEX
376aa7
# -----------------
376aa7
AC_DEFUN([SLIBTOOL_PROG_LEX],[
376aa7
376aa7
# slibtool: SLIBTOOL_PROG_LEX
376aa7
# ---------------------------
376aa7
if [[ -n "${LEX}" ]]; then
376aa7
	AC_CHECK_PROG([LEX],[flex])
376aa7
fi
376aa7
376aa7
if [[ -z "${LEX}" ]]; then
376aa7
	AC_CHECK_PROG([LEX],[flex],[flex])
376aa7
fi
376aa7
376aa7
if [[ -z "${LEX}" ]]; then
376aa7
	AC_CHECK_PROG([LEX],[lex],[lex])
376aa7
fi
ceb978
ceb978
AC_SUBST([LEX])
ceb978
AC_SUBST([LEXLIB])
376aa7
])
376aa7
376aa7
e5c426
# SLIBTOOL_LFLAG_LIBM
e5c426
# -------------------
e5c426
AC_DEFUN([SLIBTOOL_LFLAG_LIBM],[
e5c426
e5c426
# slibtool: SLIBTOOL_LFLAG_LIBM
e5c426
# -----------------------------
e5c426
LT_DEVAL([LIBM],[-lm])
e5c426
AC_SUBST([LIBM])
e5c426
])
e5c426
e5c426
e5c426
# SLIBTOOL_LFLAG_LTDL
e5c426
# -------------------
e5c426
AC_DEFUN([SLIBTOOL_LFLAG_LTDL],[
e5c426
e5c426
# slibtool: SLIBTOOL_LFLAG_LTDL
e5c426
# -----------------------------
e5c426
# (always use the system lib[s]ltdl)
e5c426
])
e5c426
e5c426
ad93f0
# SLIBTOOL_INIT(_options_)
ad93f0
# ------------------------
ad93f0
AC_DEFUN([SLIBTOOL_INIT],[
3db17d
AC_BEFORE([SLIBTOOL_LANG])
666643
AC_REQUIRE([SLIBTOOL_PREREQ])
ad93f0
AC_REQUIRE([_SLIBTOOL_DEFAULTS])
ad93f0
AC_REQUIRE([_SLIBTOOL_SET_FLAVOR])
ad93f0
AC_REQUIRE([_SLIBTOOL_ARGUMENT_HANDLING])
ad93f0
ad93f0
b1c9f4
# slibtool: tame legacy early invocation
b1c9f4
AC_DEFUN([AC_PROG_LEX])
b1c9f4
AC_DEFUN([AM_PROG_LEX])
b1c9f4
b1c9f4
AC_DEFUN([AC_PROG_RANLIB])
b1c9f4
AC_DEFUN([AM_PROG_RANLIB])
b1c9f4
b1c9f4
ad93f0
# slibtool: package defaults
ad93f0
# ---------------------
ad93f0
slbt_cfg_ifs="${IFS}"
ad93f0
IFS="${PATH_SEPARATOR}${IFS}"
ad93f0
ba1cf4
for slbt_opt in $@ ${slibtool_options:-}; do
ad93f0
	case "${slbt_opt}" in
ad93f0
		'shared')
ad93f0
			slibtool_enable_shared_default='yes'
ad93f0
			;;
ad93f0
ad93f0
		'disable-shared')
ad93f0
			slibtool_enable_shared_default='no'
ad93f0
			;;
ad93f0
ad93f0
		'static')
ad93f0
			slibtool_enable_static_default='yes'
ad93f0
			;;
ad93f0
ad93f0
		'disable-static')
ad93f0
			slibtool_enable_static_default='no'
ad93f0
			;;
ad93f0
ad93f0
		'dlopen')
ad93f0
			slibtool_enable_dlopen_default='yes'
ad93f0
			;;
ad93f0
ad93f0
		'disable-dlopen')
ad93f0
			slibtool_enable_dlopen_default='no'
ad93f0
			;;
ad93f0
ad93f0
		'win32-dll')
ad93f0
			slibtool_enable_win32_dll_default='yes'
ad93f0
			;;
ad93f0
ad93f0
		'disable-win32-dll')
ad93f0
			slibtool_enable_win32_dll_default='no'
ad93f0
			;;
ad93f0
ad93f0
		'fast-install')
ad93f0
			slibtool_enable_fast_install_default='yes'
ad93f0
			;;
ad93f0
ad93f0
		'disable-fast-install')
ad93f0
			slibtool_enable_fast_install_default='no'
ad93f0
			;;
ad93f0
ad93f0
		'pic-only')
ad93f0
			slibtool_pic_mode_default='yes'
ad93f0
			;;
ad93f0
ad93f0
		'no-pic')
ad93f0
			slibtool_pic_mode_default='no'
ad93f0
			;;
ad93f0
	esac
ad93f0
done
ad93f0
ad93f0
IFS="${slbt_cfg_ifs}"
ad93f0
unset slbt_cfg_ifs
ad93f0
ad93f0
ad93f0
# slibtool: features and argument handline
ad93f0
# ----------------------------------------
ad93f0
_SLIBTOOL_ARG_ENABLE([shared],[build shared libraries],[slibtool_enable_shared])
ad93f0
_SLIBTOOL_ARG_ENABLE([static],[build static libraries],[slibtool_enable_static])
ad93f0
_SLIBTOOL_ARG_ENABLE([dlopen],[allow -dlopen and -dlpreopen],[slibtool_enable_dlopen])
ad93f0
_SLIBTOOL_ARG_ENABLE([win32-dll],[natively support win32 dll's],[slibtool_enable_win32_dll])
ad93f0
_SLIBTOOL_ARG_ENABLE([fast-install],[optimize for fast installation],[slibtool_enable_fast_install])
ad93f0
_SLIBTOOL_ARG_WITH([pic],[override defaults for pic object usage],[slibtool_pic_mode])
5a20d9
_SLIBTOOL_ARG_WITH([sysroot],[absolute path to the target's sysroot],[slibtool_sysroot])
ad93f0
ad93f0
ad93f0
# slibtool: set flavor
ad93f0
# --------------------
ad93f0
slibtool_set_flavor
32cc7d
LIBTOOL='$(SLIBTOOL)'
567fcb
SLIBTOOL="${SLIBTOOL} \$(SLIBTOOL_FLAGS)"
ad93f0
ad93f0
AC_SUBST([LIBTOOL])
ad93f0
AC_SUBST([SLIBTOOL])
567fcb
AC_SUBST([SLIBTOOL_FLAGS])
5a20d9
AC_SUBST([SLIBTOOL_SYSROOT])
ad93f0
])
ad93f0
ad93f0
3db17d
# SLIBTOOL_LANG(_language_)
3db17d
# -------------------------
3db17d
AC_DEFUN([SLIBTOOL_LANG],[
3db17d
AC_REQUIRE([SLIBTOOL_PREREQ])
f52976
f52976
# slibtool: SLIBTOOL_LANG(C)
f52976
m4_if([$1],[C],[
f52976
AC_PROG_CC
f52976
AC_PROG_CPP
f52976
])
f52976
f52976
f52976
m4_if([$1],[C++],[
f52976
# slibtool: SLIBTOOL_LANG(C++)
f52976
AC_PROG_CC
f52976
AC_PROG_CPP
f52976
AC_PROG_CXX
f52976
AC_PROG_CXXCPP
f52976
])
f52976
f52976
m4_if([$1],[Fortran 77],[
f52976
# slibtool: SLIBTOOL_LANG(Fortran 77)
f52976
AC_PROG_FC
f52976
AC_PROG_F77
f52976
])
900387
])
900387
bfeee9
bfeee9
# produce a backward compatible slibtool.cfg
bfeee9
AC_CONFIG_COMMANDS_PRE(
bfeee9
	AC_CONFIG_FILES(
bfeee9
		[slibtool.cfg:Makefile],
3324bd
		[rm -f slibtool.cfg || exit 2;]
68fefc
		[_slibtool="${SLIBTOOL:-slibtool}";]
3324bd
		[${_slibtool%% *} --mkvars=Makefile --config > slibtool.cfg]))
3db17d
c34891
# optionally create libtool as a symlink to slibtool.sh
c34891
AC_CONFIG_COMMANDS_PRE(
c34891
	[if [[ -s slibtool.sh ]]; then
c34891
		ln -f -s slibtool.sh libtool || exit 2
c34891
	fi])
c34891
3db17d
49c143
# SLIBTOOL_PREREQ(_version_)
ad93f0
# --------------------------
ad93f0
AC_DEFUN([SLIBTOOL_PREREQ],[
666643
666643
AC_PROG_AWK
666643
AC_PROG_LEX
666643
AC_PROG_SED
666643
AC_PROG_YACC
666643
904d48
AC_PROG_AR
240d0f
AC_PROG_NM
a24c5d
AC_PROG_RANLIB
666643
666643
AC_PROG_LN_S
666643
AC_PROG_MKDIR_P
ad93f0
])
ad93f0
ad93f0
1f2874
# SLIBTOOL_OUTPUT
1f2874
# ---------------
1f2874
AC_DEFUN([SLIBTOOL_OUTPUT],[
1f2874
_slibtool_cmd="${SLIBTOOL:-slibtool}"
1f2874
_slibtool_cmd="${_slibtool_cmd%% *}"
1f2874
_slibtool_aux_dir=$("${_slibtool_cmd}" -print-aux-dir)
1f2874
cp -p "${_slibtool_aux_dir}/slibtool.sh" 'libtool'
1f2874
])
1f2874
ad93f0
# drop-in replacement
ad93f0
# -------------------
ad93f0
AC_DEFUN([LT_INIT],             [SLIBTOOL_INIT($@)])
3db17d
AC_DEFUN([LT_LANG],             [SLIBTOOL_LANG($@)])
ad93f0
AC_DEFUN([LT_PREREQ],           [SLIBTOOL_PREREQ($@)])
1f2874
AC_DEFUN([LT_OUTPUT],           [SLIBTOOL_OUTPUT($@)])
ad93f0
ad93f0
AC_DEFUN([AC_PROG_LIBTOOL],     [SLIBTOOL_INIT($@)])
ad93f0
AC_DEFUN([AM_PROG_LIBTOOL],     [SLIBTOOL_INIT($@)])
ba1cf4
a24c5d
AC_DEFUN([AC_PROG_AR],          [SLIBTOOL_PROG_AR($@)])
a24c5d
AC_DEFUN([AM_PROG_AR],          [SLIBTOOL_PROG_AR($@)])
a24c5d
240d0f
AC_DEFUN([AC_PROG_NM],          [SLIBTOOL_PROG_NM($@)])
240d0f
AC_DEFUN([AM_PROG_NM],          [SLIBTOOL_PROG_NM($@)])
240d0f
a24c5d
AC_DEFUN([AC_PROG_RANLIB],      [SLIBTOOL_PROG_RANLIB($@)])
a24c5d
AC_DEFUN([AM_PROG_RANLIB],      [SLIBTOOL_PROG_RANLIB($@)])
904d48
376aa7
AC_DEFUN([AC_PROG_LEX],         [SLIBTOOL_PROG_LEX($@)])
376aa7
AC_DEFUN([AM_PROG_LEX],         [SLIBTOOL_PROG_LEX($@)])
376aa7
ba1cf4
AC_DEFUN([AC_ENABLE_SHARED],    [SLIBTOOL_ENABLE_SHARED($@)])
ba1cf4
AC_DEFUN([AM_ENABLE_SHARED],    [SLIBTOOL_ENABLE_SHARED($@)])
ba1cf4
ba1cf4
AC_DEFUN([AC_ENABLE_STATIC],    [SLIBTOOL_ENABLE_STATIC($@)])
ba1cf4
AC_DEFUN([AM_ENABLE_STATIC],    [SLIBTOOL_ENABLE_STATIC($@)])
ba1cf4
ba1cf4
AC_DEFUN([AC_DISABLE_SHARED],   [SLIBTOOL_DISABLE_SHARED($@)])
ba1cf4
AC_DEFUN([AM_DISABLE_SHARED],   [SLIBTOOL_DISABLE_SHARED($@)])
ba1cf4
ba1cf4
AC_DEFUN([AC_DISABLE_STATIC],   [SLIBTOOL_DISABLE_STATIC($@)])
ba1cf4
AC_DEFUN([AM_DISABLE_STATIC],   [SLIBTOOL_DISABLE_STATIC($@)])
129f8a
e5c426
AC_DEFUN([LT_LIB_M],            [SLIBTOOL_LFLAG_LIBM($@)])
e5c426
AC_DEFUN([LT_LIB_DLLOAD],       [SLIBTOOL_LFLAG_LTDL($@)])
e5c426
129f8a
129f8a
# deprecated and no-op macros
129f8a
# ---------------------------
129f8a
AC_DEFUN([AC_LIBTOOL_DLOPEN],[])
129f8a
AC_DEFUN([AC_LIBTOOL_WIN32_DLL],[])
129f8a
AC_DEFUN([AC_DISABLE_FAST_INSTALL],[])
900ee6
AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],[])
900ee6
900ee6
AC_DEFUN([LT_PATH_AR],[])
900ee6
AC_DEFUN([LT_PATH_AS],[])
900ee6
AC_DEFUN([LT_PATH_LD],[])
900ee6
AC_DEFUN([LT_PATH_NM],[])
900ee6
AC_DEFUN([LT_PATH_RANLIB],[])