xref: /freebsd/contrib/file/m4/ltoptions.m4 (revision ae316d1d1cffd71ab7751f94e10118777a88e027)
1b6cee71dSXin LI# Helper functions for option handling.                    -*- Autoconf -*-
2b6cee71dSXin LI#
3*ae316d1dSXin LI#   Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free
4*ae316d1dSXin LI#   Software Foundation, Inc.
5b6cee71dSXin LI#   Written by Gary V. Vaughan, 2004
6b6cee71dSXin LI#
7b6cee71dSXin LI# This file is free software; the Free Software Foundation gives
8b6cee71dSXin LI# unlimited permission to copy and/or distribute it, with or without
9b6cee71dSXin LI# modifications, as long as this notice is preserved.
10b6cee71dSXin LI
11d38c30c0SXin LI# serial 8 ltoptions.m4
12b6cee71dSXin LI
13b6cee71dSXin LI# This is to help aclocal find these macros, as it can't see m4_define.
14b6cee71dSXin LIAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
15b6cee71dSXin LI
16b6cee71dSXin LI
17b6cee71dSXin LI# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
18b6cee71dSXin LI# ------------------------------------------
19b6cee71dSXin LIm4_define([_LT_MANGLE_OPTION],
20b6cee71dSXin LI[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
21b6cee71dSXin LI
22b6cee71dSXin LI
23b6cee71dSXin LI# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
24b6cee71dSXin LI# ---------------------------------------
25b6cee71dSXin LI# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
26b6cee71dSXin LI# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
27b6cee71dSXin LI# saved as a flag.
28b6cee71dSXin LIm4_define([_LT_SET_OPTION],
29b6cee71dSXin LI[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
30b6cee71dSXin LIm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
31b6cee71dSXin LI        _LT_MANGLE_DEFUN([$1], [$2]),
32d38c30c0SXin LI    [m4_warning([Unknown $1 option '$2'])])[]dnl
33b6cee71dSXin LI])
34b6cee71dSXin LI
35b6cee71dSXin LI
36b6cee71dSXin LI# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
37b6cee71dSXin LI# ------------------------------------------------------------
38b6cee71dSXin LI# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
39b6cee71dSXin LIm4_define([_LT_IF_OPTION],
40b6cee71dSXin LI[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
41b6cee71dSXin LI
42b6cee71dSXin LI
43b6cee71dSXin LI# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
44b6cee71dSXin LI# -------------------------------------------------------
45b6cee71dSXin LI# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
46b6cee71dSXin LI# are set.
47b6cee71dSXin LIm4_define([_LT_UNLESS_OPTIONS],
48b6cee71dSXin LI[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
49b6cee71dSXin LI	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
50b6cee71dSXin LI		      [m4_define([$0_found])])])[]dnl
51b6cee71dSXin LIm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
52b6cee71dSXin LI])[]dnl
53b6cee71dSXin LI])
54b6cee71dSXin LI
55b6cee71dSXin LI
56b6cee71dSXin LI# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
57b6cee71dSXin LI# ----------------------------------------
58b6cee71dSXin LI# OPTION-LIST is a space-separated list of Libtool options associated
59b6cee71dSXin LI# with MACRO-NAME.  If any OPTION has a matching handler declared with
60b6cee71dSXin LI# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
61b6cee71dSXin LI# the unknown option and exit.
62b6cee71dSXin LIm4_defun([_LT_SET_OPTIONS],
63b6cee71dSXin LI[# Set options
64b6cee71dSXin LIm4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
65b6cee71dSXin LI    [_LT_SET_OPTION([$1], _LT_Option)])
66b6cee71dSXin LI
67b6cee71dSXin LIm4_if([$1],[LT_INIT],[
68b6cee71dSXin LI  dnl
69b6cee71dSXin LI  dnl Simply set some default values (i.e off) if boolean options were not
70b6cee71dSXin LI  dnl specified:
71b6cee71dSXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
72b6cee71dSXin LI  ])
73b6cee71dSXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
74b6cee71dSXin LI  ])
75b6cee71dSXin LI  dnl
76b6cee71dSXin LI  dnl If no reference was made to various pairs of opposing options, then
77b6cee71dSXin LI  dnl we run the default mode handler for the pair.  For example, if neither
78d38c30c0SXin LI  dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
79b6cee71dSXin LI  dnl archives by default:
80b6cee71dSXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
81b6cee71dSXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
82b6cee71dSXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
83b6cee71dSXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
84b6cee71dSXin LI		   [_LT_ENABLE_FAST_INSTALL])
85d38c30c0SXin LI  _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
86d38c30c0SXin LI		   [_LT_WITH_AIX_SONAME([aix])])
87b6cee71dSXin LI  ])
88b6cee71dSXin LI])# _LT_SET_OPTIONS
89b6cee71dSXin LI
90b6cee71dSXin LI
91b6cee71dSXin LI## --------------------------------- ##
92b6cee71dSXin LI## Macros to handle LT_INIT options. ##
93b6cee71dSXin LI## --------------------------------- ##
94b6cee71dSXin LI
95b6cee71dSXin LI# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
96b6cee71dSXin LI# -----------------------------------------
97b6cee71dSXin LIm4_define([_LT_MANGLE_DEFUN],
98b6cee71dSXin LI[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
99b6cee71dSXin LI
100b6cee71dSXin LI
101b6cee71dSXin LI# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
102b6cee71dSXin LI# -----------------------------------------------
103b6cee71dSXin LIm4_define([LT_OPTION_DEFINE],
104b6cee71dSXin LI[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
105b6cee71dSXin LI])# LT_OPTION_DEFINE
106b6cee71dSXin LI
107b6cee71dSXin LI
108b6cee71dSXin LI# dlopen
109b6cee71dSXin LI# ------
110b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
111b6cee71dSXin LI])
112b6cee71dSXin LI
113b6cee71dSXin LIAU_DEFUN([AC_LIBTOOL_DLOPEN],
114b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], [dlopen])
115b6cee71dSXin LIAC_DIAGNOSE([obsolete],
116b6cee71dSXin LI[$0: Remove this warning and the call to _LT_SET_OPTION when you
117d38c30c0SXin LIput the 'dlopen' option into LT_INIT's first parameter.])
118b6cee71dSXin LI])
119b6cee71dSXin LI
120b6cee71dSXin LIdnl aclocal-1.4 backwards compatibility:
121b6cee71dSXin LIdnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
122b6cee71dSXin LI
123b6cee71dSXin LI
124b6cee71dSXin LI# win32-dll
125b6cee71dSXin LI# ---------
126b6cee71dSXin LI# Declare package support for building win32 dll's.
127b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [win32-dll],
128b6cee71dSXin LI[enable_win32_dll=yes
129b6cee71dSXin LI
130b6cee71dSXin LIcase $host in
131b6cee71dSXin LI*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
132b6cee71dSXin LI  AC_CHECK_TOOL(AS, as, false)
133b6cee71dSXin LI  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
134b6cee71dSXin LI  AC_CHECK_TOOL(OBJDUMP, objdump, false)
135b6cee71dSXin LI  ;;
136b6cee71dSXin LIesac
137b6cee71dSXin LI
138b6cee71dSXin LItest -z "$AS" && AS=as
139b6cee71dSXin LI_LT_DECL([], [AS],      [1], [Assembler program])dnl
140b6cee71dSXin LI
141b6cee71dSXin LItest -z "$DLLTOOL" && DLLTOOL=dlltool
142b6cee71dSXin LI_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
143b6cee71dSXin LI
144b6cee71dSXin LItest -z "$OBJDUMP" && OBJDUMP=objdump
145b6cee71dSXin LI_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
146b6cee71dSXin LI])# win32-dll
147b6cee71dSXin LI
148b6cee71dSXin LIAU_DEFUN([AC_LIBTOOL_WIN32_DLL],
149b6cee71dSXin LI[AC_REQUIRE([AC_CANONICAL_HOST])dnl
150b6cee71dSXin LI_LT_SET_OPTION([LT_INIT], [win32-dll])
151b6cee71dSXin LIAC_DIAGNOSE([obsolete],
152b6cee71dSXin LI[$0: Remove this warning and the call to _LT_SET_OPTION when you
153d38c30c0SXin LIput the 'win32-dll' option into LT_INIT's first parameter.])
154b6cee71dSXin LI])
155b6cee71dSXin LI
156b6cee71dSXin LIdnl aclocal-1.4 backwards compatibility:
157b6cee71dSXin LIdnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
158b6cee71dSXin LI
159b6cee71dSXin LI
160b6cee71dSXin LI# _LT_ENABLE_SHARED([DEFAULT])
161b6cee71dSXin LI# ----------------------------
162d38c30c0SXin LI# implement the --enable-shared flag, and supports the 'shared' and
163d38c30c0SXin LI# 'disable-shared' LT_INIT options.
164d38c30c0SXin LI# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
165b6cee71dSXin LIm4_define([_LT_ENABLE_SHARED],
166b6cee71dSXin LI[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
167b6cee71dSXin LIAC_ARG_ENABLE([shared],
168b6cee71dSXin LI    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
169b6cee71dSXin LI	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
170b6cee71dSXin LI    [p=${PACKAGE-default}
171b6cee71dSXin LI    case $enableval in
172b6cee71dSXin LI    yes) enable_shared=yes ;;
173b6cee71dSXin LI    no) enable_shared=no ;;
174b6cee71dSXin LI    *)
175b6cee71dSXin LI      enable_shared=no
176b6cee71dSXin LI      # Look at the argument we got.  We use all the common list separators.
177d38c30c0SXin LI      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
178b6cee71dSXin LI      for pkg in $enableval; do
179d38c30c0SXin LI	IFS=$lt_save_ifs
180b6cee71dSXin LI	if test "X$pkg" = "X$p"; then
181b6cee71dSXin LI	  enable_shared=yes
182b6cee71dSXin LI	fi
183b6cee71dSXin LI      done
184d38c30c0SXin LI      IFS=$lt_save_ifs
185b6cee71dSXin LI      ;;
186b6cee71dSXin LI    esac],
187b6cee71dSXin LI    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
188b6cee71dSXin LI
189b6cee71dSXin LI    _LT_DECL([build_libtool_libs], [enable_shared], [0],
190b6cee71dSXin LI	[Whether or not to build shared libraries])
191b6cee71dSXin LI])# _LT_ENABLE_SHARED
192b6cee71dSXin LI
193b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
194b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
195b6cee71dSXin LI
196b6cee71dSXin LI# Old names:
197b6cee71dSXin LIAC_DEFUN([AC_ENABLE_SHARED],
198b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
199b6cee71dSXin LI])
200b6cee71dSXin LI
201b6cee71dSXin LIAC_DEFUN([AC_DISABLE_SHARED],
202b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], [disable-shared])
203b6cee71dSXin LI])
204b6cee71dSXin LI
205b6cee71dSXin LIAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
206b6cee71dSXin LIAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
207b6cee71dSXin LI
208b6cee71dSXin LIdnl aclocal-1.4 backwards compatibility:
209b6cee71dSXin LIdnl AC_DEFUN([AM_ENABLE_SHARED], [])
210b6cee71dSXin LIdnl AC_DEFUN([AM_DISABLE_SHARED], [])
211b6cee71dSXin LI
212b6cee71dSXin LI
213b6cee71dSXin LI
214b6cee71dSXin LI# _LT_ENABLE_STATIC([DEFAULT])
215b6cee71dSXin LI# ----------------------------
216d38c30c0SXin LI# implement the --enable-static flag, and support the 'static' and
217d38c30c0SXin LI# 'disable-static' LT_INIT options.
218d38c30c0SXin LI# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
219b6cee71dSXin LIm4_define([_LT_ENABLE_STATIC],
220b6cee71dSXin LI[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
221b6cee71dSXin LIAC_ARG_ENABLE([static],
222b6cee71dSXin LI    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
223b6cee71dSXin LI	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
224b6cee71dSXin LI    [p=${PACKAGE-default}
225b6cee71dSXin LI    case $enableval in
226b6cee71dSXin LI    yes) enable_static=yes ;;
227b6cee71dSXin LI    no) enable_static=no ;;
228b6cee71dSXin LI    *)
229b6cee71dSXin LI     enable_static=no
230b6cee71dSXin LI      # Look at the argument we got.  We use all the common list separators.
231d38c30c0SXin LI      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
232b6cee71dSXin LI      for pkg in $enableval; do
233d38c30c0SXin LI	IFS=$lt_save_ifs
234b6cee71dSXin LI	if test "X$pkg" = "X$p"; then
235b6cee71dSXin LI	  enable_static=yes
236b6cee71dSXin LI	fi
237b6cee71dSXin LI      done
238d38c30c0SXin LI      IFS=$lt_save_ifs
239b6cee71dSXin LI      ;;
240b6cee71dSXin LI    esac],
241b6cee71dSXin LI    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
242b6cee71dSXin LI
243b6cee71dSXin LI    _LT_DECL([build_old_libs], [enable_static], [0],
244b6cee71dSXin LI	[Whether or not to build static libraries])
245b6cee71dSXin LI])# _LT_ENABLE_STATIC
246b6cee71dSXin LI
247b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
248b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
249b6cee71dSXin LI
250b6cee71dSXin LI# Old names:
251b6cee71dSXin LIAC_DEFUN([AC_ENABLE_STATIC],
252b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
253b6cee71dSXin LI])
254b6cee71dSXin LI
255b6cee71dSXin LIAC_DEFUN([AC_DISABLE_STATIC],
256b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], [disable-static])
257b6cee71dSXin LI])
258b6cee71dSXin LI
259b6cee71dSXin LIAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
260b6cee71dSXin LIAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
261b6cee71dSXin LI
262b6cee71dSXin LIdnl aclocal-1.4 backwards compatibility:
263b6cee71dSXin LIdnl AC_DEFUN([AM_ENABLE_STATIC], [])
264b6cee71dSXin LIdnl AC_DEFUN([AM_DISABLE_STATIC], [])
265b6cee71dSXin LI
266b6cee71dSXin LI
267b6cee71dSXin LI
268b6cee71dSXin LI# _LT_ENABLE_FAST_INSTALL([DEFAULT])
269b6cee71dSXin LI# ----------------------------------
270d38c30c0SXin LI# implement the --enable-fast-install flag, and support the 'fast-install'
271d38c30c0SXin LI# and 'disable-fast-install' LT_INIT options.
272d38c30c0SXin LI# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
273b6cee71dSXin LIm4_define([_LT_ENABLE_FAST_INSTALL],
274b6cee71dSXin LI[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
275b6cee71dSXin LIAC_ARG_ENABLE([fast-install],
276b6cee71dSXin LI    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
277b6cee71dSXin LI    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
278b6cee71dSXin LI    [p=${PACKAGE-default}
279b6cee71dSXin LI    case $enableval in
280b6cee71dSXin LI    yes) enable_fast_install=yes ;;
281b6cee71dSXin LI    no) enable_fast_install=no ;;
282b6cee71dSXin LI    *)
283b6cee71dSXin LI      enable_fast_install=no
284b6cee71dSXin LI      # Look at the argument we got.  We use all the common list separators.
285d38c30c0SXin LI      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
286b6cee71dSXin LI      for pkg in $enableval; do
287d38c30c0SXin LI	IFS=$lt_save_ifs
288b6cee71dSXin LI	if test "X$pkg" = "X$p"; then
289b6cee71dSXin LI	  enable_fast_install=yes
290b6cee71dSXin LI	fi
291b6cee71dSXin LI      done
292d38c30c0SXin LI      IFS=$lt_save_ifs
293b6cee71dSXin LI      ;;
294b6cee71dSXin LI    esac],
295b6cee71dSXin LI    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
296b6cee71dSXin LI
297b6cee71dSXin LI_LT_DECL([fast_install], [enable_fast_install], [0],
298b6cee71dSXin LI	 [Whether or not to optimize for fast installation])dnl
299b6cee71dSXin LI])# _LT_ENABLE_FAST_INSTALL
300b6cee71dSXin LI
301b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
302b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
303b6cee71dSXin LI
304b6cee71dSXin LI# Old names:
305b6cee71dSXin LIAU_DEFUN([AC_ENABLE_FAST_INSTALL],
306b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
307b6cee71dSXin LIAC_DIAGNOSE([obsolete],
308b6cee71dSXin LI[$0: Remove this warning and the call to _LT_SET_OPTION when you put
309d38c30c0SXin LIthe 'fast-install' option into LT_INIT's first parameter.])
310b6cee71dSXin LI])
311b6cee71dSXin LI
312b6cee71dSXin LIAU_DEFUN([AC_DISABLE_FAST_INSTALL],
313b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
314b6cee71dSXin LIAC_DIAGNOSE([obsolete],
315b6cee71dSXin LI[$0: Remove this warning and the call to _LT_SET_OPTION when you put
316d38c30c0SXin LIthe 'disable-fast-install' option into LT_INIT's first parameter.])
317b6cee71dSXin LI])
318b6cee71dSXin LI
319b6cee71dSXin LIdnl aclocal-1.4 backwards compatibility:
320b6cee71dSXin LIdnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
321b6cee71dSXin LIdnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
322b6cee71dSXin LI
323b6cee71dSXin LI
324d38c30c0SXin LI# _LT_WITH_AIX_SONAME([DEFAULT])
325d38c30c0SXin LI# ----------------------------------
326d38c30c0SXin LI# implement the --with-aix-soname flag, and support the `aix-soname=aix'
327d38c30c0SXin LI# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
328d38c30c0SXin LI# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
329d38c30c0SXin LIm4_define([_LT_WITH_AIX_SONAME],
330d38c30c0SXin LI[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
331d38c30c0SXin LIshared_archive_member_spec=
332d38c30c0SXin LIcase $host,$enable_shared in
333d38c30c0SXin LIpower*-*-aix[[5-9]]*,yes)
334d38c30c0SXin LI  AC_MSG_CHECKING([which variant of shared library versioning to provide])
335d38c30c0SXin LI  AC_ARG_WITH([aix-soname],
336d38c30c0SXin LI    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
337d38c30c0SXin LI      [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
338d38c30c0SXin LI    [case $withval in
339d38c30c0SXin LI    aix|svr4|both)
340d38c30c0SXin LI      ;;
341d38c30c0SXin LI    *)
342d38c30c0SXin LI      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
343d38c30c0SXin LI      ;;
344d38c30c0SXin LI    esac
345d38c30c0SXin LI    lt_cv_with_aix_soname=$with_aix_soname],
346d38c30c0SXin LI    [AC_CACHE_VAL([lt_cv_with_aix_soname],
347d38c30c0SXin LI      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
348d38c30c0SXin LI    with_aix_soname=$lt_cv_with_aix_soname])
349d38c30c0SXin LI  AC_MSG_RESULT([$with_aix_soname])
350d38c30c0SXin LI  if test aix != "$with_aix_soname"; then
351d38c30c0SXin LI    # For the AIX way of multilib, we name the shared archive member
352d38c30c0SXin LI    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
353d38c30c0SXin LI    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
354d38c30c0SXin LI    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
355d38c30c0SXin LI    # the AIX toolchain works better with OBJECT_MODE set (default 32).
356d38c30c0SXin LI    if test 64 = "${OBJECT_MODE-32}"; then
357d38c30c0SXin LI      shared_archive_member_spec=shr_64
358d38c30c0SXin LI    else
359d38c30c0SXin LI      shared_archive_member_spec=shr
360d38c30c0SXin LI    fi
361d38c30c0SXin LI  fi
362d38c30c0SXin LI  ;;
363d38c30c0SXin LI*)
364d38c30c0SXin LI  with_aix_soname=aix
365d38c30c0SXin LI  ;;
366d38c30c0SXin LIesac
367d38c30c0SXin LI
368d38c30c0SXin LI_LT_DECL([], [shared_archive_member_spec], [0],
369d38c30c0SXin LI    [Shared archive member basename, for filename based shared library versioning on AIX])dnl
370d38c30c0SXin LI])# _LT_WITH_AIX_SONAME
371d38c30c0SXin LI
372d38c30c0SXin LILT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
373d38c30c0SXin LILT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
374d38c30c0SXin LILT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
375d38c30c0SXin LI
376d38c30c0SXin LI
377b6cee71dSXin LI# _LT_WITH_PIC([MODE])
378b6cee71dSXin LI# --------------------
379d38c30c0SXin LI# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
380b6cee71dSXin LI# LT_INIT options.
381d38c30c0SXin LI# MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
382b6cee71dSXin LIm4_define([_LT_WITH_PIC],
383b6cee71dSXin LI[AC_ARG_WITH([pic],
384b6cee71dSXin LI    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
385b6cee71dSXin LI	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
386b6cee71dSXin LI    [lt_p=${PACKAGE-default}
387b6cee71dSXin LI    case $withval in
388b6cee71dSXin LI    yes|no) pic_mode=$withval ;;
389b6cee71dSXin LI    *)
390b6cee71dSXin LI      pic_mode=default
391b6cee71dSXin LI      # Look at the argument we got.  We use all the common list separators.
392d38c30c0SXin LI      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
393b6cee71dSXin LI      for lt_pkg in $withval; do
394d38c30c0SXin LI	IFS=$lt_save_ifs
395b6cee71dSXin LI	if test "X$lt_pkg" = "X$lt_p"; then
396b6cee71dSXin LI	  pic_mode=yes
397b6cee71dSXin LI	fi
398b6cee71dSXin LI      done
399d38c30c0SXin LI      IFS=$lt_save_ifs
400b6cee71dSXin LI      ;;
401b6cee71dSXin LI    esac],
402d38c30c0SXin LI    [pic_mode=m4_default([$1], [default])])
403b6cee71dSXin LI
404b6cee71dSXin LI_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
405b6cee71dSXin LI])# _LT_WITH_PIC
406b6cee71dSXin LI
407b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
408b6cee71dSXin LILT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
409b6cee71dSXin LI
410b6cee71dSXin LI# Old name:
411b6cee71dSXin LIAU_DEFUN([AC_LIBTOOL_PICMODE],
412b6cee71dSXin LI[_LT_SET_OPTION([LT_INIT], [pic-only])
413b6cee71dSXin LIAC_DIAGNOSE([obsolete],
414b6cee71dSXin LI[$0: Remove this warning and the call to _LT_SET_OPTION when you
415d38c30c0SXin LIput the 'pic-only' option into LT_INIT's first parameter.])
416b6cee71dSXin LI])
417b6cee71dSXin LI
418b6cee71dSXin LIdnl aclocal-1.4 backwards compatibility:
419b6cee71dSXin LIdnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
420b6cee71dSXin LI
421b6cee71dSXin LI## ----------------- ##
422b6cee71dSXin LI## LTDL_INIT Options ##
423b6cee71dSXin LI## ----------------- ##
424b6cee71dSXin LI
425b6cee71dSXin LIm4_define([_LTDL_MODE], [])
426b6cee71dSXin LILT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
427b6cee71dSXin LI		 [m4_define([_LTDL_MODE], [nonrecursive])])
428b6cee71dSXin LILT_OPTION_DEFINE([LTDL_INIT], [recursive],
429b6cee71dSXin LI		 [m4_define([_LTDL_MODE], [recursive])])
430b6cee71dSXin LILT_OPTION_DEFINE([LTDL_INIT], [subproject],
431b6cee71dSXin LI		 [m4_define([_LTDL_MODE], [subproject])])
432b6cee71dSXin LI
433b6cee71dSXin LIm4_define([_LTDL_TYPE], [])
434b6cee71dSXin LILT_OPTION_DEFINE([LTDL_INIT], [installable],
435b6cee71dSXin LI		 [m4_define([_LTDL_TYPE], [installable])])
436b6cee71dSXin LILT_OPTION_DEFINE([LTDL_INIT], [convenience],
437b6cee71dSXin LI		 [m4_define([_LTDL_TYPE], [convenience])])
438